web_translate_it 2.5.4 → 2.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/spec/spec_helper.rb CHANGED
@@ -3,10 +3,9 @@ if ENV['COVERAGE']
3
3
  SimpleCov.start
4
4
  end
5
5
 
6
- require File.expand_path('../../lib/web_translate_it', __FILE__)
6
+ require File.expand_path('../lib/web_translate_it', __dir__)
7
7
  require 'rspec'
8
8
 
9
9
  class I18n
10
- def self.reload!
11
- end
10
+ def self.reload!; end
12
11
  end
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe WebTranslateIt::AutoFetch do
4
-
5
- let(:application) { double(:application, :call => []) }
4
+ let(:application) { double(:application, call: []) }
6
5
 
7
6
  let(:env) do
8
7
  { 'PATH_INFO' => path }
@@ -1,27 +1,26 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe WebTranslateIt::String do
4
+ let(:api_key) { 'proj_pvt_glzDR250FLXlMgJPZfEyHQ' }
4
5
 
5
- let(:api_key) { "proj_pvt_glzDR250FLXlMgJPZfEyHQ" }
6
-
7
- describe "#initialize" do
8
- it "should assign api_key and many parameters" do
9
- string = WebTranslateIt::String.new({ "id" => 1234, "key" => "bacon"})
6
+ describe '#initialize' do
7
+ it 'should assign api_key and many parameters' do
8
+ string = WebTranslateIt::String.new({ 'id' => 1234, 'key' => 'bacon' })
10
9
  string.id.should == 1234
11
- string.key.should == "bacon"
10
+ string.key.should == 'bacon'
12
11
  end
13
12
 
14
- it "should assign parameters using symbols" do
15
- string = WebTranslateIt::String.new({ :id => 1234, :key => "bacon"})
13
+ it 'should assign parameters using symbols' do
14
+ string = WebTranslateIt::String.new({ id: 1234, key: 'bacon' })
16
15
  string.id.should == 1234
17
- string.key.should == "bacon"
16
+ string.key.should == 'bacon'
18
17
  end
19
18
  end
20
19
 
21
- describe "#save" do
22
- it "should create a new String" do
20
+ describe '#save' do
21
+ it 'should create a new String' do
23
22
  WebTranslateIt::Connection.new(api_key) do
24
- string = WebTranslateIt::String.new({ "key" => "bacon" })
23
+ string = WebTranslateIt::String.new({ 'key' => 'bacon' })
25
24
  string.save
26
25
  string.id.should_not be_nil
27
26
  string_fetched = WebTranslateIt::String.find(string.id)
@@ -32,61 +31,61 @@ describe WebTranslateIt::String do
32
31
  end
33
32
  end
34
33
 
35
- it "should update an existing String" do
34
+ it 'should update an existing String' do
36
35
  WebTranslateIt::Connection.new(api_key) do
37
- string = WebTranslateIt::String.new({ "key" => "bacony" })
36
+ string = WebTranslateIt::String.new({ 'key' => 'bacony' })
38
37
  string.save
39
- string.key = "bacon changed"
38
+ string.key = 'bacon changed'
40
39
  string.save
41
40
  string_fetched = WebTranslateIt::String.find(string.id)
42
- string_fetched.key.should == "bacon changed"
41
+ string_fetched.key.should == 'bacon changed'
43
42
  string.delete
44
43
  end
45
44
  end
46
45
 
47
- it "should create a new String with Translation" do
48
- translation1 = WebTranslateIt::Translation.new({ "locale" => "en", "text" => "Hello" })
49
- translation2 = WebTranslateIt::Translation.new({ "locale" => "fr", "text" => "Bonjour" })
46
+ it 'should create a new String with Translation' do
47
+ translation1 = WebTranslateIt::Translation.new({ 'locale' => 'en', 'text' => 'Hello' })
48
+ translation2 = WebTranslateIt::Translation.new({ 'locale' => 'fr', 'text' => 'Bonjour' })
50
49
 
51
- string = WebTranslateIt::String.new({ "key" => "bacon", "translations" => [translation1, translation2] })
50
+ string = WebTranslateIt::String.new({ 'key' => 'bacon', 'translations' => [translation1, translation2] })
52
51
  WebTranslateIt::Connection.new(api_key) do
53
52
  string.save
54
53
  string_fetched = WebTranslateIt::String.find(string.id)
