Class: Heroku::Bartender::Command
- Inherits:
-
Object
- Object
- Heroku::Bartender::Command
- Defined in:
- lib/heroku/bartender/command.rb
Class Method Summary collapse
- .current_version(heroku_remote) ⇒ Object
- .move_to(release, predeploy, heroku_remote) ⇒ Object
- .sha_exist?(sha) ⇒ Boolean
Class Method Details
.current_version(heroku_remote) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/heroku/bartender/command.rb', line 6 def self.current_version(heroku_remote) repo = Grit::Repo.new('.') if repo.remote_list.include?(heroku_remote) return `git ls-remote #{heroku_remote}`.split("\t").first end nil end |
.move_to(release, predeploy, heroku_remote) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/heroku/bartender/command.rb', line 21 def self.move_to release, predeploy, heroku_remote @@last_error = nil if predeploy && ! predeploy.strip.empty? Sandbox.new(release).predeploy(predeploy.strip) end repo = Grit::Repo.new('.') if ! repo.remote_list.include?(heroku_remote) raise "No such remote `#{heroku_remote}`" end if ! sha_exist?(release) raise "No such commit `#{release}" end rc = system("git push -f #{heroku_remote} #{release}:master") if rc.nil? || ! rc raise "Error in `git push -f #{heroku_remote} #{release}:master`: #{$?}" end end |
.sha_exist?(sha) ⇒ Boolean
14 15 16 17 18 19 |
# File 'lib/heroku/bartender/command.rb', line 14 def self.sha_exist?(sha) if sha and not `git show #{sha}`.empty? return true end false end |