Skip to content

Instantly share code, notes, and snippets.

@danmayer
Created July 3, 2014 20:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danmayer/e4be42ede2d30b52afe7 to your computer and use it in GitHub Desktop.
Save danmayer/e4be42ede2d30b52afe7 to your computer and use it in GitHub Desktop.
gem update in progress
GEM_NAME = "ls-secure_gmaps"
COMMIT_MESSAGE = "update to latest ls-secure_gmaps\n This makes sure all calls are made with the correct keys for our new contract"
APPS = ["browse", "browse-service", "escapes", "events", "preferences", "sponsors"]
CMDS = ["git pull origin master",
"bundle install",
"bundle exec rake",
"bundle update #{GEM_NAME}",
"bundle exec rake",
"git checkout -b update_gem_#{GEM_NAME.gsub('-','_')}",
"git add .",
"git commit -a -m \"#{COMMIT_MESSAGE}\"",
"git push dan update_gem_#{GEM_NAME.gsub('-','_')}",
"hub pull-request"
]
def run_cmd(cmd)
puts "running: #{cmd}"
`#{cmd}`
if($?.exitstatus > 0)
puts "command failed to run: #{cmd}"
raise "command failed: #{cmd}"
else
puts "command finished successfully: #{cmd}"
end
end
APPS.each do |app|
puts "running app #{app}"
Dir.chdir("/Users/danmayer/projects/#{app}") do |path|
begin
CMDS.each do |cmd|
run_cmd(cmd)
end
rescue => error
puts "the app #{app} failed to update because of this command #{error}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment