lib/nexus_cli/remote.rb in nexus_cli-0.1.0 vs lib/nexus_cli/remote.rb in nexus_cli-0.1.1
- old
+ new
@@ -24,11 +24,12 @@
def nexus
@nexus ||= RestClient::Resource.new configuration["url"], :user => configuration["username"], :password => configuration["password"]
end
- def pull_artifact(artifact, destination)
+ def pull_artifact(artifact, destination, overrides)
+ parse_overrides(overrides)
split_artifact = artifact.split(":")
if(split_artifact.size < 4)
raise ArtifactMalformedException
end
begin
@@ -42,12 +43,13 @@
artifact.write(fileData)
artifact.close()
File.expand_path(artifact.path)
end
- def push_artifact(artifact, file, insecure, override_repository)
+ def push_artifact(artifact, file, insecure, overrides)
#Build up the pieces that will make up the PUT request
+ parse_overrides(overrides)
split_artifact = artifact.split(":")
if(split_artifact.size < 4)
raise ArtifactMalformedException
end
artifact_id = split_artifact[0].gsub(".", "/")
@@ -84,11 +86,12 @@
delete_string = "content/repositories/releases/#{artifact_id}/#{group_id}/#{version}"
Kernel.quietly {`curl --request DELETE #{File.join(configuration['url'], delete_string)} -u #{configuration['username']}:#{configuration['password']}`}
end
- def get_artifact_info(artifact)
+ def get_artifact_info(artifact, overrides)
+ parse_overrides(overrides)
split_artifact = artifact.split(":")
if(split_artifact.size < 4)
raise ArtifactMalformedException
end
begin
@@ -101,9 +104,15 @@
private
def validate_config(configuration)
["url", "repository", "username","password"].each do |key|
raise InvalidSettingsException.new(key) unless configuration.has_key?(key)
+ end
+ end
+
+ def parse_overrides(overrides)
+ overrides.each do |key, value|
+ configuration[key] = value unless configuration[key].nil?
end
end
end
end
end
\ No newline at end of file