Class: Fastlane::Actions::ImportFromUrlAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/import_from_url/actions/import_from_url_action.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ ImportFromUrlAction

Returns a new instance of ImportFromUrlAction.



66
67
68
69
70
# File 'lib/fastlane/plugin/import_from_url/actions/import_from_url_action.rb', line 66

def initialize(params)
  @url_address = params[:url]
  @download_path = params[:path]
  @file_name = params[:file_name]
end

Instance Attribute Details

#download_pathObject (readonly)

Returns the value of attribute download_path.



10
11
12
# File 'lib/fastlane/plugin/import_from_url/actions/import_from_url_action.rb', line 10

def download_path
  @download_path
end

#file_nameObject (readonly)

Returns the value of attribute file_name.



10
11
12
# File 'lib/fastlane/plugin/import_from_url/actions/import_from_url_action.rb', line 10

def file_name
  @file_name
end

#file_pathObject (readonly)

Returns the value of attribute file_path.



10
11
12
# File 'lib/fastlane/plugin/import_from_url/actions/import_from_url_action.rb', line 10

def file_path
  @file_path
end

#url_addressObject (readonly)

Returns the value of attribute url_address.



10
11
12
# File 'lib/fastlane/plugin/import_from_url/actions/import_from_url_action.rb', line 10

def url_address
  @url_address
end

Class Method Details

.authorsObject



45
46
47
# File 'lib/fastlane/plugin/import_from_url/actions/import_from_url_action.rb', line 45

def authors
  ["Doruk Kangal"]
end

.available_optionsObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/fastlane/plugin/import_from_url/actions/import_from_url_action.rb', line 17

def available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :url,
      env_name: "IMPORT_FROM_URL",
      description: "The url address of the Fastfile to use its lanes",
      optional: false,
      type: String
    ),

    FastlaneCore::ConfigItem.new(
      key: :file_name,
      env_name: "IMPORT_FROM_FILE_NAME",
      description: "The name of the file to be downloaded",
      optional: true,
      type: String
    ),

    FastlaneCore::ConfigItem.new(
      key: :path,
      env_name: "IMPORT_FROM_FILE_NAME",
      description: "The path of the file to be downloaded",
      optional: true,
      type: String
    )
  ]
end

.descriptionObject



49
50
51
# File 'lib/fastlane/plugin/import_from_url/actions/import_from_url_action.rb', line 49

def description
  "Import another Fastfile from given url to use its lanes"
end

.detailsObject



53
54
55
# File 'lib/fastlane/plugin/import_from_url/actions/import_from_url_action.rb', line 53

def details
  "This is useful if you have shared lanes across multiple apps and you want to store a Fastfile in a url"
end

.example_codeObject



57
58
59
60
61
62
63
# File 'lib/fastlane/plugin/import_from_url/actions/import_from_url_action.rb', line 57

def example_code
  "import_from_url(
  url: '<the url of the Fastfile to be downloaded>', # Required and cannot be empty,
  path: '<the path of the Fastfile to be downloaded>', # Optional and default is fastlane/.cache
  file_name: '<the name of the Fastfile to be downloaded>' # Optional and default is DownloadedFastfile
)"
end

.run(params) ⇒ Object



13
14
15
# File 'lib/fastlane/plugin/import_from_url/actions/import_from_url_action.rb', line 13

def run(params)
  new(params).import
end

Instance Method Details

#importObject



72
73
74
75
76
77
# File 'lib/fastlane/plugin/import_from_url/actions/import_from_url_action.rb', line 72

def import
  return UI.user_error!("The url address #{url_address} is not valid.") unless url_valid?

  download_fast_file
  import_to_fastlane
end