Top Level Namespace
Defined Under Namespace
Modules: HerokuSan
Constant Summary collapse
- HEROKU_CONFIG_FILE =
Rails.root.join('config', 'heroku.yml')
Instance Method Summary collapse
- #each_heroku_app ⇒ Object
- #maintenance(app, action) ⇒ Object
- #migrate(app) ⇒ Object
- #push(commit, repo) ⇒ Object
Instance Method Details
#each_heroku_app ⇒ Object
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/heroku_san/tasks.rb', line 244 def each_heroku_app if @heroku_apps.blank? && @app_settings.keys.size == 1 app = @app_settings.keys.first puts "Defaulting to #{app} app since only one app is defined" @heroku_apps = [app] end if @heroku_apps.present? @heroku_apps.each do |name| app = @app_settings[name]['app'] config = @app_settings[name]['config'] || [] yield(name, app, "[email protected]:#{app}.git", config) end puts else puts "You must first specify at least one Heroku app: rake <app> [<app>] <command> rake production restart rake demo staging deploy" puts "\nYou can use also command all Heroku apps for this project: rake all heroku:share" exit(1) end end |
#maintenance(app, action) ⇒ Object
286 287 288 |
# File 'lib/heroku_san/tasks.rb', line 286 def maintenance(app, action) sh "heroku maintenance:#{action} --app #{app}" end |
#migrate(app) ⇒ Object
281 282 283 284 |
# File 'lib/heroku_san/tasks.rb', line 281 def migrate(app) sh "heroku rake --app #{app} db:migrate" sh "heroku restart --app #{app}" end |
#push(commit, repo) ⇒ Object
270 271 272 273 274 275 276 277 278 279 |
# File 'lib/heroku_san/tasks.rb', line 270 def push(commit, repo) commit ||= "HEAD" @git_push_arguments ||= [] begin sh "git update-ref refs/heroku_san/deploy #{commit}" sh "git push #{repo} #{@git_push_arguments.join(' ')} refs/heroku_san/deploy:refs/heads/master" ensure sh "git update-ref -d refs/heroku_san/deploy" end end |