tolk 5.0.2 → 6.0.0.alpha1

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
  SHA256:
3
- metadata.gz: e5de6a79064d4d85e04496152aac11d8fa60e14bde292f51990cc4cc006d146b
4
- data.tar.gz: 302345bdea17f7f41be7ebf0c141c872a628e6d1693036fc961327c79a2e1c3b
3
+ metadata.gz: 147970ccfb4a24e0ee2dd1ebf6388cedf15e1905198fea1f17b0e3ba9607f3c8
4
+ data.tar.gz: 3dafeb77b4910b6d015c4b33ac4b037a9ca2b2457b72d0027cb5bb1687e96ae8
5
5
  SHA512:
6
- metadata.gz: b674e81e5b20f24a5e9b573d63cbf18b5ee4881ee6522101635950757fee8947bd555fbb1e15b04c9a616b42eff2441b0844abbee2250a045de040d48e8ca7dd
7
- data.tar.gz: 1f1e0385b73dcd992a86965c4e98c9713fca8c7feae0865aa1a2c3886b367d594b85611011cb483606806c410f1a41ace06bde97d2a002b5068036e6bee92b5b
6
+ metadata.gz: 30bb529018c5c8f3cb8950bd09ed654e64a2553c383d8c2ae9a3893607a3d848d8f7fb0b8238dae83b35f233f2751fcbb9a58438c4f0cd55e3d6040211f70190
7
+ data.tar.gz: 2adc6357331643ab3b9f83ca2dd742d8cd67d97456a57ec0d727a3e7b7ecc1c3ba7087c1d640b0348f4a135314d0e1fc892b4e048b6288f70f711e8b70a29c1b
@@ -17,7 +17,7 @@ module Tolk
17
17
 
18
18
  format.yaml do
19
19
  data = @locale.to_hash
20
- render :plain => Tolk::YAML.dump(data)
20
+ render :plain => YAML.dump(data)
21
21
  end
22
22
 
23
23
  end
@@ -23,7 +23,7 @@ module Tolk
23
23
  def yaml_value(value)
24
24
  if value.present?
25
25
  unless value.is_a?(String) || value.is_a?(TrueClass) || value.is_a?(FalseClass)
26
- value = Tolk::YAML.dump(value)
26
+ value = YAML.dump(value)
27
27
  end
28
28
  end
29
29
 
@@ -4,8 +4,8 @@ module Tolk
4
4
 
5
5
  scope :containing_text, lambda {|query| where("tolk_translations.text LIKE ?", "%#{query}%") }
6
6
 
7
- serialize :text
8
- serialize :previous_text
7
+ serialize :text, coder: YAML, yaml: { permitted_classes: [Symbol, Time, nil, String, Array, Hash] }
8
+ serialize :previous_text, coder: YAML, yaml: { permitted_classes: [Symbol, Time, nil, String, Array, Hash] }
9
9
  validate :validate_text_not_nil, :if => proc {|r| r.primary.blank? && !r.explicit_nil && !r.boolean?}
10
10
  validate :check_matching_variables, :if => proc { |tr| tr.primary_translation.present? }
11
11
 
data/lib/tolk/export.rb CHANGED
@@ -10,7 +10,7 @@ module Tolk
10
10
 
11
11
  def dump
12
12
  File.open("#{destination}/#{name}.yml", "w+") do |file|
13
- file.write(Tolk::YAML.dump(data))
13
+ file.write(YAML.dump(data))
14
14
  end
15
15
  end
16
16
 
data/lib/tolk/import.rb CHANGED
@@ -53,7 +53,7 @@ module Tolk
53
53
 
54
54
  puts "[INFO] Reading #{locale_file} for locale #{self.name}"
55
55
  begin
56
- self.class.flat_hash(Tolk::YAML.load_file(locale_file)[self.name])
56
+ self.class.flat_hash(YAML.load_file(locale_file)[self.name])
57
57
  rescue
58
58
  puts "[ERROR] File #{locale_file} expected to declare #{self.name} locale, but it does not. Skipping this file."
59
59
  nil
data/lib/tolk/sync.rb CHANGED
@@ -47,7 +47,7 @@ module Tolk
47
47
  def read_primary_locale_file
48
48
  primary_file = "#{self.locales_config_path}/#{self.primary_locale_name}.yml"
49
49
  if File.exist?(primary_file)
50
- flat_hash(Tolk::YAML.load_file(primary_file)[self.primary_locale_name])
50
+ flat_hash(YAML.load_file(primary_file)[self.primary_locale_name])
51
51
  else
