Class: Slather::Project

Inherits:
Xcodeproj::Project
  • Object
show all
Defined in:
lib/slather/project.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#build_directory=(value) ⇒ Object

Sets the attribute build_directory

Parameters:

  • value

    the value to set the attribute build_directory to.



9
10
11
# File 'lib/slather/project.rb', line 9

def build_directory=(value)
  @build_directory = value
end

#ci_serviceObject

Returns the value of attribute ci_service.



9
10
11
# File 'lib/slather/project.rb', line 9

def ci_service
  @ci_service
end

#ignore_listObject

Returns the value of attribute ignore_list.



9
10
11
# File 'lib/slather/project.rb', line 9

def ignore_list
  @ignore_list
end

Class Method Details

.open(xcodeproj) ⇒ Object



11
12
13
14
15
# File 'lib/slather/project.rb', line 11

def self.open(xcodeproj)
  proj = super
  proj.configure_from_yml
  proj
end

.yml_fileObject



47
48
49
50
51
52
53
54
55
56
# File 'lib/slather/project.rb', line 47

def self.yml_file
  @yml_file ||= begin
    yml_filename = '.slather.yml'
    if File.exist?(yml_filename)
      YAML.load_file(yml_filename)
    else
      {}
    end
  end
end

Instance Method Details

#configure_from_ymlObject



58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/slather/project.rb', line 58

def configure_from_yml
  self.build_directory = self.class.yml_file["build_directory"] if self.class.yml_file["build_directory"]
  self.ignore_list = self.class.yml_file["ignore"] || []
  self.ci_service = (self.class.yml_file["ci_service"] || :travis_ci).to_sym

  coverage_service = self.class.yml_file["coverage_service"]
  if coverage_service == "coveralls"
    extend(Slather::CoverageService::Coveralls)
  elsif coverage_service == "terminal"
    extend(Slather::CoverageService::SimpleOutput)
  elsif !self.class.method_defined?(:post)
    raise ArgumentError, "value `#{coverage_service}` not valid for key `coverage_service` in #{self.class.yml_file.path}. Try `terminal` or `coveralls`"
  end
end

#setup_for_coverageObject



73
74
75
76
77
78
# File 'lib/slather/project.rb', line 73

def setup_for_coverage
  build_configurations.each do |build_configuration|
    build_configuration.build_settings["GCC_INSTRUMENT_PROGRAM_FLOW_ARCS"] = "YES"
    build_configuration.build_settings["GCC_GENERATE_TEST_COVERAGE_FILES"] = "YES"
  end
end