nexus_cli_sb 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.travis.yml +4 -0
  4. data/CHANGELOG.md +14 -0
  5. data/Gemfile +42 -0
  6. data/Guardfile +27 -0
  7. data/LICENSE +15 -0
  8. data/README.md +121 -0
  9. data/Rakefile +1 -0
  10. data/Thorfile +66 -0
  11. data/VERSION +1 -0
  12. data/bin/nexus-cli +10 -0
  13. data/data/pom.xml.erb +13 -0
  14. data/features/nexus_oss.feature +251 -0
  15. data/features/pro/nexus_custom_metadata.feature +116 -0
  16. data/features/pro/nexus_pro.feature +101 -0
  17. data/features/step_definitions/cli_steps.rb +105 -0
  18. data/features/support/env.rb +64 -0
  19. data/lib/nexus_cli/artifact.rb +44 -0
  20. data/lib/nexus_cli/base_remote.rb +16 -0
  21. data/lib/nexus_cli/cli.rb +7 -0
  22. data/lib/nexus_cli/configuration.rb +102 -0
  23. data/lib/nexus_cli/connection.rb +84 -0
  24. data/lib/nexus_cli/errors.rb +259 -0
  25. data/lib/nexus_cli/mixins/artifact_actions.rb +194 -0
  26. data/lib/nexus_cli/mixins/global_settings_actions.rb +64 -0
  27. data/lib/nexus_cli/mixins/logging_actions.rb +45 -0
  28. data/lib/nexus_cli/mixins/pro/custom_metadata_actions.rb +176 -0
  29. data/lib/nexus_cli/mixins/pro/smart_proxy_actions.rb +219 -0
  30. data/lib/nexus_cli/mixins/repository_actions.rb +245 -0
  31. data/lib/nexus_cli/mixins/user_actions.rb +125 -0
  32. data/lib/nexus_cli/n3_metadata.rb +77 -0
  33. data/lib/nexus_cli/remote/oss_remote.rb +11 -0
  34. data/lib/nexus_cli/remote/pro_remote.rb +59 -0
  35. data/lib/nexus_cli/remote_factory.rb +30 -0
  36. data/lib/nexus_cli/tasks.rb +496 -0
  37. data/lib/nexus_cli/version.rb +6 -0
  38. data/lib/nexus_cli.rb +44 -0
  39. data/nexus_cli.gemspec +31 -0
  40. data/spec/fixtures/metadata_search.xml +10 -0
  41. data/spec/fixtures/nexus.config +4 -0
  42. data/spec/spec_helper.rb +22 -0
  43. data/spec/unit/nexus_cli/artifact_spec.rb +82 -0
  44. data/spec/unit/nexus_cli/configuration_spec.rb +137 -0
  45. data/spec/unit/nexus_cli/mixins/pro/custom_metadata_actions_spec.rb +21 -0
  46. data/spec/unit/nexus_cli/oss_remote_spec.rb +78 -0
  47. data/spec/unit/nexus_cli/pro_remote_spec.rb +110 -0
  48. data/spec/unit/nexus_cli/remote_factory_spec.rb +42 -0
  49. metadata +259 -0
