Class: Falcon::Deploy
- Inherits:
-
Object
- Object
- Falcon::Deploy
- Defined in:
- lib/falcon.rb
Instance Attribute Summary collapse
-
#appname ⇒ Object
readonly
Returns the value of attribute appname.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#force ⇒ Object
readonly
Returns the value of attribute force.
Class Method Summary collapse
Instance Method Summary collapse
- #deploy ⇒ Object
- #deployer ⇒ Object
-
#initialize(appname, force = false) ⇒ Deploy
constructor
A new instance of Deploy.
- #migrations ⇒ Object
- #rollback ⇒ Object
- #rollback_warning ⇒ Object
- #run(command) ⇒ Object
Constructor Details
#initialize(appname, force = false) ⇒ Deploy
Returns a new instance of Deploy.
9 10 11 12 |
# File 'lib/falcon.rb', line 9 def initialize(appname, force=false) @appname = appname @force = force end |
Instance Attribute Details
#appname ⇒ Object (readonly)
Returns the value of attribute appname.
8 9 10 |
# File 'lib/falcon.rb', line 8 def appname @appname end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
8 9 10 |
# File 'lib/falcon.rb', line 8 def env @env end |
#force ⇒ Object (readonly)
Returns the value of attribute force.
8 9 10 |
# File 'lib/falcon.rb', line 8 def force @force end |
Class Method Details
.help ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/falcon.rb', line 14 def self.help %Q{ USAGE: `falcon [appname] [command] [flags]` APPNAME: Your Heroku app name COMMANDS: - `deploy` - deploy the code - `migrations` - deploy and run migrations - `rollback` - reverse the latest code deploy (does NOT reverse migrations) FLAGS - `-f`, `--force` - force rollback etc } end |
Instance Method Details
#deploy ⇒ Object
36 37 38 |
# File 'lib/falcon.rb', line 36 def deploy deployer.deploy end |
#deployer ⇒ Object
56 57 58 |
# File 'lib/falcon.rb', line 56 def deployer @deployer ||= HerokuDeployer.new( appname ) end |
#migrations ⇒ Object
40 41 42 |
# File 'lib/falcon.rb', line 40 def migrations deployer.migrations end |
#rollback ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/falcon.rb', line 44 def rollback unless force puts rollback_warning answer = STDIN.gets.strip return (puts "Rollback cancelled.") unless %w( y yes ).include?( answer.downcase ) end deployer.rollback end |
#rollback_warning ⇒ Object
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/falcon.rb', line 60 def rollback_warning %Q{ This command does NOT reverse migrations. If you want to reverse a migration, please do so manually: `heroku run rake db:rollback` Then run this command again. Continue (without DB rollback)? Y/N } end |
#run(command) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/falcon.rb', line 27 def run(command) if respond_to? command send command else puts "The command '#{command}' is not valid.\n" puts self.class.help end end |