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
|
# File 'lib/apprepo/commands_generator.rb', line 31
def run
program :version, AppRepo::VERSION
program :description, AppRepo::DESCRIPTION
program :help, 'Author', 'Matej Sychra <[email protected]>'
program :help, 'Website', 'https://github.com/suculent/apprepo'
program :help, 'GitHub', 'https://github.com/suculent/apprepo/tree/master/apprepo'
program :help_formatter, :compact
generator = FastlaneCore::CommanderGenerator.new
generator.generate(AppRepo::Options.available_options)
global_option('--verbose') { $verbose = true }
always_trace!
command :run do |c|
c.syntax = 'apprepo'
c.description = 'Upload IPA and metadata to SFTP (e.g. AppRepo)'
c.action do |_args, options|
config = FastlaneCore::Configuration
available_opts = AppRepo::Options.available_options
options = config.create(available_opts, options.__hash__)
loaded = options.load_configuration_file('Repofile')
loaded = true if options[:repo_description] || options[:ipa]
unless loaded
UI.message('[AppRepo::CommandsGenerator] configuration file not loaded')
if UI.confirm('No Repofile found. Do you want to setup apprepo?')
require 'apprepo/setup'
AppRepo::Setup.new.run(options)
return 0
end
end
AppRepo::Runner.new(options).run
end
end
command :download_manifest do |c|
c.syntax = 'apprepo download_manifest'
c.description = 'Download metadata only'
c.action do |_args, options|
config = FastlaneCore::Configuration
available_opts = AppRepo::Options.available_options
options = config.create(available_opts, options.__hash__)
options.load_configuration_file('Repofile')
AppRepo::Runner.new(options).download_manifest
end
end
command :submit do |c|
c.syntax = 'apprepo submit'
c.description = 'Submit a specific build-nr, use latest.'
c.action do |_args, options|
config = FastlaneCore::Configuration
available_opts = AppRepo::Options.available_options
options = config.create(available_opts, options.__hash__)
options.load_configuration_file('Repofile')
AppRepo::Runner.new(options).run
end
end
command :init do |c|
c.syntax = 'apprepo init'
c.description = 'Create the initial `apprepo` configuration'
c.action do |_args, options|
if File.exist?('Repofile') || File.exist?('fastlane/Repofile')
UI.important('You already got a running apprepo setup.')
return 0
end
require 'apprepo/setup'
config = FastlaneCore::Configuration
available_opts = AppRepo::Options.available_options
options = config.create(available_opts, options.__hash__)
AppRepo::Runner.new(options)
AppRepo::Setup.new.run(options)
end
end
default_command :run
run!
end
|