Class: Commands::Switch
- Inherits:
-
Object
- Object
- Commands::Switch
- Defined in:
- lib/app-runner/commands/switch.rb
Instance Method Summary collapse
- #download(serviceUrl, artifactUrl, destination) ⇒ Object
- #execute(global_options, options, args) ⇒ Object
Instance Method Details
#download(serviceUrl, artifactUrl, destination) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/app-runner/commands/switch.rb', line 19 def download(serviceUrl, artifactUrl, destination) url="#{serviceUrl}/api/artifacts/url/#{artifactUrl}" exitCode=system("wget \"#{url}\" -O /tmp/artifact") if exitCode FileUtils.mv '/tmp/artifact', destination['dir']+"/"+destination['filename'], :force => true else raise "Can't download artifact" end end |
#execute(global_options, options, args) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/app-runner/commands/switch.rb', line 5 def execute(, , args) config=['configHash']; serviceUrl=ENV['artifacts_url'] or config["url"]; if (["url"]) download(serviceUrl, ["url"], config["destination"]) elsif (["v"] && ["t"]=='mvn') mvn=config["mvn"]; download(serviceUrl, "#{['t']}:#{mvn["group"]}:#{mvn["artifactId"]}:#{['v']}:#{mvn["type"]}", config["destination"]) else p "Not suported yet this combination" end end |