sshkit-custom-dsl 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/.travis.yml +4 -2
- data/.versions.conf +2 -2
- data/Gemfile +1 -3
- data/README.md +3 -1
- data/Rakefile +1 -1
- data/lib/sshkit/custom/config/store.rb +3 -2
- data/lib/sshkit/custom/dsl/version.rb +1 -1
- data/lib/sshkit/custom/runner/abstract.rb +6 -4
- data/lib/sshkit/custom/runner/group.rb +0 -2
- data/lib/sshkit/custom/runner/parallel.rb +1 -1
- data/spec/unit/sshkit/custom/config/store_spec.rb +10 -2
- data/spec/unit/sshkit/custom/dsl/config_statements_spec.rb +3 -4
- data/spec/unit/sshkit/custom/dsl/exec_statements_spec.rb +0 -2
- data/spec/unit/sshkit/custom/dsl/helper_spec.rb +0 -2
- data/spec/unit/sshkit/custom/runner/abstract_spec.rb +2 -10
- data/spec/unit/sshkit/custom/runner/group_spec.rb +1 -2
- data/spec/unit/sshkit/custom/runner/parallel_spec.rb +1 -1
- data/sshkit-custom-dsl.gemspec +3 -4
- metadata +29 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fd0fd9df160256d9c8ebc4c5f0e0bbf991ae454
|
4
|
+
data.tar.gz: d4852ffc4659a50ef06321fe8e41b24704475421
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8939d7c079a9be99262d6132e98e14bc28cea0c5afc311af9bfecdb18ec96b834d9c66a15d6da3706bda552ebf032337b91840fcbfce6d95265efcba3fd4063
|
7
|
+
data.tar.gz: 3ff71a12cc83574c8be4d89c5975ac7d488f1123240db2e2d320ccec44da4f729a4bee348e434e7c4a6e38b9bda76c098c9175befa8e39c0ed53b4bfbfc593e1
|
data/.rubocop.yml
CHANGED
@@ -4,6 +4,9 @@ inherit_from: .rubocop_todo.yml
|
|
4
4
|
LineLength:
|
5
5
|
Max: 160
|
6
6
|
|
7
|
+
Metrics/ModuleLength:
|
8
|
+
Max: 250
|
9
|
+
|
7
10
|
Documentation:
|
8
11
|
Enabled: false
|
9
12
|
|
@@ -14,7 +17,7 @@ MethodLength:
|
|
14
17
|
Max: 50
|
15
18
|
|
16
19
|
# @see http://www.rubytapas.com/episodes/24-Incidental-Change
|
17
|
-
|
20
|
+
TrailingCommaInLiteral:
|
18
21
|
Enabled: false
|
19
22
|
|
20
23
|
RegexpLiteral:
|
data/.travis.yml
CHANGED
data/.versions.conf
CHANGED
data/Gemfile
CHANGED
@@ -3,11 +3,9 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in sshkit-custom-dsl.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem 'simplecov', require:
|
6
|
+
gem 'simplecov', require: false, group: :test
|
7
7
|
gem 'coveralls', require: false
|
8
8
|
gem 'rubocop', require: false
|
9
9
|
gem 'yard', require: false
|
10
10
|
gem 'redcarpet', require: false
|
11
11
|
gem 'github-markup', require: false
|
12
|
-
|
13
|
-
|
data/README.md
CHANGED
@@ -79,7 +79,9 @@ on %w{localhost 127.0.0.1}, in: :sequence, wait: 0 do
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
|
82
|
+
# thread_count is a new config option for parallel runner
|
83
|
+
# is used for Rake::ThreadPool
|
84
|
+
on %w{localhost 127.0.0.1}, thread_count: 10 do
|
83
85
|
within "/tmp" do
|
84
86
|
with rails_env: :production do
|
85
87
|
execute "env", "|sort"
|
data/Rakefile
CHANGED
@@ -67,7 +67,7 @@ module SSHKit
|
|
67
67
|
# Set the environment for the current backend.
|
68
68
|
# @param env [Hash<String, String>] The new ENV-Vars to be used.
|
69
69
|
def add_env(env)
|
70
|
-
old_env =
|
70
|
+
old_env = active_backend.env.clone
|
71
71
|
_envs << old_env
|
72
72
|
env = old_env.merge(env)
|
73
73
|
active_backend.env = env
|
@@ -88,7 +88,7 @@ module SSHKit
|
|
88
88
|
# @param user [String] The new username
|
89
89
|
# @param group [String, nil] The new group
|
90
90
|
def add_user_group(user, group)
|
91
|
-
_user_groups << { user: active_backend.user, group:
|
91
|
+
_user_groups << { user: active_backend.user, group: active_backend.group }
|
92
92
|
active_backend.user = user
|
93
93
|
active_backend.group = group
|
94
94
|
end
|
@@ -105,6 +105,7 @@ module SSHKit
|
|
105
105
|
SSHKit::Custom::Runner::Abstract.active_backend
|
106
106
|
end
|
107
107
|
|
108
|
+
# Sets the default runner opts for instance change the default runner
|
108
109
|
def default_runner_opts(opts)
|
109
110
|
global_config_scope[:_default_runner_opts] = opts
|
110
111
|
end
|
@@ -8,6 +8,7 @@ module SSHKit
|
|
8
8
|
# Base class for all runners
|
9
9
|
# @abstract Subclass and override {#apply_block_to_bcks} to implement
|
10
10
|
# @public
|
11
|
+
# rubocop:disable Performance/RedundantBlockCall
|
11
12
|
class Abstract
|
12
13
|
attr_accessor :backends
|
13
14
|
attr_reader :options
|
@@ -25,7 +26,7 @@ module SSHKit
|
|
25
26
|
when :groups
|
26
27
|
Group
|
27
28
|
else
|
28
|
-
|
29
|
+
raise "Don't know how to handle run style #{opts_with_defaults[:in].inspect}"
|
29
30
|
end.new(opts_with_defaults)
|
30
31
|
end
|
31
32
|
|
@@ -41,7 +42,7 @@ module SSHKit
|
|
41
42
|
|
42
43
|
# @api private
|
43
44
|
def self.active_backend
|
44
|
-
scope[:active_backend] ||
|
45
|
+
scope[:active_backend] || raise(ArgumentError, 'Backend not set')
|
45
46
|
end
|
46
47
|
|
47
48
|
# @api private
|
@@ -77,14 +78,14 @@ module SSHKit
|
|
77
78
|
|
78
79
|
# @abstract
|
79
80
|
def apply_block_to_bcks(&_block)
|
80
|
-
|
81
|
+
raise SSHKit::Backend::MethodUnavailableError
|
81
82
|
end
|
82
83
|
|
83
84
|
# @api private
|
84
85
|
def apply_to_bck(backend, &block)
|
85
86
|
self.active_backend = backend
|
86
87
|
block.call(backend.host)
|
87
|
-
|
88
|
+
rescue => e
|
88
89
|
e2 = ExecuteError.new e
|
89
90
|
raise e2, "Exception while executing on host #{backend.host}: #{e.message}"
|
90
91
|
ensure
|
@@ -102,6 +103,7 @@ module SSHKit
|
|
102
103
|
@wait_interval || options[:wait] || 2
|
103
104
|
end
|
104
105
|
end
|
106
|
+
# rubocop:enable Performance/RedundantBlockCall
|
105
107
|
end
|
106
108
|
end
|
107
109
|
end
|
@@ -4,7 +4,6 @@ module SSHKit
|
|
4
4
|
module Custom
|
5
5
|
module Config
|
6
6
|
describe Store do
|
7
|
-
|
8
7
|
let(:mock_bck) do
|
9
8
|
SSHKit.config.backend.new(SSHKit::Host.new('localhost'))
|
10
9
|
end
|
@@ -57,7 +56,6 @@ module SSHKit
|
|
57
56
|
end
|
58
57
|
|
59
58
|
describe '.add_env' do
|
60
|
-
|
61
59
|
it 'adds an env to the stack' do
|
62
60
|
expect(mock_bck.env).to eq({})
|
63
61
|
Store.add_env(new_env)
|
@@ -120,6 +118,16 @@ module SSHKit
|
|
120
118
|
expect(Runner::Abstract).to receive(:create_runner).with({ some: :things }.merge(opts))
|
121
119
|
Store.create_runner opts
|
122
120
|
end
|
121
|
+
|
122
|
+
it 'changes the options globally' do
|
123
|
+
Store.default_runner_opts(some: :things)
|
124
|
+
|
125
|
+
Thread.new { Store.default_runner_opts(some: :thing_else) }.join
|
126
|
+
|
127
|
+
opts = { in: :groups }
|
128
|
+
expect(Runner::Abstract).to receive(:create_runner).with({ some: :thing_else }.merge(opts))
|
129
|
+
Store.create_runner opts
|
130
|
+
end
|
123
131
|
end
|
124
132
|
end
|
125
133
|
end
|
@@ -67,7 +67,7 @@ module SSHKit
|
|
67
67
|
|
68
68
|
expect do
|
69
69
|
subject.within(dir) do
|
70
|
-
|
70
|
+
raise
|
71
71
|
end
|
72
72
|
end.to raise_error
|
73
73
|
end
|
@@ -94,7 +94,7 @@ module SSHKit
|
|
94
94
|
|
95
95
|
expect do
|
96
96
|
subject.with(env) do
|
97
|
-
|
97
|
+
raise
|
98
98
|
end
|
99
99
|
end.to raise_error
|
100
100
|
end
|
@@ -117,7 +117,7 @@ module SSHKit
|
|
117
117
|
|
118
118
|
expect do
|
119
119
|
subject.as(user: user, group: group) do
|
120
|
-
|
120
|
+
raise
|
121
121
|
end
|
122
122
|
end.to raise_error
|
123
123
|
end
|
@@ -149,7 +149,6 @@ module SSHKit
|
|
149
149
|
subject.default_runner_opts(opts)
|
150
150
|
end
|
151
151
|
end
|
152
|
-
|
153
152
|
end
|
154
153
|
end
|
155
154
|
end
|
@@ -4,7 +4,6 @@ module SSHKit
|
|
4
4
|
module Custom
|
5
5
|
module Runner
|
6
6
|
describe Abstract do
|
7
|
-
|
8
7
|
subject do
|
9
8
|
Abstract.new(wait: 1)
|
10
9
|
end
|
@@ -64,17 +63,15 @@ module SSHKit
|
|
64
63
|
subject.send_cmd(:execute) do
|
65
64
|
args
|
66
65
|
end
|
67
|
-
|
68
66
|
end
|
69
67
|
|
70
68
|
it 'reraises an exception' do
|
71
69
|
expect do
|
72
70
|
subject.send_cmd(:execute) do
|
73
|
-
|
71
|
+
raise
|
74
72
|
end
|
75
73
|
end.to raise_error
|
76
74
|
end
|
77
|
-
|
78
75
|
end
|
79
76
|
|
80
77
|
describe '.apply_to_bck' do
|
@@ -89,33 +86,28 @@ module SSHKit
|
|
89
86
|
end
|
90
87
|
|
91
88
|
it 'reraises an exception' do
|
92
|
-
block = ->(_host) {
|
89
|
+
block = ->(_host) { raise }
|
93
90
|
|
94
91
|
expect { subject.apply_to_bck(mock_bck, &block) }.to raise_error
|
95
92
|
end
|
96
|
-
|
97
93
|
end
|
98
94
|
|
99
95
|
describe '.do_wait' do
|
100
96
|
it 'sleeps [wait] seconds' do
|
101
|
-
|
102
97
|
expect do
|
103
98
|
subject.send(:do_wait)
|
104
99
|
end.to change { Time.now.utc }.by_at_least(1)
|
105
100
|
end
|
106
|
-
|
107
101
|
end
|
108
102
|
|
109
103
|
describe '.apply_block_to_bcks' do
|
110
104
|
it 'should be implemented by sub classes' do
|
111
105
|
expect do
|
112
106
|
subject.apply_block_to_bcks do
|
113
|
-
|
114
107
|
end
|
115
108
|
end.to raise_error
|
116
109
|
end
|
117
110
|
end
|
118
|
-
|
119
111
|
end
|
120
112
|
end
|
121
113
|
end
|
@@ -9,13 +9,12 @@ module SSHKit
|
|
9
9
|
end
|
10
10
|
|
11
11
|
describe '.apply_block_to_bcks' do
|
12
|
-
|
13
12
|
let(:block) { ->(_) {} }
|
14
13
|
let(:bck1) { SSHKit.config.backend.new(SSHKit::Host.new('localhost')) }
|
15
14
|
let(:bck2) { SSHKit.config.backend.new(SSHKit::Host.new('127.0.0.1')) }
|
16
15
|
|
17
16
|
before :each do
|
18
|
-
allow(subject).to receive(:use_runner).and_return(->(options) {Sequential.new(options) })
|
17
|
+
allow(subject).to receive(:use_runner).and_return(->(options) { Sequential.new(options) })
|
19
18
|
end
|
20
19
|
|
21
20
|
it 'calls apply_to_bck for every backend' do
|
data/sshkit-custom-dsl.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = SSHKit::Custom::DSL::VERSION
|
9
9
|
spec.authors = ['Dieter Späth']
|
10
10
|
spec.email = ['d.spaeth@faber.de']
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
11
|
+
spec.summary = 'Exchanges original sshkit dsl against a custom dsl'
|
12
|
+
spec.description = 'Exchanges original sshkit dsl against a custom dsl. This DSL does not change the scope of the blocks.'
|
13
13
|
spec.homepage = 'https://github.com/faber-lotto/sshkit-custom-dsl'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
@@ -18,12 +18,11 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'sshkit'
|
21
|
+
spec.add_dependency 'sshkit'
|
22
22
|
spec.add_dependency 'scoped_storage'
|
23
23
|
spec.add_dependency 'rake'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler'
|
26
|
-
spec.add_development_dependency 'rspec'
|
27
26
|
|
28
27
|
spec.add_development_dependency 'rspec', '3.0.0'
|
29
28
|
# show nicely how many specs have to be run
|
metadata
CHANGED
@@ -1,83 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sshkit-custom-dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dieter Späth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sshkit
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: scoped_storage
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '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: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '>='
|
59
|
+
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
61
|
version: '0'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- -
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
@@ -98,42 +84,42 @@ dependencies:
|
|
98
84
|
name: fuubar
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
|
-
- -
|
87
|
+
- - ">="
|
102
88
|
- !ruby/object:Gem::Version
|
103
89
|
version: '0'
|
104
90
|
type: :development
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
|
-
- -
|
94
|
+
- - ">="
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '0'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: pry
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - ">="
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: '0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
122
|
-
- -
|
108
|
+
- - ">="
|
123
109
|
- !ruby/object:Gem::Version
|
124
110
|
version: '0'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: pry-remote
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
|
-
- -
|
115
|
+
- - ">="
|
130
116
|
- !ruby/object:Gem::Version
|
131
117
|
version: '0'
|
132
118
|
type: :development
|
133
119
|
prerelease: false
|
134
120
|
version_requirements: !ruby/object:Gem::Requirement
|
135
121
|
requirements:
|
136
|
-
- -
|
122
|
+
- - ">="
|
137
123
|
- !ruby/object:Gem::Version
|
138
124
|
version: '0'
|
139
125
|
description: Exchanges original sshkit dsl against a custom dsl. This DSL does not
|
@@ -144,14 +130,14 @@ executables: []
|
|
144
130
|
extensions: []
|
145
131
|
extra_rdoc_files: []
|
146
132
|
files:
|
147
|
-
- .consolerc
|
148
|
-
- .gitignore
|
149
|
-
- .rspec
|
150
|
-
- .rubocop.yml
|
151
|
-
- .rubocop_todo.yml
|
152
|
-
- .travis.yml
|
153
|
-
- .versions.conf
|
154
|
-
- .yardopts
|
133
|
+
- ".consolerc"
|
134
|
+
- ".gitignore"
|
135
|
+
- ".rspec"
|
136
|
+
- ".rubocop.yml"
|
137
|
+
- ".rubocop_todo.yml"
|
138
|
+
- ".travis.yml"
|
139
|
+
- ".versions.conf"
|
140
|
+
- ".yardopts"
|
155
141
|
- Gemfile
|
156
142
|
- LICENSE.txt
|
157
143
|
- README.md
|
@@ -195,17 +181,17 @@ require_paths:
|
|
195
181
|
- lib
|
196
182
|
required_ruby_version: !ruby/object:Gem::Requirement
|
197
183
|
requirements:
|
198
|
-
- -
|
184
|
+
- - ">="
|
199
185
|
- !ruby/object:Gem::Version
|
200
186
|
version: '0'
|
201
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
188
|
requirements:
|
203
|
-
- -
|
189
|
+
- - ">="
|
204
190
|
- !ruby/object:Gem::Version
|
205
191
|
version: '0'
|
206
192
|
requirements: []
|
207
193
|
rubyforge_project:
|
208
|
-
rubygems_version: 2.
|
194
|
+
rubygems_version: 2.4.3
|
209
195
|
signing_key:
|
210
196
|
specification_version: 4
|
211
197
|
summary: Exchanges original sshkit dsl against a custom dsl
|