Class: Fastlane::Sftp::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/sftp/helper/options.rb

Overview

Provides available options for the commands generator

Class Method Summary collapse

Class Method Details

.available_options_downloadObject



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/fastlane/plugin/sftp/helper/options.rb', line 63

def self.available_options_download
  return [].concat(general_options).concat(
    [
      FastlaneCore::ConfigItem.new(key: :target_dir,
                                    short_option: '-x',
                                    optional: true,
                                    description: 'local target path to a folder where all downloaded files should be put'),
      FastlaneCore::ConfigItem.new(key: :file_paths,
                                    short_option: '-j',
                                    description: 'List of remote files/folders to download relative to the home directory of the user',
                                    type: Array,
                                    verify_block: proc do |value|
                                      UI.user_error!("you must provide at least one file to download") if value.empty?
                                    end)
    ]
  )
end

.available_options_uploadObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/fastlane/plugin/sftp/helper/options.rb', line 45

def self.available_options_upload
  return [].concat(general_options).concat(
    [
      FastlaneCore::ConfigItem.new(key: :target_dir,
                                    short_option: '-x',
                                    description: 'target path on the server relative to the home directory of the user'),
      FastlaneCore::ConfigItem.new(key: :file_paths,
                                    short_option: '-j',
                                    description: 'List of files/folders to upload',
                                    type: Array,
                                    verify_block: proc do |value|
                                      UI.user_error!("you must provide at least one file to upload") if value.empty?
                                      value.each { |entry| UI.user_error!("file '#{entry}' does not exist") unless File.exist?(entry) }
                                    end)
    ]
  )
end

.general_optionsObject



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
38
39
40
41
42
43
# File 'lib/fastlane/plugin/sftp/helper/options.rb', line 7

def self.general_options
  return [
    FastlaneCore::ConfigItem.new(key: :server_url,
                                 short_option: '-r',
                                 optional: false,
                                 env_name: 'SERVER_URL',
                                 description: 'URL of your server'),
    FastlaneCore::ConfigItem.new(key: :server_user,
                                 short_option: '-u',
                                 optional: false,
                                 env_name: 'SERVER_USER',
                                 description: 'USER of your server'),
    FastlaneCore::ConfigItem.new(key: :server_password,
                                 short_option: '-p',
                                 optional: true,
                                 env_name: 'SERVER_PASSWORD',
                                 description: 'PASSWORD for your server (not for production)',
                                 conflicting_options: [:server_key],
                                 conflict_block: proc do |value|
                                   UI.user_error!("You can't use 'password' and '#{value.key}' options in one run.")
                                 end),
    FastlaneCore::ConfigItem.new(key: :server_key,
                                 short_option: '-k',
                                 optional: false,
                                 env_name: 'SERVER_KEY',
                                 description: 'RSA key for your server',
                                 conflicting_options: [:server_password],
                                 conflict_block: proc do |value|
                                   UI.user_error!("You can't use 'repo_key' and '#{value.key}' options in one run.")
                                 end),
    FastlaneCore::ConfigItem.new(key: :server_key_passphrase,
                                 short_option: '-v',
                                 optional: true,
                                 env_name: 'SERVER_KEY_PASSPHRASE',
                                 description: 'Optional passphrase for the RSA key for your server. If required but not provided, user will be asked for')
  ]
end