Class: Hatchet::GitApp

Inherits:
App
  • Object
show all
Defined in:
lib/hatchet/git_app.rb

Overview

used for deploying a test app to heroku via git

Constant Summary collapse

HATCHET_BUILDPACK_BASE =
(ENV['HATCHET_BUILDPACK_BASE'] || "https://github.com/heroku/heroku-buildpack-ruby.git")
HATCHET_BUILDPACK_BRANCH =
-> { ENV['HATCHET_BUILDPACK_BRANCH'] || Hatchet.git_branch }
BUILDPACK_URL =
"https://github.com/heroku/heroku-buildpack-ruby.git"

Instance Attribute Summary

Attributes inherited from App

#directory, #name, #repo_name

Instance Method Summary collapse

Methods inherited from App

#add_database, #api_key, #config, config, #debug?, #deploy, #deployed?, #get_config, #get_labs, #heroku, #in_directory, #lab_is_installed?, #not_debugging?, #output, #push, #retry_error_message, #run, #set_config, #set_lab, #set_labs!, #teardown!

Constructor Details

#initialize(directory, options = {}) ⇒ GitApp

Returns a new instance of GitApp.



8
9
10
11
# File 'lib/hatchet/git_app.rb', line 8

def initialize(directory, options = {})
  @buildpack = options[:buildpack] || options[:buildpack_url] || [HATCHET_BUILDPACK_BASE, HATCHET_BUILDPACK_BRANCH.call].join("#")
  super
end

Instance Method Details

#git_repoObject



18
19
20
# File 'lib/hatchet/git_app.rb', line 18

def git_repo
  "[email protected]:#{name}.git"
end

#push_without_retry!Object



22
23
24
25
26
27
28
29
30
# File 'lib/hatchet/git_app.rb', line 22

def push_without_retry!
  puts `pwd`
  puts `ls`
  output = `git push #{git_repo} master 2>&1`
  if !$?.success?
    raise FailedDeploy.new(self, "Buildpack: #{@buildpack.inspect}\nRepo: #{git_repo}\n#{output}") unless @allow_failure
  end
  return output
end

#setup!Object



13
14
15
16
# File 'lib/hatchet/git_app.rb', line 13

def setup!
  super
  heroku.put_config_vars(name, 'BUILDPACK_URL' => @buildpack)
end