middleman-breadcrumbs 0.0.2
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 +7 -0
- data/.gitignore +34 -0
- data/Gemfile +4 -0
- data/Guardfile +28 -0
- data/LICENSE +21 -0
- data/README.md +11 -0
- data/lib/middleman-breadcrumbs/breadcrumbs.rb +7 -0
- data/lib/middleman-breadcrumbs/breadcrumbs_helper.rb +11 -0
- data/lib/middleman-breadcrumbs/version.rb +2 -0
- data/lib/middleman-breadcrumbs.rb +5 -0
- data/middleman-breadcrumbs.gemspec +22 -0
- data/spec/breadcrumbs_helper_spec.rb +45 -0
- data/spec/spec_helper.rb +3 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5707b707a4b01fac2d51bf8e275767ee69633e13
|
4
|
+
data.tar.gz: 6efa823b7bdc2cbe578ace2337c66817b04df260
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0806c2eb0de3670e74aecfc3c22054dead201e7b068cdc8fd28b9e9803c6d7eba1cbb63557b69da44c29595e582d45cd790026714db1febd1c5bb3d8b71b0dd1
|
7
|
+
data.tar.gz: a133a10f7a4a78d136a277f4720a2f7437d77f1c77eb3dae67378deba66fef900674ba24d21f8e90ede1285a0ce83ec466c8ee8db5c4f3546adec0a19a1e30d8
|
data/.gitignore
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/lib/bundler/man/
|
26
|
+
|
27
|
+
# for a library or gem, you might want to ignore these files since the code is
|
28
|
+
# intended to run in multiple environments; otherwise, check them in:
|
29
|
+
Gemfile.lock
|
30
|
+
# .ruby-version
|
31
|
+
# .ruby-gemset
|
32
|
+
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
+
.rvmrc
|
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard :minitest do
|
5
|
+
# with Minitest::Unit
|
6
|
+
# watch(%r{^test/(.*)\/?test_(.*)\.rb$})
|
7
|
+
# watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
8
|
+
# watch(%r{^test/test_helper\.rb$}) { 'test' }
|
9
|
+
|
10
|
+
# with Minitest::Spec
|
11
|
+
watch(%r{^spec/(.*)_spec\.rb$})
|
12
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
13
|
+
watch(%r{^spec/spec_helper\.rb$}) { 'spec' }
|
14
|
+
|
15
|
+
# Rails 4
|
16
|
+
# watch(%r{^app/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" }
|
17
|
+
# watch(%r{^app/controllers/application_controller\.rb$}) { 'test/controllers' }
|
18
|
+
# watch(%r{^app/controllers/(.+)_controller\.rb$}) { |m| "test/integration/#{m[1]}_test.rb" }
|
19
|
+
# watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
|
20
|
+
# watch(%r{^lib/(.+)\.rb$}) { |m| "test/lib/#{m[1]}_test.rb" }
|
21
|
+
# watch(%r{^test/.+_test\.rb$})
|
22
|
+
# watch(%r{^test/test_helper\.rb$}) { 'test' }
|
23
|
+
|
24
|
+
# Rails < 4
|
25
|
+
# watch(%r{^app/controllers/(.*)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" }
|
26
|
+
# watch(%r{^app/helpers/(.*)\.rb$}) { |m| "test/helpers/#{m[1]}_test.rb" }
|
27
|
+
# watch(%r{^app/models/(.*)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" }
|
28
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Marnen Laibow-Koser
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'padrino-helpers'
|
2
|
+
|
3
|
+
module BreadcrumbsHelper
|
4
|
+
include Padrino::Helpers
|
5
|
+
|
6
|
+
def breadcrumbs(page)
|
7
|
+
hierarchy = [page]
|
8
|
+
hierarchy.unshift hierarchy.first.parent while hierarchy.first.parent
|
9
|
+
hierarchy.collect {|page| link_to page.data.title, page.path }.join(h ' > ')
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require "middleman-breadcrumbs/version"
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "middleman-breadcrumbs"
|
6
|
+
s.version = Breadcrumbs::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["Marnen Laibow-Koser"]
|
9
|
+
s.email = ["marnen@marnen.org"]
|
10
|
+
s.homepage = "http://github.com/marnen/middleman-breadcrumbs"
|
11
|
+
s.summary = %q{Breadcrumbs helper for Middleman}
|
12
|
+
s.description = %q{Breadcrumbs helper for Middleman}
|
13
|
+
s.license = 'MIT'
|
14
|
+
|
15
|
+
s.add_runtime_dependency "middleman", '>= 3.3.5'
|
16
|
+
['guard-minitest', 'ffaker'].each {|gem| s.add_development_dependency gem }
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'middleman-breadcrumbs/breadcrumbs_helper'
|
4
|
+
|
5
|
+
describe BreadcrumbsHelper do
|
6
|
+
before do
|
7
|
+
@helper = Object.new
|
8
|
+
@helper.singleton_class.send :include, BreadcrumbsHelper
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '#breadcrumbs' do
|
12
|
+
before do
|
13
|
+
self.singleton_class.send :include, Padrino::Helpers
|
14
|
+
@page = page
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'top-level page' do
|
18
|
+
it 'returns a link to the page' do
|
19
|
+
@helper.breadcrumbs(@page).must_equal link_to(@page.data.title, @page.path)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'non-top-level page' do
|
24
|
+
it 'joins all links to parent pages with > signs' do
|
25
|
+
parent = page
|
26
|
+
grandparent = page
|
27
|
+
@page.parent = parent
|
28
|
+
@page.parent.parent = grandparent
|
29
|
+
|
30
|
+
@helper.breadcrumbs(@page).must_equal([grandparent, parent, @page].collect do |level|
|
31
|
+
link_to level.data.title, level.path
|
32
|
+
end.join ' > ')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def page
|
40
|
+
path = Faker::Internet.http_url
|
41
|
+
title = Faker::Lorem.sentence
|
42
|
+
data = OpenStruct.new title: title
|
43
|
+
OpenStruct.new data: data, path: path
|
44
|
+
end
|
45
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middleman-breadcrumbs
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marnen Laibow-Koser
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: middleman
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.3.5
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.3.5
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: guard-minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: ffaker
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Breadcrumbs helper for Middleman
|
56
|
+
email:
|
57
|
+
- marnen@marnen.org
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- Gemfile
|
64
|
+
- Guardfile
|
65
|
+
- LICENSE
|
66
|
+
- README.md
|
67
|
+
- lib/middleman-breadcrumbs.rb
|
68
|
+
- lib/middleman-breadcrumbs/breadcrumbs.rb
|
69
|
+
- lib/middleman-breadcrumbs/breadcrumbs_helper.rb
|
70
|
+
- lib/middleman-breadcrumbs/version.rb
|
71
|
+
- middleman-breadcrumbs.gemspec
|
72
|
+
- spec/breadcrumbs_helper_spec.rb
|
73
|
+
- spec/spec_helper.rb
|
74
|
+
homepage: http://github.com/marnen/middleman-breadcrumbs
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - '>='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.1.11
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: Breadcrumbs helper for Middleman
|
98
|
+
test_files:
|
99
|
+
- spec/breadcrumbs_helper_spec.rb
|
100
|
+
- spec/spec_helper.rb
|