i18n_checker 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8cc0a9bda5cd2dd6ec90141387fdf63601481d8
4
- data.tar.gz: 7ae32cf03e242ba9887f66066221499c8a6738ad
3
+ metadata.gz: 4d21496e1a89e1ef6ce2aef464cf113ff368cbc3
4
+ data.tar.gz: 5c8b3f8fa70b51c5b72b193e25ddc16a6e44cd97
5
5
  SHA512:
6
- metadata.gz: 49d3701f3164df63479d64256a589788761832649ef75507e827dd674d416f60048961d896ac7c728e8ab9b70eb954c17cf888cca151c94e282fcce47e5652c7
7
- data.tar.gz: 739df006a0076e099d3740c96d8d83f49ee84c544676f1e0c6296faa26c609da5c8d08e503aad3d7bc29e7466f9fe3f55da7623c64becee18b91aefcf70c4148
6
+ metadata.gz: bd7cdce91c0f705ac7003dab827c03496b7002bebf55381be5a10fee07d774c18e0beaa7c641cf395e1e3a381d8a918cd89bba6bc2e42e5f520808126ee5e127
7
+ data.tar.gz: 245142d928fa35252c3f44f34769b7d60c4717fb041b2ce697d718242d3b763a912d113232cd6b4e4013bb257d55aefe2306d80f34edb6704f40687bdfd0fc90
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- i18n_checker (0.3.0)
4
+ i18n_checker (0.4.0)
5
5
  colorator (~> 1.1.0)
6
6
  haml_parser (~> 0.4)
7
7
  parser
data/README.md CHANGED
@@ -20,7 +20,7 @@ Add the following tasks to your **Rakefile**.
20
20
  require 'i18n_checker/rake_task'
21
21
 
22
22
  I18nChecker::RakeTask.new do |task|
23
- task.template_paths = FileList['app/views/*'] # haml templates
23
+ task.source_paths = FileList['app/models/*', 'app/views/*'] # haml templates, ruby sources
24
24
  task.locale_file_paths = FileList['config/locales/*'] # locale file paths
25
25
  paths
26
26
  end
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'i18n_checker/rake_task'
5
5
  RSpec::Core::RakeTask.new(:spec)
6
6
 
7
7
  I18nChecker::RakeTask.new do |task|
8
- task.template_paths = FileList['spec/fixtures/haml/*', 'spec/fixtures/ruby/*']
8
+ task.source_paths = FileList['spec/fixtures/haml/*', 'spec/fixtures/ruby/*']
9
9
  task.locale_file_paths = FileList['spec/fixtures/locales/**']
10
10
  end
11
11
 
@@ -4,16 +4,17 @@ require "i18n_checker/detector/detected_result"
4
4
 
5
5
  module I18nChecker
6
6
  class LocaleTextNotFoundChecker
7
- def initialize(locale_texts: [], locale_files: [], reporter:)
7
+ def initialize(locale_file_paths: [], source_paths: [], reporter:)
8
8
  @reporter = reporter
9
- @locale_texts = locale_texts
10
- @locale_files = locale_files
9
+ @locale_texts = I18nChecker::Locale.texts_of(source_paths)
10
+ @locale_files = I18nChecker::Locale.load_of(locale_file_paths)
11
11
  end
12
12
 
13
13
  def check
14
14
  not_found_detector = I18nChecker::Detector::LocaleTextNotFound.new(@locale_files)
15
15
  not_found_result = @locale_texts.detect(not_found_detector)
16
16
  @reporter.report not_found_result
17
+ yield not_found_result if block_given?
17
18
  end
18
19
  end
19
20
  end
@@ -8,18 +8,20 @@ require "i18n_checker/locale_text_not_found_checker"
8
8
  module I18nChecker
9
9
  class RakeTask < ::Rake::TaskLib
10
10
  attr_accessor :name
11
- attr_accessor :template_paths
11
+ attr_accessor :reporter
12
+ attr_accessor :source_paths
12
13
  attr_accessor :locale_file_paths
13
14
  attr_accessor :logger
14
15
 
15
16
  def initialize(name = :locale_check)
16
17
  @name = name
17
- @template_paths = FileList['app/views/*']
18
+ @source_paths = FileList['app/views/*', 'app/controllers/*', 'app/jobs/*', 'app/models/*', 'app/helpers/*']
18
19
  @locale_file_paths = FileList['config/locales/*']
19
20
  @logger = Logger.new(STDOUT)
20
21
  @logger.formatter = proc {|severity, datetime, progname, message|
21
22
  "#{message}\n"
22
23
  }
24
+ @reporter = I18nChecker::Reporter::DefaultReporter.new(logger: logger)
23
25
  yield self if block_given?
24
26
  define
25
27
  end
@@ -32,16 +34,14 @@ module I18nChecker
32
34
  end
33
35
 
34
36
  def run_task
35
- reporter = I18nChecker::Reporter::DefaultReporter.new(logger: logger)
36
- locale_texts = I18nChecker::Locale.texts_of(template_paths)
37
- locale_files = I18nChecker::Locale.load_of(locale_file_paths)
38
-
39
37
  checker = I18nChecker::LocaleTextNotFoundChecker.new(
40
38
  reporter: reporter,
41
- locale_texts: locale_texts,
42
- locale_files: locale_files
39
+ source_paths: source_paths,
40
+ locale_file_paths: locale_file_paths
43
41
  )
44
- checker.check
42
+ checker.check do |result|
43
+ exit 1 unless result.empty?
44
+ end
45
45
  end
46
46
  end
47
47
  end
@@ -1,3 +1,3 @@
1
1
  module I18nChecker
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
data/screenshot.png CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n_checker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - holyshared