Class: Fastlane::Actions::DownloadAction
Class Method Summary
collapse
action_name, author, return_value, sh, step_text
Class Method Details
.authors ⇒ Object
57
58
59
|
# File 'lib/fastlane/actions/download.rb', line 57
def self.authors
["KrauseFx"]
end
|
.available_options ⇒ Object
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/fastlane/actions/download.rb', line 40
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :url,
env_name: "FL_DOWNLOAD_URL",
description: "The URL that should be downloaded",
verify_block: proc do |value|
Helper.log.warn "The URL doesn't start with http or https" unless value.start_with?("http")
end)
]
end
|
.description ⇒ Object
28
29
30
|
# File 'lib/fastlane/actions/download.rb', line 28
def self.description
"Download a file from a remote server (e.g. JSON file)"
end
|
.details ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/fastlane/actions/download.rb', line 32
def self.details
[
"Specify the URL to download and get the content as a return value",
"For more advanced networking code, use the Ruby functions instead:",
"http://docs.ruby-lang.org/en/2.0.0/Net/HTTP.html"
].join("\n")
end
|
.is_supported?(platform) ⇒ Boolean
61
62
63
|
# File 'lib/fastlane/actions/download.rb', line 61
def self.is_supported?(platform)
true
end
|
.output ⇒ Object
51
52
53
54
55
|
# File 'lib/fastlane/actions/download.rb', line 51
def self.output
[
['DOWNLOAD_CONTENT', 'The content of the file we just downloaded']
]
end
|
.run(params) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/fastlane/actions/download.rb', line 8
def self.run(params)
require 'net/http'
begin
result = Net::HTTP.get(URI(params[:url]))
begin
result = JSON.parse(result) rescue
end
Actions.lane_context[SharedValues::DOWNLOAD_CONTENT] = result
rescue => ex
raise "Error fetching remote file: #{ex}"
end
end
|