lib/tailor/configuration.rb in tailor-1.2.1 vs lib/tailor/configuration.rb in tailor-1.3.0
- old
+ new
@@ -66,11 +66,11 @@
get_formatters_from_config_file
#get_file_sets_from_config_file unless @runtime_file_list
get_file_sets_from_config_file
end
else
- log "Creating default file set..."
+ log 'Creating default file set...'
@file_sets = { default: FileSet.new(@runtime_file_list) }
end
get_output_file_from_cli_opts
get_formatters_from_cli_opts
@@ -87,11 +87,12 @@
if File.exists? user_config_file
log "Loading config from file: #{user_config_file}"
begin
- @config_from_file = instance_eval(File.read(user_config_file), user_config_file)
+ @config_from_file =
+ instance_eval(File.read(user_config_file), user_config_file)
log "Got new config from file: #{user_config_file}"
rescue LoadError => ex
raise Tailor::RuntimeError,
"Couldn't load config file: #{user_config_file}"
end
@@ -120,11 +121,11 @@
log "label: #{label}"
log "file set file list: #{file_set[:file_list]}"
log "file set style: #{file_set[:style]}"
if @file_sets[label]
- log "label already exists. Updating..."
+ log 'label already exists. Updating...'
@file_sets[label].update_file_list(file_set[:file_list])
@file_sets[label].update_style(file_set[:style])
else
log "Creating new label: #{label}"
@file_sets[label] =
@@ -143,11 +144,11 @@
def get_style_from_cli_opts
return unless @options && @options.style
@options.style.each do |property, value|
@file_sets.keys.each do |label|
- if value == :off || value == "off"
+ if value == :off || value == 'off'
@file_sets[label].style[property][1] = { level: :off }
else
@file_sets[label].style[property][0] = value
end
end
@@ -211,10 +212,12 @@
# ending with +.rb+ in your current path and deeper.
#
# @param [String] file_expression The expression to match recursively.
# @param [Symbol] label The file set label to use.
def recursive_file_set(file_expression, label=:default)
- file_set("*/**/#{file_expression}", label)
+ file_set("*/**/#{file_expression}", label) do |style|
+ yield style if block_given?
+ end
end
# Displays the current configuration as a text table.
def show
table = Text::Table.new(horizontal_padding: 4)