translation 0.6 → 0.7

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: 7b49e853f0f66e799364395aa56bbe81ecba94f3
4
- data.tar.gz: eb2a03bcb1cad5a60b4e1b5746e336d052a40bec
3
+ metadata.gz: 41e631d4dfa6720834486b6db11f51c5e2f03bc8
4
+ data.tar.gz: 6dee4a9aa3a7dbfc9c075d3235323225eb0b1030
5
5
  SHA512:
6
- metadata.gz: 32897ce198af222520da0f54006774306f23c85a058d3708187abee5a6e655dc2c515223d1cb0885ffc3d777da7c808f8a972e49aa19df06393e536b3434d19f
7
- data.tar.gz: ff7a31ab356f282d9552d54516e30e31a23b0d435504835df61057480f8280f83b4fe5ec6e27d29a7566ca59da09848efe3978548af2c4b819e4f4d3904ea25c
6
+ metadata.gz: 1b9dd3d10d0e9a8f9de9752ac4b2526edf45cfcd19c3f03b1a196ad2b89957b261bfbc30e6a39b9e3dc9b304634eb6140988b53a43db8fe5adc0512b23112bd8
7
+ data.tar.gz: ca54b082e005bd1b439d18e9dfba66069f1578377546f31f1a5444dd06284e7fd1d797a8e93634ecf1dfd62e7128782f2dfbd4123e5df17b7bb98f5ef3e45392
@@ -27,10 +27,15 @@ module TranslationIO
27
27
  TranslationIO.info haml_file_path, 2, 2
28
28
 
29
29
  haml_data = File.read(haml_file_path)
30
- ruby_data = Haml::Engine.new(haml_data).precompiled
31
30
 
32
- ruby_data.scan(GETTEXT_ENTRY_RE).each do |entry|
33
- entries << entry
31
+ begin
32
+ ruby_data = Haml::Engine.new(haml_data).precompiled
33
+
34
+ ruby_data.scan(GETTEXT_ENTRY_RE).each do |entry|
35
+ entries << entry
36
+ end
37
+ rescue Haml::SyntaxError
38
+ TranslationIO.info "File cannot be parsed (SyntaxError): #{haml_file_path}", 1, 0
34
39
  end
35
40
  end
36
41
 
@@ -26,10 +26,14 @@ module TranslationIO
26
26
  @slim_source_files.each do |slim_file_path|
27
27
  TranslationIO.info slim_file_path, 2, 2
28
28
 
29
- ruby_data = Slim::Template.new(slim_file_path, {}).precompiled_template
29
+ begin
30
+ ruby_data = Slim::Template.new(slim_file_path, {}).precompiled_template
30
31
 
31
- ruby_data.scan(GETTEXT_ENTRY_RE).each do |entry|
32
- entries << entry
32
+ ruby_data.scan(GETTEXT_ENTRY_RE).each do |entry|
33
+ entries << entry
34
+ end
35
+ rescue Slim::Parser::SyntaxError
36
+ TranslationIO.info "File cannot be parsed (SyntaxError): #{slim_file_path}", 1, 0
33
37
  end
34
38
  end
35
39
 
@@ -7,13 +7,13 @@ module TranslationIO
7
7
  class Client
8
8
  class InitOperation < BaseOperation
9
9
  def run
10
- haml_source_files = Dir['**/*.{haml}']
11
- slim_source_files = Dir['**/*.{slim}']
10
+ haml_source_files = Dir['**/*.{haml}'].select { |p| !p.start_with?('vendor/') }
11
+ slim_source_files = Dir['**/*.{slim}'].select { |p| !p.start_with?('vendor/') }
12
12
 
13
13
  BaseOperation::DumpHamlGettextKeysStep.new(haml_source_files).run
14
14
  BaseOperation::DumpSlimGettextKeysStep.new(slim_source_files).run
15
15
 
16
- source_files = Dir[SOURCE_FILES_PATTERN]
16
+ source_files = Dir[SOURCE_FILES_PATTERN].select { |p| !p.start_with?('vendor/') }
17
17
  pot_path = TranslationIO.pot_path
18
18
  source_locale = TranslationIO.config.source_locale
19
19
  target_locales = TranslationIO.config.target_locales
@@ -5,13 +5,13 @@ module TranslationIO
5
5
  class Client
6
6
  class SyncOperation < BaseOperation
7
7
  def run(purge = false)
8
- haml_source_files = Dir['**/*.{haml}']
9
- slim_source_files = Dir['**/*.{slim}']
8
+ haml_source_files = Dir['**/*.{haml}'].select { |p| !p.start_with?('vendor/') }
9
+ slim_source_files = Dir['**/*.{slim}'].select { |p| !p.start_with?('vendor/') }
10
10
 
11
11
  BaseOperation::DumpHamlGettextKeysStep.new(haml_source_files).run
12
12
  BaseOperation::DumpSlimGettextKeysStep.new(slim_source_files).run
