Sha256: 498d1e5595ee5e47bd1ced539a4a1a1ce25d06bcbfde2d43faeec93249171d89
Contents?: true
Size: 1.71 KB
Versions: 3
Compression:
Stored size: 1.71 KB
Contents
#!/usr/bin/env ruby # encoding: UTF-8 # (c) Copyright 2014 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'git' require 'fileutils' require 'require_relative' require_relative 'yaml_parse.rb' include YamlParse require_relative 'log.rb' include Logging # # Repositories module # module Repositories def clone_repo current_dir = Dir.pwd forj_dir = File.expand_path(File.dirname(__FILE__)) Dir.chdir(forj_dir) definitions = YamlParse::get_values('../lib/catalog.yaml') maestro_url = definitions['default']['maestro'] home = File.expand_path('~') path = home + '/.forj/' begin if File.directory?(path) if File.directory?(path + 'maestro') FileUtils.rm_r path + 'maestro' end Logging.info('cloning the maestro repo') Git.clone(maestro_url, 'maestro', :path => path) end rescue => e puts format('Error while cloning the repo from %{maestro_url}', maestro_url: maestro_url) puts 'If this error persist you could clone the repo manually in ~/.forj/' Logging.error(e.message) end Dir.chdir(current_dir) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
forj-0.0.24 | lib/repositories.rb |
forj-0.0.23 | lib/repositories.rb |
forj-0.0.22 | lib/repositories.rb |