i18n_flow 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/.rspec +3 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +13 -0
  6. data/Gemfile +6 -0
  7. data/Gemfile.lock +45 -0
  8. data/LICENSE +22 -0
  9. data/README.md +103 -0
  10. data/Rakefile +2 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/doc/rules.md +316 -0
  14. data/doc/tags.md +488 -0
  15. data/example/example.en.yml +14 -0
  16. data/example/example.ja.yml +9 -0
  17. data/exe/i18n_flow +11 -0
  18. data/i18n_flow.gemspec +28 -0
  19. data/i18n_flow.yml +8 -0
  20. data/lib/i18n_flow/cli/color.rb +18 -0
  21. data/lib/i18n_flow/cli/command_base.rb +33 -0
  22. data/lib/i18n_flow/cli/copy_command.rb +69 -0
  23. data/lib/i18n_flow/cli/help_command.rb +29 -0
  24. data/lib/i18n_flow/cli/lint_command/ascii.erb +45 -0
  25. data/lib/i18n_flow/cli/lint_command/ascii_renderer.rb +58 -0
  26. data/lib/i18n_flow/cli/lint_command/markdown.erb +49 -0
  27. data/lib/i18n_flow/cli/lint_command/markdown_renderer.rb +55 -0
  28. data/lib/i18n_flow/cli/lint_command.rb +55 -0
  29. data/lib/i18n_flow/cli/read_config_command.rb +20 -0
  30. data/lib/i18n_flow/cli/search_command/default.erb +11 -0
  31. data/lib/i18n_flow/cli/search_command/default_renderer.rb +67 -0
  32. data/lib/i18n_flow/cli/search_command/oneline.erb +5 -0
  33. data/lib/i18n_flow/cli/search_command/oneline_renderer.rb +39 -0
  34. data/lib/i18n_flow/cli/search_command.rb +59 -0
  35. data/lib/i18n_flow/cli/split_command.rb +20 -0
  36. data/lib/i18n_flow/cli/version_command.rb +9 -0
  37. data/lib/i18n_flow/cli.rb +42 -0
  38. data/lib/i18n_flow/configuration.rb +205 -0
  39. data/lib/i18n_flow/parser.rb +34 -0
  40. data/lib/i18n_flow/repository.rb +39 -0
  41. data/lib/i18n_flow/search.rb +176 -0
  42. data/lib/i18n_flow/splitter/merger.rb +60 -0
  43. data/lib/i18n_flow/splitter/strategy.rb +66 -0
  44. data/lib/i18n_flow/splitter.rb +5 -0
  45. data/lib/i18n_flow/util.rb +57 -0
  46. data/lib/i18n_flow/validator/errors.rb +99 -0
  47. data/lib/i18n_flow/validator/file_scope.rb +58 -0
  48. data/lib/i18n_flow/validator/multiplexer.rb +58 -0
  49. data/lib/i18n_flow/validator/symmetry.rb +154 -0
  50. data/lib/i18n_flow/validator.rb +4 -0
  51. data/lib/i18n_flow/version.rb +7 -0
  52. data/lib/i18n_flow/yaml_ast_proxy/mapping.rb +72 -0
  53. data/lib/i18n_flow/yaml_ast_proxy/node.rb +128 -0
  54. data/lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb +86 -0
  55. data/lib/i18n_flow/yaml_ast_proxy/sequence.rb +29 -0
  56. data/lib/i18n_flow/yaml_ast_proxy.rb +57 -0
  57. data/lib/i18n_flow.rb +15 -0
  58. data/spec/lib/i18n_flow/cli/command_base_spec.rb +46 -0
  59. data/spec/lib/i18n_flow/cli/help_command_spec.rb +13 -0
  60. data/spec/lib/i18n_flow/cli/version_command_spec.rb +13 -0
  61. data/spec/lib/i18n_flow/configuration_spec.rb +334 -0
  62. data/spec/lib/i18n_flow/repository_spec.rb +40 -0
  63. data/spec/lib/i18n_flow/splitter/merger_spec.rb +149 -0
  64. data/spec/lib/i18n_flow/util_spec.rb +194 -0
  65. data/spec/lib/i18n_flow/validator/file_scope_spec.rb +74 -0
  66. data/spec/lib/i18n_flow/validator/multiplexer_spec.rb +68 -0
  67. data/spec/lib/i18n_flow/validator/symmetry_spec.rb +511 -0
  68. data/spec/lib/i18n_flow/yaml_ast_proxy/node_spec.rb +151 -0
  69. data/spec/lib/i18n_flow_spec.rb +21 -0
  70. data/spec/spec_helper.rb +16 -0
  71. data/spec/support/repository_examples.rb +60 -0
  72. data/spec/support/util_macro.rb +14 -0
  73. metadata +214 -0
