Class: Fastlane::Actions::RunAction

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

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



59
60
61
# File 'lib/fastlane/plugin/apprepo/actions/run.rb', line 59

def self.authors
  ['[email protected]']
end

.available_optionsObject



55
56
57
# File 'lib/fastlane/plugin/apprepo/actions/run.rb', line 55

def self.available_options
  []
end

.descriptionObject



51
52
53
# File 'lib/fastlane/plugin/apprepo/actions/run.rb', line 51

def self.description
  'Runs the default Apprepo action'
end

.is_supported?(_platform) ⇒ Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/fastlane/plugin/apprepo/actions/run.rb', line 63

def self.is_supported?(_platform)
  true
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
38
39
40
41
42
43
44
45
# File 'lib/fastlane/plugin/apprepo/actions/run.rb', line 6

def self.run(_params)
  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!

  puts _params

  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
end