Created
October 5, 2011 04:34
-
-
Save maguec/1263644 to your computer and use it in GitHub Desktop.
Easy Rake file for building a deployable gem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :default => :build_gem | |
################################################################## | |
def run_command(cmd) | |
cmdrun = IO.popen(cmd) | |
output = cmdrun.read | |
cmdrun.close | |
if $?.to_i > 0 | |
puts "count not run #{cmd}, it returned an error #{output}" | |
exit 2 | |
end | |
puts "OK: ran command #{cmd}" | |
end | |
desc 'build the gem' | |
task :build_gem do | |
run_command("gem build deployable_sinatra.gemspec") | |
end | |
desc 'clean gems' | |
task :clean_gem do | |
run_command("rm -f deployable_sinatra*.gem") | |
end | |
desc 'clean vendor' | |
task :clean_vendor do | |
run_command("rm -rf vendor") | |
end | |
desc 'bundle for deployment' | |
task :bundle_deploy do | |
run_command("bundle install --deployment") | |
end | |
desc 'bundle for deployment' | |
task :bundle do | |
run_command("bundle install") | |
end | |
desc 'what the CI server should run' | |
task :ciserver => [:clean_gem, :clean_vendor, :bundle, :bundle_deploy, :build_gem] do | |
puts "Getting Ready to Deploy" | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment