i18n_checker 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/lib/i18n_checker/locale_text_not_found_checker.rb +4 -3
- data/lib/i18n_checker/rake_task.rb +9 -9
- data/lib/i18n_checker/version.rb +1 -1
- data/screenshot.png +0 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d21496e1a89e1ef6ce2aef464cf113ff368cbc3
|
4
|
+
data.tar.gz: 5c8b3f8fa70b51c5b72b193e25ddc16a6e44cd97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd7cdce91c0f705ac7003dab827c03496b7002bebf55381be5a10fee07d774c18e0beaa7c641cf395e1e3a381d8a918cd89bba6bc2e42e5f520808126ee5e127
|
7
|
+
data.tar.gz: 245142d928fa35252c3f44f34769b7d60c4717fb041b2ce697d718242d3b763a912d113232cd6b4e4013bb257d55aefe2306d80f34edb6704f40687bdfd0fc90
|
data/Gemfile.lock
CHANGED
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.
|
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.
|
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(
|
7
|
+
def initialize(locale_file_paths: [], source_paths: [], reporter:)
|
8
8
|
@reporter = reporter
|
9
|
-
@locale_texts =
|
10
|
-
@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 :
|
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
|
-
@
|
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
|
-
|
42
|
-
|
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
|
data/lib/i18n_checker/version.rb
CHANGED
data/screenshot.png
CHANGED
Binary file
|