@@ -0,0 +1,496 @@
1
+ require 'thor'
2
+ require 'highline'
3
+
4
+ module NexusCli
5
+ module Tasks
6
+ def self.included(base)
7
+ base.send :include, ::Thor::Actions
8
+ base.class_eval do
9
+
10
+ map 'pull' => :pull_artifact
11
+ map 'push' => :push_artifact
12
+ map 'info' => :get_artifact_info
13
+ map 'custom' => :get_artifact_custom_info
14
+ map 'config' => :get_nexus_configuration
15
+ map 'status' => :get_nexus_status
16
+ map 'search' => :search_for_artifacts
17
+ map 'search_custom' => :search_artifacts_custom
18
+ map 'transfer' => :transfer_artifact
19
+
20
+ class_option :overrides,
21
+ :type => :hash,
22
+ :default => nil,
23
+ :desc => "A hashed list of overrides. Available options are 'url', 'repository', 'username', and 'password'."
24
+
25
+ class_option :ssl_verify,
26
+ :type => :boolean,
27
+ :default => true,
28
+ :desc => "Set to false to disable SSL Verification."
29
+
30
+ method_option :destination,
31
+ :type => :string,
32
+ :default => nil,
33
+ :desc => "A different folder other than the current working directory."
34
+ desc "pull_artifact coordinates", "Pulls an artifact from Nexus and places it on your machine."
35
+ def pull_artifact(coordinates)
36
+ pull_artifact_response = nexus_remote.pull_artifact(coordinates, options[:destination])
37
+ say "Artifact has been retrieved and can be found at path: #{pull_artifact_response[:file_path]}", :green
38
+ end
39
+
40
+ desc "push_artifact coordinates file", "Pushes an artifact from your machine onto the Nexus."
41
+ def push_artifact(coordinates, file)
42
+ nexus_remote.push_artifact(coordinates, file)
43
+ say "Artifact #{coordinates} has been successfully pushed to Nexus.", :green
44
+ end
45
+
46
+ desc "get_artifact_info coordinates", "Gets and returns the metadata in XML format about a particular artifact."
47
+ def get_artifact_info(coordinates)
48
+ say nexus_remote.get_artifact_info(coordinates), :green
49
+ end
50
+
51
+ desc "search_for_artifacts", "Searches for all the versions of a particular artifact and prints it to the screen."
52
+ def search_for_artifacts(coordinates)
53
+ say nexus_remote.search_for_artifacts(coordinates), :green
54
+ end
55
+
56
+ desc "get_artifact_custom_info coordinates", "Gets and returns the custom metadata in XML format about a particular artifact."
57
+ def get_artifact_custom_info(coordinates)
58
+ raise NotNexusProException unless nexus_remote.kind_of? ProRemote
59
+ say nexus_remote.get_artifact_custom_info(coordinates), :green
60
+ end
61
+
62
+ desc "update_artifact_custom_info coordinates param1 param2 ...", "Updates the artifact custom metadata with the given key-value pairs."
63
+ def update_artifact_custom_info(coordinates, *params)
64
+ raise NotNexusProException unless nexus_remote.kind_of? ProRemote
65
+ nexus_remote.update_artifact_custom_info(coordinates, *params)
66
+ say "Custom metadata for artifact #{coordinates} has been successfully pushed to Nexus.", :green
67
+ end
68
+
69
+ desc "clear_artifact_custom_info coordinates", "Clears the artifact custom metadata."
70
+ def clear_artifact_custom_info(coordinates)
71
+ raise NotNexusProException unless nexus_remote.kind_of? ProRemote
72
+ nexus_remote.clear_artifact_custom_info(coordinates)
73
+ say "Custom metadata for artifact #{coordinates} has been successfully cleared.", :green
74
+ end
75
+
76
+ desc "search_artifacts_custom param1 param2 ... ", "Searches for artifacts using artifact metadata and returns the result as a list with items in XML format."
77
+ def search_artifacts_custom(*params)
78
+ raise NotNexusProException unless nexus_remote.kind_of? ProRemote
79
+ say (s = nexus_remote.search_artifacts_custom(*params)) == "" ? "No search results." : s, :green
80
+ end
81
+
82
+ desc "get_nexus_configuration", "Prints out configuration from the .nexus_cli file that helps inform where artifacts will be uploaded."
83
+ def get_nexus_configuration
84
+ config = nexus_remote.configuration
85
+ say "********* Reading CLI configuration from #{File.expand_path('~/.nexus_cli')} *********", :blue
86
+ say "Nexus URL: #{config['url']}", :blue
87
+ say "Nexus Repository: #{config['repository']}", :blue
88
+ end
89
+
90
+ desc "get_nexus_status", "Prints out information about the Nexus instance."
91
+ def get_nexus_status
92
+ data = nexus_remote.status
93
+ say "********* Getting Nexus status from #{data['base_url']} *********", :blue
94
+ say "Application Name: #{data['app_name']}", :blue
95
+ say "Version: #{data['version']}", :blue
96
+ say "Edition: #{data['edition_long']}", :blue
97
+ say "State: #{data['state']}", :blue
98
+ say "Started At: #{data['started_at']}", :blue
99
+ say "Base URL: #{data['base_url']}", :blue
100
+ end
101
+
102
+ desc "get_global_settings", "Prints out your Nexus' current setttings and saves them to a file."
103
+ def get_global_settings
104
+ nexus_remote.get_global_settings
105
+ say "Your current Nexus global settings have been written to the file: ~/.nexus/global_settings.json", :blue
106
+ end
107
+
108
+ method_option :json,
109
+ :type => :string,
110
+ :default => nil,
111
+ :desc => "A String of the JSON you wish to upload."
112
+ desc "upload_global_settings", "Uploads a global_settings.json file to your Nexus to update its settings."
113
+ def upload_global_settings
114
+ nexus_remote.upload_global_settings(options[:json])
115
+ say "Your global_settings.json file has been uploaded to Nexus", :blue
116
+ end
117
+
118
+ desc "reset_global_settings", "Resets your Nexus global_settings to their out-of-the-box defaults."
119
+ def reset_global_settings
120
+ nexus_remote.reset_global_settings
121
+ say "Your Nexus global settings have been reset to their default values", :blue
122
+ end
123
+
124
+ method_option :id,
125
+ :type => :string,
126
+ :desc => "The id of the repository to use."
127
+ method_option :policy,
128
+ :type => :string,
129
+ :desc => "Repo policy [RELEASE|SNAPSHOT], RELEASE by default"
130
+ method_option :provider,
131
+ :type => :string,
132
+ :desc => "Repo provider (maven2 by default)"
133
+ method_option :proxy,
134
+ :type => :boolean,
135
+ :desc => "True if the new repository should be a proxy repository"
136
+ method_option :url,
137
+ :type => :string,
138
+ :desc => "The url of the actual repository for the proxy repository to use."
139
+ desc "create_repository name", "Creates a new Repository with the provided name."
140
+ def create_repository(name)
141
+ if nexus_remote.create_repository(name, options[:proxy], options[:url], options[:id], options[:policy], options[:provider])
142
+ say "A new Repository named #{name} has been created.", :blue
143
+ end
144
+ end
145
+
146
+ desc "delete_repository name", "Deletes a Repository with the provided name."
147
+ def delete_repository(name)
148
+ if nexus_remote.delete_repository(name)
149
+ say "The Repository named #{name} has been deleted.", :blue
150
+ end
151
+ end
152
+
153
+ desc "get_repository_info name", "Finds and returns information about the provided Repository."
154
+ def get_repository_info(name)
155
+ say nexus_remote.get_repository_info(name), :green
156
+ end
157
+
158
+ desc "get_users", "Returns XML representing the users in Nexus."
159
+ def get_users
160
+ say nexus_remote.get_users, :green
161
+ end
162
+
163
+ method_option :username,
164
+ :type => :string,
165
+ :default => nil,
166
+ :desc => "The username."
167
+ method_option :first_name,
168
+ :type => :string,
169
+ :default => nil,
170
+ :desc => "The first name."
171
+ method_option :last_name,
172
+ :type => :string,
173
+ :default => nil,
174
+ :desc => "The last name."
175
+ method_option :email,
176
+ :type => :string,
177
+ :default => nil,
178
+ :desc => "The email."
179
+ method_option :password,
180
+ :type => :string,
181
+ :default => nil,
182
+ :desc => "The password."
183
+ method_option :enabled,
184
+ :type => :boolean,
185
+ :default => nil,
186
+ :desc => "Whether this new user is enabled or disabled."
187
+ method_option :roles,
188
+ :type => :array,
189
+ :default => [],
190
+ :require => false,
191
+ :desc => "An array of roles."
192
+ desc "create_user", "Creates a new user"
193
+ def create_user
194
+ params = ask_user(options)
195
+
196
+ if nexus_remote.create_user(params)
197
+ say "A user with the ID of #{params[:userId]} has been created.", :blue
198
+ end
199
+ end
200
+
201
+ method_option :username,
202
+ :type => :string,
203
+ :default => nil,
204
+ :desc => "The username."
205
+ method_option :first_name,
206
+ :type => :string,
207
+ :default => nil,
208
+ :desc => "The first name."
209
+ method_option :last_name,
210
+ :type => :string,
211
+ :default => nil,
212
+ :desc => "The last name."
213
+ method_option :email,
214
+ :type => :string,
215
+ :default => nil,
216
+ :desc => "The email."
217
+ method_option :enabled,
218
+ :type => :boolean,
219
+ :default => nil,
220
+ :desc => "Whether this new user is enabled or disabled."
221
+ method_option :roles,
222
+ :type => :array,
223
+ :default => [],
224
+ :require => false,
225
+ :desc => "An array of roles."
226
+ desc "update_user user_id", "Updates a user's details. Leave fields blank for them to remain their current values."
227
+ def update_user(user_id)
228
+ params = ask_user(options, false, false)
229
+ params[:userId] = user_id
230
+
231
+ if nexus_remote.update_user(params)
232
+ say "User #{user_id} has been updated.", :blue
233
+ end
234
+ end
235
+
236
+ desc "delete_user user_id", "Deletes the user with the given id."
237
+ def delete_user(user_id)
238
+ if nexus_remote.delete_user(user_id)
239
+ say "User #{user_id} has been deleted.", :blue
240
+ end
241
+ end
242
+
243
+ method_option :oldPassword,
244
+ :type => :string,
245
+ :default => nil,
246
+ :desc => ""
247
+ method_option :newPassword,
248
+ :type => :string,
249
+ :default => nil,
250
+ :desc => ""
251
+ desc "change_password user_id", "Changes the given user's passwords to a new one."
252
+ def change_password(user_id)
253
+
254
+ oldPassword = options[:oldPassword]
255
+ newPassword = options[:newPassword]
256
+
257
+ if oldPassword.nil?
258
+ oldPassword = ask_password("Please enter your old password:")
259
+ end
260
+ if newPassword.nil?
261
+ newPassword = ask_password("Please enter your new password:")
262
+ end
263
+
264
+ params = {:userId => user_id}
265
+ params[:oldPassword] = oldPassword
266
+ params[:newPassword] = newPassword
267
+ if nexus_remote.change_password(params)
268
+ say "The password for user #{user_id} has been updated.", :blue
269
+ end
270
+ end
271
+
272
+ desc "get_pub_sub repository_id", "Returns the publish/subscribe status of the given repository."
273
+ def get_pub_sub(repository_id)
274
+ raise NotNexusProException unless nexus_remote.kind_of? ProRemote
275
+ say nexus_remote.get_pub_sub(repository_id), :green
276
+ end
277
+
278
+ desc "enable_artifact_publish repository_id", "Sets a repository to enable the publishing of updates about its artifacts."
279
+ def enable_artifact_publish(repository_id)
280
+ raise NotNexusProException unless nexus_remote.kind_of? ProRemote
281
+ if nexus_remote.enable_artifact_publish(repository_id)
282
+ say "The repository #{repository_id} will now publish updates.", :blue
283
+ end
284
+ end
285
+
286
+ desc "disable_artifact_publish repository_id", "Sets a repository to disable the publishing of updates about its artifacts."
287
+ def disable_artifact_publish(repository_id)
288
+ raise NotNexusProException unless nexus_remote.kind_of? ProRemote
289
+ if nexus_remote.disable_artifact_publish(repository_id)
290
+ say "The repository #{repository_id} is no longer publishing updates.", :blue
291
+ end
292
+ end
293
+
294
+ method_option :preemptive_fetch,
295
+ :type => :boolean,
296
+ :default => false,
297
+ :desc => "Subscribing repositories that preemtively fetch will grab artifacts as updates are received."
298
+ desc "enable_artifact_subscribe repository_id", "Sets a repository to subscribe to updates about artifacts."
299
+ def enable_artifact_subscribe(repository_id)
300
+ raise NotNexusProException unless nexus_remote.kind_of? ProRemote
301
+ if nexus_remote.enable_artifact_subscribe(repository_id, options[:preemptive_fetch])
302
+ say "The repository #{repository_id} is now subscribed for artifact updates.", :blue
303
+ end
304
+ end
305
+
306
+ desc "disable_artifact_subscribe repository_id", "Sets a repository to stop subscribing to updates about artifacts."
307
+ def disable_artifact_subscribe(repository_id)
308
+ raise NotNexusProException unless nexus_remote.kind_of? ProRemote
309
+ if nexus_remote.disable_artifact_subscribe(repository_id)
310
+ say "The repository #{repository_id} is no longer subscribed for artifact updates.", :blue
311
+ end
312
+ end
313
+
314
+ method_option :host,
315
+ :type => :string,
316
+ :desc => "An IP address for the Nexus server at which publishing will be available."
317
+ method_option :port,
318
+ :type => :numeric,
319
+ :desc => "An available port that will be used for Smart Proxy connections."
320
+ desc "enable_smart_proxy", "Enables Smart Proxy on the server."
321
+ def enable_smart_proxy
322
+ raise NotNexusProException unless nexus_remote.kind_of? ProRemote
323
+ say nexus_remote.enable_smart_proxy(options[:host], options[:port])
324
+ end
325
+
326
+ desc "disable_smart_proxy", "Disables Smart Proxy on the server."
327
+ def disable_smart_proxy
328
+ raise NotNexusProException unless nexus_remote.kind_of? ProRemote
329
+ say nexus_remote.disable_smart_proxy
330
+ end
331
+
332
+ desc "get_smart_proxy_settings", "Returns the Smart Proxy settings of the server."
333
+ def get_smart_proxy_settings
334
+ raise NotNexusProException unless nexus_remote.kind_of? ProRemote
335
+ say JSON.pretty_generate(JSON.parse(nexus_remote.get_smart_proxy_settings)), :green
336
+ end
337
+
338
+ method_option :certificate,
339
+ :type => :string,
340
+ :required => :true,
341
+ :desc => "A path to a file containing a certificate."
342
+ method_option :description,
343
+ :type => :string,
344
+ :required => true,
345
+ :desc => "A description to give to the trusted key. It is probably best to make this meaningful."
346
+ desc "add_trusted_key", "Adds a new trusted key to the Smart Proxy configuration."
347
+ def add_trusted_key
348
+ raise NotNexusProException unless nexus_remote.kind_of? ProRemote
349
+ if nexus_remote.add_trusted_key(options[:certificate], options[:description])
350
+ say "A new trusted key has been added to the nexus.", :blue
351
+ end
352
+ end
353
+
354
+ desc "delete_trusted_key key_id", "Deletes a trusted key using the given key_id."
355
+ def delete_trusted_key(key_id)
356
+ raise NotNexusProException unless nexus_remote.kind_of? ProRemote
357
+ if nexus_remote.delete_trusted_key(key_id)
358
+ say "The trusted key with an id of #{key_id} has been deleted.", :blue
359
+ end
360
+ end
361
+
362
+ desc "get_trusted_keys", "Returns the trusted keys of the server."
363
+ def get_trusted_keys
364
+ raise NotNexusProException unless nexus_remote.kind_of? ProRemote
365
+ say JSON.pretty_generate(JSON.parse(nexus_remote.get_trusted_keys)), :green
366
+ end
367
+
368
+ desc "get_license_info", "Returns the license information of the server."
369
+ def get_license_info
370
+ say nexus_remote.get_license_info, :green
371
+ end
372
+
373
+ desc "install_license license_file", "Installs a license file into the server."
374
+ def install_license(license_file)
375
+ nexus_remote.install_license(license_file)
376
+ end
377
+
378
+ desc "get_logging_info", "Gets the log4j Settings of the Nexus server."
379
+ def get_logging_info
380
+ say nexus_remote.get_logging_info, :green
381
+ end
382
+
383
+ desc "set_logger_level level", "Updates the log4j logging level to a new value."
384
+ def set_logger_level(level)
385
+ if nexus_remote.set_logger_level(level)
386
+ say "The logging level of Nexus has been set to #{level.upcase}", :blue
387
+ end
388
+ end
389
+
390
+ desc "create_group_repository name", "Creates a new repository group with the given name."
391
+ method_option :id,
392
+ :type => :string,
393
+ :desc => "The id of the group repository to use (calculated from name by default)."
394
+ method_option :provider,
395
+ :type => :string,
396
+ :desc => "Group repo provider (maven2 by default)."
397
+ def create_group_repository(name)
398
+ if nexus_remote.create_group_repository(name, options[:id], options[:provider])
399
+ say "A new group repository named #{name} has been created.", :blue
400
+ end
401
+ end
402
+
403
+ desc "get_group_repository group_id", "Gets information about the given group repository."
404
+ def get_group_repository(group_id)
405
+ say nexus_remote.get_group_repository(group_id), :green
406
+ end
407
+
408
+ desc "add_to_group_repository group_id repository_to_add_id", "Adds a repository with the given id into the group repository."
409
+ def add_to_group_repository(group_id, repository_to_add_id)
410
+ if nexus_remote.add_to_group_repository(group_id, repository_to_add_id)
411
+ say "The repository #{repository_to_add_id} has been added to the repository group #{group_id}", :blue
412
+ end
413
+ end
414
+
415
+ desc "remove_from_group_repository group_id repository_to_remove_id", "Remove a repository with the given id from the group repository."
416
+ def remove_from_group_repository(group_id, repository_to_remove_id)
417
+ if nexus_remote.remove_from_group_repository(group_id, repository_to_remove_id)
418
+ say "The repository with an id of #{repository_to_remove_id} has been removed from the group repository, #{group_id}.", :blue
419
+ end
420
+ end
421
+
422
+ desc "delete_group_repository group_id","Deletes a group repository based on the given id."
423
+ def delete_group_repository(group_id)
424
+ if nexus_remote.delete_group_repository(group_id)
425
+ say "The group repository, #{group_id} has been deleted.", :blue
426
+ end
427
+ end
428
+
429
+ desc "transfer_artifact coordinates from_repository to_repository", "Transfers a given artifact from one repository to another."
430
+ def transfer_artifact(coordinates, from_repository, to_repository)
431
+ if nexus_remote.transfer_artifact(coordinates, from_repository, to_repository)
432
+ say "The artifact #{coordinates} has been transferred from #{from_repository} to #{to_repository}.", :blue
433
+ end
434
+ end
435
+
436
+ private
437
+
438
+ def nexus_remote
439
+ begin
440
+ nexus_remote ||= RemoteFactory.create(options[:overrides], options[:ssl_verify])
441
+ rescue NexusCliError => e
442
+ say e.message, :red
443
+ exit e.status_code
444
+ end
445
+ end
446
+
447
+ def ask_user(params, ask_username=true, ask_password=true)
448
+ username = params[:username]
449
+ first_name = params[:first_name]
450
+ last_name = params[:last_name]
451
+ email = params[:email]
452
+ enabled = params[:enabled]
453
+ password = params[:password]
454
+ roles = params[:roles]
455
+ status = enabled
456
+
457
+ if username.nil? && ask_username
458
+ username = ask "Please enter the username:"
459
+ end
460
+ if first_name.nil?
461
+ first_name = ask "Please enter the first name:"
462
+ end
463
+ if last_name.nil?
464
+ last_name = ask "Please enter the last name:"
465
+ end
466
+ if email.nil?
467
+ email = ask "Please enter the email:"
468
+ end
469
+ if enabled.nil?
470
+ status = ask "Is this user enabled for use?", :limited_to => ["true", "false"]
471
+ end
472
+ if password.nil? && ask_password
473
+ password = ask_password("Please enter a password:")
474
+ end
475
+ if roles.size == 0
476
+ roles = ask "Please enter the roles:"
477
+ end
478
+ params = {:userId => username}
479
+ params[:firstName] = first_name
480
+ params[:lastName] = last_name
481
+ params[:email] = email
482
+ params[:status] = status == true ? "active" : "disabled"
483
+ params[:password] = password
484
+ params[:roles] = roles.kind_of?(Array) ? roles : roles.split(' ')
485
+ params
486
+ end
487
+
488
+ def ask_password(message)
489
+ HighLine.new.ask(message) do |q|
490
+ q.echo = false
491
+ end
492
+ end
493
+ end
494
+ end
495
+ end
496
+ end
@@ -0,0 +1,6 @@
1
+ module NexusCli
2
+ # @return [String]
3
+ def self.version
4
+ @version ||= File.read(File.expand_path("../../../VERSION", __FILE__)).strip
5
+ end
6
+ end
data/lib/nexus_cli.rb ADDED
@@ -0,0 +1,44 @@
1
+ require 'forwardable'
2
+ require 'httpclient'
3
+ require 'nexus_cli/errors'
4
+ require 'rexml/document'
5
+ require 'yaml'
6
+ require 'active_support/core_ext/hash'
7
+
8
+ module NexusCli
9
+ DEFAULT_ACCEPT_HEADER = {
10
+ "Accept" => "application/json"
11
+ }.freeze
12
+
13
+ DEFAULT_CONTENT_TYPE_HEADER = {
14
+ "Content-Type" => "application/json"
15
+ }.freeze
16
+
17
+ autoload :Artifact, 'nexus_cli/artifact'
18
+ autoload :Tasks, 'nexus_cli/tasks'
19
+ autoload :Cli, 'nexus_cli/cli'
20
+ autoload :Connection, 'nexus_cli/connection'
21
+ autoload :RemoteFactory, 'nexus_cli/remote_factory'
22
+ autoload :BaseRemote, 'nexus_cli/base_remote'
23
+ autoload :OSSRemote, 'nexus_cli/remote/oss_remote'
24
+ autoload :ProRemote, 'nexus_cli/remote/pro_remote'
25
+ autoload :Configuration, 'nexus_cli/configuration'
26
+ autoload :N3Metadata, 'nexus_cli/n3_metadata'
27
+ autoload :ArtifactActions, 'nexus_cli/mixins/artifact_actions'
28
+ autoload :GlobalSettingsActions, 'nexus_cli/mixins/global_settings_actions'
29
+ autoload :UserActions, 'nexus_cli/mixins/user_actions'
30
+ autoload :RepositoryActions, 'nexus_cli/mixins/repository_actions'
31
+ autoload :LoggingActions, 'nexus_cli/mixins/logging_actions'
32
+ autoload :CustomMetadataActions, 'nexus_cli/mixins/pro/custom_metadata_actions'
33
+ autoload :SmartProxyActions, 'nexus_cli/mixins/pro/smart_proxy_actions'
34
+
35
+ class << self
36
+ def root
37
+ @root ||= Pathname.new(File.expand_path('../', File.dirname(__FILE__)))
38
+ end
39
+
40
+ def ui
41
+ @ui ||= Thor::Shell::Color.new
42
+ end
43
+ end
44
+ end
data/nexus_cli.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require 'nexus_cli/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "nexus_cli_sb"
7
+ s.version = NexusCli.version
8
+ s.authors = ["Kyle Allan"]
9
+ s.email = ["kallan@riotgames.com"]
10
+ s.homepage = "https://github.com/RiotGames/nexus_cli"
11
+ s.summary = %q{A command-line wrapper for making REST calls to Sonatype Nexus.}
12
+ s.description = s.summary
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib"]
18
+
19
+ s.add_dependency 'thor'
20
+ s.add_dependency 'httpclient', '= 2.2.5'
21
+ s.add_dependency 'json'
22
+ s.add_dependency 'highline'
23
+ s.add_dependency 'jsonpath'
24
+ s.add_runtime_dependency 'activesupport', '~> 3.2.0'
25
+
26
+ s.add_development_dependency 'rspec'
27
+ s.add_development_dependency 'aruba', "= 0.5.0"
28
+ s.add_development_dependency 'cucumber'
29
+ s.add_development_dependency 'rake'
30
+ s.add_development_dependency 'webmock'
31
+ end
@@ -0,0 +1,10 @@
1
+ <search-results>
2
+ <data>
3
+ <artifact>
4
+ <info>test</info>
5
+ </artifact>
6
+ <artifact>
7
+ <info>test 2</info>
8
+ </artifact>
9
+ </data>
10
+ </search-results>
@@ -0,0 +1,4 @@
1
+ url: "http://localhost:8081/nexus/"
2
+ repository: "test"
3
+ username: "test"
4
+ password: "test"
@@ -0,0 +1,22 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ require 'spork'
4
+
5
+ Spork.prefork do
6
+ require 'webmock/rspec'
7
+
8
+ APP_ROOT = File.expand_path('../../', __FILE__)
9
+ ENV["NEXUS_CONFIG"] = File.join(APP_ROOT, "spec", "fixtures", "nexus.config")
10
+ end
11
+
12
+ Spork.each_run do
13
+ require 'nexus_cli'
14
+ end
15
+
16
+ def app_root_path
17
+ Pathname.new(File.expand_path('../..', __FILE__))
18
+ end
19
+
20
+ def fixtures_path
21
+ app_root_path.join('spec/fixtures')
22
+ end