Class: DeepThought::Deployer::Heroku

Inherits:
Deployer
  • Object
show all
Defined in:
lib/deep_thought-heroku/deployer/heroku.rb

Instance Method Summary collapse

Instance Method Details

#execute?(deploy, config) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/deep_thought-heroku/deployer/heroku.rb', line 18

def execute?(deploy, config)
  environment = deploy.environment || "development"

  variables = Hash.new

  if deploy.variables
    YAML.load(deploy.variables).each do |k, v|
      variables[k] = v;
    end
  end

  force = false

  if variables['force']
    force = true
  end

  result = push_to_heroku(deploy.project.name, environment, deploy.branch, force)

  deploy.log = result['log']

  result['success']
end

#setup?(project, config) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
13
14
15
16
# File 'lib/deep_thought-heroku/deployer/heroku.rb', line 6

def setup?(project, config)
  environments = config['heroku']['environments']

  if environments
    environments.each do |k, v|
      system "cd ./.projects/#{project.name} && git remote add #{k} #{v} > /dev/null 2>&1"
    end
  else
    false
  end
end