class Object
Public Instance Methods
is_git_url?(url)
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# 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)
click to toggle source
# 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