├── .gitignore ├── CHANGELOG ├── Gemfile ├── LICENSE ├── README.textile ├── Rakefile ├── lib └── sinatra │ ├── simple-navigation.rb │ ├── simple_navigation.rb │ └── simple_navigation │ └── version.rb └── sinatra-simple-navigation.gemspec /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | rdoc 3 | pkg 4 | coverage 5 | Gemfile.lock 6 | .rvmrc 7 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | *4.1.0 2 | 3 | * update sinatra dependency to support 1.x through 2.x 4 | 5 | *4.0.0 6 | 7 | * fix extension registration, depends on simple-navigation 4.0.0 8 | 9 | *3.7.0 10 | 11 | * depends on simple-navigation 3.12.0 12 | 13 | *3.6.0 14 | 15 | * depends on simple-navigation 3.10.1 16 | 17 | *3.5.1 18 | 19 | * depends on simple-navigation 3.5.x 20 | 21 | *3.5.0 22 | 23 | * depends on simple-navigation 3.5.0 24 | 25 | *3.4.2 26 | 27 | * depends on simple-navigation 3.4.2 28 | 29 | *3.4.1 30 | 31 | * depends on simple-navigation 3.4.1 32 | 33 | *3.4.0 34 | 35 | * depends on simple-navigation 3.4.0 36 | 37 | *3.3.5 38 | 39 | * depends on simple-navigation 3.3.4 40 | 41 | *3.3.4 42 | 43 | * depends on simple-navigation 3.3.3 44 | 45 | *3.3.3 46 | 47 | * depends on simple-navigation 3.3.2 48 | 49 | *3.3.2 50 | 51 | * depends on simple-navigation 3.3.1 52 | 53 | *3.3.1 54 | 55 | * fixing padrino. Did not register properly (downside: registers twice now in sinatra) 56 | 57 | *3.3.0 58 | 59 | * depends on simple-navigation 3.3.0 60 | 61 | *3.2.1 62 | 63 | * bugfix. Creating a modular style app now works without requiring 'sinatra'. Credits to Carlo Bertini. 64 | 65 | *3.2.0 66 | 67 | * depends on simple-navigation 3.2.0 68 | 69 | *3.1.0 70 | 71 | * depends on new simple-navigation 3.1.0 72 | 73 | *3.0.2 74 | 75 | * depends on new simple-navigation 3.0.2 76 | 77 | *3.0.1 78 | 79 | * depends on new simple-navigation 3.0.1 80 | 81 | *3.0.0 82 | 83 | * depends on new simple-navigation 3.0.0 84 | 85 | *3.0.0.beta1 86 | 87 | * initial version. Dependent on simple-navigation-3.0.0.beta2 88 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gemspec 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Andi Schacke 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.textile: -------------------------------------------------------------------------------- 1 | !https://badge.fury.io/rb/sinatra-simple-navigation.png!:http://badge.fury.io/rb/sinatra-simple-navigation 2 | 3 | h1. sinatra-simple-navigation 4 | 5 | sinatra-simple-navigation is a sinatra extension enabling the use of the "simple-navigation":http://github.com/codeplant/simple-navigation gem in your sinatra and padrino applications. 6 | 7 | h2. Installation 8 | 9 | Either manually install the gem 10 | 11 | @gem install sinatra-simple-navigation@ 12 | 13 | or preferably use bundler and add it to your Gemfile 14 | 15 | @gem 'sinatra-simple-navigation'@ 16 | 17 | and run @bundle install@ 18 | 19 | h2. Usage 20 | 21 | h3. Sinatra Applications 22 | 23 | h4. Classic Style 24 | 25 | To use simple-navigation in your classic style sinatra application, just require 'sinatra/simple-navigation': 26 | 27 |
require 'rubygems'
28 | require 'sinatra'
29 | require 'sinatra/simple-navigation'
30 |
31 | # Your app code goes here
32 |
33 | h4. Modular Style
34 |
35 | If you're developing a module style sinatra application (i.e. subclassing Sinatra::Base), you have to register Sinatra::SimpleNavigation:
36 |
37 | require 'rubygems'
38 | require 'sinatra/base'
39 | require 'sinatra/simple-navigation'
40 |
41 | class MyApp < Sinatra::Base
42 | register Sinatra::SimpleNavigation
43 |
44 | # Your app code goes here
45 | end
46 |
47 | h3. Padrino Applications
48 |
49 | Using simple-navigation in your padrino application is similar to the modular sinatra style. In your @app/app.rb@ file:
50 |
51 | require 'sinatra/simple-navigation'
52 |
53 | class MyApp < Padrino::Application
54 | register Sinatra::SimpleNavigation
55 |
56 | # Your app code goes here
57 | end
58 |
59 | Instead of requiring sinatra/simple-navigation at the top of the file, you could add this to your Gemfile:
60 |
61 | @gem 'sinatra-simple-navigation', :require => 'sinatra/simple-navigation'@
62 |
63 | h2. Resources
64 |
65 | * simple-navigation source code: "http://github.com/codeplant/simple-navigation":http://github.com/codeplant/simple-navigation
66 | * simple-navigation wiki: "http://wiki.github.com/codeplant/simple-navigation":http://wiki.github.com/codeplant/simple-navigation
67 | * demo project with sample applications for rails, sinatra and padrino: "http://github.com/codeplant/simple-navigation-demo":http://github.com/codeplant/simple-navigation-demo
68 |
69 | h2. Legal
70 |
71 | Copyright (c) 2014 codeplant GmbH, released under the MIT license
72 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | require 'bundler/gem_tasks'
2 |
3 | desc 'Default: build the gem.'
4 | task default: :build
5 |
--------------------------------------------------------------------------------
/lib/sinatra/simple-navigation.rb:
--------------------------------------------------------------------------------
1 | require 'sinatra/simple_navigation'
--------------------------------------------------------------------------------
/lib/sinatra/simple_navigation.rb:
--------------------------------------------------------------------------------
1 | require 'sinatra/base'
2 | require 'simple-navigation'
3 |
4 | module Sinatra
5 |
6 | module SimpleNavigation
7 | def self.registered(app)
8 | app.helpers ::SimpleNavigation::Helpers
9 | ::SimpleNavigation.register(app)
10 | end
11 | end
12 |
13 | # for classic style apps
14 | unless ::Sinatra::Application.root.nil?
15 | register SimpleNavigation
16 | end
17 |
18 | end
--------------------------------------------------------------------------------
/lib/sinatra/simple_navigation/version.rb:
--------------------------------------------------------------------------------
1 | module Sinatra
2 | module SimpleNavigation
3 | VERSION = '4.1.0'
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/sinatra-simple-navigation.gemspec:
--------------------------------------------------------------------------------
1 | # coding: utf-8
2 | lib = File.expand_path('../lib', __FILE__)
3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4 | require 'sinatra/simple_navigation/version'
5 |
6 | Gem::Specification.new do |spec|
7 | spec.name = 'sinatra-simple-navigation'
8 | spec.version = Sinatra::SimpleNavigation::VERSION
9 | spec.authors = ['Andi Schacke', 'Mark J. Titorenko']
10 | spec.email = ['andi@codeplant.ch']
11 | spec.description = 'A Sinatra extension to enable creating navigations ' \
12 | 'with the simple-navigation gem. Also works for ' \
13 | 'Padrino. See ' \
14 | 'http://github.com/codeplant/simple-navigation for ' \
15 | 'more information on simple-navigation.'
16 | spec.summary = 'A Sinatra extension to enable creating navigations ' \
17 | 'with the simple-navigation gem. Also works for ' \
18 | 'Padrino.'
19 | spec.homepage = 'http://github.com/codeplant/sinatra-simple-navigation'
20 | spec.license = 'MIT'
21 |
22 | spec.files = `git ls-files -z`.split("\x0")
23 | spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
24 | spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
25 | spec.require_paths = ['lib']
26 |
27 | spec.rdoc_options = ['--inline-source', '--charset=UTF-8']
28 |
29 | spec.add_runtime_dependency('simple-navigation', '~> 4.0')
30 | spec.add_runtime_dependency('sinatra', ['>= 1.0', '< 3.0'])
31 |
32 | spec.add_development_dependency 'rake'
33 | end
34 |
--------------------------------------------------------------------------------