lita-nexus 0.1.1 → 0.1.2

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: 70fd60aacf7139a550fe55469d878f1f756a5823
4
- data.tar.gz: da3d02c969e153e80cb4dfcaae8ada70bb7342f0
3
+ metadata.gz: 580e358fe99830cc662d50448a47262f7ffdedee
4
+ data.tar.gz: adfbea4187499491fc084f1c9be1ba1da4e9d52c
5
5
  SHA512:
6
- metadata.gz: 0d8996e1c701c9ab082b0592fdd746d2c1be32f1df5960f8e6cae2676e3bd948c499231bb601ce214056952fc4e22a0a5660c9ff54ebc5faf90944bd2de6eaee
7
- data.tar.gz: 59ac2202ad916cbb1daa638f9f0939f130b75936c15bf297dab5f2a9c316aa3f6e1518f5ae74e05f909b8e0b7b7cf1bd29184a860ed4efed87de7901efc32b99
6
+ metadata.gz: b0918b63b41f54b7fa8bf8ce30e82a0990e2bf3f70a56dce6748e769f7e88fca5d661fd973f86dbeeeba2649a9063edede9baa6a94517994d0237328d443c5a1
7
+ data.tar.gz: d5c176816a314c60a268c208efee9d972f9e94922539e432a7c3342a345129c3f54a94187de468d03159e609dd4e4e63c5e84f423f8b835425851072c29647e3
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
- # lita-nexus change log
1
+ # Change Log
2
+
3
+ ## 0.1.2
4
+ * Allow to change/show current working repository
5
+ * Allow to delete a repository
6
+ * Allow to delete an artifact with coordinate
2
7
 
3
8
  ## 0.1.1
4
9
  Fix help message.
10
+
5
11
  ## 0.1.0
6
12
  Initial release.
data/README.md CHANGED
@@ -35,6 +35,9 @@ end
35
35
  ## Usage
36
36
 
37
37
  * nexus artifact info webapps:sweetrewards:tar.gz:1.8.0
38
+ * nexus delete artifact webapps:sweetrewards:tar.gz:1.8.0
38
39
  * nexus search artifact webapps:sweetrewards
39
40
  * nexus license info # only for pro version
40
41
  * nexus repo info snapshots
42
+ * nexus show current repo
43
+ * nexus set current repo releases
@@ -11,6 +11,7 @@ module Lita
11
11
  config :default_repository, required: false, type: String
12
12
  config :verify_ssl, required: false, type: [TrueClass,FalseClass], default: false
13
13
  config :rsa_private_key, required: true, type: String
14
+ config :current_repository, required: false, type: String
14
15
 
15
16
  include ::LitaNexusHelper::Remote
16
17
 
@@ -50,6 +51,34 @@ module Lita
50
51
  }
51
52
  )
52
53
 
54
+ route(
55
+ /^nexus\s+delete\s+artifact\s+(\S+)\s*$/,
56
+ :cmd_delete_artifact,
57
+ command: true,
58
+ help: {
59
+ t('help.cmd_delete_artifact_key') => t('help.cmd_delete_artifact_value')
60
+ }
61
+ )
62
+
63
+ route(
64
+ /^nexus\s+show\s+current\s+repo\s*$/,
65
+ :cmd_show_current_repository,
66
+ command: true,
67
+ help: {
68
+ t('help.cmd_show_repo_key') => t('help.cmd_show_repo_value')
69
+ }
70
+ )
71
+
72
+ route(
73
+ /^nexus\s+set\s+current\s+repo\s+(\S+)\s*$/,
74
+ :cmd_set_current_repository,
75
+ command: true,
76
+ help: {
77
+ t('help.cmd_set_repo_key') => t('help.cmd_set_repo_value')
78
+ }
79
+ )
80
+
81
+
53
82
  def cmd_artifact_info(response)
54
83
  coordinate = response.matches[0][0]
55
84
  puts "coordinate = #{coordinate}"
@@ -75,6 +104,30 @@ module Lita
75
104
  response.reply info
76
105
  end
77
106
 