55
- string_fetched.translation_for("en").should_not be_nil
56
- string_fetched.translation_for("en").text.should == "Hello"
57
- string_fetched.translation_for("fr").should_not be_nil
58
- string_fetched.translation_for("fr").text.should == "Bonjour"
59
- string_fetched.translation_for("es").should be_nil
54
+ string_fetched.translation_for('en').should_not be_nil
55
+ string_fetched.translation_for('en').text.should == 'Hello'
56
+ string_fetched.translation_for('fr').should_not be_nil
57
+ string_fetched.translation_for('fr').text.should == 'Bonjour'
58
+ string_fetched.translation_for('es').should be_nil
60
59
  string.delete
61
60
  end
62
61
  end
63
62
 
64
- it "should update a String and save its Translation" do
65
- translation1 = WebTranslateIt::Translation.new({ "locale" => "en", "text" => "Hello" })
66
- translation2 = WebTranslateIt::Translation.new({ "locale" => "fr", "text" => "Bonjour" })
63
+ it 'should update a String and save its Translation' do
64
+ translation1 = WebTranslateIt::Translation.new({ 'locale' => 'en', 'text' => 'Hello' })
65
+ translation2 = WebTranslateIt::Translation.new({ 'locale' => 'fr', 'text' => 'Bonjour' })
67
66
 
68
- string = WebTranslateIt::String.new({ "key" => "bacon" })
67
+ string = WebTranslateIt::String.new({ 'key' => 'bacon' })
69
68
  WebTranslateIt::Connection.new(api_key) do
70
69
  string.save
71
70
  string_fetched = WebTranslateIt::String.find(string.id)
72
- string_fetched.translation_for("fr").should be_nil
71
+ string_fetched.translation_for('fr').should be_nil
73
72
 
74
73
  string_fetched.translations = [translation1, translation2]
75
74
  string_fetched.save
76
75
 
77
76
  string_fetched = WebTranslateIt::String.find(string.id)
78
- string_fetched.translation_for("en").should_not be_nil
79
- string_fetched.translation_for("en").text.should == "Hello"
80
- string_fetched.translation_for("fr").should_not be_nil
81
- string_fetched.translation_for("fr").text.should == "Bonjour"
77
+ string_fetched.translation_for('en').should_not be_nil
78
+ string_fetched.translation_for('en').text.should == 'Hello'
79
+ string_fetched.translation_for('fr').should_not be_nil
80
+ string_fetched.translation_for('fr').text.should == 'Bonjour'
82
81
  string.delete
83
82
  end
84
83
  end
85
84
  end
86
85
 
87
- describe "#delete" do
88
- it "should delete a String" do
89
- string = WebTranslateIt::String.new({ "key" => "bacon" })
86
+ describe '#delete' do
87
+ it 'should delete a String' do
88
+ string = WebTranslateIt::String.new({ 'key' => 'bacon' })
90
89
  WebTranslateIt::Connection.new(api_key) do
91
90
  string.save
92
91
  string_fetched = WebTranslateIt::String.find(string.id)
@@ -98,54 +97,54 @@ describe WebTranslateIt::String do
98
97
  end
99
98
  end
100
99
 
101
- describe "#find_all" do
102
- it "should find many strings" do
100
+ describe '#find_all' do
101
+ it 'should find many strings' do
103
102
  WebTranslateIt::Connection.new(api_key) do
104
- string1 = WebTranslateIt::String.new({ "key" => "one two three" })
103
+ string1 = WebTranslateIt::String.new({ 'key' => 'one two three' })
105
104
  string1.save
106
- string2 = WebTranslateIt::String.new({ "key" => "four five six" })
105
+ string2 = WebTranslateIt::String.new({ 'key' => 'four five six' })
107
106
  string2.save
108
- string3 = WebTranslateIt::String.new({ "key" => "six seven eight" })
107
+ string3 = WebTranslateIt::String.new({ 'key' => 'six seven eight' })
109
108
  string3.save
110
109
 
111
- strings = WebTranslateIt::String.find_all({ "key" => "six" })
110
+ strings = WebTranslateIt::String.find_all({ 'key' => 'six' })
112
111
  strings.count.should == 2
113
- strings[0].key.should == "four five six"
114
- strings[1].key.should == "six seven eight"
112
+ strings[0].key.should == 'four five six'
113
+ strings[1].key.should == 'six seven eight'
115
114
 
116
- strings = WebTranslateIt::String.find_all({ :key => "six" })
115
+ strings = WebTranslateIt::String.find_all({ key: 'six' })
117
116
  strings.count.should == 2
118
- strings[0].key.should == "four five six"
119
- strings[1].key.should == "six seven eight"
117
+ strings[0].key.should == 'four five six'
118
+ strings[1].key.should == 'six seven eight'
120
119
 
121
- strings = WebTranslateIt::String.find_all({ "key" => "eight" })
120
+ strings = WebTranslateIt::String.find_all({ 'key' => 'eight' })
122
121
  strings.count.should == 1
