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 +4 -4
- data/lib/bb_deploy/config.rb +18 -0
- data/lib/bb_deploy/deployer.rb +2 -1
- data/lib/bb_deploy/heroku.rb +12 -5
- data/lib/bb_deploy/logger.rb +5 -4
- data/lib/bb_deploy/task.rb +0 -2
- metadata +1 -2
- data/lib/tasks/deploy.rake +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0d49f7d13e54ae2d7327460b9c20a4ed73d0aa6
|
4
|
+
data.tar.gz: 7b4626caef82427c994a8fd883046175911bbaf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7d64c2882f5d840da266b15e523807e365a14b86a458f203792bcfbdd2918177b367b9020f1a2795e6f57302fad5076ea7acd65e6f8a114186f9cb2412bb774
|
7
|
+
data.tar.gz: 3297ebab2f7eee11c49ff83c45f09457d06c8b4e56ac6e8cb5d743d8b304374dd42b553cf0663a0399ceda0b650d43ffb49ecd0ba2ac90f94bc3c898c08333a9
|
data/lib/bb_deploy/config.rb
CHANGED
@@ -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
|
data/lib/bb_deploy/deployer.rb
CHANGED
@@ -11,7 +11,8 @@ class BbDeploy::Deployer
|
|
11
11
|
attr_reader :phase
|
12
12
|
|
13
13
|
def initialize(phase:)
|
14
|
-
BbDeploy::Config.
|
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
|
|
data/lib/bb_deploy/heroku.rb
CHANGED
@@ -1,10 +1,16 @@
|
|
1
|
+
require_relative './task'
|
2
|
+
|
1
3
|
module BbDeploy::Heroku
|
2
4
|
class << self
|
3
|
-
def
|
4
|
-
|
5
|
-
|
6
|
-
|
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
|
-
|
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
|
data/lib/bb_deploy/logger.rb
CHANGED
@@ -60,10 +60,11 @@ module BbDeploy::Logger
|
|
60
60
|
}
|
61
61
|
]
|
62
62
|
|
63
|
-
|
64
|
-
slack.ping("*Deploying to #{phase}*", attachments: attachment, channel: BbDeploy::Config.
|
65
|
-
|
66
|
-
@consolidated_logger.
|
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
|
data/lib/bb_deploy/task.rb
CHANGED
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.
|
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
|
data/lib/tasks/deploy.rake
DELETED
@@ -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
|