mirror of
https://github.com/Growstuff/growstuff.git
synced 2025-12-24 01:57:46 -05:00
27 lines
657 B
Ruby
Executable File
27 lines
657 B
Ruby
Executable File
#!/usr/bin/env ruby
|
|
# frozen_string_literal: true
|
|
|
|
require 'platform-api'
|
|
require 'yaml'
|
|
|
|
heroku = PlatformAPI.connect(ENV.fetch('HEROKU_API_KEY', nil))
|
|
branch = ENV.fetch('TRAVIS_BRANCH', nil)
|
|
travis_config = YAML.load_file('.travis.yml')
|
|
if travis_config['deploy']['app'].key? branch
|
|
app = travis_config['deploy']['app'][branch]
|
|
else
|
|
abort "No Heroku app found for branch #{branch}"
|
|
end
|
|
|
|
case ARGV[0]
|
|
when "on"
|
|
maintenance_state = true
|
|
when "off"
|
|
maintenance_state = false
|
|
else
|
|
abort "usage: #{$PROGRAM_NAME} (on|off)"
|
|
end
|
|
|
|
puts "Turning #{maintenance_state} maintenance mode on app #{app}"
|
|
heroku.app.update app, maintenance: maintenance_state
|