loaf 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -8
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +23 -2
  5. data/Appraisals +18 -0
  6. data/CHANGELOG.md +12 -0
  7. data/Gemfile +16 -1
  8. data/README.md +69 -52
  9. data/Rakefile +5 -3
  10. data/bin/setup +7 -0
  11. data/gemfiles/rails3.2.gemfile +21 -0
  12. data/gemfiles/rails4.0.gemfile +22 -0
  13. data/gemfiles/rails4.1.gemfile +21 -0
  14. data/gemfiles/rails4.2.gemfile +21 -0
  15. data/lib/loaf.rb +24 -1
  16. data/lib/loaf/configuration.rb +15 -22
  17. data/lib/loaf/controller_extensions.rb +25 -12
  18. data/lib/loaf/crumb.rb +13 -1
  19. data/lib/loaf/crumb_formatter.rb +14 -13
  20. data/lib/loaf/options_validator.rb +10 -2
  21. data/lib/loaf/translation.rb +15 -8
  22. data/lib/loaf/version.rb +1 -8
  23. data/lib/loaf/view_extensions.rb +42 -15
  24. data/loaf.gemspec +10 -17
  25. data/spec/integration/configuration_spec.rb +7 -8
  26. data/spec/integration/crumbs_routing_spec.rb +31 -28
  27. data/spec/rails_app/app/controllers/application_controller.rb +0 -2
  28. data/spec/rails_app/app/controllers/posts_controller.rb +13 -2
  29. data/spec/rails_app/app/views/layouts/_breadcrumbs.html.erb +2 -0
  30. data/spec/rails_app/app/views/posts/index.html.erb +0 -2
  31. data/spec/rails_app/app/views/posts/new.html.erb +3 -0
  32. data/spec/rails_app/app/views/posts/show.html.erb +1 -0
  33. data/spec/rails_app/config/environments/development.rb +2 -0
  34. data/spec/rails_app/config/environments/production.rb +2 -0
  35. data/spec/rails_app/config/environments/test.rb +2 -3
  36. data/spec/rails_app/config/routes.rb +0 -2
  37. data/spec/rails_app/{app/mailers → log}/.gitkeep +0 -0
  38. data/spec/spec_helper.rb +42 -4
  39. data/spec/support/dummy_view.rb +7 -0
  40. data/spec/unit/controller_extensions_spec.rb +63 -0
  41. data/spec/unit/crumb_formatter_spec.rb +38 -0
  42. data/spec/unit/options_validator_spec.rb +17 -0
  43. data/spec/unit/translation_spec.rb +22 -0
  44. data/spec/unit/view_extensions/breadcrumb_spec.rb +24 -0
  45. data/spec/unit/view_extensions/breadcrumbs_spec.rb +128 -0
  46. data/spec/unit/view_extensions/has_breadcrumbs_spec.rb +12 -0
  47. data/tasks/console.rake +10 -0
  48. data/tasks/coverage.rake +11 -0
  49. data/tasks/spec.rake +29 -0
  50. metadata +50 -100
  51. data/.rvmrc +0 -28
  52. data/Gemfile.lock +0 -132
  53. data/spec/integration/nested_crumbs_spec.rb +0 -5
  54. data/spec/loaf/controller_extensions_spec.rb +0 -55
  55. data/spec/loaf/crumb_formatter_spec.rb +0 -33
  56. data/spec/loaf/options_validator_spec.rb +0 -29
  57. data/spec/loaf/translation_spec.rb +0 -23
  58. data/spec/loaf/view_extensions_spec.rb +0 -114
  59. data/spec/loaf_spec.rb +0 -5
  60. data/spec/rails_app/app/assets/images/rails.png +0 -0
  61. data/spec/rails_app/app/assets/javascripts/application.js +0 -9
  62. data/spec/rails_app/app/assets/stylesheets/application.css +0 -7
  63. data/spec/rails_app/app/helpers/application_helper.rb +0 -2
  64. data/spec/rails_app/app/models/.gitkeep +0 -0
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Loaf::ViewExtensions, '.breadcrumb?' do
6
+ it 'checks for breadcrumbs existance' do
7
+ instance = DummyView.new
8
+ expect(instance.breadcrumbs?).to eq(false)
9
+ instance.breadcrumb 'Home', :home_path
10
+ expect(instance.breadcrumbs?).to eq(true)
11
+ end
12
+ end
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+
3
+ desc 'Load gem inside irb console'
4
+ task :console do
5
+ require 'irb'
6
+ require 'irb/completion'
7
+ require File.join(__FILE__, '../../lib/loaf')
8
+ ARGV.clear
9
+ IRB.start
10
+ end
@@ -0,0 +1,11 @@
1
+ # encoding: utf-8
2
+
3
+ desc 'Measure code coverage'
4
+ task :coverage do
5
+ begin
6
+ original, ENV['COVERAGE'] = ENV['COVERAGE'], 'true'
7
+ Rake::Task['spec'].invoke
8
+ ensure
9
+ ENV['COVERAGE'] = original
10
+ end
11
+ end
@@ -0,0 +1,29 @@
1
+ # encoding: utf-8
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+
6
+ desc 'Run all specs'
7
+ RSpec::Core::RakeTask.new(:spec) do |task|
8
+ task.pattern = 'spec/{unit,integration}{,/*/**}/*_spec.rb'
9
+ end
10
+
11
+ namespace :spec do
12
+ desc 'Run unit specs'
13
+ RSpec::Core::RakeTask.new(:unit) do |task|
14
+ task.pattern = 'spec/unit{,/*/**}/*_spec.rb'
15
+ end
16
+
17
+ desc 'Run integration specs'
18
+ RSpec::Core::RakeTask.new(:integration) do |task|
19
+ task.pattern = 'spec/integration{,/*/**}/*_spec.rb'
20
+ end
21
+ end
22
+
23
+ rescue LoadError
24
+ %w[spec spec:unit spec:integration].each do |name|
25
+ task name do
26
+ $stderr.puts "In order to run #{name}, do `gem install rspec`"
27
+ end
28
+ end
29
+ end
metadata CHANGED
@@ -1,102 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loaf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
5
- prerelease:
4
+ version: 0.4.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Piotr Murach
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-02-25 00:00:00.000000000 Z
11
+ date: 2015-01-10 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rails
16
- requirement: &2160425740 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
- version: '0'
19
+ version: '3.1'
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *2160425740
25
- - !ruby/object:Gem::Dependency
26
- name: rails
27
- requirement: &2160424420 !ruby/object:Gem::Requirement
28
- none: false
22
+ version_requirements: !ruby/object:Gem::Requirement
29
23
  requirements:
30
- - - ~>
24
+ - - '>='
31
25
  - !ruby/object:Gem::Version
32
26
  version: '3.1'
33
- type: :development
34
- prerelease: false
35
- version_requirements: *2160424420
36
- - !ruby/object:Gem::Dependency
37
- name: sqlite3
38
- requirement: &2160422760 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
43
- version: '0'
44
- type: :development
45
- prerelease: false
46
- version_requirements: *2160422760
47
- - !ruby/object:Gem::Dependency
48
- name: rspec-rails
49
- requirement: &2160420740 !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- type: :development
56
- prerelease: false
57
- version_requirements: *2160420740
58
- - !ruby/object:Gem::Dependency
59
- name: capybara
60
- requirement: &2160419820 !ruby/object:Gem::Requirement
61
- none: false
62
- requirements:
63
- - - ! '>='
64
- - !ruby/object:Gem::Version
65
- version: '0'
66
- type: :development
67
- prerelease: false
68
- version_requirements: *2160419820
69
- - !ruby/object:Gem::Dependency
70
- name: bundler
71
- requirement: &2160418980 !ruby/object:Gem::Requirement
72
- none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: *2160418980
80
- description: Loaf helps you manage breadcrumbs in your rails app. It aims to handle
81
- crumb data through easy dsl and expose it through view helpers without any assumptions
82
- about markup.
27
+ description: Loaf manages and displays breadcrumb trails in your Rails app. It aims
28
+ to handle breadcrumb data through easy dsl and expose it through view helpers without
29
+ any assumptions about markup.
83
30
  email:
84
31
  - ''
85
- executables: []
32
+ executables:
33
+ - setup
86
34
  extensions: []
87
35
  extra_rdoc_files: []
88
36
  files:
89
37
  - .document
90
38
  - .gitignore
91
39
  - .rspec
92
- - .rvmrc
40
+ - .ruby-version
93
41
  - .travis.yml
42
+ - Appraisals
94
43
  - CHANGELOG.md
95
44
  - Gemfile
96
- - Gemfile.lock
97
45
  - LICENSE.txt
98
46
  - README.md
99
47
  - Rakefile
48
+ - bin/setup
49
+ - gemfiles/rails3.2.gemfile
50
+ - gemfiles/rails4.0.gemfile
51
+ - gemfiles/rails4.1.gemfile
52
+ - gemfiles/rails4.2.gemfile
100
53
  - init.rb
101
54
  - lib/config/locales/en.yml
102
55
  - lib/loaf.rb
@@ -114,30 +67,18 @@ files:
114
67
  - loaf.gemspec
115
68
  - spec/integration/configuration_spec.rb
116
69
  - spec/integration/crumbs_routing_spec.rb
117
- - spec/integration/nested_crumbs_spec.rb
118
- - spec/loaf/controller_extensions_spec.rb
119
- - spec/loaf/crumb_formatter_spec.rb
120
- - spec/loaf/options_validator_spec.rb
121
- - spec/loaf/translation_spec.rb
122
- - spec/loaf/view_extensions_spec.rb
123
- - spec/loaf_spec.rb
124
70
  - spec/rails_app/.gitignore
125
71
  - spec/rails_app/Rakefile
126
- - spec/rails_app/app/assets/images/rails.png
127
- - spec/rails_app/app/assets/javascripts/application.js
128
- - spec/rails_app/app/assets/stylesheets/application.css
129
72
  - spec/rails_app/app/controllers/application_controller.rb
130
73
  - spec/rails_app/app/controllers/comments_controller.rb
131
74
  - spec/rails_app/app/controllers/home_controller.rb
132
75
  - spec/rails_app/app/controllers/posts_controller.rb
133
- - spec/rails_app/app/helpers/application_helper.rb
134
- - spec/rails_app/app/mailers/.gitkeep
135
- - spec/rails_app/app/models/.gitkeep
136
76
  - spec/rails_app/app/views/home/index.html.erb
137
77
  - spec/rails_app/app/views/layouts/_breadcrumbs.html.erb
138
78
  - spec/rails_app/app/views/layouts/application.html.erb
139
79
  - spec/rails_app/app/views/posts/index.html.erb
140
80
  - spec/rails_app/app/views/posts/new.html.erb
81
+ - spec/rails_app/app/views/posts/show.html.erb
141
82
  - spec/rails_app/config.ru
142
83
  - spec/rails_app/config/application.rb
143
84
  - spec/rails_app/config/boot.rb
@@ -157,6 +98,7 @@ files:
157
98
  - spec/rails_app/db/seeds.rb
158
99
  - spec/rails_app/lib/assets/.gitkeep
159
100
  - spec/rails_app/lib/tasks/.gitkeep
101
+ - spec/rails_app/log/.gitkeep
160
102
  - spec/rails_app/public/404.html
161
103
  - spec/rails_app/public/422.html
162
104
  - spec/rails_app/public/500.html
@@ -165,58 +107,56 @@ files:
165
107
  - spec/rails_app/script/rails
166
108
  - spec/spec_helper.rb
167
109
  - spec/support/capybara.rb
110
+ - spec/support/dummy_view.rb
168
111
  - spec/support/load_routes.rb
112
+ - spec/unit/controller_extensions_spec.rb
113
+ - spec/unit/crumb_formatter_spec.rb
114
+ - spec/unit/options_validator_spec.rb
115
+ - spec/unit/translation_spec.rb
116
+ - spec/unit/view_extensions/breadcrumb_spec.rb
117
+ - spec/unit/view_extensions/breadcrumbs_spec.rb
118
+ - spec/unit/view_extensions/has_breadcrumbs_spec.rb
119
+ - tasks/console.rake
120
+ - tasks/coverage.rake
121
+ - tasks/spec.rake
169
122
  homepage: https://github.com/peter-murach/loaf
170
123
  licenses: []
124
+ metadata: {}
171
125
  post_install_message:
172
126
  rdoc_options: []
173
127
  require_paths:
174
128
  - lib
175
129
  required_ruby_version: !ruby/object:Gem::Requirement
176
- none: false
177
130
  requirements:
178
- - - ! '>='
131
+ - - '>='
179
132
  - !ruby/object:Gem::Version
180
133
  version: '0'
181
134
  required_rubygems_version: !ruby/object:Gem::Requirement
182
- none: false
183
135
  requirements:
184
- - - ! '>='
136
+ - - '>='
185
137
  - !ruby/object:Gem::Version
186
138
  version: '0'
187
139
  requirements: []
188
- rubyforge_project: tytus
189
- rubygems_version: 1.8.10
140
+ rubyforge_project:
141
+ rubygems_version: 2.0.3
190
142
  signing_key:
