Skip to content

Instantly share code, notes, and snippets.

@Chew
Last active July 3, 2022 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chew/b2c9b7a51179eeb14744a7c0210de05f to your computer and use it in GitHub Desktop.
Save Chew/b2c9b7a51179eeb14744a7c0210de05f to your computer and use it in GitHub Desktop.
[WIP] DeployBoy - A simple way to automate Rails deployment, efficiently
# Pull from GitHub
puts "Pulling..."
pull = `git pull`
if pull.include? "Already up to date."
puts "Already up to date, nothing to deploy."
exit
end
# Gem changes occur, we must bundle install
if pull.include? "Gemfile"
print "Updating Gems..."
`bundle install`
puts " Done!"
end
# Did package.json or yarn.lock change?
# Install and recompile assets
if pull.include?("yarn.lock") || pull.include?("package.json")
print "Updating dependencies..."
`yarn install --check-files`
`rake assets:precompile`
puts " Done!"
end
# Did assets change? precompile
if pull.include?("assets") || pull.include?("javascript")
print "Compiling assets..."
`rake assets:precompile`
puts " Done!"
end
`rails restart`
# Done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment