lita-nexus 0.1.2 → 0.1.3

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: 580e358fe99830cc662d50448a47262f7ffdedee
4
- data.tar.gz: adfbea4187499491fc084f1c9be1ba1da4e9d52c
3
+ metadata.gz: a9e8478e68e75511ed9ce99998c40a280a198600
4
+ data.tar.gz: 0ab905b4f2370f2c42d54d466bc0d7ed8f8ad4c2
5
5
  SHA512:
6
- metadata.gz: b0918b63b41f54b7fa8bf8ce30e82a0990e2bf3f70a56dce6748e769f7e88fca5d661fd973f86dbeeeba2649a9063edede9baa6a94517994d0237328d443c5a1
7
- data.tar.gz: d5c176816a314c60a268c208efee9d972f9e94922539e432a7c3342a345129c3f54a94187de468d03159e609dd4e4e63c5e84f423f8b835425851072c29647e3
6
+ metadata.gz: 6f1058969a70d8cda6ba1ec122a3b89b9e802442bbadd3741d74f7db602044c359216469241d3fd27bb5e9fccf291d3d91f8bb0ce96cfb8059e72293c52a7f5d
7
+ data.tar.gz: 077f3486f956ea6bace8e96408f3b0dbc1949e163e1574ad12752f728565f3071403938c6d9240ac413522b855cbf3b91faedb0b0de3036e38d21e1dad2dde07
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format
2
+ documentation
3
+ --fail-fast
data/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
1
  # Change Log
2
+ ## 0.1.3
3
+ * Allow use plain password.
4
+ * Use docker container for testing.
2
5
 
3
6
  ## 0.1.2
4
7
  * Allow to change/show current working repository
data/README.md CHANGED
@@ -15,16 +15,17 @@ Encrypted password can be generated use example rsa_encrypt script
15
15
  ## Configuration
