Module: GitInit
- Defined in:
- lib/git_init.rb,
lib/git_init/version.rb
Defined Under Namespace
Classes: GitUrl
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
Class Method Details
.run ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/git_init.rb', line 90 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 |