123
- strings[0].key.should == "six seven eight"
122
+ strings[0].key.should == 'six seven eight'
124
123
 
125
- strings = WebTranslateIt::String.find_all({ "key" => "three" })
124
+ strings = WebTranslateIt::String.find_all({ 'key' => 'three' })
126
125
  strings.count.should == 1
127
- strings[0].key.should == "one two three"
126
+ strings[0].key.should == 'one two three'
128
127
  end
129
128
  end
130
129
  end
131
130
 
132
- describe "#translation_for" do
133
- it "should fetch translations" do
134
- translation = WebTranslateIt::Translation.new({ "locale" => "en", "text" => "Hello" })
135
- string = WebTranslateIt::String.new({ "key" => "greetings", "translations" => [translation] })
131
+ describe '#translation_for' do
132
+ it 'should fetch translations' do
133
+ translation = WebTranslateIt::Translation.new({ 'locale' => 'en', 'text' => 'Hello' })
134
+ string = WebTranslateIt::String.new({ 'key' => 'greetings', 'translations' => [translation] })
136
135
  WebTranslateIt::Connection.new(api_key) do
137
136
  string.save
138
137
  string_fetched = WebTranslateIt::String.find(string.id)
139
- string_fetched.translation_for("en").should_not be_nil
140
- string_fetched.translation_for("en").text.should == "Hello"
141
- string_fetched.translation_for("fr").should be_nil
138
+ string_fetched.translation_for('en').should_not be_nil
139
+ string_fetched.translation_for('en').text.should == 'Hello'
140
+ string_fetched.translation_for('fr').should be_nil
142
141
  string.delete
143
142
  end
144
143
  end
145
144
 
146
- it "should not return a stale object" do
147
- string = WebTranslateIt::String.new({ :key => "greetings 2" })
148
- translation = WebTranslateIt::Translation.new({ :locale => "es", :text => "text", :string_id => string.id })
145
+ it 'should not return a stale object' do
146
+ string = WebTranslateIt::String.new({ key: 'greetings 2' })
147
+ translation = WebTranslateIt::Translation.new({ locale: 'es', text: 'text', string_id: string.id })
149
148
  string.translations << translation
150
149
  string.translation_for('fr').should be_nil
151
150
  string.translation_for('es').should_not be_nil
@@ -1,27 +1,26 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe WebTranslateIt::Term do
4
+ let(:api_key) { 'proj_pvt_glzDR250FLXlMgJPZfEyHQ' }
4
5
 
5
- let(:api_key) { "proj_pvt_glzDR250FLXlMgJPZfEyHQ" }
6
-
7
- describe "#initialize" do
8
- it "should assign api_key and many parameters" do
9
- term = WebTranslateIt::Term.new({ "id" => 1234, "text" => "bacon"})
6
+ describe '#initialize' do
7
+ it 'should assign api_key and many parameters' do
8
+ term = WebTranslateIt::Term.new({ 'id' => 1234, 'text' => 'bacon' })
10
9
  term.id.should == 1234
11
- term.text.should == "bacon"
10
+ term.text.should == 'bacon'
12
11
  end
13
12
 
14
- it "should assign parameters using symbols" do
15
- term = WebTranslateIt::Term.new({ :id => 1234, :text => "bacon"})
13
+ it 'should assign parameters using symbols' do
14
+ term = WebTranslateIt::Term.new({ id: 1234, text: 'bacon' })
16
15
  term.id.should == 1234
17
- term.text.should == "bacon"
16
+ term.text.should == 'bacon'
18
17
  end
19
18
  end
20
19
 
21
- describe "#save" do
22
- it "should create a new Term" do
20
+ describe '#save' do
21
+ it 'should create a new Term' do
23
22
  WebTranslateIt::Connection.new(api_key) do
24
- term = WebTranslateIt::Term.new({ "text" => "Term", "description" => "A description" })
23
+ term = WebTranslateIt::Term.new({ 'text' => 'Term', 'description' => 'A description' })
25
24
  term.save
26
25
  term.id.should_not be_nil
27
26
  term_fetched = WebTranslateIt::Term.find(term.id)
@@ -32,59 +31,59 @@ describe WebTranslateIt::Term do
32
31
  end
33
32
  end
34
33
 
35
- it "should update an existing Term" do
34
+ it 'should update an existing Term' do
36
35
  WebTranslateIt::Connection.new(api_key) do
37
- term = WebTranslateIt::Term.new({ "text" => "Term 2", "description" => "A description" })
36
+ term = WebTranslateIt::Term.new({ 'text' => 'Term 2', 'description' => 'A description' })
38
37
  term.save
39
- term.text = "A Term"
38
+ term.text = 'A Term'
40
39
  term.save
41
40
  term_fetched = WebTranslateIt::Term.find(term.id)
42
- term_fetched.text.should == "A Term"
41
+ term_fetched.text.should == 'A Term'
43
42
  term.delete
44
43
  end
45
44
  end
46
45
 
47
- it "should create a new Term with a TermTranslation" do
48
- translation1 = WebTranslateIt::TermTranslation.new({ "locale" => "fr", "text" => "Bonjour" })
49
- translation2 = WebTranslateIt::TermTranslation.new({ "locale" => "fr", "text" => "Salut" })
46
+ it 'should create a new Term with a TermTranslation' do
47
+ translation1 = WebTranslateIt::TermTranslation.new({ 'locale' => 'fr', 'text' => 'Bonjour' })
48
+ translation2 = WebTranslateIt::TermTranslation.new({ 'locale' => 'fr', 'text' => 'Salut' })
50
49
 
51
- term = WebTranslateIt::Term.new({ "text" => "Hello", "translations" => [translation1, translation2] })
50
+ term = WebTranslateIt::Term.new({ 'text' => 'Hello', 'translations' => [translation1, translation2] })
52
51
  WebTranslateIt::Connection.new(api_key) do
53
52
  term.save
54
53
  term_fetched = WebTranslateIt::Term.find(term.id)
55
- term_fetched.translation_for("fr").should_not be_nil
56
- term_fetched.translation_for("fr")[0].text.should == "Salut"
57
- term_fetched.translation_for("fr")[1].text.should == "Bonjour"
58
- term_fetched.translation_for("es").should be_nil
54
+ term_fetched.translation_for('fr').should_not be_nil
55
+ term_fetched.translation_for('fr')[0].text.should == 'Salut'
56
+ term_fetched.translation_for('fr')[1].text.should == 'Bonjour'
57
+ term_fetched.translation_for('es').should be_nil
59
58
  term.delete
60
59
  end
61
60
  end
62
61
 
63
- it "should update a Term and save its Translation" do
64
- translation1 = WebTranslateIt::TermTranslation.new({ "locale" => "fr", "text" => "Bonjour" })
65
- translation2 = WebTranslateIt::TermTranslation.new({ "locale" => "fr", "text" => "Salut" })
62
+ it 'should update a Term and save its Translation' do
63
+ translation1 = WebTranslateIt::TermTranslation.new({ 'locale' => 'fr', 'text' => 'Bonjour' })
64
+ translation2 = WebTranslateIt::TermTranslation.new({ 'locale' => 'fr', 'text' => 'Salut' })
66
65
 
67
- term = WebTranslateIt::Term.new({ "text" => "Hi!" })
66
+ term = WebTranslateIt::Term.new({ 'text' => 'Hi!' })
68
67
  WebTranslateIt::Connection.new(api_key) do
69
68
  term.save
70
69
  term_fetched = WebTranslateIt::Term.find(term.id)
71
- term_fetched.translation_for("fr").should be_nil
70
+ term_fetched.translation_for('fr').should be_nil
72
71
 
73
72
  term_fetched.translations = [translation1, translation2]
74
73
  term_fetched.save
75
74
 
76
75
  term_fetched = WebTranslateIt::Term.find(term.id)
77
- term_fetched.translation_for("fr").should_not be_nil
78
- term_fetched.translation_for("fr")[0].text.should == "Salut"
79
- term_fetched.translation_for("fr")[1].text.should == "Bonjour"
76
+ term_fetched.translation_for('fr').should_not be_nil
77
+ term_fetched.translation_for('fr')[0].text.should == 'Salut'
78
+ term_fetched.translation_for('fr')[1].text.should == 'Bonjour'
80
79
  term.delete
81
80
  end
82
81
  end
83
82
  end
84
83
 
85
- describe "#delete" do
86
- it "should delete a Term" do
87
- term = WebTranslateIt::Term.new({ "text" => "bacon" })
84
+ describe '#delete' do
85
+ it 'should delete a Term' do
86
+ term = WebTranslateIt::Term.new({ 'text' => 'bacon' })
88
87
  WebTranslateIt::Connection.new(api_key) do
89
88
  term.save
90
89
  term_fetched = WebTranslateIt::Term.find(term.id)
@@ -97,17 +96,17 @@ describe WebTranslateIt::Term do
97
96
  end
98
97
  end
99
98
 
100
- describe "#find_all" do
101
- it "should fetch many terms" do
99
+ describe '#find_all' do
100
+ it 'should fetch many terms' do
102
101
  WebTranslateIt::Connection.new(api_key) do
103
102
  terms = WebTranslateIt::Term.find_all
104
103
  count = terms.count
105
-
106
- term1 = WebTranslateIt::Term.new({ "text" => "greeting 1" })
104
+
105
+ term1 = WebTranslateIt::Term.new({ 'text' => 'greeting 1' })
107
106
  term1.save
108
- term2 = WebTranslateIt::Term.new({ "text" => "greeting 2" })
107
+ term2 = WebTranslateIt::Term.new({ 'text' => 'greeting 2' })
109
108
  term2.save
110
- term3 = WebTranslateIt::Term.new({ "text" => "greeting 3" })
109
+ term3 = WebTranslateIt::Term.new({ 'text' => 'greeting 3' })
111
110
  term3.save
112
111
 
113
112
  terms = WebTranslateIt::Term.find_all
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_translate_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.4
4
+ version: 2.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edouard Briere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-08 00:00:00.000000000 Z
11
+ date: 2022-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: multi_json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: multipart-post
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,13 +53,27 @@ dependencies:
39
53
  - !ruby/object:Gem::Version
40
54
  version: '3.0'
41
55
  - !ruby/object:Gem::Dependency
42
- name: multi_json
56
+ name: guard-rspec
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - ">="
46
60
  - !ruby/object:Gem::Version
47
61
  version: '0'
48
- type: :runtime
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard-rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
@@ -67,7 +95,7 @@ dependencies:
67
95
  - !ruby/object:Gem::Version
68
96
  version: 2.6.0
69
97
  - !ruby/object:Gem::Dependency
70
- name: simplecov
98
+ name: rubocop
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
101
  - - ">="
@@ -81,7 +109,7 @@ dependencies:
81
109
  - !ruby/object:Gem::Version
82
110
  version: '0'
83
111
  - !ruby/object:Gem::Dependency
84
- name: guard-rspec
112
+ name: simplecov
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
115
  - - ">="
@@ -94,8 +122,8 @@ dependencies:
94
122
  - - ">="
95
123
  - !ruby/object:Gem::Version
96
124
  version: '0'
97
- description: A gem to push and pull language files to WebTranslateIt.com.
98
- email: edouard@atelierconvivialite.com
125
+ description: A Command Line Interface tool to push and pull language files to WebTranslateIt.com.
126
+ email: support@webtranslateit.com
99
127
  executables:
100
128
  - wti
101
129
  extensions: []
@@ -137,7 +165,14 @@ files:
137
165
  homepage: https://webtranslateit.com
138
166
  licenses:
139
167
  - MIT
140
- metadata: {}
168
+ metadata:
169
+ rubygems_mfa_required: 'true'
170
+ bug_tracker_uri: https://github.com/webtranslateit/webtranslateit/issues
171
+ changelog_uri: https://github.com/webtranslateit/webtranslateit/blob/master/history.md
172
+ documentation_uri: https://github.com/webtranslateit/webtranslateit#readme
173
+ homepage_uri: https://webtranslateit.com
174
+ source_code_uri: https://github.com/webtranslateit/webtranslateit
175
+ wiki_uri: https://github.com/webtranslateit/webtranslateit/wiki
141
176
  post_install_message:
142
177
  rdoc_options:
143
178
  - "--main"
@@ -148,21 +183,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
183
  requirements:
149
184
  - - ">="
150
185
  - !ruby/object:Gem::Version
151
- version: '0'
186
+ version: '2.5'
152
187
  required_rubygems_version: !ruby/object:Gem::Requirement
153
188
  requirements:
154
189
  - - ">="
155
190
  - !ruby/object:Gem::Version
156
191
  version: '0'
157
192
  requirements: []
158
- rubygems_version: 3.1.6
193
+ rubygems_version: 3.3.3
159
194
  signing_key:
160
195
  specification_version: 4
161
- summary: A CLI to sync locale files with WebTranslateIt.com.
196
+ summary: A CLI tool to sync locale files with WebTranslateIt.com.
162
197
  test_files:
163
- - spec/web_translate_it/auto_fetch_spec.rb
164
- - spec/web_translate_it/term_spec.rb
165
- - spec/web_translate_it/string_spec.rb
166
- - spec/spec_helper.rb
167
198
  - spec/examples/config/translation.yml
168
199
  - spec/examples/en.yml
200
+ - spec/spec_helper.rb
201
+ - spec/web_translate_it/auto_fetch_spec.rb
202
+ - spec/web_translate_it/string_spec.rb
203
+ - spec/web_translate_it/term_spec.rb