serverkit 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c00c2ac80338e61da1d1b07403cd86449a4a1ac9
4
- data.tar.gz: c835c29a91aa4dd642b24b7f9057cd808a208327
3
+ metadata.gz: f40c38c419fd96b3e97a018266dccf0e33b61840
4
+ data.tar.gz: 88d12492f9067a4b315659ede04688121467a050
5
5
  SHA512:
6
- metadata.gz: 7d8390a050502e6348bb951c88a26e47254c3d013a67de78bca8169e23b7b2260a77c1e4f000aed05522f8d306c6a4fccb7202c6fd47abf608a965e485277cb2
7
- data.tar.gz: c80d55fc927edf108dfdaae10d2d10bd1b57976ba3aaffe542425da940a155385816ce060e667f81159d5daa07165a79ddff64818b512ae25393eb6404181adf
6
+ metadata.gz: f05703924e9cb0f31d9930b90562805c8eabff0f8bf84485aaf910d602985bac4bf3bd46173f4d2e585fa8998c8e1285659da7dcc17ac078b4a831277bd08ab1
7
+ data.tar.gz: 9094021c5a28689cc70cafcbaac895486a2fd44a4fbc447a6d61d29a55b66dfe5c6ec9506f8cc14161adf16046de0329cacc3bfb4e8ca4a5b85839aaf38497da
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.3.4
2
+ - Add -f option on symlink resource
3
+ - Change attributes naming rule: status -> state
4
+
1
5
  ## 0.3.3
2
6
  - Return exit code 1 if any resource failed
3
7
 
data/README.md CHANGED
@@ -24,6 +24,7 @@ Write a recipe, then run `serverkit` executable to validate, inspect, check, and
24
24
  ### serverkit validate
25
25
  Validates recipe schema, resources, and attributes.
26
26
  For instance, it shows validation error if `source` attributes is missing in `file` resource.
27
+ If any validation error is detected, it returns exit status 1.
27
28
 
28
29
  ```
29
30
  $ serverkit validate recipe.yml
@@ -70,6 +71,7 @@ $ serverkit inspect recipe.yml
70
71
 
71
72
  ### serverkit check
72
73
  Shows the difference between your recipe and the state of the target host.
74
+ If any difference is detected, it returns exit status 1.
73
75
 
74
76
  ```
75
77
  $ serverkit check recipe.yml
@@ -83,6 +85,7 @@ $ serverkit check recipe.yml
83
85
 
84
86
  ### serverkit apply
85
87
  Executes migration process to fill-in the gaps.
88
+ If any failure is detected, it returns exit status 1.
86
89
 
87
90
  ```
88
91
  $ serverkit apply recipe.yml
@@ -135,7 +135,7 @@ module Serverkit
135
135
  # @note For override
136
136
  # @return [String]
137
137
  def default_id
138
- type
138
+ required_values.join(" ")
139
139
  end
140
140
 
141
141
  # @note For override
@@ -158,6 +158,20 @@ module Serverkit
158
158
  def run_command_from_identifier(*args)
159
159
  run_command(backend.command.get(*args))
160
160
  end
161
+
162
+ # @return [Array<Symbol>]
163
+ def required_attribute_names
164
+ _validators.select do |key, validators|
165
+ validators.grep(::RequiredValidator).any?
166
+ end.keys
167
+ end
168
+
169
+ # @return [Array]
170
+ def required_values
171
+ required_attribute_names.map do |required_attribute_name|
172
+ send(required_attribute_name)
173
+ end
174
+ end
161
175
  end
162
176
  end
163
177
  end
@@ -23,10 +23,6 @@ module Serverkit
23
23
 
24
24
  private
25
25
 
26
- def default_id
27
- script
28
- end
29
-
30
26
  # @note Override
31
27
  def recheck
32
28
  case
@@ -31,11 +31,6 @@ module Serverkit
31
31
  run_command_from_identifier(:change_file_owner, destination, owner)
32
32
  end
33
33
 
34
- # @note Override
35
- def default_id
36
- destination
37
- end
38
-
39
34
  def file_sendable?
40
35
  !has_file? || !has_same_content?
41
36
  end
@@ -3,11 +3,11 @@ require "serverkit/resources/base"
3
3
  module Serverkit
4
4
  module Resources
5
5
  class Git < Base
6
- DEFAULT_STATUS = "cloned"
6
+ DEFAULT_STATE = "cloned"
7
7
 
8
8
  attribute :path, required: true, type: String
9
9
  attribute :repository, required: true, type: String
10
- attribute :status, default: DEFAULT_STATUS, type: String
10
+ attribute :state, default: DEFAULT_STATE, type: String
11
11
 
12
12
  # @note Override
13
13
  def apply
@@ -35,11 +35,6 @@ module Serverkit
35
35
  check_command_from_identifier(:check_file_is_directory, git_path)
36
36
  end
37
37
 
38
- # @note Override
39
- def default_id
40
- repository
41
- end
42
-
43
38
  # @return [String] Path to .git directory in the cloned repository
44
39
  def git_path
45
40
  ::File.join(path, ".git")
@@ -60,7 +55,7 @@ module Serverkit
60
55
  end
61
56
 
62
57
  def updatable?
63
- status == "updated" && !updated?
58
+ state == "updated" && !updated?
64
59
  end
65
60
 
66
61
  def update
@@ -14,13 +14,6 @@ module Serverkit
14
14
  def check
15
15
  check_command("/usr/local/bin/brew cask list -1 | grep -E '^#{name}$'")
16
16
  end
17
-
18
- private
19
-
20
- # @note Override
21
- def default_id
22
- name
23
- end
24
17
  end
25
18
  end
26
19
  end
@@ -16,13 +16,6 @@ module Serverkit
16
16
  def check
17
17
  check_command_from_identifier(:check_package_is_installed, name, version)
18
18
  end
19
-
20
- private
21
-
22
- # @note Override
23
- def default_id
24
- name
25
- end
26
19
  end
27
20
  end
28
21
  end
@@ -14,13 +14,6 @@ module Serverkit
14
14
  def check
15
15
  check_command_from_identifier(:check_service_is_running, name)
16
16
  end
17
-
18
- private
19
-
20
- # @note Override
21
- def default_id
22
- name
23
- end
24
17
  end
25
18
  end
26
19
  end
@@ -6,22 +6,16 @@ module Serverkit
6
6
  attribute :destination, required: true, type: String
7
7
  attribute :source, required: true, type: String
8
8
 
9
+ # @note Specinfra's #link_to command does not support -f option for now
9
10
  # @note Override
10
11
  def apply
11
- run_command_from_identifier(:link_file_to, source, destination)
12
+ run_command("ln -fs #{destination} #{source}")
12
13
  end
13
14
 
14
15
  # @note Override
15
16
  def check
16
17
  check_command_from_identifier(:check_file_is_linked_to, source, destination)
17
18
  end
18
-
19
- private
20
-
21
- # @note Override
22
- def default_id
23
- destination
24
- end
25
19
  end
26
20
  end
27
21
  end
@@ -1,3 +1,3 @@
1
1
  module Serverkit
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-13 00:00:00.000000000 Z
11
+ date: 2015-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -255,4 +255,3 @@ signing_key:
255
255
  specification_version: 4
256
256
  summary: Configuration management toolkit for IT automation.
257
257
  test_files: []
258
- has_rdoc: