Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env ruby
- #
- # a simple script to setup a new github project locally
- #
- # usage: ghdir project-name
- #
- dir = ARGV.shift || abort('ghdir (project-name)')
- gitdir = File.expand_path(File.join('~', 'git'))
- Dir.chdir(gitdir)
- commands = <<-__
- mkdir #{ dir.inspect }
- cd #{ dir.inspect }
- git init
- echo #{ dir.inspect } >> README
- git add README
- git commit -m 'first commit'
- git remote add origin git@github.com:dojo4/#{ dir }.git
- git push origin master
- __
- commands = commands.strip.split(%r/\n+/).map{|command| command.strip}
- commands.each do |command|
- puts command
- system(command) or abort("#{ command } # failed with #{ $?.inspect }")
- end
- END{
- exec("cd #{ dir.inspect }")
- }
Add Comment
Please, Sign In to add comment