navigator_rails 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/README.rdoc +6 -1
- data/lib/navigator_rails/store.rb +24 -20
- data/lib/navigator_rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f43e0d7fbb36756c86aa08413e5fb0be3c1568a
|
4
|
+
data.tar.gz: 03f2e8968e73e5de02872af52d52ed57eebb97f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d230cbfe4873a039b7b4ef69daf08ec78c4bf26f5d048ad71567644663d11cf7f5d76b66386ba4e1e8bc973193587b41e9bb3c0d6733409b8a735119ab70a49b
|
7
|
+
data.tar.gz: 81e78f418600d7d1575d50526353578becf42946d3d6430467b0b2e292ddcb47747a9a37d4ce6aafb000d945b12d0e7651d04f785ec307b0c24adeac19e43130
|
data/README.rdoc
CHANGED
@@ -1,3 +1,8 @@
|
|
1
1
|
= NavigatorRails
|
2
2
|
|
3
|
-
This project rocks and uses MIT-LICENSE.
|
3
|
+
This project rocks and uses MIT-LICENSE.
|
4
|
+
|
5
|
+
= Code Climate
|
6
|
+
|
7
|
+
Climtate: {<img src="https://codeclimate.com/github/steigr/navigator_rails/badges/gpa.svg" />}[https://codeclimate.com/github/steigr/navigator_rails]
|
8
|
+
Coverage: {<img src="https://codeclimate.com/github/steigr/navigator_rails/badges/coverage.svg" />}[https://codeclimate.com/github/steigr/navigator_rails]
|
@@ -90,7 +90,7 @@ module NavigatorRails
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
private
|
93
|
-
def
|
93
|
+
def collect_paths
|
94
94
|
paths = []
|
95
95
|
@items.each do |item|
|
96
96
|
path = item.path
|
@@ -101,30 +101,34 @@ module NavigatorRails
|
|
101
101
|
path = path.split('/')[0..-2].join('/')
|
102
102
|
end
|
103
103
|
end
|
104
|
-
paths
|
104
|
+
paths
|
105
|
+
end
|
106
|
+
def get_i18n_content content
|
107
|
+
begin
|
108
|
+
content.singularize.constantize.model_name.human(count: 2)
|
109
|
+
return "'#{content}'.singularize.constantize.model_name.human(count: 2)"
|
110
|
+
rescue I18n::InvalidPluralizationData
|
111
|
+
content.singularize.constantize.model_name.human(count: 1)
|
112
|
+
return "'#{content}'.singularize.constantize.model_name.human(count: 1)"
|
113
|
+
rescue NameError
|
114
|
+
return content
|
115
|
+
end
|
116
|
+
end
|
117
|
+
def fill_gaps
|
118
|
+
collect_paths.each do |path|
|
105
119
|
next unless get(path).nil?
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
params[:content] = "#{File.basename(path)}"
|
112
|
-
begin
|
113
|
-
params[:active_controller] = "#{params[:content]}Controller".constantize
|
114
|
-
params[:active_on] = :all
|
115
|
-
rescue NameError
|
116
|
-
nil
|
117
|
-
end
|
120
|
+
item = Item.new
|
121
|
+
item.path = path
|
122
|
+
item.type = Decorator.at level: item.level
|
123
|
+
item.constraint = Constraint.default
|
124
|
+
item.content = get_i18n_content("#{File.basename(path)}")
|
118
125
|
begin
|
119
|
-
|
120
|
-
|
121
|
-
rescue I18n::InvalidPluralizationData
|
122
|
-
params[:content].singularize.constantize.model_name.human(count: 1)
|
123
|
-
params[:content] = "'#{params[:content]}'.singularize.constantize.model_name.human(count: 1)"
|
126
|
+
item.active_controller = "#{item.content}Controller".constantize
|
127
|
+
item.active_on = :all
|
124
128
|
rescue NameError
|
125
129
|
nil
|
126
130
|
end
|
127
|
-
|
131
|
+
item.save
|
128
132
|
end
|
129
133
|
end
|
130
134
|
end
|