lita-nexus 0.1.6 → 0.1.7

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: dbc794f471930b728dd358f570eed7a89597af0b
4
- data.tar.gz: 1e70eb6098a4976efd221b6979ba4483b55b68b9
3
+ metadata.gz: c4346dc2067ad2f052178e5715c9616e9ac99051
4
+ data.tar.gz: 38a29eaf66f5b3dbab1bf04cba7d33f8bf41a15f
5
5
  SHA512:
6
- metadata.gz: e599ffc8b730fd4f609f682c72ae9282ffaf88bfb52b36ab88180c0c7d878631d9e231e149fc78058bc8da5de392ece0fca8bdc2f5140e9ac0d1679434afb5a6
7
- data.tar.gz: c62d35d0703b6624fa0f0e0b08dd7c7d9906cc747ea6c51de6b3665541208b8da12793daba8526fd6defbba5e5a4b0879d868ea819ca4be636f7283e48472477
6
+ metadata.gz: a76441fbec949793a4dc521b7c2c9af15c79313257f6f5c3be812650a1fd53e78b31689af2d7838fb8a00e516b15d933992d2fe9aa71091cbd7e8f7b6469f7df
7
+ data.tar.gz: aa27d8873f8f7a4bc363e5f2e95d2022a1c0598564bd69f8350fcfdbe97531fd2423da3ae1297de33052c2b9979c49cd67e5b56f78375f93d0b37149a6a24ef5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.1.7
4
+ * externalize messages
5
+ * allow reuse docker container reuse during development testing, through environment variables.
6
+
3
7
  ## 0.1.6
4
8
  * Show artifact versions
5
9
  * Search artifact now by default only show 5 latest version, configuration limit. Show text other than xml result.
@@ -163,7 +163,8 @@ module Lita
163
163
  coordinate = response.matches[0][0]
164
164
  begin
165
165
  delete_artifact(coordinate)
166
- response.reply "Artifact deleted successfully."
166
+ #response.reply "Artifact deleted successfully."
167
+ response.reply t('msg.info_artifact_deleted')
167
168
  rescue Exception => e
168
169
  response.reply e.message
169
170
  end
@@ -174,13 +175,14 @@ module Lita
174
175
  if repo && repo.strip.length >0
175
176
  config.current_repository = repo
176
177
  end
177
- response.reply "Success: current repository is changed to #{repo}."
178
+ #response.reply "Success: current repository is changed to #{repo}."
179
+ response.reply t('msg.info_repos_set_success', repo: repo)
178
180
  end
179
181
 
180
182
  def cmd_show_current_repository(response)
181
183
  current_repo = get_current_repo
182
- response.reply "Current repository is #{current_repo}"
183
-
184
+ #response.reply "Current repository is #{current_repo}"
185
+ response.reply t('msg.info_current_repo_is', repo: current_repo)
184
186
  end
185
187
 
186
188
  def cmd_push_artifact(coordinate, file_path)
@@ -33,7 +33,7 @@ module LitaNexusHelper
33
33
  begin
34
34
  info = remote.get_artifact_info(coordinate)
35
35
  rescue NexusCli::ArtifactNotFoundException => e
36
- info = "Artifact not found"
36
+ info = t('msg.info_artifact_not_found')
37
37
  end
38
38
  #puts "info: #{info}"
39
39
  info
@@ -55,7 +55,8 @@ module LitaNexusHelper
55
55
  if remote.respond_to? 'get_license_info'
56
56
  remote.get_license_info
57
57
  else
58
- 'Only supported on professional version.'
58
+ #'Only supported on professional version.'
59
+ t('msg.info_only_supported_on_pro_version')
59
60
  end
60
61
  end
61
62
 
@@ -65,9 +66,8 @@ module LitaNexusHelper
65
66
  begin
66
67
  info = remote.get_repository_info(coordinate)
67
68
  rescue NexusCli::RepositoryNotFoundException => e
68
- info = "Repository not found"
69
+ info = t('msg.info_repository_not_found')
69
70
  end
70
- #puts "info: #{info}"
71
71
  info
72
72
  end
73
73
 
data/lita-nexus.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-nexus"
3
- spec.version = "0.1.6"
3
+ spec.version = "0.1.7"
4
4
  spec.authors = ["Wang, Dawei"]
5
5
  spec.email = ["dwang@entertainment.com"]
6
6
  spec.description = "Lita Nexus Operations"
data/locales/en.yml CHANGED
@@ -19,3 +19,10 @@ en:
19
19
  cmd_set_repo_value: 'Set current repository to specified REPO'
20
20
  cmd_get_artifact_versions_key: 'nexus get artifact versions G:A'
21
21
  cmd_get_artifact_versions_value: 'Get all versions of artifact with groupId and artifacId'
22
+ msg:
23
+ info_repository_not_found: 'Specified repository not found.'
24
+ info_only_supported_on_pro_version: 'Feature only supported on professional version.'
25
+ info_artifact_deleted: 'Artifact is deleted successfully.'
26
+ info_current_repo_is: 'Current repository is %{repo}.'
27
+ info_repos_set_success: 'Success: current repository is changed to %{repo}.'
28
+ info_artifact_not_found: 'Artifact cannot be found.'
@@ -1,68 +1,78 @@
1
1
  require "spec_helper"
2
2
  require 'docker'
3
+ require 'i18n'
3
4
 
4
5
  describe Lita::Handlers::Nexus, lita_handler: true do
5
6
  before :all do
6
- @image = Docker::Image.create('fromImage' => 'sonatype/nexus:oss')
7
- #
8
- @container_data = Docker::Container.create( 'Image' => 'sonatype/nexus:oss',
9
- 'Cmd' => "true"
10
- )
11
- @container_data.rename('lita_nexus_data')
12
- @container_data.start
13
-
14
- sleep 5
15
-
16
- #check docker image documentation
17
- default_settings =[
18
- 'MAX_HEAP=768m'
19
- ]
20
- @container_nexus = Docker::Container.create( 'Image' => 'sonatype/nexus:oss',
21
- 'Env'=> default_settings,
22
- 'ExposedPorts' => {
23
- '8081/tcp' => {}
24
- },
25
- 'HostConfig' => {
26
- 'PortBindings' => { '8081/tcp' => [{ 'HostPort' => '8081' }] }
27
- },
28
- 'VolumesFrom' => ['lita_nexus_data']
29
- )
30
- @container_nexus.rename('lita_nexus')
31
- @container_nexus.start
32
-
33
- # waiting container to startup
34
- wait_time = ENV['LITA_NEXUS_WAIT_TIME'] || 20
35
- sleep wait_time
36
-
37
-
38
-
39
- #now upload test artifact to server
40
- test_jar = File.expand_path("../../../fixtures/file/maven-reporting-api-2.0.9.jar", __FILE__)
41
- #puts robot.handlers.to_a[0].class
42
- overrides = {
43
- :url => 'http://localhost:8081',
44
- :repository => 'releases',
45
- :username => 'admin',
46
- :password => 'admin123'
47
- }
48
- nexus_remote ||= NexusCli::RemoteFactory.create(overrides, false)
49
-
50
- puts "Upload testing artifact: #{test_jar}"
51
- success = nexus_remote.push_artifact('org.apache.maven.reporting:maven-reporting:jar:2.0.9', test_jar)
52
-
53
- unless success
54
- raise "Failed to upload test artifact"
55
- end
7
+ if ENV['LITA_provision'] != 'no'
8
+ @image = Docker::Image.create('fromImage' => 'sonatype/nexus:oss')
9
+ #
10
+ @container_data = Docker::Container.create( 'Image' => 'sonatype/nexus:oss',
11
+ 'Cmd' => "true"
12
+ )
13
+ @container_data.rename('lita_nexus_data')
14
+ @container_data.start
15
+
16
+ sleep 5
17
+
18
+ #check docker image documentation
19
+ default_settings =[
20
+ 'MAX_HEAP=768m'
21
+ ]
22
+ @container_nexus = Docker::Container.create( 'Image' => 'sonatype/nexus:oss',
23
+ 'Env'=> default_settings,
24
+ 'ExposedPorts' => {
25
+ '8081/tcp' => {}
26
+ },
27
+ 'HostConfig' => {
28
+ 'PortBindings' => { '8081/tcp' => [{ 'HostPort' => '8081' }] }
29
+ },
30
+ 'VolumesFrom' => ['lita_nexus_data']
31
+ )
32
+ @container_nexus.rename('lita_nexus')
33
+ @container_nexus.start
34
+
35
+ # waiting container to startup
36
+ wait_time = ENV['LITA_NEXUS_WAIT_TIME'] || 20
37
+ sleep wait_time
38
+
39
+
40
+
41
+ #now upload test artifact to server
42
+ test_jar1 = File.expand_path("../../../fixtures/file/maven-reporting-api-2.0.9.jar", __FILE__)
43
+ test_jar2 = File.expand_path("../../../fixtures/file/maven-reporting-api-2.0.6.jar", __FILE__)
44
+ #puts robot.handlers.to_a[0].class
45
+ overrides = {
46
+ :url => 'http://localhost:8081',
47
+ :repository => 'releases',
48
+ :username => 'admin',
49
+ :password => 'admin123'
50
+ }
51
+ nexus_remote ||= NexusCli::RemoteFactory.create(overrides, false)
52
+
53
+ puts "Upload testing artifact: #{test_jar1}"
54
+ success = nexus_remote.push_artifact('org.apache.maven.reporting:maven-reporting:jar:2.0.9', test_jar1)
55
+ unless success
56
+ raise "Failed to upload test artifact"
57
+ end
58
+ puts "Upload testing artifact: #{test_jar2}"
59
+ success = nexus_remote.push_artifact('org.apache.maven.reporting:maven-reporting:jar:2.0.6', test_jar2)
60
+ unless success
61
+ raise "Failed to upload test artifact"
62
+ end
63
+ end #if
56
64
 
