eb-docker-deploy 0.4.0 → 0.5.0
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/deploy/deployer.rb +47 -2
- data/lib/deploy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac65a96dc65d9de88303721646139f11a63dd7b5
|
4
|
+
data.tar.gz: 414634332803119a4ac249fb5e3fb71c4f928d9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08109c1809e539e4831e3168a99f6f296fa1985ba37879257e6fe40670be142d4dbb312d50a3488df7ec7cf035fd58733aa2a1ab6f6133566cbff5c0d70d30d5
|
7
|
+
data.tar.gz: 0acf0c52f67246a79ab5a5c64ba80784513e262138bd7d5d5343b935c3f5f109f3a4bc85c7da1d9ea5bc39da4f7b3cc85ee65a6dd7ffddabd435e979a7f96354
|
data/lib/deploy/deployer.rb
CHANGED
@@ -30,7 +30,7 @@ module Deploy
|
|
30
30
|
build = options[:build]
|
31
31
|
|
32
32
|
version = options[:version]
|
33
|
-
(
|
33
|
+
check_version(version)
|
34
34
|
|
35
35
|
repo = ENV['DOCKER_REPO']
|
36
36
|
|
@@ -47,6 +47,7 @@ module Deploy
|
|
47
47
|
end
|
48
48
|
|
49
49
|
run_deploy(version, environment)
|
50
|
+
record_version(version)
|
50
51
|
announce({ color: 'good', title: 'Deployment Succeeded!!', text: "The current version of #{environment || 'stage'} is #{version}" })
|
51
52
|
end
|
52
53
|
|
@@ -58,7 +59,7 @@ module Deploy
|
|
58
59
|
|
59
60
|
environment = options[:environment]
|
60
61
|
version = options[:version]
|
61
|
-
(
|
62
|
+
check_rollback_version(version)
|
62
63
|
|
63
64
|
repo = ENV['DOCKER_REPO']
|
64
65
|
|
@@ -71,6 +72,7 @@ module Deploy
|
|
71
72
|
push_image(repo, 'latest')
|
72
73
|
|
73
74
|
run_rollback(version, environment)
|
75
|
+
record_version(version)
|
74
76
|
announce({ color: 'good', title: 'Rollback Succeeded!!', text: "The current version of #{environment || 'stage'} is #{version}" })
|
75
77
|
end
|
76
78
|
|
@@ -79,6 +81,13 @@ module Deploy
|
|
79
81
|
notifier('', { color: 'good', title: 'This is a test notification from eb-docker-deploy.' })
|
80
82
|
end
|
81
83
|
|
84
|
+
desc 'list versions', 'list versions'
|
85
|
+
def versions
|
86
|
+
versions_array.each do |v|
|
87
|
+
shout v
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
82
91
|
no_commands do
|
83
92
|
|
84
93
|
def announce(attachments)
|
@@ -145,6 +154,42 @@ module Deploy
|
|
145
154
|
system("which #{command} > /dev/null 2>&1")
|
146
155
|
end
|
147
156
|
|
157
|
+
def check_rollback_version(version)
|
158
|
+
check_version(version)
|
159
|
+
(shout('You can only rollback to a previous version'); exit(1)) unless versions_array.include?(version)
|
160
|
+
end
|
161
|
+
|
162
|
+
def check_version(version)
|
163
|
+
(shout('You must pass a version with -v'); exit(1)) unless version
|
164
|
+
(shout('You are currently on that version'); exit(1)) if current_version == version
|
165
|
+
end
|
166
|
+
|
167
|
+
def record_version(version)
|
168
|
+
write_to_versions_file(versions_array.push(version))
|
169
|
+
end
|
170
|
+
|
171
|
+
def current_version
|
172
|
+
versions_array.last
|
173
|
+
end
|
174
|
+
|
175
|
+
def versions_array
|
176
|
+
read_versions_file.read.split
|
177
|
+
end
|
178
|
+
|
179
|
+
def write_to_versions_file(new_array)
|
180
|
+
write_versions_file do |f|
|
181
|
+
new_array.each { |v| f.puts(v) }
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
def write_versions_file(&block)
|
186
|
+
File.open('.versions', 'w+', &block)
|
187
|
+
end
|
188
|
+
|
189
|
+
def read_versions_file
|
190
|
+
File.open('.versions', 'r')
|
191
|
+
end
|
192
|
+
|
148
193
|
end
|
149
194
|
|
150
195
|
end
|
data/lib/deploy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eb-docker-deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|