eb-docker-deploy 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 539614f1d8a8d22dfd586a569e55d5b9d240589f
4
- data.tar.gz: 3b8774cdaf1c024683b4689451d0e0d14397daa5
3
+ metadata.gz: 02df66ec1675e50705fdb62095917a230c4b5649
4
+ data.tar.gz: f2d019128389c04833cdbba09326e9471e279d63
5
5
  SHA512:
6
- metadata.gz: 6533c37673099f1c86a7bd5cc504c307b96b09f92f2df8bfff78b0df1fb15e573f3fca025b136336ad2f247e087a9341b75f59ab95da1fe3e57e293733473e89
7
- data.tar.gz: 21184bcd20eaf21e7543e17bbb8fa56a6edd7fe77f88418402f6a11ca4417c1e27bb8313986181daf3e82d08735506e11a5bc113f62598a3cc7430aa009e2340
6
+ metadata.gz: b6019431a1df15632b63d6be92bd1e103a2384fb01f521910303cec5b2e1d591d743f26684f734e01715f7dd22811fbad8eaf2c4eea31812d37583ae655bc9a6
7
+ data.tar.gz: 680bbd97fa0356a48d08f8a8a80226647cb5c9fe9d7975953b99cff07e0adee9379326a5c740ad73fcfd517dfeae33ae80f7524e6ce884706df3750430797b4d
@@ -23,4 +23,6 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_dependency 'thor'
25
25
  spec.add_dependency 'highline'
26
+
27
+ spec.add_dependency 'slack-notifier'
26
28
  end
data/lib/deploy.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'thor'
2
2
  require 'highline/import'
3
+ require 'slack-notifier'
3
4
 
4
5
  require 'deploy/output'
5
6
 
@@ -33,15 +33,19 @@ module Deploy
33
33
  repo = ENV['DOCKER_REPO']
34
34
 
35
35
  if build
36
+ notifier('', { color: '#6080C0', title: "Deployment started with build", text: "Deploying version #{version}" })
36
37
  build_image(repo, version)
37
38
 
38
39
  tag_image_as_latest(repo, version)
39
40
 
40
41
  push_image(repo, version)
41
42
  push_image(repo, 'latest')
43
+ else
44
+ notifier('', { color: '#6080C0', title: "Deployment started without build", text: "Deploying version #{version}" })
42
45
  end
43
46
 
44
47
  run_deploy(version)
48
+ notifier('', { color: 'good', title: 'Deployment Succeeded!!', text: "The new version is #{version}" })
45
49
  end
46
50
 
47
51
  method_option :version, aliases: '-v', desc: 'Version'
@@ -59,8 +63,24 @@ module Deploy
59
63
  run_deploy(version)
60
64
  end
61
65
 
66
+ desc 'send test notification', 'send test notification'
67
+ def test_slack
68
+ notifier('', { color: 'good', title: 'This is a test notification from eb-docker-deploy.' })
69
+ end
70
+
62
71
  no_commands do
63
72
 
73
+ def notifier(message, attachments)
74
+ if ENV['SLACK_WEBHOOK']
75
+ @notifier ||= Slack::Notifier.new(ENV['SLACK_WEBHOOK'])
76
+ @notifier.ping(message, {
77
+ attachments: [attachments]
78
+ })
79
+ else
80
+ shout 'You can send deployment notifications if you set the SLACK_WEBHOOK environment variable.'
81
+ end
82
+ end
83
+
64
84
  def build_image(repo, tag)
65
85
  shout "Building Docker Image: #{repo}:#{tag}"
66
86
  command = "docker build -t #{repo}:#{tag} ."
@@ -85,14 +105,6 @@ module Deploy
85
105
  exit(1) unless system(command)
86
106
  end
87
107
 
88
- def save_version(version)
89
- #config_file['current_version'] = version
90
- end
91
-
92
- def aws_config_file
93
- #UserConfig.new('.eb-deploy')['versions']
94
- end
95
-
96
108
  def check_setup
97
109
  (shout('docker not installed'); exit(1)) unless command?('docker')
98
110
  (shout('eb command not installed'); exit(1)) unless command?('eb')
@@ -1,3 +1,3 @@
1
1
  module Deploy
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eb-docker-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: slack-notifier
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: deploy with docker and aws eb
70
84
  email:
71
85
  - thogg4@gmail.com