Class: CoverageCommand

Inherits:
Clamp::Command
  • Object
show all
Defined in:
lib/slather/command/coverage_command.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



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
# File 'lib/slather/command/coverage_command.rb', line 41

def execute
  puts "Slathering..."

  setup_ymlfile # MUST be the first setup
  setup_service_name
  setup_ignore_list
  setup_build_directory
  setup_source_directory
  setup_output_directory
  setup_coverage_service
  setup_verbose_mode
  setup_input_format
  setup_scheme
  setup_configuration
  setup_workspace
  setup_binary_file
  setup_binary_basename
  setup_arch
  setup_source_files
  setup_decimals

  project.configure

  post

  puts "Slathered"
end

#postObject



107
108
109
# File 'lib/slather/command/coverage_command.rb', line 107

def post
  project.post
end

#projectObject



111
112
113
114
115
116
117
118
119
120
# File 'lib/slather/command/coverage_command.rb', line 111

def project
  @project ||= begin
    xcodeproj_path_to_open = xcodeproj_path || Slather::Project.yml["xcodeproj"]
    if xcodeproj_path_to_open
      project = Slather::Project.open(xcodeproj_path_to_open)
    else
      raise StandardError, "Must provide an xcodeproj either via the 'slather [SUBCOMMAND] [PROJECT].xcodeproj' command or through .slather.yml"
    end
  end
end

#setup_archObject



172
173
174
# File 'lib/slather/command/coverage_command.rb', line 172

def setup_arch
  project.arch = arch
end

#setup_binary_basenameObject



168
169
170
# File 'lib/slather/command/coverage_command.rb', line 168

def setup_binary_basename
  project.binary_basename = binary_basename_list if !binary_basename_list.empty?
end

#setup_binary_fileObject



164
165
166
# File 'lib/slather/command/coverage_command.rb', line 164

def setup_binary_file
  project.binary_file = binary_file_list if !binary_file_list.empty?
end

#setup_build_directoryObject



73
74
75
# File 'lib/slather/command/coverage_command.rb', line 73

def setup_build_directory
  project.build_directory = build_directory if build_directory
end

#setup_configurationObject



156
157
158
# File 'lib/slather/command/coverage_command.rb', line 156

def setup_configuration
  project.configuration = configuration
end

#setup_coverage_serviceObject



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/slather/command/coverage_command.rb', line 122

def setup_coverage_service
  if coveralls?
    project.coverage_service = :coveralls
  elsif simple_output?
    project.coverage_service = :terminal
  elsif gutter_json?
    project.coverage_service = :gutter_json
  elsif cobertura_xml?
    project.coverage_service = :cobertura_xml
  elsif llvm_cov?
    project.coverage_service = :llvm_cov
  elsif html?
    project.coverage_service = :html
    project.show_html = show?
    project.cdn_assets = cdn_assets?
  elsif json?
    project.coverage_service = :json
  elsif sonarqube_xml?
    project.coverage_service = :sonarqube_xml
  end
end

#setup_decimalsObject



180
181
182
# File 'lib/slather/command/coverage_command.rb', line 180

def setup_decimals
  project.decimals = decimals if decimals
end

#setup_ignore_listObject



85
86
87
# File 'lib/slather/command/coverage_command.rb', line 85

def setup_ignore_list
  project.ignore_list = ignore_list if !ignore_list.empty?
end

#setup_input_formatObject



148
149
150
# File 'lib/slather/command/coverage_command.rb', line 148

def setup_input_format
  project.input_format = input_format
end

#setup_output_directoryObject



81
82
83
# File 'lib/slather/command/coverage_command.rb', line 81

def setup_output_directory
  project.output_directory = output_directory if output_directory
end

#setup_schemeObject



152
153
154
# File 'lib/slather/command/coverage_command.rb', line 152

def setup_scheme
  project.scheme = scheme
end

#setup_service_nameObject



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/slather/command/coverage_command.rb', line 89

def setup_service_name
  if travis?
    project.ci_service = :travis_ci
  elsif travispro?
    project.ci_service = :travis_pro
  elsif circleci?
    project.ci_service = :circleci
  elsif jenkins?
    project.ci_service = :jenkins
  elsif buildkite?
    project.ci_service = :buildkite
  elsif teamcity?
    project.ci_service = :teamcity
  elsif github?
    project.ci_service = :github
  end
end

#setup_source_directoryObject



77
78
79
# File 'lib/slather/command/coverage_command.rb', line 77

def setup_source_directory
  project.source_directory = source_directory if source_directory
end

#setup_source_filesObject



176
177
178
# File 'lib/slather/command/coverage_command.rb', line 176

def setup_source_files
  project.source_files = source_files_list if !source_files_list.empty?
end

#setup_verbose_modeObject



144
145
146
# File 'lib/slather/command/coverage_command.rb', line 144

def setup_verbose_mode
  project.verbose_mode = verbose?
end

#setup_workspaceObject



160
161
162
# File 'lib/slather/command/coverage_command.rb', line 160

def setup_workspace
  project.workspace = workspace
end

#setup_ymlfileObject



69
70
71
# File 'lib/slather/command/coverage_command.rb', line 69

def setup_ymlfile
  Slather::Project.yml_filename = ymlfile if ymlfile
end