wss_agent 0.0.15 → 0.0.16

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: 9ad1e711f699f18be6a05b2a369ee188ea659c28
4
- data.tar.gz: 735adf1d078320d844bd1e07cdb8652dd085ac2d
3
+ metadata.gz: 4aa441c8a0cc500e8e0ead1f0c09dbc01624581c
4
+ data.tar.gz: c2fe89302d7c099c0961ebd36969fe4da4cd8e9a
5
5
  SHA512:
6
- metadata.gz: cea5bba0c253e28e9d5f18ab3a833cfe4c353df179b843675a1308a8cb58e1b3deccaf8af95855a443ea1f2661e1ed04b2b3f6f94c62dc6f69d95b3d5d59033b
7
- data.tar.gz: 36b32524a8e165d596f28ad8243b4a0e0abcf92a5119136084bbde350aef87ba8358ec1a160233a60502e7e3f2ffabbcf3d6e9ed831cc390ae633d33e6571622
6
+ metadata.gz: bf27a14d2bd2c649e3986277fdf9d2310ae82a059c3f931da196cebb9a30852606b8598800c47340ddf26c152f4a58af7e2c6763a2dd3195cbc61ce7561a0d6d
7
+ data.tar.gz: 47c3fbe7778fd1335f705a9c490d33610c022ec43d33023ab49192920ad747fa99c5780bfac82232022de554f1ac07624ceb186f809ef64a7d5bcaa193101e8c
data/lib/wss_agent/cli.rb CHANGED
@@ -17,10 +17,10 @@ module WssAgent
17
17
  results = Specifications.list(options)
18
18
  ap results
19
19
  rescue Bundler::GemfileNotFound => ex
20
- ap ex.message
20
+ ap ex.message, color: { string: :red }
21
21
  rescue Bundler::GemNotFound => ex
22
- ap ex.message
23
- ap "Could you execute 'bundle install' before"
22
+ ap ex.message, color: { string: :red }
23
+ ap "Could you execute 'bundle install' before", color: { string: :red }
24
24
  end
25
25
 
26
26
  desc 'update', 'update open source inventory'
@@ -31,7 +31,7 @@ module WssAgent
31
31
  WssAgent.enable_debug! if options['verbose']
32
32
  Specifications.update(options)
33
33
  rescue => ex
34
- ap ex.message
34
+ ap ex.message, color: { string: :red }
35
35
  end
36
36
 
37
37
  desc 'check_policies', 'checking dependencies that they conforms with company policy.'
@@ -32,11 +32,17 @@ module WssAgent
32
32
  end
33
33
 
34
34
  def current
35
- if defined?(Bundler) && File.exist?(current_path)
36
- default.merge(YAML.load(File.read(current_path)))
37
- else
38
- default
35
+ unless File.exist?(current_path)
36
+ return raise NotFoundConfigFile, "Config file isn't exist. Could you please run 'wss_agent config' before."
37
+ end
38
+
39
+ @current_config = YAML.load(File.read(current_path))
40
+
41
+ unless !!@current_config
42
+ return raise InvalidConfigFile, "Problem reading wss_agent.yml, please check the file is a valid YAML"
39
43
  end
44
+
45
+ default.merge(@current_config)
40
46
  end
41
47
 
42
48
  def uri
@@ -45,6 +51,9 @@ module WssAgent
45
51
  raise ApiUrlNotFound, "Can't find the url, please add your Whitesource url destination in the wss_agent.yml file."
46
52
  end
47
53
  URI(@url)
54
+
55
+ rescue URI::Error
56
+ raise ApiUrlInvalid, "Api url is invalid. Could you please check url in wss_agent.yml"
48
57
  end
49
58
 
50
59
  def port
@@ -13,11 +13,10 @@ module WssAgent
13
13
  end
14
14
 
15
15
  def project_version
16
- case
17
- when is_gem?
16
+ if is_gem?
18
17
  gem.version.to_s
19
18
  else
20
- '0.0.0'
19
+ ''
21
20
  end
22
21
  end
23
22
 
@@ -49,7 +49,8 @@ module WssAgent
49
49
  WssAgent.logger.debug result.data
50
50
  puts result.message
51
51
  else
52
- ap "synchronization errors occur: status: #{result.status}, message: #{result.message}"
52
+ WssAgent.logger.debug "synchronization errors occur: status: #{result.status}, message: #{result.message}, data: #{result.data}"
53
+ ap "error: #{result.status}/#{result.data}", color: {string: :red }
53
54
  end
54
55
 
55
56
  result.success?
@@ -65,7 +66,8 @@ module WssAgent
65
66
  WssAgent.logger.debug result.data
66
67
  puts result.message
67
68
  else
68
- ap "check policies errors occur: #{result.status}, message: #{result.message}, data: #{result.data}"
69
+ WssAgent.logger.debug "check policies errors occur: #{result.status}, message: #{result.message}, data: #{result.data}"
70
+ ap "error: #{result.status}/#{result.data}", color: {string: :red }
69
71
  end
70
72
  end
71
73
 
@@ -1,4 +1,4 @@
1
1
  module WssAgent
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.16"
3
3
  NAME = 'wss_agent'
4
4
  end
data/lib/wss_agent.rb CHANGED
@@ -27,8 +27,11 @@ module WssAgent
27
27
  end
28
28
  end
29
29
 
30
+ class NotFoundConfigFile < WssAgentError; status_code(8) ; end
31
+ class InvalidConfigFile < WssAgentError; status_code(9) ; end
30
32
  class TokenNotFound < WssAgentError; status_code(10) ; end
31
33
  class ApiUrlNotFound < WssAgentError; status_code(11) ; end
34
+ class ApiUrlInvalid < WssAgentError; status_code(12) ; end
32
35
 
33
36
  def self.logger
34
37
  @logger ||= Yell.new STDOUT, level: [:info]
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.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxim Pechnikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-27 00:00:00.000000000 Z
11
+ date: 2015-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler