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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 35a1a102b4b6008d98e37949dc9579b644884977
4
- data.tar.gz: dd4981ca0f515497bd11248a7a55b660ef6a09a5
3
+ metadata.gz: 9f43e0d7fbb36756c86aa08413e5fb0be3c1568a
4
+ data.tar.gz: 03f2e8968e73e5de02872af52d52ed57eebb97f9
5
5
  SHA512:
6
- metadata.gz: b4c65abefe70e1a59c5935d8714a779d5221c9ca09c8209997da4a242aac98e51398d1e5af12b52a138067897af0c2395695a41473fa97553bf7df2975dc19f6
7
- data.tar.gz: 0813e03755966c7934496882d9323280518dd0492c4c84a73cc6a31a1d8480a3127924bf9a5a6eafdce4343bef4715f107d88fd074f7715b0688a8cd2dd0f1ea
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 fill_gaps
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.each do |path|
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
- params = {}
107
- level = Item.level_of path
108
- params[:path] = path
109
- params[:type] = Decorator.at level: level
110
- params[:constraint] = Constraint.default
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
- params[:content].singularize.constantize.model_name.human(count: 2)
120
- params[:content] = "'#{params[:content]}'.singularize.constantize.model_name.human(count: 2)"
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
- Item.new(params).save
131
+ item.save
128
132
  end
129
133
  end
130
134
  end
@@ -1,3 +1,3 @@
1
1
  module NavigatorRails
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: navigator_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - mathias Kaufmann