Class: Fastlane::Actions::CarthageCacheFtpsAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



43
44
45
# File 'lib/fastlane/plugin/carthage_cache_ftps/actions/carthage_cache_ftps_action.rb', line 43

def self.authors
  ["Wolfgang Lutz"]
end

.available_optionsObject



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/fastlane/plugin/carthage_cache_ftps/actions/carthage_cache_ftps_action.rb', line 55

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :host,
                            env_name: "CARTHAGE_CACHE_FTPS_HOST",
                         description: "The ftps host to use for carthage cache",
                            optional: false,
                                type: String,
                       default_value: "127.0.0.1",
                        short_option: "h"),
    FastlaneCore::ConfigItem.new(key: :username,
                            env_name: "CARTHAGE_CACHE_FTPS_USERNAME",
                         description: "The ftps username to use for carthage cache",
                            optional: false,
                                type: String,
                       default_value: "anonymous",
                        short_option: "u"),
    FastlaneCore::ConfigItem.new(key: :password,
                            env_name: "CARTHAGE_CACHE_FTPS_PASSWORD",
                         description: "The ftps password to use for carthage cache. If not given, keychain is used",
                            optional: true,
                                type: String,
                           sensitive: true,
                        short_option: "p"),
    FastlaneCore::ConfigItem.new(key: :command,
                            env_name: "CARTHAGE_CACHE_COMMAND",
                         description: "The carthage cache command to use. Allowed values: publish, install",
                            optional: false,
                                type: String,
                       default_value: "install",
                        short_option: "c",
                        verify_block: proc do |value|
                                        UI.user_error!("Unknown carthage cache command. Allowed: install, publish") unless ["install", "publish"].include?(value)
                                      end),
    FastlaneCore::ConfigItem.new(key: :subfolder,
                            env_name: "CARTHAGE_CACHE_FTPS_SUBFOLDER",
                         description: "The subfolder to use for carthage cache",
                            optional: true,
                                type: String,
                       default_value: "carthage_cache",
                        short_option: "f"),
    FastlaneCore::ConfigItem.new(key: :local_path,
                            env_name: "CARTHAGE_CACHE_FTPS_LOCAL_PATH",
                         description: "The path to the folder containing the 'Carthage' folder",
                            optional: true,
                                type: String,
                       default_value: ".",
                        short_option: "l")
  ]
end

.descriptionObject



39
40
41
# File 'lib/fastlane/plugin/carthage_cache_ftps/actions/carthage_cache_ftps_action.rb', line 39

def self.description
  "Allows to publish or install the carthage builds via ftps to avoid recompilation"
end

.detailsObject



51
52
53
# File 'lib/fastlane/plugin/carthage_cache_ftps/actions/carthage_cache_ftps_action.rb', line 51

def self.details
  "This plugin extends the carthage_cache_gem with ftps functionality, to be able to cache the built carthage libraries remotely on an ftp server."
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


105
106
107
# File 'lib/fastlane/plugin/carthage_cache_ftps/actions/carthage_cache_ftps_action.rb', line 105

def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end

.return_valueObject



47
48
49
# File 'lib/fastlane/plugin/carthage_cache_ftps/actions/carthage_cache_ftps_action.rb', line 47

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/fastlane/plugin/carthage_cache_ftps/actions/carthage_cache_ftps_action.rb', line 6

def self.run(params)
  FastlaneCore::PrintTable.print_values(config: params, title: "Summary for Carthage Cache FTPS")

  host = params.values[:host]
  remote_subfolder = params.values[:subfolder]
  username = params.values[:username]
  password = params.values[:password] || PasswordHelper.new.password(host, username)

  config = {
            bucket_name: remote_subfolder,
            aws_s3_client_options: {
              region: host,
              aws_access_key_id: username,
              secret_access_key: password,
              access_key_id: "bla"
              }
            }

  local_path = params.values[:local_path]
  application = CarthageCache::Application.new(local_path, true, config, repository: FTPRepository)

  puts application.inspect

  command = params.values[:command]

  case command.to_sym
  when :install
    exit 1 unless application.install_archive
  when :publish
    exit 1 unless application.create_archive
  end
end