Skip to content

Commit

Permalink
[project] Refactor configuration method names
Browse files Browse the repository at this point in the history
  • Loading branch information
viteinfinite committed Dec 27, 2015
1 parent 2c43d91 commit 1e40d93
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 72 deletions.
2 changes: 1 addition & 1 deletion bin/slather
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Clamp do
setup_scheme
setup_binary_file

project.configure_from_yml
project.configure

post

Expand Down
42 changes: 21 additions & 21 deletions lib/slather/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,40 +166,40 @@ def self.yml
@yml ||= File.exist?(yml_filename) ? YAML.load_file(yml_filename) : {}
end

def configure_from_yml
configure_build_directory_from_yml
configure_ignore_list_from_yml
configure_ci_service_from_yml
configure_coverage_access_token_from_yml
configure_coverage_service_from_yml
configure_source_directory_from_yml
configure_output_directory_from_yml
configure_input_format_from_yml
configure_scheme_from_yml
configure_binary_file_from_yml
def configure
configure_build_directory
configure_ignore_list
configure_ci_service
configure_coverage_access_token
configure_coverage_service
configure_source_directory
configure_output_directory
configure_input_format
configure_scheme
configure_binary_file
end

def configure_build_directory_from_yml
def configure_build_directory
self.build_directory ||= self.class.yml["build_directory"] || derived_data_path
end

def configure_source_directory_from_yml
def configure_source_directory
self.source_directory ||= self.class.yml["source_directory"] if self.class.yml["source_directory"]
end

def configure_output_directory_from_yml
def configure_output_directory
self.output_directory ||= self.class.yml["output_directory"] if self.class.yml["output_directory"]
end

def configure_ignore_list_from_yml
def configure_ignore_list
self.ignore_list ||= [(self.class.yml["ignore"] || [])].flatten
end

def configure_ci_service_from_yml
def configure_ci_service
self.ci_service ||= (self.class.yml["ci_service"] || :travis_ci)
end

def configure_input_format_from_yml
def configure_input_format
self.input_format ||= self.class.yml["input_format"] || input_format
end

Expand All @@ -215,19 +215,19 @@ def input_format=(format)
end
end

def configure_scheme_from_yml
def configure_scheme
self.scheme ||= self.class.yml["scheme"] if self.class.yml["scheme"]
end

def ci_service=(service)
@ci_service = service && service.to_sym
end

def configure_coverage_service_from_yml
def configure_coverage_service
self.coverage_service ||= (self.class.yml["coverage_service"] || :terminal)
end

def configure_coverage_access_token_from_yml
def configure_coverage_access_token
self.coverage_access_token ||= (ENV["COVERAGE_ACCESS_TOKEN"] || self.class.yml["coverage_access_token"] || "")
end

Expand All @@ -251,7 +251,7 @@ def coverage_service=(service)
@coverage_service = service
end

def configure_binary_file_from_yml
def configure_binary_file
if self.input_format == "profdata"
self.binary_file ||= self.class.yml["binary_file"] || find_binary_file
end
Expand Down
2 changes: 1 addition & 1 deletion spec/slather/coverage_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
let(:fixtures_project) do
project = Slather::Project.open(FIXTURES_PROJECT_PATH)
project.build_directory = TEMP_DERIVED_DATA_PATH
project.send(:configure_from_yml)
project.send(:configure)
project.stub(:input_format).and_return("gcov")
project
end
Expand Down
2 changes: 1 addition & 1 deletion spec/slather/coverage_service/cobertura_xml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
proj.build_directory = TEMP_DERIVED_DATA_PATH
proj.input_format = "gcov"
proj.coverage_service = "cobertura_xml"
proj.configure_from_yml
proj.configure
proj
end

Expand Down
4 changes: 2 additions & 2 deletions spec/slather/coverage_service/coveralls_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
context "#gcov file format" do
before(:each) {
fixtures_project.stub(:input_format).and_return("gcov")
fixtures_project.send(:configure_from_yml)
fixtures_project.send(:configure)
}

describe '#coveralls_coverage_data' do
Expand Down Expand Up @@ -132,7 +132,7 @@
context "#profdata file format" do
before(:each) {
fixtures_project.stub(:input_format).and_return("profdata")
fixtures_project.send(:configure_from_yml)
fixtures_project.send(:configure)
}

describe '#coveralls_coverage_data' do
Expand Down
2 changes: 1 addition & 1 deletion spec/slather/coverage_service/gutter_json_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
proj.build_directory = TEMP_DERIVED_DATA_PATH
proj.input_format = "gcov"
proj.coverage_service = "gutter_json"
proj.configure_from_yml
proj.configure
proj
end

Expand Down
2 changes: 1 addition & 1 deletion spec/slather/coverage_service/hardcover_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
proj.build_directory = TEMP_DERIVED_DATA_PATH
proj.input_format = "gcov"
proj.coverage_service = "hardcover"
proj.configure_from_yml
proj.configure
proj
end

Expand Down
4 changes: 2 additions & 2 deletions spec/slather/coverage_service/html_output_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def extract_header_title(doc)

before(:each) {
fixtures_project.stub(:input_format).and_return("gcov")
fixtures_project.send(:configure_from_yml)
fixtures_project.send(:configure)
}

it "should create all coverage as static html files" do
Expand Down Expand Up @@ -189,7 +189,7 @@ def extract_cov_data(doc)

before(:each) {
fixtures_project.stub(:input_format).and_return("profdata")
fixtures_project.send(:configure_from_yml)
fixtures_project.send(:configure)
}

it "should create a valid report when using profdata format" do
Expand Down
2 changes: 1 addition & 1 deletion spec/slather/coverage_service/simple_output_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
proj = Slather::Project.open(FIXTURES_PROJECT_PATH)
proj.build_directory = TEMP_DERIVED_DATA_PATH
proj.input_format = "gcov"
proj.configure_from_yml
proj.configure
proj
end

Expand Down
Loading

0 comments on commit 1e40d93

Please sign in to comment.