serverkit 0.3.2 → 0.3.3

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: bf19625178585db94d3e42ad1a098bd428fd835f
4
- data.tar.gz: 38a0dfb3bc2943af2b361aa8894ad6d880e835cc
3
+ metadata.gz: c00c2ac80338e61da1d1b07403cd86449a4a1ac9
4
+ data.tar.gz: c835c29a91aa4dd642b24b7f9057cd808a208327
5
5
  SHA512:
6
- metadata.gz: 63a60f19f80a9c9fa81d6e6f1bb6bc8f8325652c53cab16ed45439f4bdefa5c2964fccd0f8bad8a2e6aecaed5957633231ab4a91165042d4e86e084214dd7914
7
- data.tar.gz: a5628aa61752352635ef4087d9d9a41ee261a25ba05ebdd4dd9a11332f34327a10ed368ac5eb7b0bedf935bbad51b9973a632811721f82c928ba4ec36cc6eb8f
6
+ metadata.gz: 7d8390a050502e6348bb951c88a26e47254c3d013a67de78bca8169e23b7b2260a77c1e4f000aed05522f8d306c6a4fccb7202c6fd47abf608a965e485277cb2
7
+ data.tar.gz: c80d55fc927edf108dfdaae10d2d10bd1b57976ba3aaffe542425da940a155385816ce060e667f81159d5daa07165a79ddff64818b512ae25393eb6404181adf
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.3.3
2
+ - Return exit code 1 if any resource failed
3
+
1
4
  ## 0.3.2
2
5
  - Fix git resource on git-clone
3
6
 
data/README.md CHANGED
@@ -171,8 +171,6 @@ A resource must have a type attribute. Currently the following types are availab
171
171
  - command
172
172
  - file
173
173
  - git
174
- - homebrew
175
- - homebrew_cask
176
174
  - nothing
177
175
  - package
178
176
  - recipe
@@ -224,6 +222,7 @@ Serverkit finds `Serverkit::Resources::FooBar` resource class from `type: "foo_b
224
222
 
225
223
  - [serverkit-atom](https://github.com/r7kamura/serverkit-atom)
226
224
  - [serverkit-defaults](https://github.com/r7kamura/serverkit-defaults)
225
+ - [serverkit-homebrew](https://github.com/r7kamura/serverkit-homebrew)
227
226
  - [serverkit-karabiner](https://github.com/r7kamura/serverkit-karabiner)
228
227
  - [serverkit-rbenv](https://github.com/r7kamura/serverkit-rbenv)
229
228
 
@@ -232,6 +231,7 @@ Serverkit finds `Serverkit::Resources::FooBar` resource class from `type: "foo_b
232
231
  gem "serverkit"
233
232
  gem "serverkit-atom"
234
233
  gem "serverkit-defaults"
234
+ gem "serverkit-homebrew"
235
235
  gem "serverkit-karabiner"
236
236
  gem "serverkit-rbenv"
237
237
  ```
@@ -5,20 +5,28 @@ module Serverkit
5
5
  module Actions
6
6
  class Apply < Base
7
7
  def run
8
- backends.map do |backend|
8
+ successful = backends.map do |backend|
9
9
  Thread.new do
10
- recipe.resources.map(&:clone).map do |resource|
10
+ resources = recipe.resources.map(&:clone).map do |resource|
11
11
  resource.backend = backend
12
12
  resource.run_apply
13
13
  puts resource.inspect_apply_result
14
14
  resource
15
- end.select(&:notifiable?).flat_map(&:handlers).uniq.map(&:dup).each do |handler|
15
+ end
16
+ handlers = resources.select(&:notifiable?).flat_map(&:handlers).uniq.map(&:clone).map do |handler|
16
17
  handler.backend = backend
17
18
  handler.run_apply
18
19
  puts handler.inspect_apply_result
20
+ handler
19
21
  end
22
+ resources + handlers
20
23
  end
21
- end.each(&:join)
24
+ end.map(&:value).flatten.all?(&:successful?)
25
+ if successful
26
+ exit
27
+ else
28
+ exit(1)
29
+ end
22
30
  end
23
31
  end
24
32
  end
@@ -5,15 +5,21 @@ module Serverkit
5
5
  module Actions
6
6
  class Check < Base
7
7
  def run
8
- backends.map do |backend|
8
+ successful = backends.map do |backend|
9
9
  Thread.new do
10
- recipe.resources.map(&:clone).each do |resource|
10
+ recipe.resources.map(&:clone).map do |resource|
11
11
  resource.backend = backend
12
12
  resource.run_check
13
13
  puts resource.inspect_check_result
14
+ resource
14
15
  end
15
16
  end
16
- end.each(&:join)
17
+ end.map(&:value).flatten.all?(&:successful?)
18
+ if successful
19
+ exit
20
+ else
21
+ exit(1)
22
+ end
17
23
  end
18
24
  end
19
25
  end
@@ -86,14 +86,19 @@ module Serverkit
86
86
  def run_apply
87
87
  unless run_check
88
88
  apply
89
- @recheck_result = recheck
89
+ @recheck_result = !!recheck
90
90
  end
91
91
  end
92
92
 
93
93
  # @note #check wrapper
94
94
  # @return [true, false]
95
95
  def run_check
96
- @check_result = check
96
+ @check_result = !!check
97
+ end
98
+
99
+ # @return [true, false]
100
+ def successful?
101
+ @check_result == true || @recheck_result == true
97
102
  end
98
103
 
99
104
  # @note recipe resource will override to replace itself with multiple resources
@@ -1,3 +1,3 @@
1
1
  module Serverkit
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura