serverkit 0.6.9 → 0.8.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
- SHA1:
3
- metadata.gz: b16828f0b794222ed550bb3b10f7fd979aa7188c
4
- data.tar.gz: e1158d5a49d5ceabe44584cdde1888e471bcc1f0
2
+ SHA256:
3
+ metadata.gz: 0ce764896945d0b12f9f53a0fd4c63372468bf07525fe8759fb98af0e7f8e4cf
4
+ data.tar.gz: 7238d155e7572c6cc15ce468a04297edfe908abd2c1d9bc008ce0f1f52351238
5
5
  SHA512:
6
- metadata.gz: e7657a6587fbaf0fb9fb6a178e4918b73beec12447bfea3fc5b801b8c3fd225b304759396afa524753a6a7e7e651ed6d0ac5048ff005e8fa888fb0abfc1b4716
7
- data.tar.gz: b5e63eaff08bf79fa6327c7804c9c4f532f6b5539120a01a3c5c849777bf6e720738d40430e4d46b5ce4f988b66feeb82da26a0db3a8f8f9045a2683deb7104d
6
+ metadata.gz: 30bc8a1686266af21c76d45509b3977dcba32bb80e9eb120faf61eb2f1145e8e48c52589e4e74870387cc33f84a50ade184afb76ea104be801f76f3a61aaba75
7
+ data.tar.gz: f84ae0f215bc5ee7091745792a60cd61a0ec3e93acfbc3952db7601132537502a99aff17e25df98add6eed210bcc478bccd7408876dd4a2fab98da62c3fcbff2
data/.rubocop.yml CHANGED
@@ -1,3 +1,6 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.3
3
+
1
4
  Lint/AssignmentInCondition:
2
5
  Enabled: false
3
6
 
@@ -19,6 +22,9 @@ Lint/UnusedMethodArgument:
19
22
  Metrics/AbcSize:
20
23
  Enabled: false
21
24
 
25
+ Metrics/BlockLength:
26
+ Enabled: false
27
+
22
28
  Metrics/ClassLength:
23
29
  Enabled: false
24
30
 
@@ -34,7 +40,13 @@ Metrics/MethodLength:
34
40
  Metrics/PerceivedComplexity:
35
41
  Enabled: false
36
42
 
37
- Style/AccessorMethodName:
43
+ Naming/AccessorMethodName:
44
+ Enabled: false
45
+
46
+ Naming/PredicateName:
47
+ Enabled: false
48
+
49
+ Naming/UncommunicativeMethodParamName:
38
50
  Enabled: false
39
51
 
40
52
  Style/AndOr:
@@ -46,6 +58,12 @@ Style/Documentation:
46
58
  Style/DoubleNegation:
47
59
  Enabled: false
48
60
 
61
+ Style/EmptyMethod:
62
+ Enabled: false
63
+
64
+ Style/FrozenStringLiteralComment:
65
+ Enabled: false
66
+
49
67
  Style/FormatString:
50
68
  Enabled: false
51
69
 
@@ -64,11 +82,8 @@ Style/MultilineBlockChain:
64
82
  Style/PercentLiteralDelimiters:
65
83
  Enabled: false
66
84
 
67
- Style/PredicateName:
68
- Enabled: false
69
-
70
85
  Style/RegexpLiteral:
71
- MaxSlashes: 0
86
+ AllowInnerSlashes: false
72
87
 
73
88
  Style/SignalException:
74
89
  Enabled: false
@@ -76,7 +91,16 @@ Style/SignalException:
76
91
  Style/StringLiterals:
77
92
  EnforcedStyle: double_quotes
78
93
 
79
- Style/TrailingComma:
94
+ Style/SymbolArray:
95
+ Enabled: false
96
+
97
+ Style/TrailingCommaInArrayLiteral:
98
+ Enabled: false
99
+
100
+ Style/TrailingCommaInHashLiteral:
101
+ Enabled: false
102
+
103
+ Style/TrailingCommaInArguments:
80
104
  Enabled: false
81
105
 
82
106
  Style/TrivialAccessors:
data/.travis.yml CHANGED
@@ -1,3 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.0
3
+ - 2.3.0
4
+ - 2.7.7
5
+ - 3.0.5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.8.0
2
+ - Add Ruby 3.0 support.
3
+
4
+ ## 0.7.0
5
+ - Drop Ruby 2.2 support.
6
+
1
7
  ## 0.6.9
2
8
  - Support --ssh-identity and --ssh-user options
3
9
 
data/README.md CHANGED
@@ -47,6 +47,7 @@ $ serverkit apply recipe.yml
47
47
  - [serverkit-karabiner](https://github.com/serverkit/serverkit-karabiner)
48
48
  - [serverkit-rbenv](https://github.com/serverkit/serverkit-rbenv)
49
49
  - [serverkit-login_items](https://github.com/take/serverkit-login_items)
50
+ - [serverkit-vscode](https://github.com/toshimaru/serverkit-vscode)
50
51
  - [Vagrant integration](/doc/vagrant_integration.md)
51
52
 
52
53
  ## Similar tools
data/bin/serverkit CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__))
3
+ $LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
4
4
  require "serverkit"
5
5
 
6
6
  Serverkit::Command.new(ARGV).call
@@ -1,5 +1,4 @@
1
1
  require "serverkit/actions/base"
2
- require "thread"
3
2
 
4
3
  module Serverkit
5
4
  module Actions
@@ -1,5 +1,4 @@
1
1
  require "serverkit/actions/base"
2
- require "thread"
3
2
 
4
3
  module Serverkit
5
4
  module Actions
@@ -4,7 +4,7 @@ require "specinfra"
4
4
  module Serverkit
5
5
  module Backends
6
6
  class LocalBackend < BaseBackend
7
- HOST = "localhost"
7
+ HOST = "localhost".freeze
8
8
 
9
9
  # @note Override
10
10
  def host
@@ -6,7 +6,7 @@ require "specinfra"
6
6
  module Serverkit
7
7
  module Backends
8
8
  class SshBackend < BaseBackend
9
- DEFAULT_SSH_OPTIONS = {}
9
+ DEFAULT_SSH_OPTIONS = {}.freeze
10
10
 
11
11
  attr_reader :host
12
12
 
@@ -28,7 +28,7 @@ module Serverkit
28
28
  "FATAL" => Logger::FATAL,
29
29
  "INFO" => Logger::INFO,
30
30
  "WARN" => Logger::WARN,
31
- }
31
+ }.freeze
32
32
 
33
33
  # @param [Array<String>] argv
34
34
  def initialize(argv)
@@ -51,15 +51,15 @@ module Serverkit
51
51
  else
52
52
  raise Errors::UnknownActionNameError, action_name
53
53
  end
54
- rescue Errors::Base, Psych::SyntaxError, Slop::MissingArgumentError, Slop::MissingOptionError => exception
55
- abort "Error: #{exception}"
54
+ rescue Errors::Base, Psych::SyntaxError, Slop::MissingArgumentError, Slop::MissingOptionError => e
55
+ abort "Error: #{e}"
56
56
  end
57
57
 
58
58
  private
59
59
 
60
60
  # @note #inspect is reserved ;(
61
61
  def _inspect
62
- Actions::Inspect.new(action_options).call
62
+ Actions::Inspect.new(**action_options).call
63
63
  end
64
64
 
65
65
  # @return [String, nil]
@@ -81,11 +81,11 @@ module Serverkit
81
81
  end
82
82
 
83
83
  def apply
84
- Actions::Apply.new(action_options).call
84
+ Actions::Apply.new(**action_options).call
85
85
  end
86
86
 
87
87
  def check
88
- Actions::Check.new(action_options).call
88
+ Actions::Check.new(**action_options).call
89
89
  end
90
90
 
91
91
  # @note This options are commonly used from all actions for now, however,
@@ -123,7 +123,7 @@ module Serverkit
123
123
  end
124
124
 
125
125
  def validate
126
- Actions::Validate.new(action_options).call
126
+ Actions::Validate.new(**action_options).call
127
127
  end
128
128
 
129
129
  def variables_path
@@ -8,7 +8,7 @@ require "yaml"
8
8
  module Serverkit
9
9
  module Loaders
10
10
  class BaseLoader
11
- YAML_EXTNAMES = [".yaml", ".yml"]
11
+ YAML_EXTNAMES = [".yaml", ".yml"].freeze
12
12
 
13
13
  # @param [String] path
14
14
  def initialize(path)
@@ -16,12 +16,11 @@ module Serverkit
16
16
  end
17
17
 
18
18
  def load
19
- case
20
- when !pathname.exist?
19
+ if !pathname.exist?
21
20
  raise Errors::NonExistentPathError, pathname
22
- when has_directory_path?
21
+ elsif has_directory_path?
23
22
  load_from_directory
24
- when has_erb_path?
23
+ elsif has_erb_path?
25
24
  load_from_erb
26
25
  else
27
26
  load_from_data
@@ -68,7 +67,6 @@ module Serverkit
68
67
  @expanded_erb_tempfile ||= Tempfile.new(["", expanded_erb_path_suffix]).tap do |tempfile|
69
68
  tempfile << expand_erb
70
69
  tempfile.close
71
- tempfile
72
70
  end
73
71
  end
74
72
 
@@ -90,10 +88,9 @@ module Serverkit
90
88
 
91
89
  # @return [Hash]
92
90
  def load_data
93
- case
94
- when has_executable_path?
91
+ if has_executable_path?
95
92
  load_data_from_executable
96
- when has_yaml_path?
93
+ elsif has_yaml_path?
97
94
  load_data_from_yaml
98
95
  else
99
96
  load_data_from_json
@@ -5,7 +5,7 @@ require "serverkit/recipe"
5
5
  module Serverkit
6
6
  module Loaders
7
7
  class RecipeLoader < BaseLoader
8
- DEFAULT_VARIABLES_DATA = {}
8
+ DEFAULT_VARIABLES_DATA = {}.freeze
9
9
 
10
10
  # @param [String] path
11
11
  # @param [String, nil] variables_path
@@ -17,10 +17,9 @@ module Serverkit
17
17
  # @return [Array<Serverkit::Errors::Base>]
18
18
  def errors
19
19
  @errors ||= begin
20
- case
21
- when !has_valid_typed_recipe_data?
20
+ if !has_valid_typed_recipe_data?
22
21
  errors_for_invalid_typed_recipe_data
23
- when !has_valid_typed_resources_property?
22
+ elsif !has_valid_typed_resources_property?
24
23
  errors_for_invalid_typed_resources_property
25
24
  else
26
25
  errors_in_resources
@@ -46,10 +46,9 @@ module Serverkit
46
46
 
47
47
  # @return [Class]
48
48
  def resource_class
49
- case
50
- when type.nil?
49
+ if type.nil?
51
50
  Resources::Missing
52
- when has_known_type?
51
+ elsif has_known_type?
53
52
  Resources.const_get(resource_class_name, false)
54
53
  else
55
54
  Resources::Unknown
@@ -226,10 +226,9 @@ module Serverkit
226
226
  # @param [String] command one-line shell script to be executed on remote machine
227
227
  # @return [Specinfra::CommandResult]
228
228
  def run_command(command)
229
- case
230
- when cwd
229
+ if cwd
231
230
  command = "cd #{Shellwords.escape(cwd)} && #{command}"
232
- when user
231
+ elsif user
233
232
  command = "cd && #{command}"
234
233
  end
235
234
  unless user.nil?
@@ -3,7 +3,7 @@ require "serverkit/resources/base"
3
3
  module Serverkit
4
4
  module Resources
5
5
  class Git < Base
6
- DEFAULT_STATE = "cloned"
6
+ DEFAULT_STATE = "cloned".freeze
7
7
 
8
8
  attribute :path, required: true, type: String
9
9
  attribute :repository, required: true, type: String
@@ -8,7 +8,7 @@ module Serverkit
8
8
  # path: /etc/sudoers
9
9
  # line: "#includedir /etc/sudoers.d"
10
10
  class Line < Base
11
- DEFAULT_STATE = "present"
11
+ DEFAULT_STATE = "present".freeze
12
12
 
13
13
  attribute :path, required: true, type: String
14
14
  attribute :insert_after, type: String
@@ -42,12 +42,11 @@ module Serverkit
42
42
 
43
43
  # @return [String]
44
44
  def applied_remote_file_content
45
- case
46
- when absent?
45
+ if absent?
47
46
  content.delete(line)
48
- when insert_after
47
+ elsif insert_after
49
48
  content.insert_after(Regexp.new(insert_after), line)
50
- when insert_before
49
+ elsif insert_before
51
50
  content.insert_before(Regexp.new(insert_before), line)
52
51
  else
53
52
  content.append(line)
@@ -69,10 +68,9 @@ module Serverkit
69
68
  end
70
69
 
71
70
  def has_correct_line?
72
- case
73
- when present? && !has_matched_line?
71
+ if present? && !has_matched_line?
74
72
  false
75
- when !present? && has_matched_line?
73
+ elsif !present? && has_matched_line?
76
74
  false
77
75
  else
78
76
  true
@@ -5,7 +5,7 @@ require "serverkit/resources/remote_file"
5
5
  module Serverkit
6
6
  module Resources
7
7
  class Template < RemoteFile
8
- DEFAULT_VARIABLES_DATA = {}
8
+ DEFAULT_VARIABLES_DATA = {}.freeze
9
9
 
10
10
  private
11
11
 
@@ -23,7 +23,7 @@ module Serverkit
23
23
 
24
24
  # @return [String] ERB content
25
25
  def template_content
26
- @template ||= ::File.read(source)
26
+ @template_content ||= ::File.read(source)
27
27
  end
28
28
 
29
29
  # @note Override
@@ -27,18 +27,17 @@ module Serverkit
27
27
 
28
28
  # @note Override
29
29
  def check
30
- case
31
- when !has_correct_user?
30
+ if !has_correct_user?
32
31
  false
33
- when !has_correct_gid?
32
+ elsif !has_correct_gid?
34
33
  false
35
- when !has_correct_home_directory?
34
+ elsif !has_correct_home_directory?
36
35
  false
37
- when !has_correct_password?
36
+ elsif !has_correct_password?
38
37
  false
39
- when !has_correct_login_shell?
38
+ elsif !has_correct_login_shell?
40
39
  false
41
- when !has_correct_uid?
40
+ elsif !has_correct_uid?
42
41
  false
43
42
  else
44
43
  true
@@ -22,7 +22,7 @@ module Serverkit
22
22
  end
23
23
 
24
24
  class BindableMash < Hashie::Mash
25
- DEFAULT_PROC = -> (hash, key) do
25
+ DEFAULT_PROC = ->(hash, key) do
26
26
  raise KeyError, "key not found: #{key.inspect} (perhaps variables are wrong?)"
27
27
  end
28
28
 
@@ -1,3 +1,3 @@
1
1
  module Serverkit
2
- VERSION = "0.6.9"
2
+ VERSION = "0.8.0".freeze
3
3
  end
data/serverkit.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path("lib", __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require "serverkit/version"
4
4
 
@@ -14,10 +14,10 @@ Gem::Specification.new do |spec|
14
14
  spec.bindir = "bin"
15
15
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
16
  spec.require_paths = ["lib"]
17
- spec.required_ruby_version = ">= 2.0.0"
17
+ spec.required_ruby_version = ">= 2.3.0"
18
18
 
19
19
  spec.add_runtime_dependency "activemodel"
20
- spec.add_runtime_dependency "activesupport", "< 5.0.0"
20
+ spec.add_runtime_dependency "activesupport", ">= 5.0.0"
21
21
  spec.add_runtime_dependency "bundler"
22
22
  spec.add_runtime_dependency "hashie"
23
23
  spec.add_runtime_dependency "highline"
@@ -25,8 +25,8 @@ Gem::Specification.new do |spec|
25
25
  spec.add_runtime_dependency "slop", "~> 3.4"
26
26
  spec.add_runtime_dependency "specinfra", ">= 2.31.0"
27
27
  spec.add_runtime_dependency "unix-crypt"
28
- spec.add_development_dependency "pry", "0.10.1"
29
- spec.add_development_dependency "rake", "~> 10.0"
30
- spec.add_development_dependency "rspec", "3.2.0"
31
- spec.add_development_dependency "rubocop", "0.29.1"
28
+ spec.add_development_dependency "pry"
29
+ spec.add_development_dependency "rake"
30
+ spec.add_development_dependency "rspec"
31
+ spec.add_development_dependency "rubocop", "~> 0.75.0"
32
32
  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.6.9
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-05 00:00:00.000000000 Z
11
+ date: 2022-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -28,14 +28,14 @@ dependencies:
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "<"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 5.0.0
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
40
  version: 5.0.0
41
41
  - !ruby/object:Gem::Dependency
@@ -140,59 +140,59 @@ dependencies:
140
140
  name: pry
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
- version: 0.10.1
145
+ version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
- version: 0.10.1
152
+ version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rake
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - "~>"
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: '10.0'
159
+ version: '0'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - "~>"
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: '10.0'
166
+ version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rspec
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - '='
171
+ - - ">="
172
172
  - !ruby/object:Gem::Version
173
- version: 3.2.0
173
+ version: '0'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - '='
178
+ - - ">="
179
179
  - !ruby/object:Gem::Version
180
- version: 3.2.0
180
+ version: '0'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: rubocop
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - '='
185
+ - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: 0.29.1
187
+ version: 0.75.0
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - '='
192
+ - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: 0.29.1
195
- description:
194
+ version: 0.75.0
195
+ description:
196
196
  email:
197
197
  - r7kamura@gmail.com
198
198
  executables:
@@ -296,7 +296,7 @@ homepage: https://github.com/serverkit/serverkit
296
296
  licenses:
297
297
  - MIT
298
298
  metadata: {}
299
- post_install_message:
299
+ post_install_message:
300
300
  rdoc_options: []
301
301
  require_paths:
302
302
  - lib
@@ -304,16 +304,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
304
304
  requirements:
305
305
  - - ">="
306
306
  - !ruby/object:Gem::Version
307
- version: 2.0.0
307
+ version: 2.3.0
308
308
  required_rubygems_version: !ruby/object:Gem::Requirement
309
309
  requirements:
310
310
  - - ">="
311
311
  - !ruby/object:Gem::Version
312
312
  version: '0'
313
313
  requirements: []
314
- rubyforge_project:
315
- rubygems_version: 2.5.2
316
- signing_key:
314
+ rubygems_version: 3.3.7
315
+ signing_key:
317
316
  specification_version: 4
318
317
  summary: Assemble servers from your recipe.
319
318
  test_files: []