wss_agent 0.0.23 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +2 -4
- data/lib/wss_agent/configure.rb +5 -1
- data/lib/wss_agent/version.rb +1 -1
- data/spec/spec_helper.rb +2 -1
- data/spec/support/exit_code_matches.rb +37 -0
- data/spec/wss_agent/cli_spec.rb +10 -9
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a934aec4d6f03e152b8625b778c911f567a8f7c
|
4
|
+
data.tar.gz: c1d903609a3415acbbaa8ddb202385f8ce426290
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e0b9642dcacfb3b7eb19704f9f5fd6fbadb6d295cabf2b640652f30579148857e032e24a865b561f07e3fddfbaaef93c29bccae53edbcfe0fb7439501467c45
|
7
|
+
data.tar.gz: ab6bfcd1880ac1e76f98e549ce17f24c3b08a37d9ed3f45bc558b372ac9a6e0f8720fe39c134cce543844ba15bdf8d618e80fcc0bde9851fe5fbb12bbe91e08a
|
data/Rakefile
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
require 'rspec/core/rake_task'
|
2
1
|
require "bundler/gem_tasks"
|
2
|
+
require 'rspec/core/rake_task'
|
3
3
|
|
4
4
|
# Default directory to look in is `/specs`
|
5
5
|
# Run with `rake spec`
|
6
|
-
RSpec::Core::RakeTask.new(:spec)
|
7
|
-
task.rspec_opts = ['--color', '--format']
|
8
|
-
end
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
9
7
|
|
10
8
|
task :default => :spec
|
data/lib/wss_agent/configure.rb
CHANGED
@@ -82,15 +82,19 @@ module WssAgent
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def coordinates
|
85
|
+
return {} unless current['project_token'].to_s.strip.empty?
|
86
|
+
|
85
87
|
project_meta = WssAgent::Project.new
|
88
|
+
|
86
89
|
coordinates_config = current['coordinates']
|
87
90
|
coordinates_artifact_id = coordinates_config['artifact_id']
|
88
91
|
coordinates_version = coordinates_config['version']
|
89
92
|
|
90
|
-
if coordinates_artifact_id.
|
93
|
+
if coordinates_artifact_id.to_s.strip.empty?
|
91
94
|
coordinates_artifact_id = project_meta.project_name
|
92
95
|
coordinates_version = project_meta.project_version
|
93
96
|
end
|
97
|
+
|
94
98
|
{
|
95
99
|
'artifactId' => coordinates_artifact_id,
|
96
100
|
'version' => coordinates_version
|
data/lib/wss_agent/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -6,9 +6,10 @@ require 'webmock/rspec'
|
|
6
6
|
require 'timecop'
|
7
7
|
|
8
8
|
require 'vcr'
|
9
|
+
require 'support/exit_code_matches'
|
9
10
|
|
10
11
|
VCR.configure do |config|
|
11
|
-
config.cassette_library_dir =
|
12
|
+
config.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
12
13
|
config.hook_into :webmock
|
13
14
|
config.configure_rspec_metadata!
|
14
15
|
config.allow_http_connections_when_no_cassette = false
|
@@ -0,0 +1,37 @@
|
|
1
|
+
RSpec::Matchers.define :terminate do |code|
|
2
|
+
actual = nil
|
3
|
+
|
4
|
+
def supports_block_expectations?
|
5
|
+
true
|
6
|
+
end
|
7
|
+
|
8
|
+
match do |block|
|
9
|
+
begin
|
10
|
+
block.call
|
11
|
+
rescue SystemExit => e
|
12
|
+
actual = e.status
|
13
|
+
end
|
14
|
+
actual and actual == status_code
|
15
|
+
end
|
16
|
+
|
17
|
+
chain :with_code do |status_code|
|
18
|
+
@status_code = status_code
|
19
|
+
end
|
20
|
+
|
21
|
+
failure_message do |block|
|
22
|
+
"expected block to call exit(#{status_code}) but exit" +
|
23
|
+
(actual.nil? ? " not called" : "(#{actual}) was called")
|
24
|
+
end
|
25
|
+
|
26
|
+
failure_message_when_negated do |block|
|
27
|
+
"expected block not to call exit(#{status_code})"
|
28
|
+
end
|
29
|
+
|
30
|
+
description do
|
31
|
+
"expect block to call exit(#{status_code})"
|
32
|
+
end
|
33
|
+
|
34
|
+
def status_code
|
35
|
+
@status_code ||= 0
|
36
|
+
end
|
37
|
+
end
|
data/spec/wss_agent/cli_spec.rb
CHANGED
@@ -28,23 +28,24 @@ describe WssAgent::CLI, vcr: true do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
context 'update' do
|
31
|
-
let(:output) { capture(:stdout) { subject.update } }
|
32
31
|
context 'when not found token' do
|
33
|
-
|
34
|
-
|
32
|
+
let(:output) { capture(:stdout) { subject.update } }
|
33
|
+
it 'should display results' do
|
34
|
+
expect(WssAgent::Specifications).to receive(:update).and_return(double('result', success?: true))
|
35
|
+
expect{ output }.to terminate.with_code(0)
|
35
36
|
end
|
36
37
|
end
|
37
|
-
it 'should display results' do
|
38
|
-
expect(WssAgent::Specifications).to receive(:update).and_return([])
|
39
|
-
expect(output).to eq("")
|
40
|
-
end
|
41
38
|
end
|
42
39
|
|
43
40
|
context 'check_policies' do
|
44
41
|
let(:output) { capture(:stdout) { subject.check_policies } }
|
45
42
|
it 'should display results' do
|
46
|
-
expect(
|
47
|
-
|
43
|
+
expect(
|
44
|
+
WssAgent::Specifications
|
45
|
+
).to receive(:check_policies).and_return(
|
46
|
+
double('result', success?: true, policy_violations?: true)
|
47
|
+
)
|
48
|
+
expect { output }.to terminate.with_code(1)
|
48
49
|
end
|
49
50
|
end
|
50
51
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wss_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maxim Pechnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -305,6 +305,7 @@ files:
|
|
305
305
|
- spec/fixtures/vcr_cassettes/WssAgent_Specifications/_update/when_check_policies_is_true/and_check_policies_returns_without_a_violation/should_update_inventory.yml
|
306
306
|
- spec/fixtures/wss_agent.yml
|
307
307
|
- spec/spec_helper.rb
|
308
|
+
- spec/support/exit_code_matches.rb
|
308
309
|
- spec/wss_agent/cli_spec.rb
|
309
310
|
- spec/wss_agent/client_spec.rb
|
310
311
|
- spec/wss_agent/configure_spec.rb
|
@@ -354,8 +355,8 @@ test_files:
|
|
354
355
|
- spec/fixtures/vcr_cassettes/WssAgent_Specifications/_update/when_check_policies_is_true/and_check_policies_returns_without_a_violation/should_update_inventory.yml
|
355
356
|
- spec/fixtures/wss_agent.yml
|
356
357
|
- spec/spec_helper.rb
|
358
|
+
- spec/support/exit_code_matches.rb
|
357
359
|
- spec/wss_agent/cli_spec.rb
|
358
360
|
- spec/wss_agent/client_spec.rb
|
359
361
|
- spec/wss_agent/configure_spec.rb
|
360
362
|
- spec/wss_agent/specifications_spec.rb
|
361
|
-
has_rdoc:
|