191
- specification_version: 3
192
- summary: Loaf is a breadcrumb managing gem.
143
+ specification_version: 4
144
+ summary: Loaf manages and displays breadcrumb trails in your Rails application.
193
145
  test_files:
194
146
  - spec/integration/configuration_spec.rb
195
147
  - spec/integration/crumbs_routing_spec.rb
196
- - spec/integration/nested_crumbs_spec.rb
197
- - spec/loaf/controller_extensions_spec.rb
198
- - spec/loaf/crumb_formatter_spec.rb
199
- - spec/loaf/options_validator_spec.rb
200
- - spec/loaf/translation_spec.rb
201
- - spec/loaf/view_extensions_spec.rb
202
- - spec/loaf_spec.rb
203
148
  - spec/rails_app/.gitignore
204
149
  - spec/rails_app/Rakefile
205
- - spec/rails_app/app/assets/images/rails.png
206
- - spec/rails_app/app/assets/javascripts/application.js
207
- - spec/rails_app/app/assets/stylesheets/application.css
208
150
  - spec/rails_app/app/controllers/application_controller.rb
209
151
  - spec/rails_app/app/controllers/comments_controller.rb
210
152
  - spec/rails_app/app/controllers/home_controller.rb
211
153
  - spec/rails_app/app/controllers/posts_controller.rb
212
- - spec/rails_app/app/helpers/application_helper.rb
213
- - spec/rails_app/app/mailers/.gitkeep
214
- - spec/rails_app/app/models/.gitkeep
215
154
  - spec/rails_app/app/views/home/index.html.erb
216
155
  - spec/rails_app/app/views/layouts/_breadcrumbs.html.erb
217
156
  - spec/rails_app/app/views/layouts/application.html.erb
218
157
  - spec/rails_app/app/views/posts/index.html.erb
219
158
  - spec/rails_app/app/views/posts/new.html.erb
159
+ - spec/rails_app/app/views/posts/show.html.erb
220
160
  - spec/rails_app/config.ru
221
161
  - spec/rails_app/config/application.rb
222
162
  - spec/rails_app/config/boot.rb
@@ -236,6 +176,7 @@ test_files:
236
176
  - spec/rails_app/db/seeds.rb
237
177
  - spec/rails_app/lib/assets/.gitkeep
238
178
  - spec/rails_app/lib/tasks/.gitkeep
179
+ - spec/rails_app/log/.gitkeep
239
180
  - spec/rails_app/public/404.html
240
181
  - spec/rails_app/public/422.html
241
182
  - spec/rails_app/public/500.html
@@ -244,4 +185,13 @@ test_files:
244
185
  - spec/rails_app/script/rails
245
186
  - spec/spec_helper.rb
246
187
  - spec/support/capybara.rb
188
+ - spec/support/dummy_view.rb
247
189
  - spec/support/load_routes.rb