@@ -0,0 +1,60 @@
1
+ shared_examples :create_repository do
2
+ let(:repository) do
3
+ I18nFlow::Repository.new(
4
+ base_path: '/fixtures',
5
+ glob_patterns: ['models/**/*.yml', 'views/**/*.yml'],
6
+ )
7
+ end
8
+
9
+ let(:models_user_en_yml) do
10
+ <<-YAML
11
+ en:
12
+ models:
13
+ user:
14
+ key_1: text_1
15
+ YAML
16
+ end
17
+ let(:models_user_ja_yml) do
18
+ <<-YAML
19
+ ja:
20
+ models:
21
+ user:
22
+ key_1: text_1
23
+ YAML
24
+ end
25
+ let(:views_profiles_show_en_yml) do
26
+ <<-YAML
27
+ en:
28
+ views:
29
+ profiles:
30
+ show:
31
+ key_1: text_1
32
+ YAML
33
+ end
34
+ let(:views_profiles_show_ja_yml) do
35
+ <<-YAML
36
+ ja:
37
+ views:
38
+ profiles:
39
+ show:
40
+ key_1: text_1
41
+ YAML
42
+ end
43
+ let(:views_profiles_show_fr_yml) do
44
+ <<-YAML
45
+ fr:
46
+ views:
47
+ profiles:
48
+ show:
49
+ key_1: text_1
50
+ YAML
51
+ end
52
+
53
+ before do
54
+ create_file('/fixtures/models/user.en.yml', models_user_en_yml)
55
+ create_file('/fixtures/models/user.ja.yml', models_user_ja_yml)
56
+ create_file('/fixtures/views/profiles/show.en.yml', views_profiles_show_en_yml)
57
+ create_file('/fixtures/views/profiles/show.ja.yml', views_profiles_show_ja_yml)
58
+ create_file('/fixtures/views/profiles/show.fr.yml', views_profiles_show_fr_yml)
59
+ end
60
+ end
@@ -0,0 +1,14 @@
1
+ module UtilMacro
2
+ def parse_yaml(yaml)
3
+ parser = I18nFlow::Parser.new(yaml)
4
+ parser.parse!
5
+ parser.root_proxy
6
+ end
7
+
8
+ def create_file(path, content)
9
+ FakeFS::FakeFile.new.tap do |file|
10
+ file.content = content
11
+ FakeFS::FileSystem.add(path, file)
12
+ end
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,214 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: i18n_flow
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Yuki Iwanaga
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-07-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: psych
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.16'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.16'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: fakefs
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Manage translation status in yaml file
98
+ email:
99
+ - yuki@creasty.com
100
+ executables:
101
+ - i18n_flow
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitignore"
106
+ - ".rspec"
107
+ - ".ruby-version"
108
+ - ".travis.yml"
109
+ - Gemfile
110
+ - Gemfile.lock
111
+ - LICENSE
112
+ - README.md
113
+ - Rakefile
114
+ - bin/console
115
+ - bin/setup
116
+ - doc/rules.md
117
+ - doc/tags.md
118
+ - example/example.en.yml
119
+ - example/example.ja.yml
120
+ - exe/i18n_flow
121
+ - i18n_flow.gemspec
122
+ - i18n_flow.yml
123
+ - lib/i18n_flow.rb
124
+ - lib/i18n_flow/cli.rb
125
+ - lib/i18n_flow/cli/color.rb
126
+ - lib/i18n_flow/cli/command_base.rb
127
+ - lib/i18n_flow/cli/copy_command.rb
128
+ - lib/i18n_flow/cli/help_command.rb
129
+ - lib/i18n_flow/cli/lint_command.rb
130
+ - lib/i18n_flow/cli/lint_command/ascii.erb
131
+ - lib/i18n_flow/cli/lint_command/ascii_renderer.rb
132
+ - lib/i18n_flow/cli/lint_command/markdown.erb
133
+ - lib/i18n_flow/cli/lint_command/markdown_renderer.rb
134
+ - lib/i18n_flow/cli/read_config_command.rb
135
+ - lib/i18n_flow/cli/search_command.rb
136
+ - lib/i18n_flow/cli/search_command/default.erb
137
+ - lib/i18n_flow/cli/search_command/default_renderer.rb
138
+ - lib/i18n_flow/cli/search_command/oneline.erb
139
+ - lib/i18n_flow/cli/search_command/oneline_renderer.rb
140
+ - lib/i18n_flow/cli/split_command.rb
141
+ - lib/i18n_flow/cli/version_command.rb
142
+ - lib/i18n_flow/configuration.rb
143
+ - lib/i18n_flow/parser.rb
144
+ - lib/i18n_flow/repository.rb
145
+ - lib/i18n_flow/search.rb
146
+ - lib/i18n_flow/splitter.rb
147
+ - lib/i18n_flow/splitter/merger.rb
148
+ - lib/i18n_flow/splitter/strategy.rb
149
+ - lib/i18n_flow/util.rb
150
+ - lib/i18n_flow/validator.rb
151
+ - lib/i18n_flow/validator/errors.rb
152
+ - lib/i18n_flow/validator/file_scope.rb
153
+ - lib/i18n_flow/validator/multiplexer.rb
154
+ - lib/i18n_flow/validator/symmetry.rb
155
+ - lib/i18n_flow/version.rb
156
+ - lib/i18n_flow/yaml_ast_proxy.rb
157
+ - lib/i18n_flow/yaml_ast_proxy/mapping.rb
158
+ - lib/i18n_flow/yaml_ast_proxy/node.rb
159
+ - lib/i18n_flow/yaml_ast_proxy/node_meta_data.rb
160
+ - lib/i18n_flow/yaml_ast_proxy/sequence.rb
161
+ - spec/lib/i18n_flow/cli/command_base_spec.rb
162
+ - spec/lib/i18n_flow/cli/help_command_spec.rb
163
+ - spec/lib/i18n_flow/cli/version_command_spec.rb
164
+ - spec/lib/i18n_flow/configuration_spec.rb
165
+ - spec/lib/i18n_flow/repository_spec.rb
166
+ - spec/lib/i18n_flow/splitter/merger_spec.rb
167
+ - spec/lib/i18n_flow/util_spec.rb
168
+ - spec/lib/i18n_flow/validator/file_scope_spec.rb
169
+ - spec/lib/i18n_flow/validator/multiplexer_spec.rb
170
+ - spec/lib/i18n_flow/validator/symmetry_spec.rb
171
+ - spec/lib/i18n_flow/yaml_ast_proxy/node_spec.rb
172
+ - spec/lib/i18n_flow_spec.rb
173
+ - spec/spec_helper.rb
174
+ - spec/support/repository_examples.rb
175
+ - spec/support/util_macro.rb
176
+ homepage: https://github.com/creasty/i18n_flow
177
+ licenses: []
178
+ metadata: {}
179
+ post_install_message:
180
+ rdoc_options: []
181
+ require_paths:
182
+ - lib
183
+ required_ruby_version: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ required_rubygems_version: !ruby/object:Gem::Requirement
189
+ requirements:
190
+ - - ">="
191
+ - !ruby/object:Gem::Version
192
+ version: '0'
193
+ requirements: []
194
+ rubyforge_project:
195
+ rubygems_version: 2.6.13
196
+ signing_key:
197
+ specification_version: 4
198
+ summary: Manage translation status in yaml file
199
+ test_files:
200
+ - spec/lib/i18n_flow/cli/command_base_spec.rb
201
+ - spec/lib/i18n_flow/cli/help_command_spec.rb
202
+ - spec/lib/i18n_flow/cli/version_command_spec.rb
203
+ - spec/lib/i18n_flow/configuration_spec.rb
204
+ - spec/lib/i18n_flow/repository_spec.rb
205
+ - spec/lib/i18n_flow/splitter/merger_spec.rb
206
+ - spec/lib/i18n_flow/util_spec.rb
207
+ - spec/lib/i18n_flow/validator/file_scope_spec.rb
208
+ - spec/lib/i18n_flow/validator/multiplexer_spec.rb
209
+ - spec/lib/i18n_flow/validator/symmetry_spec.rb
210
+ - spec/lib/i18n_flow/yaml_ast_proxy/node_spec.rb
211
+ - spec/lib/i18n_flow_spec.rb
212
+ - spec/spec_helper.rb
213
+ - spec/support/repository_examples.rb
214
+ - spec/support/util_macro.rb