bb_deploy 0.0.1.1 → 0.0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4265cc5173996544b0df461c34d76fa8dc525d39
4
- data.tar.gz: be98bb1650d4a2c678a9e09d72ea22ae7a41a2eb
3
+ metadata.gz: c0d49f7d13e54ae2d7327460b9c20a4ed73d0aa6
4
+ data.tar.gz: 7b4626caef82427c994a8fd883046175911bbaf1
5
5
  SHA512:
6
- metadata.gz: f4cd670da569b6c8954023da9fd7d374a4cc56cd903ed82167422a8bc6d3021c9b26da8302a0dcb00b11094405dc25a39c5863bfbb3f1b017edf745a3acd9141
7
- data.tar.gz: e25c4afd11033f7f7c6002497a14ffd76c6260b0e1021f98e49cb5b27fbe57975108a0ebbed5d5b30e365206461ec99688116bcb0ae3a16147435cda9c515b8e
6
+ metadata.gz: b7d64c2882f5d840da266b15e523807e365a14b86a458f203792bcfbdd2918177b367b9020f1a2795e6f57302fad5076ea7acd65e6f8a114186f9cb2412bb774
7
+ data.tar.gz: 3297ebab2f7eee11c49ff83c45f09457d06c8b4e56ac6e8cb5d743d8b304374dd42b553cf0663a0399ceda0b650d43ffb49ecd0ba2ac90f94bc3c898c08333a9
@@ -1,3 +1,5 @@
1
+ require_relative './heroku'
2
+
1
3
  module BbDeploy
2
4
  class Config
3
5
  attr_accessor :application_name,
@@ -16,6 +18,22 @@ module BbDeploy
16
18
  yield(configuration)
17
19
  end
18
20
 
21
+ def configure_from_yaml(filepath)
22
+ options = YAML.load_file(filepath)
23
+ configure do |config|
24
+ %i(application_name application_urls deployment_channel engineering_channel).each do |key|
25
+ config.send("#{key}=", options[key])
26
+ end
27
+ end
28
+ end
29
+
30
+ def set_heroku_fields!(phase:)
31
+ configure do |config|
32
+ config.logentries_token = BbDeploy::Heroku.get_variable(phase, 'DEPLOY_LOG_TOKEN').freeze
33
+ config.slack_webhook_key = BbDeploy::Heroku.get_variable(phase, 'SLACK_WEBHOOK').freeze
34
+ end
35
+ end
36
+
19
37
  def method_missing(method, *args)
20
38
  configuration.send(method, *args)
21
39
  end
@@ -11,7 +11,8 @@ class BbDeploy::Deployer
11
11
  attr_reader :phase
12
12
 
13
13
  def initialize(phase:)
14
- BbDeploy::Config.set_dynamic_fields!(phase: phase)
14
+ BbDeploy::Config.configure_from_yaml('config/deploy.yml')
15
+ BbDeploy::Config.set_heroku_fields!(phase: phase)
15
16
  @phase = phase
16
17
  end
17
18
 
@@ -1,10 +1,16 @@
1
+ require_relative './task'
2
+
1
3
  module BbDeploy::Heroku
2
4
  class << self
3
- def set_dynamic_fields!(phase:)
4
- BbDeploy::Config.configure do |config|
5
- config.logentries_token = get_heroku_variable(phase, 'DEPLOY_LOG_TOKEN').freeze
6
- config.slack_webhook_key = get_heroku_variable(phase, 'SLACK_WEBHOOK').freeze
5
+ def get_variable(phase, var_name)
6
+ @heroku_env_vars ||= {}
7
+ return @heroku_env_vars[var_name] if @heroku_env_vars[var_name]
8
+ if token = heroku_run("heroku config:get #{var_name} --remote #{phase}").chomp.presence
9
+ @heroku_env_vars[var_name] = token.split.last
10
+ else
11
+ raise "Ack! Thbbft!!! Can't find #{var_name} on heroku #{phase}."
7
12
  end
13
+ @heroku_env_vars[var_name]
8
14
  end
9
15
 
10
16
  def last_release_sha(phase)
@@ -29,7 +35,8 @@ module BbDeploy::Heroku
29
35
  def heroku_run(*cmds)
30
36
  # Heroku Toolbelt uses Ruby 1.9, which requires clearing the RUBYOPT var ...
31
37
  puts "Running\n#{cmds}"
32
- run(*cmds.map { |cmd| cmd =~ /heroku/ ? "export RUBYOPT='' && #{cmd}" : cmd })
38
+ puts *cmds.map { |cmd| cmd =~ /heroku/ ? "export RUBYOPT='' && #{cmd}" : cmd }
39
+ # BbDeploy::Task.run(*cmds.map { |cmd| cmd =~ /heroku/ ? "export RUBYOPT='' && #{cmd}" : cmd })
33
40
  end
34
41
  end
35
42
  end
@@ -60,10 +60,11 @@ module BbDeploy::Logger
60
60
  }
61
61
  ]
62
62
 
63
- slack.ping("*Deploying to #{phase}*", attachments: attachment, channel: BbDeploy::Config.deployment_channel)
64
- slack.ping("*Deploying to #{phase}*", attachments: attachment, channel: BbDeploy::Config.engineering_channel) if notify_eng_hub
65
- @consolidated_logger ||= ConsolidatedLogger::Logentries.new(phase)
66
- @consolidated_logger.logger.info("DEPLOY--#{msg}")
63
+ puts "[ *Deploying to #{phase}* ]"
64
+ # slack.ping("*Deploying to #{phase}*", attachments: attachment, channel: BbDeploy::Config.deployment_channel)
65
+ # slack.ping("*Deploying to #{phase}*", attachments: attachment, channel: BbDeploy::Config.engineering_channel) if notify_eng_hub
66
+ # @consolidated_logger ||= ConsolidatedLogger::Logentries.new(phase)
67
+ # @consolidated_logger.logger.info("DEPLOY--#{msg}")
67
68
  end
68
69
 
69
70
  def slack
@@ -1,5 +1,3 @@
1
- require 'highline'
2
-
3
1
  module BbDeploy::Task
4
2
  class << self
5
3
  def run(*cmds)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bb_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.1
4
+ version: 0.0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter van Wesep
@@ -24,7 +24,6 @@ files:
24
24
  - lib/bb_deploy/heroku.rb
25
25
  - lib/bb_deploy/logger.rb
26
26
  - lib/bb_deploy/task.rb
27
- - lib/tasks/deploy.rake
28
27
  homepage:
29
28
  licenses:
30
29
  - MIT
@@ -1,15 +0,0 @@
1
- namespace :heroku do
2
- namespace :deploy do
3
- task qa: :environment do
4
- BbDeploy::Deployer.new(phase: 'qa').deploy!
5
- end
6
-
7
- task staging: :environment do
8
- BbDeploy::Deployer.new(phase: 'staging').deploy!
9
- end
10
-
11
- task production: :environment do
12
- BbDeploy::Deployer.new(phase: 'production').deploy!
13
- end
14
- end
15
- end