phrasing 4.2.1 → 4.3.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 +5 -5
- data/.travis.yml +5 -4
- data/Gemfile +3 -2
- data/README.md +2 -3
- data/app/assets/javascripts/phrasing.js +5 -1
- data/lib/generators/phrasing/phrasing_generator.rb +3 -5
- data/lib/phrasing/version.rb +1 -1
- data/spec/controllers/phrasing_phrases_controller.rb +1 -1
- data/spec/dummy/config/application.rb +0 -1
- data/spec/dummy/config/initializers/secret_token.rb +1 -0
- data/spec/factories/phrasing_phrases.rb +5 -6
- data/spec/features/dummy_spec.rb +5 -5
- data/spec/features/phrasing_spec.rb +20 -34
- data/spec/lib/phrasing_serializer_spec.rb +8 -8
- data/spec/lib/phrasing_spec.rb +1 -1
- data/spec/models/phrasing_phrase_spec.rb +1 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3fa80ff59b5b335272a27f88818c9b527182c7e91d367f4baeea71b680122372
|
4
|
+
data.tar.gz: dd0343b4dc10fdb3434251fb5f44124cc52b99fd0e6065391155a8072246f6ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eef3283f9cdf3dbda9a2de72e1628fac2403cb174e4a8ce64c5a9b7a45fa3ee4c5e68fe93bf3e52a92be2b190699007446cc663b7b52ac7ec6e403a9c7118fbd
|
7
|
+
data.tar.gz: '0873b3672640c7203f5b1f0a6c01a0f4ead2b4f24b4f1bdeb18ca6bd80db29d50099aff1fbbb05082345f1a7419334955a179855790cc381dbb82944d32c64a0'
|
data/.travis.yml
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
sudo: false
|
2
2
|
language: ruby
|
3
3
|
before_install:
|
4
|
-
- gem
|
4
|
+
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
5
|
+
- gem install bundler -v '< 2'
|
5
6
|
script:
|
6
7
|
- RAILS_ENV=test bundle exec rake db:migrate --trace
|
7
8
|
- bundle exec rspec spec/
|
8
9
|
|
9
10
|
matrix:
|
10
11
|
include:
|
11
|
-
- rvm: 2.
|
12
|
+
- rvm: 2.3.0
|
12
13
|
env: "RAILS_VERSION=4.1.0"
|
13
|
-
- rvm: 2.
|
14
|
+
- rvm: 2.4.0
|
14
15
|
env: "RAILS_VERSION=4.2.0"
|
15
|
-
- rvm: 2.
|
16
|
+
- rvm: 2.5.0
|
16
17
|
env: "RAILS_VERSION=5.0.0"
|
data/Gemfile
CHANGED
@@ -8,11 +8,12 @@ gem 'nokogiri', '~> 1.8.3'
|
|
8
8
|
gem 'rails', "~> #{rails_version}"
|
9
9
|
|
10
10
|
gem 'capybara'
|
11
|
-
gem '
|
11
|
+
gem 'factory_bot_rails'
|
12
12
|
gem 'jasmine-core', '~> 2.9.1'
|
13
13
|
gem 'jasmine-rails'
|
14
14
|
gem 'poltergeist'
|
15
15
|
gem 'pry-rails'
|
16
|
+
gem 'rdoc'
|
16
17
|
gem 'rspec-rails', '~> 3.7.1'
|
17
18
|
gem 'sass'
|
18
|
-
gem 'sqlite3'
|
19
|
+
gem 'sqlite3', '~> 1.3.6'
|
data/README.md
CHANGED
@@ -100,14 +100,13 @@ config.allow_update_on_all_models_and_attributes = true
|
|
100
100
|
|
101
101
|
## Turbolinks
|
102
102
|
|
103
|
-
If you're
|
103
|
+
If you're using Turbolinks make sure the phrasing gem is required after it:
|
104
104
|
|
105
105
|
```javascript
|
106
106
|
//= require jquery
|
107
107
|
//= require jquery_ujs
|
108
|
-
//= require jquery.turbolinks
|
109
|
-
//= require phrasing
|
110
108
|
//= require turbolinks
|
109
|
+
//= require phrasing
|
111
110
|
```
|
112
111
|
|
113
112
|
## Phrasing Appearance
|
@@ -163,7 +163,11 @@ var phrasing_setup = function(){
|
|
163
163
|
}
|
164
164
|
};
|
165
165
|
|
166
|
-
|
166
|
+
if(typeof Turbolinks == "object") {
|
167
|
+
$(document).on('turbolinks:load', phrasing_setup);
|
168
|
+
} else {
|
169
|
+
$(document).ready(phrasing_setup);
|
170
|
+
}
|
167
171
|
|
168
172
|
$(document).on('page:before-change', function() {
|
169
173
|
Phrasing.Bus.off();
|
@@ -25,12 +25,10 @@ class PhrasingGenerator < Rails::Generators::Base
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def migration_version
|
28
|
-
if
|
29
|
-
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
|
30
|
-
end
|
28
|
+
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" if rails_major_version >= 5
|
31
29
|
end
|
32
30
|
|
33
|
-
def
|
34
|
-
Rails.version.
|
31
|
+
def rails_major_version
|
32
|
+
Rails.version.first.to_i
|
35
33
|
end
|
36
34
|
end
|
data/lib/phrasing/version.rb
CHANGED
@@ -7,7 +7,7 @@ describe PhrasingPhrasesController do
|
|
7
7
|
expect(response).to render_template(:index)
|
8
8
|
end
|
9
9
|
|
10
|
-
let(:phrase) {
|
10
|
+
let(:phrase) { FactoryBot.create(:phrasing_phrase, value: 'old_value') }
|
11
11
|
|
12
12
|
it 'updates phrase' do
|
13
13
|
expect do
|
@@ -5,3 +5,4 @@
|
|
5
5
|
# Make sure the secret is at least 30 characters and all random,
|
6
6
|
# no regular words or you'll be exposed to dictionary attacks.
|
7
7
|
Dummy::Application.config.secret_token = '58a2a6a84d84c3e438f9ca2616323039174f7da3337e52de287033934caa5d32051779feec0aba01731cd4811d60150b208b856b706bee47f510c8a0648f1600'
|
8
|
+
Dummy::Application.config.secret_key_base = '91f7361433a40ea1fb938722ec727bd89312d0a2431a0e3f2770ebf4fe5ada502e8e9920ce5743e965c219cc153ef9f68fbcfd0f4c837cdb96174dc4068f3a69'
|
@@ -1,12 +1,11 @@
|
|
1
|
-
|
1
|
+
FactoryBot.define do
|
2
2
|
sequence :string do |n|
|
3
3
|
"string%09d" % n
|
4
4
|
end
|
5
|
-
|
5
|
+
|
6
6
|
factory :phrasing_phrase do
|
7
|
-
key {
|
8
|
-
value {
|
9
|
-
locale I18n.default_locale
|
7
|
+
key { FactoryBot.generate(:string) }
|
8
|
+
value { FactoryBot.generate(:string) }
|
9
|
+
locale { I18n.default_locale }
|
10
10
|
end
|
11
11
|
end
|
12
|
-
|
data/spec/features/dummy_spec.rb
CHANGED
@@ -9,7 +9,7 @@ feature "use #phrase" do
|
|
9
9
|
|
10
10
|
it "should see the header phrase modified if created before visiting" do
|
11
11
|
PhrasingPhrase.where(key: 'site.index.header').destroy_all
|
12
|
-
|
12
|
+
FactoryBot.create(:phrasing_phrase, key: 'site.index.header', value: 'The Header1')
|
13
13
|
visit root_path
|
14
14
|
expect(page).to have_content 'The Header1'
|
15
15
|
end
|
@@ -30,7 +30,7 @@ feature "use #phrase" do
|
|
30
30
|
|
31
31
|
it "shows the phrasing_phrase instead of the yaml" do
|
32
32
|
PhrasingPhrase.where(key: 'site.index.header').destroy_all
|
33
|
-
|
33
|
+
FactoryBot.create(:phrasing_phrase, key: 'site.index.header', value: 'A different header')
|
34
34
|
visit root_path
|
35
35
|
expect(page).not_to have_content 'The Header'
|
36
36
|
expect(page).to have_content 'A different header'
|
@@ -38,7 +38,7 @@ feature "use #phrase" do
|
|
38
38
|
|
39
39
|
it "allows to treat every translation as html safe" do
|
40
40
|
PhrasingPhrase.where(key: 'site.index.header').destroy_all
|
41
|
-
|
41
|
+
FactoryBot.create(:phrasing_phrase, key: 'site.index.header', value: '<strong>Strong header</strong>')
|
42
42
|
visit root_path
|
43
43
|
expect(page).to have_content 'Strong header'
|
44
44
|
visit root_path
|
@@ -93,8 +93,8 @@ feature "locales" do
|
|
93
93
|
end
|
94
94
|
|
95
95
|
it "displays different text based on users' locale" do
|
96
|
-
|
97
|
-
|
96
|
+
FactoryBot.create(:phrasing_phrase, locale: 'en', key: 'site.index.intro', value: 'world')
|
97
|
+
FactoryBot.create(:phrasing_phrase, locale: 'es', key: 'site.index.intro', value: 'mundo')
|
98
98
|
|
99
99
|
I18n.locale = :en
|
100
100
|
visit root_path
|
@@ -24,26 +24,12 @@ feature 'edit mode bubble' do
|
|
24
24
|
find(:css, ".phrasing-edit-all-phrases-link").click
|
25
25
|
expect(current_path).to eq phrasing_phrases_path
|
26
26
|
end
|
27
|
-
|
28
|
-
xit "phrases should have class shouldn't have class phrasable on when edit mode is off", js: true do
|
29
|
-
edit_mode_checkbox = find(:css, ".onoffswitch-checkbox")
|
30
|
-
edit_mode_checkbox.click
|
31
|
-
expect(page.find('.header').first('.phrasable')['class']).to eq 'phrasable'
|
32
|
-
end
|
33
|
-
|
34
|
-
xit 'edit phrases', js: true do
|
35
|
-
header_phrase = page.find('.header').first('.phrasable')
|
36
|
-
header_phrase['class'].should eq 'phrasable phrasable_on'
|
37
|
-
expect(header_phrase.text).to eq 'The Header'
|
38
|
-
header_phrase.set "content"
|
39
|
-
expect(header_phrase.expect.text).to eq 'content'
|
40
|
-
end
|
41
27
|
end
|
42
28
|
|
43
29
|
feature "phrasing index" do
|
44
30
|
|
45
31
|
before do
|
46
|
-
|
32
|
+
FactoryBot.create(:phrasing_phrase, key: "foo", value: "bar")
|
47
33
|
visit phrasing_phrases_path
|
48
34
|
end
|
49
35
|
|
@@ -87,23 +73,23 @@ feature "phrasing index" do
|
|
87
73
|
end
|
88
74
|
|
89
75
|
it "searches in the middles of strings" do
|
90
|
-
|
76
|
+
FactoryBot.create(:phrasing_phrase, key: "site.index.something")
|
91
77
|
fill_in 'search', with: 'index'
|
92
78
|
click_button 'Search'
|
93
79
|
expect(page).to have_content 'site.index.something'
|
94
80
|
end
|
95
81
|
|
96
82
|
it "can show all" do
|
97
|
-
|
83
|
+
FactoryBot.create(:phrasing_phrase, key: "foe", value: "beer")
|
98
84
|
click_button 'Search'
|
99
85
|
expect(page).to have_content 'foo'
|
100
86
|
expect(page).to have_content 'foe'
|
101
87
|
end
|
102
88
|
|
103
89
|
it 'not null values first, global order by key' do
|
104
|
-
|
105
|
-
|
106
|
-
|
90
|
+
FactoryBot.create(:phrasing_phrase, key: "foo1", value: nil)
|
91
|
+
FactoryBot.create(:phrasing_phrase, key: "foo2", value: "beer")
|
92
|
+
FactoryBot.create(:phrasing_phrase, key: "foo3", value: nil)
|
107
93
|
visit phrasing_phrases_path
|
108
94
|
expect(page.body).to match /foo[\s\S]*foo2[\s\S]*foo1[\s\S]*foo3/
|
109
95
|
end
|
@@ -112,9 +98,9 @@ feature "phrasing index" do
|
|
112
98
|
|
113
99
|
before do
|
114
100
|
PhrasingPhrase.destroy_all
|
115
|
-
|
116
|
-
|
117
|
-
|
101
|
+
FactoryBot.create(:phrasing_phrase, key: "foo", value: "bar1", locale: "en")
|
102
|
+
FactoryBot.create(:phrasing_phrase, key: "foo", value: "bar2", locale: "fa")
|
103
|
+
FactoryBot.create(:phrasing_phrase, key: "foo", value: "bar3", locale: "it")
|
118
104
|
end
|
119
105
|
|
120
106
|
it "nil locale, blank search" do
|
@@ -216,7 +202,7 @@ end
|
|
216
202
|
|
217
203
|
feature "phrasing edit" do
|
218
204
|
before do
|
219
|
-
|
205
|
+
FactoryBot.create(:phrasing_phrase, key: "foo", value: "bar")
|
220
206
|
visit phrasing_phrases_path
|
221
207
|
end
|
222
208
|
|
@@ -234,7 +220,7 @@ end
|
|
234
220
|
|
235
221
|
feature "phrasing update" do
|
236
222
|
before do
|
237
|
-
|
223
|
+
FactoryBot.create(:phrasing_phrase, key: "foo", value: "bar")
|
238
224
|
visit phrasing_phrases_path
|
239
225
|
fill_in 'search', with: 'foo'
|
240
226
|
click_button 'Search'
|
@@ -257,7 +243,7 @@ end
|
|
257
243
|
|
258
244
|
feature 'phrase versions' do
|
259
245
|
before do
|
260
|
-
phrase =
|
246
|
+
phrase = FactoryBot.create(:phrasing_phrase, key: "foo", value: "bar")
|
261
247
|
visit edit_phrasing_phrase_path(phrase)
|
262
248
|
end
|
263
249
|
|
@@ -299,11 +285,11 @@ feature "downloading and uploading yaml files" do
|
|
299
285
|
end
|
300
286
|
|
301
287
|
it "round-trips the YAML" do
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
288
|
+
FactoryBot.create(:phrasing_phrase, key: "a.foo1", value: "bar1")
|
289
|
+
FactoryBot.create(:phrasing_phrase, key: "a.foo2:", value: "bar2")
|
290
|
+
FactoryBot.create(:phrasing_phrase, key: "a.b.foo3", value: "bar3")
|
291
|
+
FactoryBot.create(:phrasing_phrase, key: "c.foo4", value: "bar4")
|
292
|
+
FactoryBot.create(:phrasing_phrase, key: 2, value: "bar5")
|
307
293
|
expect(PhrasingPhrase.count).to eq 5
|
308
294
|
|
309
295
|
visit import_export_phrasing_phrases_path
|
@@ -332,7 +318,7 @@ feature "downloading and uploading yaml files" do
|
|
332
318
|
|
333
319
|
it "round-trips the yaml with complicated text" do
|
334
320
|
value = "“hello world“ üokåa®fgsdf;::fs;kdf"
|
335
|
-
|
321
|
+
FactoryBot.create(:phrasing_phrase, key: "a.foo", value: value)
|
336
322
|
|
337
323
|
visit import_export_phrasing_phrases_path
|
338
324
|
click_link 'Download as YAML'
|
@@ -396,8 +382,8 @@ feature "locales" do
|
|
396
382
|
end
|
397
383
|
|
398
384
|
it "exports yaml containing multiple locales" do
|
399
|
-
|
400
|
-
|
385
|
+
FactoryBot.create(:phrasing_phrase, locale: 'en', key: 'hello', value: 'world')
|
386
|
+
FactoryBot.create(:phrasing_phrase, locale: 'es', key: 'hello', value: 'mundo')
|
401
387
|
|
402
388
|
visit download_phrasing_phrases_path
|
403
389
|
yaml = page.source
|
@@ -90,8 +90,8 @@ describe Phrasing::Serializer do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
it 'overrides old values' do
|
93
|
-
|
94
|
-
|
93
|
+
FactoryBot.create(:phrasing_phrase, key: "site.intro", value: "Go Home")
|
94
|
+
FactoryBot.create(:phrasing_phrase, key: "site.outro", value: "Kthnx Bye")
|
95
95
|
|
96
96
|
expect(english_phrases.where(key: "site.intro").first.value).to eq("Go Home")
|
97
97
|
expect(english_phrases.where(key: "site.outro").first.value).to eq("Kthnx Bye")
|
@@ -112,8 +112,8 @@ describe Phrasing::Serializer do
|
|
112
112
|
|
113
113
|
context 'imports and exports' do
|
114
114
|
it 'without changing, should return 0 number of changes' do
|
115
|
-
|
116
|
-
|
115
|
+
FactoryBot.create(:phrasing_phrase, key: "site.intro", value: "Go Home")
|
116
|
+
FactoryBot.create(:phrasing_phrase, key: "site.outro", value: "Kthnx Bye")
|
117
117
|
|
118
118
|
expect(english_phrases.where(key: "site.intro").first.value).to eq("Go Home")
|
119
119
|
expect(english_phrases.where(key: "site.outro").first.value).to eq("Kthnx Bye")
|
@@ -133,8 +133,8 @@ describe Phrasing::Serializer do
|
|
133
133
|
PhrasingPhrase.destroy_all
|
134
134
|
end
|
135
135
|
it 'flattened phrases' do
|
136
|
-
|
137
|
-
|
136
|
+
FactoryBot.create(:phrasing_phrase, key: "site.intro", value: "Go Home")
|
137
|
+
FactoryBot.create(:phrasing_phrase, key: "site.outro", value: "Kthnx Bye")
|
138
138
|
|
139
139
|
expect(english_phrases.where(key: "site.intro").first.value).to eq("Go Home")
|
140
140
|
expect(english_phrases.where(key: "site.outro").first.value).to eq("Kthnx Bye")
|
@@ -146,8 +146,8 @@ describe Phrasing::Serializer do
|
|
146
146
|
end
|
147
147
|
|
148
148
|
it 'with different locales' do
|
149
|
-
|
150
|
-
|
149
|
+
FactoryBot.create(:phrasing_phrase, key: "site.intro", value: "Hello", locale: :en)
|
150
|
+
FactoryBot.create(:phrasing_phrase, key: "site.intro", value: "Bonjour", locale: :fr)
|
151
151
|
|
152
152
|
expect(english_phrases.where(key: "site.intro").first.value).to eq("Hello")
|
153
153
|
expect(french_phrases.where(key: "site.intro").first.value).to eq("Bonjour")
|
data/spec/lib/phrasing_spec.rb
CHANGED
@@ -9,7 +9,7 @@ describe PhrasingPhrase do
|
|
9
9
|
it 'on #save! should raise errors if the key and locale are the same for two phrases' do
|
10
10
|
PhrasingPhrase.create(key: "foo", locale: "en", value: "bar")
|
11
11
|
new_phrase = PhrasingPhrase.new(key: "foo", locale: "en", value: "bar2")
|
12
|
-
expect { new_phrase.save! }.to raise_error
|
12
|
+
expect { new_phrase.save! }.to raise_error(ActiveRecord::RecordInvalid)
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'on #save, if the key and locale are the same for two phrases, the latter one should be invalid' do
|
@@ -29,7 +29,3 @@ describe PhrasingPhrase do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
end
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phrasing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomislav Car
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-06-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -200,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
200
|
version: '0'
|
201
201
|
requirements: []
|
202
202
|
rubyforge_project:
|
203
|
-
rubygems_version: 2.
|
203
|
+
rubygems_version: 2.7.3
|
204
204
|
signing_key:
|
205
205
|
specification_version: 4
|
206
206
|
summary: Edit phrases inline for Rails applications!
|