107
+ def cmd_delete_artifact(response)
108
+ coordinate = response.matches[0][0]
109
+ begin
110
+ delete_artifact(coordinate)
111
+ response.reply "Artifact deleted successfully."
112
+ rescue Exception => e
113
+ response.reply e.message
114
+ end
115
+ end
116
+
117
+ def cmd_set_current_repository(response)
118
+ repo = response.matches[0][0]
119
+ if repo && repo.strip.length >0
120
+ config.current_repository = repo
121
+ end
122
+ response.reply "Current repository is changed to #{repo}."
123
+ end
124
+
125
+ def cmd_show_current_repository(response)
126
+ current_repo = get_current_repo
127
+ response.reply "Current repository is #{current_repo}"
128
+
129
+ end
130
+
78
131
  Lita.register_handler(self)
79
132
  end
80
133
  end
@@ -11,7 +11,7 @@ module LitaNexusHelper
11
11
  decrypted_pass = pk.private_decrypt Base64::decode64(config.password_hash)
12
12
  overrides = {
13
13
  :url => config.url,
14
- :repository => config.default_repository,
14
+ :repository => get_current_repo,
15
15
  :username => config.username,
16
16
  :password => decrypted_pass
17
17
  }
@@ -59,5 +59,14 @@ module LitaNexusHelper
59
59
  #puts "info: #{info}"
60
60
  info
61
61
  end
62
+
63
+ def delete_artifact(coordinate)
64
+ remote = nexus_remote
65
+ remote.delete_artifact(coordinate)
66
+ end
67
+
68
+ def get_current_repo
69
+ config.current_repository || config.default_repository
70
+ end
62
71
  end#module Remote
63
72
  end #module helper
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.1"
3
+ spec.version = "0.1.2"
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
@@ -3,11 +3,17 @@ en:
3
3
  handlers:
4
4
  nexus:
5
5
  help:
6
- cmd_artifact_info_key: 'nexus artifact info COORDICNATE'
6
+ cmd_artifact_info_key: 'nexus artifact info COORDINATE'
7
7
  cmd_artifact_info_value: 'Show artifact info with coordinate'
8
8
  cmd_license_info_key: 'nexus license info'
9
9
  cmd_license_info_value: 'Show license info'
10
- cmd_search_artifact_key: 'nexus search artifact COORDICNATE'
10
+ cmd_search_artifact_key: 'nexus search artifact COORDINATE'
11
11
  cmd_search_artifact_value: 'Search all versions artifact with coordinate'
12
12
  cmd_repo_info_key: 'nexus repo info REPONAME'
13
13
  cmd_repo_info_value: 'Show repository REPONAME info'
14
+ cmd_delete_artifact_key: 'nexus delete artifact COORDINATE'
15
+ cmd_delete_artifact_value: 'Delete an artifact by coordinate'
16
+ cmd_show_repo_key: 'nexus show current repo'
17
+ cmd_show_repo_value: 'Show current repository used'
18
+ cmd_set_repo_key: 'nexus set current repo REPO'
19
+ cmd_set_repo_value: 'Set current repository to specified REPO'
@@ -19,6 +19,9 @@ describe Lita::Handlers::Nexus, lita_handler: true do
19
19
  is_expected.to route_command('nexus artifact info webapps:sweetrewards:tar.gz:1.8.0').to(:cmd_artifact_info)
20
20
  is_expected.to route_command('nexus license info').to(:cmd_license_info)
21
21
  is_expected.to route_command('nexus repo info test').to(:cmd_repo_info)
22
+ is_expected.to route_command('nexus delete artifact webapps:sweetrewards:tar.gz:1.8.0').to(:cmd_delete_artifact)
23
+ is_expected.to route_command('nexus show current repo').to(:cmd_show_current_repository)
24
+ is_expected.to route_command('nexus set current repo releases').to(:cmd_set_current_repository)
22
25
  end
23
26
 
24
27
  describe '#get artifact info' do
@@ -53,4 +56,22 @@ describe Lita::Handlers::Nexus, lita_handler: true do
53
56
  puts replies
54
57
  end
55
58
  end
59
+
60
+ describe '#show and set current repo' do
61
+ it 'get current repo' do
62
+ send_command('nexus show current repo')
63
+ puts "Getting current repo"
64
+ puts replies
65
+ end
66
+ it 'set current repo ' do
67
+ send_command('nexus set current repo releases')
68
+ puts "Setting current repo"
69
+ puts replies
70
+ end
71
+ it 'get current repo' do
72
+ send_command('nexus show current repo')
73
+ puts "Getting current repo, changed"
74
+ puts replies
75
+ end
76
+ end
56
77
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-nexus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wang, Dawei