lib/i18n/tasks/scanners/base_scanner.rb in i18n-tasks-0.8.5 vs lib/i18n/tasks/scanners/base_scanner.rb in i18n-tasks-0.8.6

- old
+ new

@@ -13,11 +13,13 @@ ALWAYS_EXCLUDE = %w(*.jpg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less *.yml *.json) def initialize(config = {}) @config = config.dup.with_indifferent_access.tap do |conf| - conf[:relative_roots] = %w(app/views app/controllers app/helpers app/presenters) if conf[:relative_roots].blank? + if conf[:relative_roots].blank? + conf[:relative_roots] = %w(app/controllers app/helpers app/mailers app/presenters app/views) + end conf[:paths] = %w(app/) if conf[:paths].blank? conf[:include] = Array(conf[:include]) if conf[:include].present? conf[:exclude] = Array(conf[:exclude]) + ALWAYS_EXCLUDE # Regexps for lines to ignore per extension if conf[:ignore_lines] && !conf[:ignore_lines].is_a?(Hash) @@ -107,10 +109,10 @@ def src_location(path, text, src_pos, position = true) data = {src_path: path} if position line_begin = text.rindex(/^/, src_pos - 1) - line_end = text.index(/.(?=\n|$)/, src_pos) + line_end = text.index(/.(?=\r?\n|$)/, src_pos) data.merge! pos: src_pos, line_num: text[0..src_pos].count("\n") + 1, line_pos: src_pos - line_begin + 1, line: text[line_begin..line_end] end