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



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/fastlane/plugin/sftp/helper/options.rb', line 98

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',
        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



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
# File 'lib/fastlane/plugin/sftp/helper/options.rb', line 67

def self.available_options_upload
  return [].concat(general_options).concat(
    [
      FastlaneCore::ConfigItem.new(
        key: :delete_target_dir,
        short_option: '-b',
        optional: true,
        env_name: 'DELETE_TARGET_DIR',
        type: Boolean,
        description: 'Specify, if an existing target folder should be deleted prior to uploading files',
        default_value: false
      ),
      FastlaneCore::ConfigItem.new(
        key: :target_dir,
        short_option: '-x',
        description: 'target path on the server'
      ),
      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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# 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_port,
      short_option: '-t',
      optional: true,
      env_name: 'SERVER_PORT',
      type: Integer,
      description: 'PORT used to connect to the server. Defaults to 22',
      default_value: 22
    ),
    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 'server_password' and '#{value.key}' options in one run.")
      end
    ),
    FastlaneCore::ConfigItem.new(
      key: :server_key,
      short_option: '-k',
      optional: true,
      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 'server_key' and '#{value.key}' options in one run.")
      end,
      verify_block: proc do |value|
        UI.user_error!("Key file '#{value}' does not exist") unless File.exist?(value)
      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