57
65
  end
58
66
 
59
67
 
60
68
  after :all do
61
- puts "Shutting down containers"
62
- @container_nexus.stop
63
- @container_nexus.delete(:force => true)
64
- sleep 1
65
- @container_data.delete(:force => true)
69
+ if ENV['LITA_destroy'] != 'no'
70
+ puts "Shutting down containers"
71
+ @container_nexus.stop
72
+ @container_nexus.delete(:force => true)
73
+ sleep 1
74
+ @container_data.delete(:force => true)
75
+ end
66
76
  end
67
77
 
68
78
  before do
@@ -93,67 +103,74 @@ describe Lita::Handlers::Nexus, lita_handler: true do
93
103
 
94
104
  describe '#get artifact info' do
95
105
  #let(:robot) { Lita::Robot.new(registry) }
96
- it 'fecth artifact info' do
106
+ it 'fecth artifact info should return info' do
97
107
  send_command('nexus artifact info org.apache.maven.reporting:maven-reporting:jar:2.0.9')
98
108
  expect(replies.last).to match(/repositoryPath/)
99
109
  end
110
+
111
+ it 'return not found for non-existing' do
112
+ send_command('nexus artifact info webapps:maven-reporting:jar:2.0.9')
113
+ expect(replies.last).to eq(I18n.t('lita.handlers.nexus.msg.info_artifact_not_found'))
114
+ end
100
115
  end
101
116
 
102
117
  describe '#search artifact info' do
103
- it 'search artifact' do
118
+ it 'search artifact should return artifact' do
104
119
  send_command('nexus search artifact org.apache.maven.reporting:maven-reporting limit 5')
105
- expect(replies.first).to match(/Artifact found: 1/)
106
- expect(replies.last).to match(/org.apache.maven.reporting:maven-reporting:2.0.9:jar/)
120
+ expect(replies.first).to match(/Artifact found: [0-9]+/)
121
+ expect(replies.last).to match(/org.apache.maven.reporting:maven-reporting/)
107
122
  end
108
- it 'search artifact with default limit' do
123
+ it 'search artifact with default limit should return artifact' do
109
124
  send_command('nexus search artifact org.apache.maven.reporting:maven-reporting')
