Class: Xccoveralls::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/xccoveralls/options.rb

Class Method Summary collapse

Class Method Details

.available_optionsObject

rubocop:disable Metrics/MethodLength, Metrics/LineLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity



5
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/xccoveralls/options.rb', line 5

def self.available_options # rubocop:disable Metrics/MethodLength, Metrics/LineLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
  root_path = `git rev-parse --show-toplevel`.strip
  [
    FastlaneCore::ConfigItem.new(
      key: :source_path,
      short_option: '-s',
      optional: true,
      env_name: 'XCCOVERALLS_SOURCE_PATH',
      description: 'Path to project root',
      default_value: root_path,
      verify_block: proc do |value|
        v = File.expand_path(value.to_s)
        File.exist?(v) ||
          user_error!("Source path #{v} does not exist")
        File.directory?(v) ||
          user_error!("Source path #{v} is not a directory")
      end
    ),
    FastlaneCore::ConfigItem.new(
      key: :derived_data_path,
      short_option: '-d',
      optional: true,
      env_name: 'XCCOVERALLS_DERIVED_DATA_PATH',
      description: 'Path to DerivedData',
      default_value: "#{ENV.fetch('HOME')}/Library/Developer/Xcode/DerivedData", # rubocop:disable Metrics/LineLength
      verify_block: proc do |value|
        v = File.expand_path(value.to_s)
        File.exist?(v) ||
          user_error!("Source path #{v} does not exist")
        File.directory?(v) ||
          user_error!("Source path #{v} is not a directory")
      end
    ),
    FastlaneCore::ConfigItem.new(
      key: :ignorefile_path,
      short_option: '-i',
      optional: true,
      env_name: 'XCCOVERALLS_IGNOREFILE_PATH',
      description: 'Path to Ignorefile',
      default_value: nil,
      verify_block: proc do |value|
        value.nil? && return
        v = File.expand_path(value.to_s)
        File.exist?(v) ||
          user_error!("Ignorefile does not exist at #{v}")
        File.file?(v) ||
          user_error!("#{v} is not a file")
      end
    ),
    FastlaneCore::ConfigItem.new(
      key: :repo_token,
      short_option: '-T',
      optional: true,
      env_name: 'XCCOVERALLS_REPO_TOKEN',
      description: 'Coveralls secret repo token'
    )
  ]
end

.user_error!(msg) ⇒ Object



66
67
68
# File 'lib/xccoveralls/options.rb', line 66

def self.user_error!(msg)
  FastlaneCore::UI.user_error!(msg)
end