13
13
 
14
- source_files = Dir[SOURCE_FILES_PATTERN]
14
+ source_files = Dir[SOURCE_FILES_PATTERN].select { |p| !p.start_with?('vendor/') }
15
15
  pot_path = TranslationIO.pot_path
16
16
  source_locale = TranslationIO.config.source_locale
17
17
  target_locales = TranslationIO.config.target_locales
@@ -14,7 +14,7 @@ module TranslationIO
14
14
  end
15
15
 
16
16
  def to_s
17
- "#{api_key} #{source_locale} => #{target_locales.join(' + ')}"
17
+ "#{api_key} - #{source_locale} => #{target_locales.join(' + ')}"
18
18
  end
19
19
  end
20
20
  end
@@ -5,27 +5,17 @@ namespace :translation do
5
5
  puts TranslationIO.config
6
6
  end
7
7
 
8
- task :init => :environment do
9
- if TranslationIO.client
10
- TranslationIO.client.init
11
- else
12
- TranslationIO.info "[Error] Client cannot be built. Did you set up the initializer?"
13
- end
14
- end
15
-
16
- task :sync => :environment do
17
- if TranslationIO.client
18
- TranslationIO.client.sync
19
- else
20
- TranslationIO.info "[Error] Client cannot be built. Did you set up the initializer?"
21
- end
22
- end
23
-
24
- task :purge => :environment do
25
- if TranslationIO.client
26
- TranslationIO.client.purge
27
- else
28
- TranslationIO.info "[Error] Client cannot be built. Did you set up the initializer?"
8
+ [ :init, :sync, :purge ].each do |t|
9
+ task t => :environment do
10
+ if TranslationIO.client
11
+ TranslationIO.client.send(t)
12
+ else
13
+ message = <<EOS
14
+ [Error] Can't configure client. Did you set up the initializer?
15
+ Read usage instructions here : http://translation.io/usage
16
+ EOS
17
+ TranslationIO.info(message)
18
+ end
29
19
  end
30
20
  end
31
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: translation
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.6'
4
+ version: '0.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aurelien Malisart
@@ -15,84 +15,84 @@ dependencies:
15
15
  name: gettext
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: 3.1.2
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: 3.1.2
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rails
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: haml
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: slim
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - '>='
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - '>='
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  description: translation.io connector
@@ -101,30 +101,30 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
+ - README.md
104
105
  - lib/translation.rb
106
+ - lib/translation_io/client.rb
107
+ - lib/translation_io/client/base_operation.rb
105
108
  - lib/translation_io/client/base_operation/create_new_mo_files_step.rb
106
109
  - lib/translation_io/client/base_operation/dump_haml_gettext_keys_step.rb
107
110
  - lib/translation_io/client/base_operation/dump_slim_gettext_keys_step.rb
108
111
  - lib/translation_io/client/base_operation/save_new_po_files_step.rb
109
112
  - lib/translation_io/client/base_operation/save_new_yaml_files_step.rb
110
113
  - lib/translation_io/client/base_operation/save_special_yaml_files_step.rb
111
- - lib/translation_io/client/base_operation.rb
114
+ - lib/translation_io/client/init_operation.rb
112
115
  - lib/translation_io/client/init_operation/cleanup_yaml_files_step.rb
113
116
  - lib/translation_io/client/init_operation/create_yaml_po_files_step.rb
114
117
  - lib/translation_io/client/init_operation/update_and_collect_po_files_step.rb
115
118
  - lib/translation_io/client/init_operation/update_pot_file_step.rb
116
- - lib/translation_io/client/init_operation.rb
119
+ - lib/translation_io/client/sync_operation.rb
117
120
  - lib/translation_io/client/sync_operation/create_yaml_pot_file_step.rb
118
121
  - lib/translation_io/client/sync_operation/update_and_collect_pot_file_step.rb
119
- - lib/translation_io/client/sync_operation.rb
120
- - lib/translation_io/client.rb
121
122
  - lib/translation_io/config.rb
122
123
  - lib/translation_io/controller.rb
123
124
  - lib/translation_io/flat_hash.rb
124
125
  - lib/translation_io/railtie.rb
125
126
  - lib/translation_io/tasks.rb
126
127
  - lib/translation_io/yaml_conversion.rb
127
- - README.md
128
128
  homepage: http://rails.translation.io
129
129
  licenses:
130
130
  - MIT
@@ -135,17 +135,17 @@ require_paths:
135
135
  - lib
136
136
  required_ruby_version: !ruby/object:Gem::Requirement
137
137
  requirements:
138
- - - '>='
138
+ - - ">="
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
141
  required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '>='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  requirements: []
147
147
  rubyforge_project:
148
- rubygems_version: 2.0.0
148
+ rubygems_version: 2.2.0
149
149
  signing_key:
150
150
  specification_version: 4
151
151
  summary: translation.io connector