Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Easy Rake file for building a deployable gem
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