penchant/template/script/initialize-environment

36 lines
748 B
Plaintext
Raw Permalink Normal View History

2011-07-14 19:50:51 +00:00
#!/usr/bin/env ruby
if File.file?('Gemfile.erb')
pwd = Dir.pwd
2011-07-14 19:50:51 +00:00
Dir.chdir '..' do
File.readlines(File.join(pwd, 'Gemfile.erb')).find_all { |line| line[':git'] }.each do |line|
2011-09-09 18:41:16 +00:00
repo = line[%r{:git => (['"])([^'"]+)\1}, 2]
2011-07-14 19:50:51 +00:00
puts "Installing #{repo}"
system %{git clone #{repo}}
end
2011-07-14 19:50:51 +00:00
end
puts "Bundling for local environment"
system %{script/gemfile local}
else
puts "Bundling..."
system %{bundle}
end
2011-07-14 19:50:51 +00:00
puts "Installing git hooks"
system %{script/install-git-hooks}
2011-08-16 15:11:11 +00:00
bundle = File.file?('Gemfile') ? 'bundle exec' : ''
command = [ bundle, 'rake', '-s', '-T', 'bootstrap' ]
if !(%x{#{command.join(' ')}}).empty?
puts "Trying to run rake bootstrap..."
system %{#{bundle} rake bootstrap}
end
2011-07-14 21:16:11 +00:00
2011-07-14 19:50:51 +00:00
puts "Done!"