190
+ - spec/unit/controller_extensions_spec.rb
191
+ - spec/unit/crumb_formatter_spec.rb
192
+ - spec/unit/options_validator_spec.rb
193
+ - spec/unit/translation_spec.rb
194
+ - spec/unit/view_extensions/breadcrumb_spec.rb
195
+ - spec/unit/view_extensions/breadcrumbs_spec.rb
196
+ - spec/unit/view_extensions/has_breadcrumbs_spec.rb
197
+ has_rdoc:
data/.rvmrc DELETED
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- environment_id="ruby-1.9.3-p0@loaf"
4
-
5
- if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
6
- && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
7
- then
8
- \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
9
-
10
- if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
11
- then
12
- . "${rvm_path:-$HOME/.rvm}/hooks/after_use"
13
- fi
14
- else
15
- # If the environment file has not yet been created, use the RVM CLI to select.
16
- if ! rvm --create "$environment_id"
17
- then
18
- echo "Failed to create RVM environment '${environment_id}'."
19
- return 1
20
- fi
21
- fi
22
-
23
- if [[ $- == *i* ]] # check for interactive shells
24
- then
25
- echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
26
- else
27
- echo "Using: $GEM_HOME" # don't use colors in interactive shells
28
- fi
@@ -1,132 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- loaf (0.2.1)
5
- rails
6
-
7
- GEM
8
- remote: http://rubygems.org/
9
- specs:
10
- actionmailer (3.1.3)
11
- actionpack (= 3.1.3)
12
- mail (~> 2.3.0)
13
- actionpack (3.1.3)
14
- activemodel (= 3.1.3)
15
- activesupport (= 3.1.3)
16
- builder (~> 3.0.0)
17
- erubis (~> 2.7.0)
18
- i18n (~> 0.6)
19
- rack (~> 1.3.5)
20
- rack-cache (~> 1.1)
21
- rack-mount (~> 0.8.2)
22
- rack-test (~> 0.6.1)
23
- sprockets (~> 2.0.3)
24
- activemodel (3.1.3)
25
- activesupport (= 3.1.3)
26
- builder (~> 3.0.0)
27
- i18n (~> 0.6)
28
- activerecord (3.1.3)
29
- activemodel (= 3.1.3)
30
- activesupport (= 3.1.3)
31
- arel (~> 2.2.1)
32
- tzinfo (~> 0.3.29)
33
- activeresource (3.1.3)
34
- activemodel (= 3.1.3)
35
- activesupport (= 3.1.3)
36
- activesupport (3.1.3)
37
- multi_json (~> 1.0)
38
- arel (2.2.1)
39
- builder (3.0.0)
40
- capybara (1.1.2)
41
- mime-types (>= 1.16)
42
- nokogiri (>= 1.3.3)
43
- rack (>= 1.0.0)
44
- rack-test (>= 0.5.4)
45
- selenium-webdriver (~> 2.0)
46
- xpath (~> 0.1.4)
47
- childprocess (0.2.3)
48
- ffi (~> 1.0.6)
49
- diff-lcs (1.1.3)
50
- erubis (2.7.0)
51
- ffi (1.0.11)
52
- hike (1.2.1)
53
- i18n (0.6.0)
54
- json (1.6.3)
55
- mail (2.3.0)
56
- i18n (>= 0.4.0)
57
- mime-types (~> 1.16)
58
- treetop (~> 1.4.8)
59
- mime-types (1.17.2)
60
- multi_json (1.0.4)
61
- nokogiri (1.5.0)
62
- polyglot (0.3.3)
63
- rack (1.3.5)
64
- rack-cache (1.1)
65
- rack (>= 0.4)
66
- rack-mount (0.8.3)
67
- rack (>= 1.0.0)
68
- rack-ssl (1.3.2)
69
- rack
70
- rack-test (0.6.1)
71
- rack (>= 1.0)
72
- rails (3.1.3)
73
- actionmailer (= 3.1.3)
74
- actionpack (= 3.1.3)
75
- activerecord (= 3.1.3)
76
- activeresource (= 3.1.3)
77
- activesupport (= 3.1.3)
78
- bundler (~> 1.0)
79
- railties (= 3.1.3)
80
- railties (3.1.3)
81
- actionpack (= 3.1.3)
82
- activesupport (= 3.1.3)
83
- rack-ssl (~> 1.3.2)
84
- rake (>= 0.8.7)
85
- rdoc (~> 3.4)
86
- thor (~> 0.14.6)
87
- rake (0.9.2.2)
88
- rdoc (3.12)
89
- json (~> 1.4)
90
- rspec (2.7.0)
91
- rspec-core (~> 2.7.0)
92
- rspec-expectations (~> 2.7.0)
93
- rspec-mocks (~> 2.7.0)
94
- rspec-core (2.7.1)
95
- rspec-expectations (2.7.0)
96
- diff-lcs (~> 1.1.2)
97
- rspec-mocks (2.7.0)
98
- rspec-rails (2.7.0)
99
- actionpack (~> 3.0)
100
- activesupport (~> 3.0)
101
- railties (~> 3.0)
102
- rspec (~> 2.7.0)
103
- rubyzip (0.9.5)
104
- selenium-webdriver (2.15.0)
105
- childprocess (>= 0.2.1)
106
- ffi (~> 1.0.9)
107
- multi_json (~> 1.0.4)
108
- rubyzip
109
- sprockets (2.0.3)
110
- hike (~> 1.2)
111
- rack (~> 1.0)
112
- tilt (~> 1.1, != 1.3.0)
113
- sqlite3 (1.3.5)
114
- thor (0.14.6)
115
- tilt (1.3.3)
116
- treetop (1.4.10)
117
- polyglot
118
- polyglot (>= 0.3.1)
119
- tzinfo (0.3.31)
120
- xpath (0.1.4)
121
- nokogiri (~> 1.3)
122
-
123
- PLATFORMS
124
- ruby
125
-
126
- DEPENDENCIES
127
- bundler
128
- capybara
129
- loaf!
130
- rails (~> 3.1)
131
- rspec-rails
132
- sqlite3