nexus_cli 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -26,7 +26,8 @@ module NexusCli
26
26
  @nexus ||= RestClient::Resource.new configuration["url"], :user => configuration["username"], :password => configuration["password"]
27
27
  end
28
28
 
29
- def pull_artifact(artifact, destination)
29
+ def pull_artifact(artifact, destination, overrides)
30
+ parse_overrides(overrides)
30
31
  split_artifact = artifact.split(":")
31
32
  if(split_artifact.size < 4)
32
33
  raise ArtifactMalformedException
@@ -44,8 +45,9 @@ module NexusCli
44
45
  File.expand_path(artifact.path)
45
46
  end
46
47
 
47
- def push_artifact(artifact, file, insecure, override_repository)
48
+ def push_artifact(artifact, file, insecure, overrides)
48
49
  #Build up the pieces that will make up the PUT request
50
+ parse_overrides(overrides)
49
51
  split_artifact = artifact.split(":")
50
52
  if(split_artifact.size < 4)
51
53
  raise ArtifactMalformedException
@@ -86,7 +88,8 @@ module NexusCli
86
88
  Kernel.quietly {`curl --request DELETE #{File.join(configuration['url'], delete_string)} -u #{configuration['username']}:#{configuration['password']}`}
87
89
  end
88
90
 
89
- def get_artifact_info(artifact)
91
+ def get_artifact_info(artifact, overrides)
92
+ parse_overrides(overrides)
90
93
  split_artifact = artifact.split(":")
91
94
  if(split_artifact.size < 4)
92
95
  raise ArtifactMalformedException
@@ -105,6 +108,12 @@ module NexusCli
105
108
  raise InvalidSettingsException.new(key) unless configuration.has_key?(key)
106
109
  end
107
110
  end
111
+
112
+ def parse_overrides(overrides)
113
+ overrides.each do |key, value|
114
+ configuration[key] = value unless configuration[key].nil?
115
+ end
116
+ end
108
117
  end
109
118
  end
110
119
  end
@@ -10,10 +10,14 @@ module NexusCli
10
10
  :type => :string,
11
11
  :default => nil,
12
12
  :desc => "A different folder other than the current working directory."
13
+ method_option :overrides,
14
+ :type => :hash,
15
+ :default => {},
16
+ :desc => "A hashed list of overrides. Available options are 'url', 'repository', 'username', and 'password'."
13
17
  desc "pull_artifact artifact", "Pulls an artifact from Nexus and places it on your machine."
14
18
  def pull_artifact(artifact)
15
19
  begin
16
- path_to_artifact = Remote.pull_artifact(artifact, options[:destination])
20
+ path_to_artifact = Remote.pull_artifact(artifact, options[:destination], options[:overrides])
17
21
  say "Artifact has been retrived and can be found at path: #{path_to_artifact}", :green
18
22
  rescue NexusCliError => e
19
23
  say e.message, :red
@@ -25,14 +29,14 @@ module NexusCli
25
29
  :type => :boolean,
26
30
  :default => false,
27
31
  :desc => "Overrides any failures because of an 'insecure' SSL conncetion."
28
- method_option :repository,
29
- :type => :string,
30
- :default => nil,
31
- :desc => "A String of a repository that will override the value in the .nexus_cli config file."
32
+ method_option :overrides,
33
+ :type => :hash,
34
+ :default => {},
35
+ :desc => "A hashed list of overrides. Available options are 'url', 'repository', 'username', and 'password'."
32
36
  desc "push_artifact artifact file", "Pushes an artifact from your machine onto the Nexus."
33
37
  def push_artifact(artifact, file)
34
38
  begin
35
- Remote.push_artifact(artifact, file, options[:insecure], options[:repository])
39
+ Remote.push_artifact(artifact, file, options[:insecure], options[:overrides])
36
40
  say "Artifact #{artifact} has been successfully pushed to Nexus.", :green
37
41
  rescue NexusCliError => e
38
42
  say e.message, :red
@@ -40,10 +44,27 @@ module NexusCli
40
44
  end
41
45
  end
42
46
 
47
+ method_option :overrides,
48
+ :type => :hash,
49
+ :default => {},
50
+ :desc => "A hashed list of overrides. Available options are 'url', 'repository', 'username', and 'password'."
43
51
  desc "get_artifact_info artifact", "Gets and returns the XML information about a particular artifact."
44
52
  def get_artifact_info(artifact)
45
53
  begin
46
- say Remote.get_artifact_info(artifact), :green
54
+ say Remote.get_artifact_info(artifact, options[:overrides]), :green
55
+ rescue NexusCliError => e
56
+ say e.message, :red
57
+ exit e.status_code
58
+ end
59
+ end
60
+
61
+ desc "get_nexus_configuration", "Prints out configuration from the .nexus_cli file that helps inform where artifacts will be uploaded."
62
+ def get_nexus_configuration
63
+ begin
64
+ config = Remote.configuration
65
+ say "*********Reading Configuration from #{File.expand_path('~/.nexus_cli')}*********", :blue
66
+ say "Nexus URL: #{config['url']}", :blue
67
+ say "Nexus Repository: #{config['repository']}", :blue
47
68
  rescue NexusCliError => e
48
69
  say e.message, :red
49
70
  exit e.status_code
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexus_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-27 00:00:00.000000000 Z
12
+ date: 2012-07-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -149,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
149
149
  version: '0'
150
150
  segments:
151
151
  - 0
152
- hash: -2766397999758953733
152
+ hash: -112545221912666474
153
153
  required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  none: false
155
155
  requirements:
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  version: '0'
159
159
  segments:
160
160
  - 0
161
- hash: -2766397999758953733
161
+ hash: -112545221912666474
162
162
  requirements: []
163
163
  rubyforge_project:
164
164
  rubygems_version: 1.8.21