Class: Xccoveralls::Command

Inherits:
Object
  • Object
show all
Includes:
Commander::Methods
Defined in:
lib/xccoveralls/command.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCommand

rubocop:disable Metrics/MethodLength



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/xccoveralls/command.rb', line 21

def initialize # rubocop:disable Metrics/MethodLength
  program :version, VERSION
  program :description, DESCRIPTION
  program :help, 'Author', 'Atsushi Nagase <[email protected]>'
  program :help, 'Blog', 'https://ngs.io'
  program :help, 'GitHub', 'https://github.com/ngs/xccoveralls'
  program :help_formatter, :compact

  global_option('--verbose') do
    FastlaneCore::Globals.verbose = true
    ENV['COVERALLS_DEBUG'] = '1'
  end

  command(:report) { |command| setup_report(command) }
  default_command :report
end

Class Method Details

.run!Object



14
15
16
17
18
19
# File 'lib/xccoveralls/command.rb', line 14

def self.run!
  FastlaneCore::UpdateChecker.start_looking_for_update NAME
  new.run!
ensure
  FastlaneCore::UpdateChecker.show_update_status NAME, VERSION
end

Instance Method Details

#run_report!(_args, options) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/xccoveralls/command.rb', line 48

def run_report!(_args, options)
  config = FastlaneCore::Configuration.create(
    Options.available_options,
    options.__hash__.reject { |k, _v| k == :verbose }
  )
  Xccoveralls::Runner.new(config.values).run!
end

#setup_report(command) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/xccoveralls/command.rb', line 38

def setup_report(command)
  command.syntax = NAME
  command.description = 'Send Coverage information to Coveralls'
  command.action { |args, options| run_report!(args, options) }
  FastlaneCore::CommanderGenerator.new.generate(
    Options.available_options,
    command: command
  )
end