16
16
  ```ruby
17
17
  Lita.configure do |config|
18
- config.handlers.nexus.url = 'https://nexus.prod.co.entpub.net/nexus/'
19
- config.handlers.nexus.username = 'dwang_sa'
18
+ config.handlers.nexus.url = "http://localhost:8081/"
19
+ config.handlers.nexus.username = 'admin'
20
20
  #encrypted use rsa_public_key
21
- config.handlers.nexus.password_hash =
22
- 'Zrt3Hwo7Er4nu9Ne4r0Y6ykuxwxlmvKTrEN26G7EYw63Wtnt9K4H9e933NEZ
23
- eaqUhjoXKYCylhZNWsSj/KDnrEflCCr4eHkFq3kwNi9fRraI3kWVoBzg0v2E
24
- jn5sVCVgrIKG3W8p+RGKbm+HEnkNSZRKJumqJy3vtPcbgMdSlWZQPpwNP4X2
25
- c4NnOUNVY3nmEijX1FJkGnfL3pcZlJgx60lLhhLbGnKQkLz5LdeFRbiiXaVw
26
- acFQufgrhNN85AsKaUlDp/n8ISuMB1K1nGVdN2ZYByf1aKVYwnIWdj+omffz
27
- Da2gZuDpdDWvNfYsm7o3JV6BcmsS9YgiaeiBNi0l1Q=='
21
+ # config.handlers.nexus.password_hash =
22
+ # 'Zrt3Hwo7Er4nu9Ne4r0Y6ykuxwxlmvKTrEN26G7EYw63Wtnt9K4H9e933NEZ
23
+ # eaqUhjoXKYCylhZNWsSj/KDnrEflCCr4eHkFq3kwNi9fRraI3kWVoBzg0v2E
24
+ # jn5sVCVgrIKG3W8p+RGKbm+HEnkNSZRKJumqJy3vtPcbgMdSlWZQPpwNP4X2
25
+ # c4NnOUNVY3nmEijX1FJkGnfL3pcZlJgx60lLhhLbGnKQkLz5LdeFRbiiXaVw
26
+ # acFQufgrhNN85AsKaUlDp/n8ISuMB1K1nGVdN2ZYByf1aKVYwnIWdj+omffz
27
+ # Da2gZuDpdDWvNfYsm7o3JV6BcmsS9YgiaeiBNi0l1Q=='
28
+ config.handlers.nexus.password_plain = 'admin123'
28
29
  config.handlers.nexus.verify_ssl = false
29
30
  config.handlers.nexus.default_repository = 'entertainment'
30
31
  #used to decrypt password hash
@@ -7,12 +7,15 @@ module Lita
7
7
  # insert handler code here
8
8
  config :url, required: true, type: String
9
9
  config :username, required: true, type: String
10
- config :password_hash, required: true, type: String
10
+ #use either plain password or encrypted one
11
+ config :password_hash, required: false, type: String
12
+ config :password_plain, required: false, type: String
11
13
  config :default_repository, required: false, type: String
12
14
  config :verify_ssl, required: false, type: [TrueClass,FalseClass], default: false
13
15
  config :rsa_private_key, required: true, type: String
14
16
  config :current_repository, required: false, type: String
15
17
 
18
+
16
19
  include ::LitaNexusHelper::Remote
17
20
 
18
21
  route(
@@ -6,9 +6,14 @@ module LitaNexusHelper
6
6
  module Remote
7
7
  def nexus_remote
8
8
  begin
9
- pk_path = config.rsa_private_key
10
- pk = OpenSSL::PKey::RSA.new File.read(pk_path)
11
- decrypted_pass = pk.private_decrypt Base64::decode64(config.password_hash)
9
+ if config.password_plain.nil? || config.password_plain.length <1
10
+ pk_path = config.rsa_private_key
11
+ pk = OpenSSL::PKey::RSA.new File.read(pk_path)
12
+ decrypted_pass = pk.private_decrypt Base64::decode64(config.password_hash)
13
+ else
14
+ decrypted_pass = config.password_plain
15
+ end
16
+
12
17
  overrides = {
13
18
  :url => config.url,
14
19
  :repository => get_current_repo,
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.2"
3
+ spec.version = "0.1.3"
4
4
  spec.authors = ["Wang, Dawei"]
5
5
  spec.email = ["dwang@entertainment.com"]
6
6
  spec.description = "Lita Nexus Operations"
@@ -24,4 +24,5 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "rake"
25
25
  #spec.add_development_dependency "rack-test"
26
26
  spec.add_development_dependency "rspec", ">= 3.0.0"
27
+ spec.add_development_dependency "docker-api"
27
28
  end
@@ -1,18 +1,65 @@
1
1
  require "spec_helper"
2
+ require 'docker'
2
3
 
3
4
  describe Lita::Handlers::Nexus, lita_handler: true do
5
+
6
+ before :all do
7
+ @image = Docker::Image.create('fromImage' => 'sonatype/nexus:oss')
8
+
9
+
10
+ #
11
+ @container_data = Docker::Container.create( 'Image' => 'sonatype/nexus:oss',
12
+ 'Cmd' => "true"
13
+ )
14
+ @container_data.rename('lita_nexus_data')
15
+ @container_data.start
16
+
17
+ sleep 5
18
+
19
+ #check docker image documentation
20
+ default_settings =[
21
+ 'MAX_HEAP=768m'
22
+ ]
23
+ @container_nexus = Docker::Container.create( 'Image' => 'sonatype/nexus:oss',
24
+ 'Env'=> default_settings,
25
+ 'ExposedPorts' => {
26
+ '8081/tcp' => {}
27
+ },
28
+ 'HostConfig' => {
29
+ 'PortBindings' => { '8081/tcp' => [{ 'HostPort' => '8081' }] }
30
+ },
31
+ 'VolumesFrom' => ['lita_nexus_data']
32
+ )
33
+ @container_nexus.rename('lita_nexus')
34
+ @container_nexus.start
35
+
36
+ # waiting container to startup
37
+ wait_time = ENV['LITA_NEXUS_WAIT_TIME'] || 20
38
+ sleep wait_time
39
+ end
40
+
41
+
42
+ after :all do
43
+ puts "Shutting down containers"
44
+ @container_nexus.stop
45
+ @container_nexus.delete(:force => true)
46
+ sleep 1
47
+ @container_data.delete(:force => true)
48
+ end
49
+
4
50
  before do
5
- registry.config.handlers.nexus.url = 'https://nexus.prod.co.entpub.net/nexus/'
6
- registry.config.handlers.nexus.username = 'dwang_sa'
7
- registry.config.handlers.nexus.password_hash =
8
- 'Zrt3Hwo7Er4nu9Ne4r0Y6ykuxwxlmvKTrEN26G7EYw63Wtnt9K4H9e933NEZ
9
- eaqUhjoXKYCylhZNWsSj/KDnrEflCCr4eHkFq3kwNi9fRraI3kWVoBzg0v2E
10
- jn5sVCVgrIKG3W8p+RGKbm+HEnkNSZRKJumqJy3vtPcbgMdSlWZQPpwNP4X2
11
- c4NnOUNVY3nmEijX1FJkGnfL3pcZlJgx60lLhhLbGnKQkLz5LdeFRbiiXaVw
12
- acFQufgrhNN85AsKaUlDp/n8ISuMB1K1nGVdN2ZYByf1aKVYwnIWdj+omffz
13
- Da2gZuDpdDWvNfYsm7o3JV6BcmsS9YgiaeiBNi0l1Q=='
51
+ registry.config.handlers.nexus.url = 'http://localhost:8081/'
52
+ registry.config.handlers.nexus.username = 'admin'
53
+ # registry.config.handlers.nexus.password_hash =
54
+ # 'C3Enajd6ygmzot1CB8H7FdYb7oLOpOr+fZMisp4HDfb8l1YDaNRxUhCYKxYq
55
+ # ma3qv6fxmU3wkPLfcN1c/u164jgGVPPl4mi8PtZxbN2uAh0hm/sIqTAoFczy
56
+ # 6lctLPNNYb3eK+4lH/XvOHeS1L+uSwPIiQNub//IsE7MeWz3gW6AXr0I5sUt
57
+ # k81o63GwYqdT0VS4PpJqfl2zq8LHd6s0SFUfZv02HvW0TvwNxmjiWnsRYLcs
58
+ # aU9B+umfH9rCqNXNqDaAgEDXBTbMkqTjwQvRi0qMouQmITPC7dnC2lYsC/Ka
59
+ # HXpfWKIFjbVtf5Tslfj1l5/9mW7PTtwyeXc7z50iUA=='
60
+ registry.config.handlers.nexus.password_plain='admin123'
14
61
  registry.config.handlers.nexus.verify_ssl = false
15
- registry.config.handlers.nexus.default_repository = 'entertainment'
62
+ registry.config.handlers.nexus.default_repository = 'releases'
16
63
  registry.config.handlers.nexus.rsa_private_key = "#{File.expand_path('~')}/.ssh/id_rsa"
17
64
  end
18
65
  it do
@@ -64,7 +111,7 @@ describe Lita::Handlers::Nexus, lita_handler: true do
64
111
  puts replies
65
112
  end
66
113
  it 'set current repo ' do
67
- send_command('nexus set current repo releases')
114
+ send_command('nexus set current repo snapshots')
68
115
  puts "Setting current repo"
69
116
  puts replies
70
117
  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.2
4
+ version: 0.1.3
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-08 00:00:00.000000000 Z
11
+ date: 2016-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: 3.0.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: docker-api
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description: Lita Nexus Operations
98
112
  email:
99
113
  - dwang@entertainment.com
@@ -103,6 +117,7 @@ extensions: []
103
117
  extra_rdoc_files: []
104
118
  files:
105
119
  - ".gitignore"
120
+ - ".rspec"
106
121
  - CHANGELOG.md
107
122
  - Gemfile
108
123
  - README.md