Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the file argument to self.configure in lib/coverband.rb #100

Merged
merged 2 commits into from
Jul 24, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/coverband.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ def self.parse_baseline(baseline_file = './tmp/coverband_baseline.json')
end

def self.configure(file = nil)
configuration_file = file || CONFIG_FILE

configuration
if block_given?
yield(configuration)
else
if File.exists?(CONFIG_FILE)
file ||= CONFIG_FILE
require file
if File.exists?(configuration_file)
require configuration_file
else
raise ArgumentError, "configure requires a block or the existance of a #{CONFIG_FILE} in your project"
raise ArgumentError, "configure requires a block, the existance of a #{CONFIG_FILE} in your project, or a path to a config file passed in to configure"
end
end
end
Expand Down