110
- expect(replies.first).to match(/Artifact found: 1/)
111
- expect(replies.last).to match(/org.apache.maven.reporting:maven-reporting:2.0.9:jar/)
125
+ expect(replies.first).to match(/Artifact found: [0-9]+/)
126
+ expect(replies.last).to match(/org.apache.maven.reporting:maven-reporting/)
112
127
  end
113
128
  end
114
129
 
115
130
  describe '#get license info' do
116
- it 'fecth server license info' do
131
+ it 'fecth server license info should show feature only available in pro version' do
117
132
  send_command('nexus license info')
118
- expect(replies.last).to match(/professional version/)
133
+ expect(replies.last).to eq(I18n.t('lita.handlers.nexus.msg.info_only_supported_on_pro_version'))
119
134
  end
120
135
  end
121
136
 
122
137
  describe '#get repo info' do
123
- it 'fecth repository info' do
138
+ it 'fecth repository info should show snapshots' do
124
139
  send_command('nexus repo info snapshots')
125
140
  expect(replies.last).to match(/<id>snapshots/)
126
-
127
141
  end
128
142
  it 'show repository not found' do
129
143
  send_command('nexus repo info notexist')
130
- expect(replies.last).to match(/not found/)
144
+ expect(replies.last).to eq(I18n.t('lita.handlers.nexus.msg.info_repository_not_found'))
131
145
  end
132
146
  end
133
147
 
134
148
  describe '#show and set current repo' do
135
- it 'get current repo' do
149
+ it 'get current repo should show as releases' do
136
150
  send_command('nexus show current repo')
137
151
  #puts replies
138
- expect(replies.last).to match(/releases/)
152
+ #expect(replies.last).to match(/releases/)
153
+ expect(replies.last).to eq(I18n.t('lita.handlers.nexus.msg.info_current_repo_is', repo: 'releases'))
139
154
  end
140
- it 'set current repo ' do
155
+ it 'set current repo with success ' do
141
156
  send_command('nexus set current repo snapshots')
142
- expect(replies.last).to match(/Success/)
157
+ #expect(replies.last).to match(/Success/)
158
+ expect(replies.last).to eq(I18n.t('lita.handlers.nexus.msg.info_repos_set_success', repo: 'snapshots'))
143
159
  end
144
- it 'get current repo' do
160
+ it 'get current repo shoud show as snapshots' do
145
161
  send_command('nexus show current repo')
146
- puts "Getting current repo, changed"
147
162
  #puts replies
148
- expect(replies.last).to match(/snapshots/)
163
+ expect(replies.last).to eq(I18n.t('lita.handlers.nexus.msg.info_current_repo_is', repo: 'snapshots'))
149
164
  end
150
165
  end
151
166
 
152
167
  describe '#get artifact versions' do
153
- it 'get artifact versions' do
168
+ it 'get artifact versions should show both versions' do
154
169
  send_command('nexus get artifact versions org.apache.maven.reporting:maven-reporting')
155
- #puts replies
156
- expect(replies.last).to match(/[0-9.]+/)
170
+ expect(replies.last).to include('2.0.6')
171
+ expect(replies.last).to include('2.0.9')
172
+
173
+ puts I18n.t('lita.handlers.nexus.msg.info_repository_not_found')
157
174
  end
158
175
  end
159
176
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-nexus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wang, Dawei
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-13 00:00:00.000000000 Z
11
+ date: 2016-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -156,6 +156,7 @@ files:
156
156
  - lib/nexushelper/remote.rb
157
157
  - lita-nexus.gemspec
158
158
  - locales/en.yml
159
+ - spec/fixtures/file/maven-reporting-api-2.0.6.jar
159
160
  - spec/fixtures/file/maven-reporting-api-2.0.9.jar
160
161
  - spec/lita/handlers/nexus_spec.rb
161
162
  - spec/spec_helper.rb
@@ -186,6 +187,7 @@ signing_key:
186
187
  specification_version: 4
187
188
  summary: Nexus server related operations
188
189
  test_files:
190
+ - spec/fixtures/file/maven-reporting-api-2.0.6.jar
189
191
  - spec/fixtures/file/maven-reporting-api-2.0.9.jar
190
192
  - spec/lita/handlers/nexus_spec.rb
191
193
  - spec/spec_helper.rb