Class: Fastlane::Actions::InitAction

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

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



42
43
44
# File 'lib/fastlane/plugin/apprepo/actions/init.rb', line 42

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

.available_optionsObject



38
39
40
# File 'lib/fastlane/plugin/apprepo/actions/init.rb', line 38

def self.available_options
  []
end

.descriptionObject



34
35
36
# File 'lib/fastlane/plugin/apprepo/actions/init.rb', line 34

def self.description
  'Initializes Repofile'
end

.is_supported?(_platform) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/fastlane/plugin/apprepo/actions/init.rb', line 46

def self.is_supported?(_platform)
  true
end

.run(_params) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fastlane/plugin/apprepo/actions/init.rb', line 9

def self.run(_params)
  # sh 'bundle exec rubocop -D'
  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
end