Class: Purobu::Heroku

Inherits:
Object
  • Object
show all
Defined in:
lib/purobu/heroku.rb

Defined Under Namespace

Classes: FailedCommand

Class Method Summary collapse

Class Method Details

.heroku_pathObject



15
16
17
18
19
20
21
22
# File 'lib/purobu/heroku.rb', line 15

def self.heroku_path
  @heroku_path ||= begin
                     FileUtils.cd File.expand_path(File.join("..", ".."), File.dirname(__FILE__)) do
                       eval(File.read('purobu.gemspec'))
                     end
                     Gem.bin_path("heroku", "heroku")
                   end
end

.run(command) ⇒ Object

Raises:



6
7
8
9
10
11
12
13
# File 'lib/purobu/heroku.rb', line 6

def self.run(command)
  result = nil
  Purobu.log(heroku: true, command: command) do
    result = `#{heroku_path} #{command}`
  end
  raise FailedCommand.new(result) unless $?.exitstatus.zero?
  result
end