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 +4 -4
- data/CHANGELOG.md +7 -1
- data/README.md +3 -0
- data/lib/lita/handlers/nexus.rb +53 -0
- data/lib/nexushelper/remote.rb +10 -1
- data/lita-nexus.gemspec +1 -1
- data/locales/en.yml +8 -2
- data/spec/lita/handlers/nexus_spec.rb +21 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 580e358fe99830cc662d50448a47262f7ffdedee
|
4
|
+
data.tar.gz: adfbea4187499491fc084f1c9be1ba1da4e9d52c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0918b63b41f54b7fa8bf8ce30e82a0990e2bf3f70a56dce6748e769f7e88fca5d661fd973f86dbeeeba2649a9063edede9baa6a94517994d0237328d443c5a1
|
7
|
+
data.tar.gz: d5c176816a314c60a268c208efee9d972f9e94922539e432a7c3342a345129c3f54a94187de468d03159e609dd4e4e63c5e84f423f8b835425851072c29647e3
|
data/CHANGELOG.md
CHANGED
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
|
data/lib/lita/handlers/nexus.rb
CHANGED
@@ -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
|
data/lib/nexushelper/remote.rb
CHANGED
@@ -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 =>
|
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
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
|
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
|
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
|