52
52
  {}
53
53
  end
data/lib/tolk/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tolk
2
- VERSION = "5.0.2"
2
+ VERSION = "6.0.0.alpha1"
3
3
  end
data/lib/tolk.rb CHANGED
@@ -1,10 +1,8 @@
1
- require 'safe_yaml/load'
2
1
  require 'tolk/config'
3
2
  require 'tolk/engine'
4
3
  require 'tolk/sync'
5
4
  require 'tolk/import'
6
5
  require 'tolk/export'
7
- require 'tolk/yaml'
8
6
  require 'tolk/pagination'
9
7
 
10
8
  module Tolk
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tolk
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.2
4
+ version: 6.0.0.alpha1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -20,20 +20,20 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: '6.0'
23
+ version: '7.0'
24
24
  - - "<"
25
25
  - !ruby/object:Gem::Version
26
- version: '7.2'
26
+ version: '7.3'
27
27
  type: :runtime
28
28
  prerelease: false
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '6.0'
33
+ version: '7.0'
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: '7.2'
36
+ version: '7.3'
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: sprockets-rails
39
39
  requirement: !ruby/object:Gem::Requirement
@@ -48,20 +48,6 @@ dependencies:
48
48
  - - "~>"
49
49
  - !ruby/object:Gem::Version
50
50
  version: '3.4'
51
- - !ruby/object:Gem::Dependency
52
- name: safe_yaml
53
- requirement: !ruby/object:Gem::Requirement
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- version: 0.8.6
58
- type: :runtime
59
- prerelease: false
60
- version_requirements: !ruby/object:Gem::Requirement
61
- requirements:
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- version: 0.8.6
65
51
  - !ruby/object:Gem::Dependency
66
52
  name: sqlite3
67
53
  requirement: !ruby/object:Gem::Requirement
@@ -150,16 +136,16 @@ dependencies:
150
136
  name: puma
151
137
  requirement: !ruby/object:Gem::Requirement
152
138
  requirements:
153
- - - ">="
139
+ - - "~>"
154
140
  - !ruby/object:Gem::Version
155
- version: '5.5'
141
+ version: '6.0'
156
142
  type: :development
157
143
  prerelease: false
158
144
  version_requirements: !ruby/object:Gem::Requirement
159
145
  requirements:
160
- - - ">="
146
+ - - "~>"
161
147
  - !ruby/object:Gem::Version
162
- version: '5.5'
148
+ version: '6.0'
163
149
  - !ruby/object:Gem::Dependency
164
150
  name: appraisal
165
151
  requirement: !ruby/object:Gem::Requirement
@@ -226,7 +212,6 @@ files:
226
212
  - lib/tolk/pagination.rb
227
213
  - lib/tolk/sync.rb
228
214
  - lib/tolk/version.rb
229
- - lib/tolk/yaml.rb
230
215
  homepage: https://github.com/tolk/tolk
231
216
  licenses:
232
217
  - MIT
@@ -239,7 +224,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
239
224
  requirements:
240
225
  - - ">="
241
226
  - !ruby/object:Gem::Version
242
- version: 2.5.0
227
+ version: 3.0.0
243
228
  required_rubygems_version: !ruby/object:Gem::Requirement
244
229
  requirements:
245
230
  - - ">="
data/lib/tolk/yaml.rb DELETED
@@ -1,29 +0,0 @@
1
- module Tolk
2
- module YAML
3
- SAFE_YAML_OPTIONS = SafeYAML::Deep.freeze({
4
- :default_mode => :safe,
5
- :deserialize_symbols => true
6
- })
7
-
8
- def self.load(yaml)
9
- # SafeYAML.load has different arity depending on the YAML engine used.
10
- if SafeYAML::YAML_ENGINE == "psych"
11
- SafeYAML.load(yaml, nil, SAFE_YAML_OPTIONS)
12
- else # syck
13
- SafeYAML.load(yaml, SAFE_YAML_OPTIONS)
14
- end
15
- end
16
-
17
- def self.load_file(filename)
18
- SafeYAML.load_file(filename, SAFE_YAML_OPTIONS)
19
- end
20
-
21
- def self.dump(payload)
22
- if payload.respond_to?(:ya2yaml)
23
- payload.ya2yaml(:syck_compatible => true)
24
- else
25
- ::YAML.dump(payload, line_width: Tolk::Config.yaml_line_width)
26
- end
27
- end
28
- end
29
- end