mamiya 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/example/README.md +1 -1
- data/lib/mamiya/agent.rb +1 -0
- data/lib/mamiya/helpers/git.rb +1 -1
- data/lib/mamiya/master.rb +1 -1
- data/lib/mamiya/storages/s3.rb +1 -1
- data/lib/mamiya/version.rb +1 -1
- data/mamiya.gemspec +2 -2
- data/spec/agent/task_queue_spec.rb +4 -4
- data/spec/agent_spec.rb +4 -4
- data/spec/dsl_spec.rb +4 -4
- data/spec/master/agent_monitor_spec.rb +1 -1
- data/spec/master/application_status_spec.rb +4 -4
- data/spec/master/package_status_spec.rb +7 -7
- data/spec/master/web_spec.rb +5 -5
- data/spec/package_spec.rb +19 -19
- data/spec/script_spec.rb +11 -10
- data/spec/spec_helper.rb +10 -1
- data/spec/steps/build_spec.rb +2 -2
- data/spec/steps/prepare_spec.rb +1 -1
- data/spec/steps/switch_spec.rb +3 -3
- data/spec/storages/filesystem_spec.rb +2 -2
- data/spec/storages/s3_proxy_spec.rb +1 -2
- data/spec/storages/s3_spec.rb +2 -11
- data/spec/util/label_matcher_spec.rb +17 -17
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f15e60a8affe0a9de8edc3d1d08eeae88c53430f
|
4
|
+
data.tar.gz: 6bd610f27e771b8722fb73071dfc3a852d5a8109
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb0b2083ba26dfd25202b139e4afe41fc26d2a99d71a0a47bc38da526e844083c812d739f95d8a9100def23f4b1733fd0bf605c00943a12ce965b693bc58db63
|
7
|
+
data.tar.gz: 5e83441d2ebe53be256d0129a30b9e8b639d925954a6c72769e822867114e73c652f5547f6fd188c9ccaef0857a68a1f0bbb97b5f1e4d2b0edca0f75ebcaa926
|
data/example/README.md
CHANGED
data/lib/mamiya/agent.rb
CHANGED
@@ -189,6 +189,7 @@ module Mamiya
|
|
189
189
|
payload_str = payload.merge(name: self.serf.name).to_json
|
190
190
|
|
191
191
|
@trigger_lock.synchronize do
|
192
|
+
logger.debug "Send serf event #{name}(coalesce=#{coalesce}): #{payload_str}"
|
192
193
|
serf.event(name, payload_str, coalesce: coalesce)
|
193
194
|
end
|
194
195
|
end
|
data/lib/mamiya/helpers/git.rb
CHANGED
@@ -17,7 +17,7 @@ def git_ignored_files
|
|
17
17
|
raise "`git clean -ndx` doesn't return line starting with 'Would remove' or 'Would skip'"
|
18
18
|
end
|
19
19
|
|
20
|
-
excludes = git_clean_out.grep(prefix).map{ |_| _.sub(prefix, '').chomp }
|
20
|
+
excludes = git_clean_out.grep(prefix).map{ |_| _.sub(prefix, '').chomp.chomp('/') }
|
21
21
|
if package_under
|
22
22
|
excludes.grep(/^#{Regexp.escape(package_under)}/).map{ |_| _.sub(/^#{Regexp.escape(package_under)}\/?/, '') }
|
23
23
|
else
|
data/lib/mamiya/master.rb
CHANGED
@@ -90,7 +90,7 @@ module Mamiya
|
|
90
90
|
app: self.web,
|
91
91
|
Port: options[:port] ? options[:port].to_i : 7761,
|
92
92
|
Host: options[:bind] || '0.0.0.0', # TODO: IPv6
|
93
|
-
environment: options[:environment] ||
|
93
|
+
environment: options[:environment] || 'development',
|
94
94
|
server: options[:server],
|
95
95
|
Logger: logger['web']
|
96
96
|
}
|
data/lib/mamiya/storages/s3.rb
CHANGED
data/lib/mamiya/version.rb
CHANGED
data/mamiya.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_runtime_dependency "thor", ">= 0.18.1"
|
22
|
-
spec.add_runtime_dependency "aws-sdk-
|
22
|
+
spec.add_runtime_dependency "aws-sdk-s3", ">= 1"
|
23
23
|
spec.add_runtime_dependency "term-ansicolor", ">= 1.3.0"
|
24
24
|
unless ENV["MAMIYA_VILLEIN_PATH"]
|
25
25
|
spec.add_runtime_dependency "villein", ">= 0.5.0"
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_runtime_dependency "sinatra", ">= 1.4.5"
|
29
29
|
spec.add_runtime_dependency "sigdump"
|
30
30
|
|
31
|
-
spec.add_development_dependency "rspec", "
|
31
|
+
spec.add_development_dependency "rspec", ">= 3.0"
|
32
32
|
spec.add_development_dependency 'rack-test', '~> 0.6.2'
|
33
33
|
|
34
34
|
spec.add_development_dependency "bundler", "~> 1.5"
|
@@ -75,15 +75,15 @@ describe Mamiya::Agent::TaskQueue do
|
|
75
75
|
expect(queue).to be_running
|
76
76
|
|
77
77
|
expect(queue.worker_threads).to be_a_kind_of(Hash)
|
78
|
-
expect(queue.worker_threads.values.all? { |v| v.kind_of?(Thread) }).to
|
79
|
-
expect(queue.worker_threads.values.all? { |v| v.alive? }).to
|
78
|
+
expect(queue.worker_threads.values.all? { |v| v.kind_of?(Thread) }).to be true
|
79
|
+
expect(queue.worker_threads.values.all? { |v| v.alive? }).to be true
|
80
80
|
threads = queue.worker_threads.dup
|
81
81
|
|
82
82
|
queue.stop!
|
83
83
|
|
84
84
|
expect(queue).not_to be_running
|
85
85
|
expect(queue.worker_threads).to be_nil
|
86
|
-
expect(threads.each_value.all? { |v| !v.alive? }).to
|
86
|
+
expect(threads.each_value.all? { |v| !v.alive? }).to be true
|
87
87
|
end
|
88
88
|
|
89
89
|
it "can stop gracefully"
|
@@ -138,7 +138,7 @@ describe Mamiya::Agent::TaskQueue do
|
|
138
138
|
|
139
139
|
100.times { break if task_class_a.runs.size == 1; sleep 0.01 }
|
140
140
|
expect(task_class_a.runs.size).to eq 1
|
141
|
-
expect(task_class_a.runs[0].key?('_labels')).to
|
141
|
+
expect(task_class_a.runs[0].key?('_labels')).to be false
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
data/spec/agent_spec.rb
CHANGED
@@ -140,19 +140,19 @@ describe Mamiya::Agent do
|
|
140
140
|
subject(:status) { agent.status(packages: false) }
|
141
141
|
|
142
142
|
it "doesn't include existing packages" do
|
143
|
-
expect(status.has_key?(:packages)).to
|
143
|
+
expect(status.has_key?(:packages)).to be false
|
144
144
|
end
|
145
145
|
|
146
146
|
it "doesn't include existing prereleases" do
|
147
|
-
expect(status.has_key?(:prereleases)).to
|
147
|
+
expect(status.has_key?(:prereleases)).to be false
|
148
148
|
end
|
149
149
|
|
150
150
|
it "doesn't include existing releases" do
|
151
|
-
expect(status.has_key?(:releases)).to
|
151
|
+
expect(status.has_key?(:releases)).to be false
|
152
152
|
end
|
153
153
|
|
154
154
|
it "doesn't include existing currents" do
|
155
|
-
expect(status.has_key?(:currents)).to
|
155
|
+
expect(status.has_key?(:currents)).to be false
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
data/spec/dsl_spec.rb
CHANGED
@@ -8,7 +8,7 @@ describe Mamiya::DSL do
|
|
8
8
|
|
9
9
|
describe ".set_default" do
|
10
10
|
it "sets default" do
|
11
|
-
expect { dsl.testvar }.to raise_error
|
11
|
+
expect { dsl.testvar }.to raise_error(NoMethodError, /\btestvar\b/)
|
12
12
|
klass.set_default :testvar, 1
|
13
13
|
expect(dsl.testvar).to eq 1
|
14
14
|
end
|
@@ -16,7 +16,7 @@ describe Mamiya::DSL do
|
|
16
16
|
|
17
17
|
describe ".add_hook" do
|
18
18
|
it "adds hook" do
|
19
|
-
expect { dsl.testhook }.to raise_error
|
19
|
+
expect { dsl.testhook }.to raise_error(NoMethodError, /\btesthook\b/)
|
20
20
|
klass.add_hook :testhook
|
21
21
|
expect(dsl.testhook).to be_a(Proc)
|
22
22
|
end
|
@@ -98,7 +98,7 @@ describe Mamiya::DSL do
|
|
98
98
|
|
99
99
|
describe "#set" do
|
100
100
|
it "sets variable" do
|
101
|
-
expect{ dsl.foo }.to raise_error
|
101
|
+
expect{ dsl.foo }.to raise_error(NoMethodError, /\bfoo\b/)
|
102
102
|
dsl.set :foo, 100
|
103
103
|
expect(dsl.foo).to eq 100
|
104
104
|
expect(dsl[:foo]).to eq 100
|
@@ -157,7 +157,7 @@ describe Mamiya::DSL do
|
|
157
157
|
it "raises error" do
|
158
158
|
expect {
|
159
159
|
dsl.invoke :nul
|
160
|
-
}.to raise_error
|
160
|
+
}.to raise_error(Mamiya::DSL::TaskNotDefinedError)
|
161
161
|
end
|
162
162
|
end
|
163
163
|
end
|
@@ -243,7 +243,7 @@ describe Mamiya::Master::AgentMonitor do
|
|
243
243
|
end
|
244
244
|
|
245
245
|
context "with argument" do
|
246
|
-
it "passes args to serf query",
|
246
|
+
it "passes args to serf query", skip: 'stub_serf_queries cannot handle kwarg' do
|
247
247
|
stub_serf_queries(expected_kwargs: {node: 'foo'})
|
248
248
|
agent_monitor.refresh(node: 'foo')
|
249
249
|
end
|
@@ -133,7 +133,7 @@ describe Mamiya::Master::ApplicationStatus do
|
|
133
133
|
}
|
134
134
|
end
|
135
135
|
|
136
|
-
it {
|
136
|
+
it { is_expected.to eq('a' => %w(agent1 agent3), 'b' => %w(agent2)) }
|
137
137
|
end
|
138
138
|
|
139
139
|
describe "#major_current" do
|
@@ -153,7 +153,7 @@ describe Mamiya::Master::ApplicationStatus do
|
|
153
153
|
}
|
154
154
|
end
|
155
155
|
|
156
|
-
it {
|
156
|
+
it { is_expected.to eq 'a' }
|
157
157
|
end
|
158
158
|
|
159
159
|
describe "#common_releases" do
|
@@ -173,7 +173,7 @@ describe Mamiya::Master::ApplicationStatus do
|
|
173
173
|
}
|
174
174
|
end
|
175
175
|
|
176
|
-
it {
|
176
|
+
it { is_expected.to eq %w(b c) }
|
177
177
|
end
|
178
178
|
|
179
179
|
describe "#common_previous_release" do
|
@@ -196,6 +196,6 @@ describe Mamiya::Master::ApplicationStatus do
|
|
196
196
|
}
|
197
197
|
end
|
198
198
|
|
199
|
-
it {
|
199
|
+
it { is_expected.to eq ?b }
|
200
200
|
end
|
201
201
|
end
|
@@ -49,8 +49,8 @@ describe Mamiya::Master::PackageStatus do
|
|
49
49
|
}
|
50
50
|
end
|
51
51
|
|
52
|
-
it {
|
53
|
-
it {
|
52
|
+
it { is_expected.to include(:distributing) }
|
53
|
+
it { is_expected.to include(:partially_distributed) }
|
54
54
|
end
|
55
55
|
|
56
56
|
context "if there's queued agents" do
|
@@ -83,8 +83,8 @@ describe Mamiya::Master::PackageStatus do
|
|
83
83
|
}
|
84
84
|
end
|
85
85
|
|
86
|
-
it {
|
87
|
-
it {
|
86
|
+
it { is_expected.to include(:distributing) }
|
87
|
+
it { is_expected.to include(:partially_distributed) }
|
88
88
|
end
|
89
89
|
|
90
90
|
context "if any agents have the package" do
|
@@ -112,7 +112,7 @@ describe Mamiya::Master::PackageStatus do
|
|
112
112
|
}
|
113
113
|
end
|
114
114
|
|
115
|
-
it {
|
115
|
+
it { is_expected.to include(:partially_distributed) }
|
116
116
|
end
|
117
117
|
|
118
118
|
context "if all agents have the package" do
|
@@ -141,7 +141,7 @@ describe Mamiya::Master::PackageStatus do
|
|
141
141
|
}
|
142
142
|
end
|
143
143
|
|
144
|
-
it {
|
144
|
+
it { is_expected.to include(:distributed) }
|
145
145
|
end
|
146
146
|
|
147
147
|
context "if no agents relate to the package" do
|
@@ -168,7 +168,7 @@ describe Mamiya::Master::PackageStatus do
|
|
168
168
|
}
|
169
169
|
end
|
170
170
|
|
171
|
-
it {
|
171
|
+
it { is_expected.to eq [:unknown] }
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
data/spec/master/web_spec.rb
CHANGED
@@ -324,7 +324,7 @@ describe Mamiya::Master::Web do
|
|
324
324
|
}
|
325
325
|
end
|
326
326
|
|
327
|
-
it {
|
327
|
+
it { is_expected.to eq 'distributing' }
|
328
328
|
end
|
329
329
|
|
330
330
|
context "if there's queued agents" do
|
@@ -357,7 +357,7 @@ describe Mamiya::Master::Web do
|
|
357
357
|
}
|
358
358
|
end
|
359
359
|
|
360
|
-
it {
|
360
|
+
it { is_expected.to eq 'distributing' }
|
361
361
|
end
|
362
362
|
|
363
363
|
context "if any agents have the package" do
|
@@ -385,7 +385,7 @@ describe Mamiya::Master::Web do
|
|
385
385
|
}
|
386
386
|
end
|
387
387
|
|
388
|
-
it {
|
388
|
+
it { is_expected.to eq 'partially_distributed' }
|
389
389
|
end
|
390
390
|
|
391
391
|
context "if all agents have the package" do
|
@@ -414,7 +414,7 @@ describe Mamiya::Master::Web do
|
|
414
414
|
}
|
415
415
|
end
|
416
416
|
|
417
|
-
it {
|
417
|
+
it { is_expected.to eq 'distributed' }
|
418
418
|
end
|
419
419
|
|
420
420
|
context "if no agents relate to the package" do
|
@@ -441,7 +441,7 @@ describe Mamiya::Master::Web do
|
|
441
441
|
}
|
442
442
|
end
|
443
443
|
|
444
|
-
it {
|
444
|
+
it { is_expected.to eq 'unknown' }
|
445
445
|
end
|
446
446
|
end
|
447
447
|
|
data/spec/package_spec.rb
CHANGED
@@ -48,26 +48,26 @@ describe Mamiya::Package do
|
|
48
48
|
|
49
49
|
describe "#path" do
|
50
50
|
subject { package.path }
|
51
|
-
it {
|
51
|
+
it { is_expected.to eq Pathname.new(package_path) }
|
52
52
|
|
53
53
|
context "without file extension" do
|
54
54
|
let(:arg) { 'test' }
|
55
|
-
it {
|
55
|
+
it { is_expected.to eq Pathname.new('test.tar.gz') }
|
56
56
|
end
|
57
57
|
|
58
58
|
context "with .tar.gz" do
|
59
59
|
let(:arg) { 'test.tar.gz' }
|
60
|
-
it {
|
60
|
+
it { is_expected.to eq Pathname.new('test.tar.gz') }
|
61
61
|
end
|
62
62
|
|
63
63
|
context "with .json" do
|
64
64
|
let(:arg) { 'test.json' }
|
65
|
-
it {
|
65
|
+
it { is_expected.to eq Pathname.new('test.tar.gz') }
|
66
66
|
end
|
67
67
|
|
68
68
|
context "with filename containing dot" do
|
69
69
|
let(:arg) { 'a.b' }
|
70
|
-
it {
|
70
|
+
it { is_expected.to eq Pathname.new('a.b.tar.gz') }
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -76,22 +76,22 @@ describe Mamiya::Package do
|
|
76
76
|
|
77
77
|
context "without file extension" do
|
78
78
|
let(:arg) { 'test' }
|
79
|
-
it {
|
79
|
+
it { is_expected.to eq Pathname.new('test.json') }
|
80
80
|
end
|
81
81
|
|
82
82
|
context "with .tar.gz" do
|
83
83
|
let(:arg) { 'test.tar.gz' }
|
84
|
-
it {
|
84
|
+
it { is_expected.to eq Pathname.new('test.json') }
|
85
85
|
end
|
86
86
|
|
87
87
|
context "with .json" do
|
88
88
|
let(:arg) { 'test.json' }
|
89
|
-
it {
|
89
|
+
it { is_expected.to eq Pathname.new('test.json') }
|
90
90
|
end
|
91
91
|
|
92
92
|
context "with filename containing dot" do
|
93
93
|
let(:arg) { 'a.b' }
|
94
|
-
it {
|
94
|
+
it { is_expected.to eq Pathname.new('a.b.json') }
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
@@ -155,7 +155,7 @@ describe Mamiya::Package do
|
|
155
155
|
File.write(meta_path, {"checksum" => Digest::SHA2.hexdigest("test\n")}.to_json + "\n")
|
156
156
|
end
|
157
157
|
|
158
|
-
it {
|
158
|
+
it { is_expected.to be true }
|
159
159
|
end
|
160
160
|
|
161
161
|
context "when checksum is incorrect" do
|
@@ -164,7 +164,7 @@ describe Mamiya::Package do
|
|
164
164
|
File.write(meta_path, {"checksum" => Digest::SHA2.hexdigest("text\n")}.to_json + "\n")
|
165
165
|
end
|
166
166
|
|
167
|
-
it {
|
167
|
+
it { is_expected.to be false }
|
168
168
|
end
|
169
169
|
|
170
170
|
context "when package not exists" do
|
@@ -187,42 +187,42 @@ describe Mamiya::Package do
|
|
187
187
|
describe "#name" do
|
188
188
|
subject { package.name }
|
189
189
|
|
190
|
-
it {
|
190
|
+
it { is_expected.to eq 'test' }
|
191
191
|
|
192
192
|
context "when meta['name'] exists" do
|
193
193
|
before do
|
194
194
|
package.meta['name'] = 'pack'
|
195
195
|
end
|
196
196
|
|
197
|
-
it {
|
197
|
+
it { is_expected.to eq 'pack' }
|
198
198
|
end
|
199
199
|
end
|
200
200
|
|
201
201
|
describe "#application" do
|
202
202
|
subject { package.application }
|
203
203
|
|
204
|
-
it {
|
204
|
+
it { is_expected.to eq nil }
|
205
205
|
|
206
206
|
context "when meta['application'] exists" do
|
207
207
|
before do
|
208
208
|
package.meta['application'] = 'app'
|
209
209
|
end
|
210
210
|
|
211
|
-
it {
|
211
|
+
it { is_expected.to eq 'app' }
|
212
212
|
end
|
213
213
|
end
|
214
214
|
|
215
215
|
describe "#checksum" do
|
216
216
|
subject { package.checksum }
|
217
217
|
|
218
|
-
it {
|
218
|
+
it { is_expected.to be_nil }
|
219
219
|
|
220
220
|
context "when package exists" do
|
221
221
|
before do
|
222
222
|
File.write package_path, "text\n"
|
223
223
|
end
|
224
224
|
|
225
|
-
it {
|
225
|
+
it { is_expected.to eq Digest::SHA2.hexdigest("text\n") }
|
226
226
|
end
|
227
227
|
end
|
228
228
|
|
@@ -234,7 +234,7 @@ describe Mamiya::Package do
|
|
234
234
|
File.write package_path, ''
|
235
235
|
end
|
236
236
|
|
237
|
-
it {
|
237
|
+
it { is_expected.to be true }
|
238
238
|
end
|
239
239
|
|
240
240
|
context "when package not exists" do
|
@@ -242,7 +242,7 @@ describe Mamiya::Package do
|
|
242
242
|
File.unlink(package_path) if File.exists?(package_path)
|
243
243
|
end
|
244
244
|
|
245
|
-
it {
|
245
|
+
it { is_expected.to be false }
|
246
246
|
end
|
247
247
|
end
|
248
248
|
|
data/spec/script_spec.rb
CHANGED
@@ -14,9 +14,9 @@ describe Mamiya::Script do
|
|
14
14
|
|
15
15
|
let(:logger) {
|
16
16
|
double("logger").tap do |_|
|
17
|
-
_.
|
17
|
+
allow(_).to receive(:[]) { _ }
|
18
18
|
%i(info warn debug error).each do |severity|
|
19
|
-
_.
|
19
|
+
allow(_).to receive(severity) { |*args| log << [severity, *args]; _ }
|
20
20
|
end
|
21
21
|
end
|
22
22
|
}
|
@@ -27,14 +27,15 @@ describe Mamiya::Script do
|
|
27
27
|
|
28
28
|
describe "#run" do
|
29
29
|
it "runs command" do
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
30
|
+
Dir.mktmpdir('mamiya-script-spec') do |tmpdir|
|
31
|
+
testee = File.join(tmpdir, 'test')
|
32
|
+
|
33
|
+
expect {
|
34
|
+
script.run("touch", testee)
|
35
|
+
} \
|
36
|
+
.to change { File.exists?(testee) } \
|
37
|
+
.from(false).to(true)
|
38
|
+
end
|
38
39
|
end
|
39
40
|
|
40
41
|
context "when given environment variables" do
|
data/spec/spec_helper.rb
CHANGED
@@ -27,7 +27,8 @@ unless ENV["ENABLE_LOG"]
|
|
27
27
|
end
|
28
28
|
|
29
29
|
RSpec.configure do |config|
|
30
|
-
config.
|
30
|
+
config.raise_errors_for_deprecations!
|
31
|
+
|
31
32
|
config.run_all_when_everything_filtered = true
|
32
33
|
config.filter_run :focus
|
33
34
|
|
@@ -40,4 +41,12 @@ RSpec.configure do |config|
|
|
40
41
|
config.after(:each) do
|
41
42
|
Mamiya::Storages::Mock.clear
|
42
43
|
end
|
44
|
+
|
45
|
+
config.before(:suite) do
|
46
|
+
%w(AWS_ACCESS_KEY AWS_ACCESS_KEY_ID AMAZON_ACCESS_KEY_ID
|
47
|
+
AWS_SECRET_KEY AWS_SECRET_ACCESS_KEY AMAZON_SECRET_ACCESS_KEY
|
48
|
+
AWS_SESSION_TOKEN AMAZON_SESSION_TOKEN).each do |key|
|
49
|
+
ENV.delete key
|
50
|
+
end
|
51
|
+
end
|
43
52
|
end
|
data/spec/steps/build_spec.rb
CHANGED
@@ -88,7 +88,7 @@ describe Mamiya::Steps::Build do
|
|
88
88
|
|
89
89
|
it "calls build hook in :build_from (pwd)" do
|
90
90
|
pwd = nil
|
91
|
-
script.
|
91
|
+
allow(script).to receive_messages(build: proc { pwd = Dir.pwd })
|
92
92
|
|
93
93
|
expect {
|
94
94
|
build_step.run!
|
@@ -114,7 +114,7 @@ describe Mamiya::Steps::Build do
|
|
114
114
|
package_under: 'foo',
|
115
115
|
)
|
116
116
|
) {
|
117
|
-
expect(built).to
|
117
|
+
expect(built).to be true
|
118
118
|
}
|
119
119
|
|
120
120
|
build_step.run!
|
data/spec/steps/prepare_spec.rb
CHANGED
data/spec/steps/switch_spec.rb
CHANGED
@@ -88,7 +88,7 @@ describe Mamiya::Steps::Switch do
|
|
88
88
|
|
89
89
|
it "calls hook in :target (pwd)" do
|
90
90
|
pwd = nil
|
91
|
-
script.
|
91
|
+
allow(script).to receive_messages(release: proc { pwd = Dir.pwd })
|
92
92
|
|
93
93
|
expect {
|
94
94
|
step.run!
|
@@ -132,7 +132,7 @@ describe Mamiya::Steps::Switch do
|
|
132
132
|
allow(script).to receive(:after_switch).and_return(proc { called = true })
|
133
133
|
step.run!
|
134
134
|
|
135
|
-
expect(called).to
|
135
|
+
expect(called).to be false
|
136
136
|
end
|
137
137
|
|
138
138
|
context "with do_release" do
|
@@ -182,7 +182,7 @@ describe Mamiya::Steps::Switch do
|
|
182
182
|
allow(script).to receive(:release).and_return(proc { called = true })
|
183
183
|
step.run!
|
184
184
|
|
185
|
-
expect(called).to
|
185
|
+
expect(called).to be false
|
186
186
|
end
|
187
187
|
end
|
188
188
|
end
|
@@ -40,7 +40,7 @@ describe Mamiya::Storages::Filesystem do
|
|
40
40
|
|
41
41
|
context "when not built" do
|
42
42
|
before do
|
43
|
-
package.
|
43
|
+
allow(package).to receive_messages(:exists? => false)
|
44
44
|
end
|
45
45
|
|
46
46
|
it "raises error" do
|
@@ -128,7 +128,7 @@ describe Mamiya::Storages::Filesystem do
|
|
128
128
|
fetch
|
129
129
|
rescue Mamiya::Storages::Abstract::AlreadyFetched; end
|
130
130
|
|
131
|
-
expect(File.exist?(metafile)).to
|
131
|
+
expect(File.exist?(metafile)).to be true
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'aws-sdk-core'
|
3
2
|
require 'mamiya/package'
|
4
3
|
require 'mamiya/storages/abstract'
|
5
4
|
require 'mamiya/storages/s3_proxy'
|
@@ -112,7 +111,7 @@ describe Mamiya::Storages::S3Proxy do
|
|
112
111
|
fetch
|
113
112
|
rescue Mamiya::Storages::Abstract::AlreadyFetched; end
|
114
113
|
|
115
|
-
expect(File.exist?(metafile)).to
|
114
|
+
expect(File.exist?(metafile)).to be true
|
116
115
|
end
|
117
116
|
end
|
118
117
|
end
|
data/spec/storages/s3_spec.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'aws-sdk-core'
|
3
2
|
require 'mamiya/package'
|
4
3
|
require 'mamiya/storages/abstract'
|
5
4
|
require 'mamiya/storages/s3'
|
@@ -8,14 +7,6 @@ require 'fileutils'
|
|
8
7
|
require 'stringio'
|
9
8
|
|
10
9
|
describe Mamiya::Storages::S3 do
|
11
|
-
before(:suite) do
|
12
|
-
%w(AWS_ACCESS_KEY AWS_ACCESS_KEY_ID AMAZON_ACCESS_KEY_ID
|
13
|
-
AWS_SECRET_KEY AWS_SECRET_ACCESS_KEY AMAZON_SECRET_ACCESS_KEY
|
14
|
-
AWS_SESSION_TOKEN AMAZON_SESSION_TOKEN).each do |key|
|
15
|
-
ENV.delete key
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
10
|
let(:bucket) { 'testbucket' }
|
20
11
|
let(:config) do
|
21
12
|
{
|
@@ -76,7 +67,7 @@ describe Mamiya::Storages::S3 do
|
|
76
67
|
|
77
68
|
context "when not built" do
|
78
69
|
before do
|
79
|
-
package.
|
70
|
+
allow(package).to receive_messages(:exists? => false)
|
80
71
|
end
|
81
72
|
|
82
73
|
it "raises error" do
|
@@ -171,7 +162,7 @@ describe Mamiya::Storages::S3 do
|
|
171
162
|
fetch
|
172
163
|
rescue Mamiya::Storages::Abstract::AlreadyFetched; end
|
173
164
|
|
174
|
-
expect(File.exist?(metafile)).to
|
165
|
+
expect(File.exist?(metafile)).to be true
|
175
166
|
end
|
176
167
|
end
|
177
168
|
|
@@ -6,31 +6,31 @@ describe Mamiya::Util::LabelMatcher do
|
|
6
6
|
let(:str) { '' }
|
7
7
|
subject { described_class.parse_string_expr(str) }
|
8
8
|
|
9
|
-
it {
|
9
|
+
it { is_expected.to eq [] }
|
10
10
|
|
11
11
|
describe "(simple)" do
|
12
12
|
let(:str) { 'foo' }
|
13
|
-
it {
|
13
|
+
it { is_expected.to eq [['foo']] }
|
14
14
|
end
|
15
15
|
|
16
16
|
describe "(and)" do
|
17
17
|
let(:str) { 'foo,bar' }
|
18
|
-
it {
|
18
|
+
it { is_expected.to eq [['foo','bar']] }
|
19
19
|
end
|
20
20
|
|
21
21
|
describe "(or)" do
|
22
22
|
let(:str) { 'foo|bar' }
|
23
|
-
it {
|
23
|
+
it { is_expected.to eq [['foo'],['bar']] }
|
24
24
|
end
|
25
25
|
|
26
26
|
describe "(and/or)" do
|
27
27
|
let(:str) { 'foo,bar|baz' }
|
28
|
-
it {
|
28
|
+
it { is_expected.to eq [['foo','bar'],['baz']] }
|
29
29
|
end
|
30
30
|
|
31
31
|
describe "(and/or 2)" do
|
32
32
|
let(:str) { '1,2|3,4' }
|
33
|
-
it {
|
33
|
+
it { is_expected.to eq [['1','2'],['3','4']] }
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -54,63 +54,63 @@ describe Mamiya::Util::LabelMatcher do
|
|
54
54
|
context "when expression is Array<Symbol>" do
|
55
55
|
context "and match" do
|
56
56
|
let(:expression) { [[:a, :d]] }
|
57
|
-
it {
|
57
|
+
it { is_expected.to eq true }
|
58
58
|
end
|
59
59
|
|
60
60
|
context "and match (2)" do
|
61
61
|
let(:expression) { [[:a]] }
|
62
|
-
it {
|
62
|
+
it { is_expected.to eq true }
|
63
63
|
end
|
64
64
|
|
65
65
|
context "and not match" do
|
66
66
|
let(:expression) { [[:a, :c]] }
|
67
|
-
it {
|
67
|
+
it { is_expected.to eq false }
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
71
|
context "when expression is Symbol" do
|
72
72
|
context "and match" do
|
73
73
|
let(:expression) { [:a] }
|
74
|
-
it {
|
74
|
+
it { is_expected.to eq true }
|
75
75
|
end
|
76
76
|
|
77
77
|
context "and not match" do
|
78
78
|
let(:expression) { [:c] }
|
79
|
-
it {
|
79
|
+
it { is_expected.to eq false }
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
83
|
context "when all expressions are Symbol" do
|
84
84
|
context "and match" do
|
85
85
|
let(:expression) { [:a, :b] }
|
86
|
-
it {
|
86
|
+
it { is_expected.to eq true }
|
87
87
|
end
|
88
88
|
|
89
89
|
context "and not match" do
|
90
90
|
let(:expression) { [:a, :c] }
|
91
|
-
it {
|
91
|
+
it { is_expected.to eq false }
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
95
|
context "when expression is Array<Array> (recursive call)" do
|
96
96
|
describe "(case A)" do
|
97
97
|
let(:expression) { [ [[:a, :c], [:b, :d]] ] }
|
98
|
-
it {
|
98
|
+
it { is_expected.to eq true }
|
99
99
|
end
|
100
100
|
|
101
101
|
describe "(case B)" do
|
102
102
|
let(:expression) { [ [[:a]] ] }
|
103
|
-
it {
|
103
|
+
it { is_expected.to eq true }
|
104
104
|
end
|
105
105
|
|
106
106
|
describe "(case C)" do
|
107
107
|
let(:expression) { [ [[:c]] ] }
|
108
|
-
it {
|
108
|
+
it { is_expected.to eq false }
|
109
109
|
end
|
110
110
|
|
111
111
|
describe "(case D)" do
|
112
112
|
let(:expression) { [ [[:a, :c], :b] ] }
|
113
|
-
it {
|
113
|
+
it { is_expected.to eq true }
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mamiya
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shota Fukumori (sora_h)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -25,19 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.18.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: aws-sdk-
|
28
|
+
name: aws-sdk-s3
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: term-ansicolor
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,16 +98,16 @@ dependencies:
|
|
98
98
|
name: rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: '3.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: '3.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rack-test
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -300,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
300
300
|
version: '0'
|
301
301
|
requirements: []
|
302
302
|
rubyforge_project:
|
303
|
-
rubygems_version: 2.
|
303
|
+
rubygems_version: 2.6.13
|
304
304
|
signing_key:
|
305
305
|
specification_version: 4
|
306
306
|
summary: Fast deploy tool using tarballs and serf
|