wor 0.0.5 → 0.0.6
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/wor.rb +1 -1
- data/lib/wor/collection.rb +4 -2
- data/spec/rails_app/content/courses/course-test.md +4 -0
- data/spec/wor_spec.rb +23 -2
- data/wor.gemspec +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51d36d05dcaab9fe8e0024a92c8cc5eff1f179c5
|
4
|
+
data.tar.gz: 62f708932066dba41c28acd4daf0502c09e8bf85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 322e02530c05b53a7f8fbadfb33f3b9cab70b8914a93629ba8a3ad13738dd83064d3df983447b50e37dd9b93118dc992c3c864dba3d45567244ee5fa19683dc3
|
7
|
+
data.tar.gz: 1dc8c11d6da49a44940462eea0c12a6e1ad36ac30193f4f26cf7b0918c8a75e1b0d03869558ff771bf28803715fbd46394e843a83dec9c795eb8cf8d3eb97ed6
|
data/Gemfile.lock
CHANGED
data/lib/wor.rb
CHANGED
@@ -20,7 +20,7 @@ module WOR
|
|
20
20
|
else
|
21
21
|
collection_name = params[:collection]
|
22
22
|
translated_collection_name = WOR::Collection.get_folder_name(locale: params[:locale], collection_name: collection_name)
|
23
|
-
path += "/#{
|
23
|
+
path += "/#{translated_collection_name}"
|
24
24
|
end
|
25
25
|
|
26
26
|
path += "/#{WOR::Localization.translate_path_to_original(path: params[:page_name], locale: params[:locale])}.md"
|
data/lib/wor/collection.rb
CHANGED
@@ -15,13 +15,15 @@ module WOR
|
|
15
15
|
return params[:collection_name]
|
16
16
|
end
|
17
17
|
|
18
|
+
collection_name = params[:collection_name]
|
19
|
+
|
18
20
|
locale_info['paths'].each do | key, value |
|
19
21
|
if (value == params[:collection_name].to_s)
|
20
|
-
|
22
|
+
collection_name = key
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
24
|
-
return
|
26
|
+
return collection_name
|
25
27
|
end
|
26
28
|
|
27
29
|
def get_folder_name_by_path(params)
|
data/spec/wor_spec.rb
CHANGED
@@ -9,20 +9,34 @@ describe WOR::Core do
|
|
9
9
|
expect(target.permalink).not_to be(nil)
|
10
10
|
end
|
11
11
|
|
12
|
-
it 'find with
|
12
|
+
it 'find with language in pt language and have all translation' do
|
13
13
|
params = { collection: "cursos", locale: "pt", page_name: "teste"}
|
14
14
|
target = WOR::Core.find(params)
|
15
15
|
|
16
16
|
expect(target).not_to be(nil)
|
17
17
|
end
|
18
18
|
|
19
|
-
it '
|
19
|
+
it 'have correctly url in pt language and dont have page name translation' do
|
20
|
+
params = { collection: "cursos", locale: "pt", page_name: "course-test"}
|
21
|
+
target = WOR::Core.find(params)
|
22
|
+
|
23
|
+
expect(target.url).to eq("/pt/cursos/course-test")
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'find with basename in default language' do
|
20
27
|
params = { collection: "courses", locale: "en", page_name: "test" }
|
21
28
|
target = WOR::Core.find(params)
|
22
29
|
|
23
30
|
expect(target.permalink).not_to be(nil)
|
24
31
|
end
|
25
32
|
|
33
|
+
it 'find with language in default language and dont have page name translation' do
|
34
|
+
params = { collection: "cursos", locale: "pt", page_name: "course-test"}
|
35
|
+
target = WOR::Core.find(params)
|
36
|
+
|
37
|
+
expect(target).not_to be(nil)
|
38
|
+
end
|
39
|
+
|
26
40
|
it 'get url of root in default language' do
|
27
41
|
params = { collection: "pages", locale: "en", page_name: "index" }
|
28
42
|
target = WOR::Core.find(params)
|
@@ -50,6 +64,13 @@ describe WOR::Core do
|
|
50
64
|
|
51
65
|
expect(target.url).to eq("/pt/cursos")
|
52
66
|
end
|
67
|
+
|
68
|
+
it 'get existing collection' do
|
69
|
+
collection = WOR::Collection.new('Courses')
|
70
|
+
|
71
|
+
expect(collection).not_to be(nil)
|
72
|
+
end
|
73
|
+
|
53
74
|
end
|
54
75
|
|
55
76
|
describe WOR::Helpers do
|
data/wor.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Vargas
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- spec/rails_app/config/environments/test.rb
|
64
64
|
- spec/rails_app/config/locales/wor.en.yml
|
65
65
|
- spec/rails_app/config/locales/wor.pt.yml
|
66
|
+
- spec/rails_app/content/courses/course-test.md
|
66
67
|
- spec/rails_app/content/courses/test.md
|
67
68
|
- spec/rails_app/content/pages/courses.md
|
68
69
|
- spec/rails_app/content/pages/index.md
|