Skip to content

Commit

Permalink
Added more functionality to Rakefile
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyt committed Jan 10, 2011
1 parent a2069a4 commit c7dbf19
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 19 deletions.
8 changes: 4 additions & 4 deletions .gitignore
@@ -1,12 +1,12 @@
.DS_Store
Vagrantfile
.bundle
.rvmrc
roles/gemstone.json
.vagrant
Gemfile.lock
.chef/*
*.log
*.swp
*.swo
tmp/*
.bundle
couchdb.std*
.rvmrc
roles/gemstone.json
10 changes: 5 additions & 5 deletions Gemfile
@@ -1,9 +1,9 @@
source :rubygems
gem "virtualbox", "0.7.5"
#gem "virtualbox", "0.7.5"
gem "vagrant", "0.6.4"
gem "chef"
gem "gitty"
#gem "gitty"
gem "net-ssh-multi"
gem "highline"
gem "fog", "0.2.30"
gem "excon"
#gem "highline"
#gem "fog", "0.2.30"
#gem "excon"
37 changes: 27 additions & 10 deletions Rakefile
@@ -1,28 +1,45 @@
require 'rubygems'
require 'chef'
require 'json'
# require 'chef'
# require 'json'

desc "Install needed gems and copy example files"
task :setup do
puts "-- Checking for bundler"
puts colorize("-- Checking for RubyGems 1.3.6", :blue)

md = %x[gem env].match(/(\d\.\d\.\d)/)
version_string = md.captures.first

if version_string.gsub(/\./, '').to_i >= 136
puts colorize(" RubyGems #{version_string} is already installed", :yellow)
else
puts colorize(" Updating RubyGems - this may prompt for your password", :green)
system "sudo gem update --system"
end

puts colorize("-- Checking for Bundler", :blue)
if %x[gem list] =~ /bundler/
puts colorize(" bundler is already installed", :yellow)
puts colorize(" Bundler is already installed", :yellow)
else
puts colorize(" Installing bundler", :green)
commands = []
commands << "sudo gem install bundler --no-rdoc --no-ri"
commands << "bundle install"
system commands.join(" && ")
puts colorize(" Installing Bundler - this may prompt for your password", :green)
system "sudo gem install bundler --no-rdoc --no-ri"
end

puts colorize("-- Running bundle install", :blue)
system "bundle install"

puts colorize("-- Copying example files", :blue)
%w[ Vagrantfile roles/gemstone.json ].each do |filename|
path = File.expand_path(File.join(File.dirname(__FILE__), filename))

unless File.exists?(path)
if File.exists?(path)
puts colorize(" Already exists: #{path}", :yellow)
else
puts colorize(" Creating #{path}", :green)
FileUtils.cp(path+".example", path)
end
end

puts colorize("\n\n Now open roles/gemstone.json and put in your PUBLIC ssh key.\n\n", :blue)
end

desc "SSH into vagrant box as glass"
Expand Down

0 comments on commit c7dbf19

Please sign in to comment.