module GitInit
Constants
- VERSION
Public Class Methods
run()
click to toggle source
# File lib/git_init.rb, line 91 def GitInit.run unless ARGV[0] $stderr.puts "Please give a git url as first parameter" exit 1 end git=GitUrl.new (ARGV[0]) dest_path = Pathname.new(ENV['HOME']).join('git', git.domain, git.path, git.basename[0..-5]) if File.exists? dest_path $stderr.puts "Destination directory already exists: '#{dest_path}'" exit 2 end FileUtils.mkdir_p dest_path.dirname system('git', 'clone', git.url, dest_path.to_s) puts dest_path end