Class: Fastlane::Actions::DownloadAction
Constant Summary
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Class Method Summary
collapse
action_name, author, deprecated_notes, lane_context, method_missing, other_action, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.authors ⇒ Object
67
68
69
|
# File 'fastlane/lib/fastlane/actions/download.rb', line 67
def self.authors
["KrauseFx"]
end
|
.available_options ⇒ Object
40
41
42
43
44
45
46
47
48
49
|
# File 'fastlane/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|
UI.important("The URL doesn't start with http or https") unless value.start_with?("http")
end)
]
end
|
.category ⇒ Object
63
64
65
|
# File 'fastlane/lib/fastlane/actions/download.rb', line 63
def self.category
:misc
end
|
.description ⇒ Object
28
29
30
|
# File 'fastlane/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 'fastlane/lib/fastlane/actions/download.rb', line 32
def self.details
[
"Specify the URL to download and get the content as a return value.",
"Automatically parses JSON into a Ruby data structure.",
"For more advanced networking code, use the Ruby functions instead: [http://docs.ruby-lang.org/en/2.0.0/Net/HTTP.html](http://docs.ruby-lang.org/en/2.0.0/Net/HTTP.html)."
].join("\n")
end
|
.example_code ⇒ Object
57
58
59
60
61
|
# File 'fastlane/lib/fastlane/actions/download.rb', line 57
def self.example_code
[
'data = download(url: "https://host.com/api.json")'
]
end
|
.is_supported?(platform) ⇒ Boolean
71
72
73
|
# File 'fastlane/lib/fastlane/actions/download.rb', line 71
def self.is_supported?(platform)
true
end
|
.output ⇒ Object
51
52
53
54
55
|
# File 'fastlane/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 'fastlane/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
UI.user_error!("Error fetching remote file: #{ex}")
end
end
|