Top Level Namespace
Defined Under Namespace
Modules: GetRepos
Instance Method Summary collapse
- #is_git_url?(url) ⇒ Boolean
- #is_valid_json_repo?(data) ⇒ Boolean
- #is_valid_json_root?(data) ⇒ Boolean
- #prep_dest_dir(dest_dir) ⇒ Object
- #run_local(command) ⇒ Object
Instance Method Details
#is_git_url?(url) ⇒ Boolean
23 24 25 26 27 28 29 |
# File 'lib/getrepos/util.rb', line 23 def is_git_url?(url) if File.extname(URI(url).path) == '.git' return true else return false end end |
#is_valid_json_repo?(data) ⇒ Boolean
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/getrepos/util.rb', line 10 def is_valid_json_repo?(data) return_flag = true [:name, :version, :url].each do |key| if data[key].nil? puts "Missing required key \"#{key}\"".light_red return_flag = false end end return return_flag end |
#is_valid_json_root?(data) ⇒ Boolean
1 2 3 4 5 6 7 8 |
# File 'lib/getrepos/util.rb', line 1 def is_valid_json_root?(data) if data[:repos].nil? puts 'Missing required key "repos"'.light_red return false else return true end end |
#prep_dest_dir(dest_dir) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/getrepos/util.rb', line 43 def prep_dest_dir(dest_dir) FileUtils.rm_rf('build/.tmprepo') FileUtils.mkdir_p('build/.tmprepo') FileUtils.rm_rf(dest_dir) FileUtils.mkdir_p(File.dirname(dest_dir)) end |
#run_local(command) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/getrepos/util.rb', line 31 def run_local(command) response = %x(#{command}) exit_status = $?.to_i if exit_status != 0 puts "Error: #{command} (exit status: #{exit_status})" puts response end return exit_status end |