#!/usr/bin/env ruby dirname = ARGV[0] classname = ARGV[0].gsub(/(^.|_.)/) { |s| s[-1..-1].upcase } puts "" exit unless system( "git clone https://github.com/winton/gem_template.git #{dirname}" ) Dir.chdir(dirname) do puts "\nWriting .ruby-gemset..." system("echo #{dirname} > .ruby-gemset") if RUBY_PATCHLEVEL.to_i < 0 puts "\e[31m\nCouldn't write .ruby-version :( Removing it for now.\e[0m" system("rm .ruby-version") else puts "\nWriting .ruby-version..." system("echo #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} > .ruby-version") end puts "\nInstalling namer..." system("gem install namer") puts "\nRenaming GemTemplate to #{classname}..." system("namer gem_template:#{dirname} GemTemplate:#{classname}") unless ARGV[1..-1].empty? puts "\nFetching..." system("git fetch") puts "\nMerging branches..." ARGV[1..-1].each do |branch| system("git merge origin/#{branch}") end end end puts "" puts "\e[32mTo finish setting up your project:\e[0m" puts " cd #{dirname}" puts " bundle" puts "" # -- replace # #!/usr/bin/env ruby # # require File.expand_path("../../lib/gem_template", __FILE__)