Class: ArgumentHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/jenkins_util/argument_handler.rb

Overview

rubocop:disable Metrics/ClassLength

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeArgumentHandler

rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength



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
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/jenkins_util/argument_handler.rb', line 30

def initialize
  @keychain = nil
  @keychain_password = nil
  @code_signing_identities = []
  @provisioning_profiles = []
  @dropbox_sources = []
  @dropbox_destination = nil
  @dropbox_flatten = true
  @dropbox_root = Dir.pwd
  @kill_simulators = false
  @xcode_project_path = nil
  @xcode_export_plist = nil
  @xcode_target = nil
  @xcode_build_configuration = nil
  @xcode_bundle_identifier = nil
  @xcode_build_number = nil
  @xcode_set_manual_provisioning_style = nil
  @xcode_archive_plist = nil
  @zip_sources = []
  @zip_archive = nil
  @zip_destination = nil
  @verbose = false
  @version = false

  ARGV.push('-h') if ARGV.empty?

  # rubocop:disable Metrics/BlockLength
  parser = OptionParser.new do |opts|
    opts.banner = 'Usage: jenkins_util'

    # keychain_util
    opts.on('-k', '--keychain [KEYCHAIN_PATH]', 'Path to Keychain to be unlocked') do |keychain|
      @keychain = keychain
    end

    # keychain_util
    opts.on('-p', '--keychain-password [KEYCHAIN_PASSWORD]', 'Password for Keychain to be unlocked') do |password|
      @keychain_password = password
    end

    # keychain_util
    opts.on('-c', '--code-signing-identities c1,c2', Array, 'Provisioning Profiles to check after keychain is unlocked') do |identities|
      @code_signing_identities = identities
    end

    # keychain_util
    opts.on('-P', '--provisioning-profiles p1,p2', Array, 'Provisioning Profiles to check after keychain is unlocked') do |profiles|
      @provisioning_profiles = profiles
    end

    # dropbox_util
    opts.on('-s', '--dropbox-sources s1,s2', Array, 'A set of paths/matchers for uploading to dropbox') do |sources|
      @dropbox_sources = sources
    end

    # dropbox_util
    opts.on('-d', '--dropbox-destination x', 'The dropbox destination usually /L4Builds/Path') do |destination|
      @dropbox_destination = destination
    end

    # dropbox_util
    opts.on('-f', '--dropbox-keep-folders', 'If passed file folders will be preserved') do
      @dropbox_flatten = false
    end

    # dropbox_util
    opts.on('-r', '--dropbox-root x', 'The path to remove when uploading defaults to pwd') do |root|
      @dropbox_root = root
    end

    # simulator_util
    opts.on('-K', '--kill-simulators', 'Shutdown and reset all iOS simulators') do
      @kill_simulators = true
    end

    # xcode_util
    opts.on('--xcode-project project', 'Path to an Xcode project file') do |project_path|
      @xcode_project_path = project_path
    end

    opts.on('--xcode-get-team-id plist', 'Path to an Xcode export plist') do |export_plist|
      @xcode_export_plist = export_plist
    end

    opts.on('--xcode-target target', 'Target to update in the Xcode project specified with --xcode-project') do |target|
      @xcode_target = target
    end

    opts.on('--xcode-build-configuration build_configuration',
            'Build configuration to update in the Xcode project specified with --xcode-project') do |build_configuration|
      @xcode_build_configuration = build_configuration
    end

    opts.on('--xcode-bundle-identifier identifer',
            'Bundle identifier to set in the Xcode project specified with --xcode-project') do |bundle_identifier|
      @xcode_bundle_identifier = bundle_identifier
    end

    opts.on('--xcode-append-bundle-version version',
            'the version passed is appended to the build version Xcode project specified with --xcode-project') do |build_number|
      @xcode_build_number = build_number
    end

    opts.on('--xcode-set-manual-provisioning-style', 'Set project to automatically sign if true and Manual if false') do
      @xcode_set_manual_provisioning_style = true
    end

    opts.on('--xcode-get-build-name archive-plist', 'Gets the build name "NAME_v_VERSION_b_BUILD"') do |archive_plist|
      @xcode_archive_plist = archive_plist
    end

    # zip_util
    opts.on('--zip-compress s1,s2,s3', Array, 'Compress files into zip archive') do |sources|
      @zip_sources = sources
    end

    opts.on('--zip-uncompress zip_archive', 'Uncompress zip archive') do |zip_archive|
      @zip_archive = zip_archive
    end

    opts.on('--zip-destination destination',
            'The path to save a new zip archive for a --zip-compress',
            'The path to a directory to uncompress a zip archive for --zip-uncompress') do |destination|
      @zip_destination = destination
    end

    # logger_util
    opts.on('--verbose', 'Output more information') do
      @verbose = true
    end

    opts.on_tail('-h', '--help', 'Show this message') do
      puts opts
      abort
    end

    opts.on_tail('-v', '--version', 'Display Current version') do
      @version = true
    end
  end

  parser.parse!
end

Instance Attribute Details

#code_signing_identitiesObject (readonly)

Returns the value of attribute code_signing_identities.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def code_signing_identities
  @code_signing_identities
end

#dropbox_destinationObject (readonly)

Returns the value of attribute dropbox_destination.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def dropbox_destination
  @dropbox_destination
end

#dropbox_flattenObject (readonly)

Returns the value of attribute dropbox_flatten.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def dropbox_flatten
  @dropbox_flatten
end

#dropbox_rootObject (readonly)

Returns the value of attribute dropbox_root.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def dropbox_root
  @dropbox_root
end

#dropbox_sourcesObject (readonly)

Returns the value of attribute dropbox_sources.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def dropbox_sources
  @dropbox_sources
end

#keychainObject (readonly)

Returns the value of attribute keychain.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def keychain
  @keychain
end

#keychain_passwordObject (readonly)

Returns the value of attribute keychain_password.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def keychain_password
  @keychain_password
end

#kill_simulatorsObject (readonly)

Returns the value of attribute kill_simulators.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def kill_simulators
  @kill_simulators
end

#provisioning_profilesObject (readonly)

Returns the value of attribute provisioning_profiles.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def provisioning_profiles
  @provisioning_profiles
end

#verboseObject (readonly)

Returns the value of attribute verbose.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def verbose
  @verbose
end

#versionObject (readonly)

Returns the value of attribute version.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def version
  @version
end

#xcode_archive_plistObject (readonly)

Returns the value of attribute xcode_archive_plist.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def xcode_archive_plist
  @xcode_archive_plist
end

#xcode_build_configurationObject (readonly)

Returns the value of attribute xcode_build_configuration.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def xcode_build_configuration
  @xcode_build_configuration
end

#xcode_build_numberObject (readonly)

Returns the value of attribute xcode_build_number.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def xcode_build_number
  @xcode_build_number
end

#xcode_bundle_identifierObject (readonly)

Returns the value of attribute xcode_bundle_identifier.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def xcode_bundle_identifier
  @xcode_bundle_identifier
end

#xcode_export_plistObject (readonly)

Returns the value of attribute xcode_export_plist.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def xcode_export_plist
  @xcode_export_plist
end

#xcode_project_pathObject (readonly)

Returns the value of attribute xcode_project_path.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def xcode_project_path
  @xcode_project_path
end

#xcode_set_manual_provisioning_styleObject (readonly)

Returns the value of attribute xcode_set_manual_provisioning_style.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def xcode_set_manual_provisioning_style
  @xcode_set_manual_provisioning_style
end

#xcode_targetObject (readonly)

Returns the value of attribute xcode_target.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def xcode_target
  @xcode_target
end

#zip_archiveObject (readonly)

Returns the value of attribute zip_archive.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def zip_archive
  @zip_archive
end

#zip_destinationObject (readonly)

Returns the value of attribute zip_destination.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def zip_destination
  @zip_destination
end

#zip_sourcesObject (readonly)

Returns the value of attribute zip_sources.



5
6
7
# File 'lib/jenkins_util/argument_handler.rb', line 5

def zip_sources
  @zip_sources
end