Class: Hatchet::AnvilApp
Instance Attribute Summary
Attributes inherited from App
Instance Method Summary collapse
-
#initialize(directory, options = {}) ⇒ AnvilApp
constructor
A new instance of AnvilApp.
- #push! ⇒ Object
- #teardown! ⇒ Object
Methods inherited from App
config, #config, #debug?, #deploy, #deployed?, #not_debugging?, #run, #setup!
Constructor Details
#initialize(directory, options = {}) ⇒ AnvilApp
Returns a new instance of AnvilApp.
7 8 9 10 11 |
# File 'lib/hatchet/anvil_app.rb', line 7 def initialize(directory, = {}) @buildpack = [:buildpack] @buildpack ||= File.('.') super end |
Instance Method Details
#push! ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/hatchet/anvil_app.rb', line 13 def push! slug_url = nil begin stderr_orig = $stderr stdout_orig = $stdout string_io = StringIO.new $stderr = string_io slug_url = Anvil::Engine.build(".", :buildpack => @buildpack, :pipeline => true) puts "Releasing to http://#{@name}.herokuapp.com" response = release(@name, slug_url) while response.status == 202 response = Excon.get("#{release_host}#{response.headers["Location"]}") end rescue Anvil::Builder::BuildError => e output = $stderr.dup stdout_orig.puts output.string # print the errors to the test output return [false, output.string] ensure $stderr = stderr_orig $stdout = stdout_orig end [true, string_io.string] end |
#teardown! ⇒ Object
39 40 41 42 |
# File 'lib/hatchet/anvil_app.rb', line 39 def teardown! super FileUtils.rm_rf("#{directory}/.anvil") end |