pages 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +19 -1
- data/Rakefile +5 -21
- data/lib/generators/pages/setup_generator.rb +7 -0
- data/lib/pages/routes.rb +6 -3
- data/lib/pages/version.rb +1 -1
- metadata +6 -6
- data/MIT-LICENSE +0 -20
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Pages #
|
2
2
|
|
3
|
-
[![Build Status](
|
3
|
+
[![Build Status](https://secure.travis-ci.org/dockyard/pages.png?branch=master)](http://travis-ci.org/dockyard/pages)
|
4
|
+
[![Dependency Status](https://gemnasium.com/dockyard/pages.png?travis)](https://gemnasium.com/dockyard/pages)
|
5
|
+
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/dockyard/pages)
|
4
6
|
|
5
7
|
Simple dynamic yet static pages for a Rails app
|
6
8
|
|
@@ -52,10 +54,26 @@ touch app/views/pages/about.html.erb
|
|
52
54
|
|
53
55
|
And create whatever content you want!
|
54
56
|
|
57
|
+
If you'd like to modify the routes that Pages generates, you can alter the
|
58
|
+
page parameter by passing an options hash containing a block. This is
|
59
|
+
particularly useful for creating SEO-friendly routes:
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
page :press_kit, :transform => { |page| page.dasherize }
|
63
|
+
```
|
64
|
+
|
65
|
+
would expand to:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
get '/press-kit' => 'pages#press_kit', :as => :press_kit
|
69
|
+
```
|
70
|
+
|
55
71
|
## Authors ##
|
56
72
|
|
57
73
|
[Brian Cardarella](http://twitter.com/bcardarella)
|
58
74
|
|
75
|
+
[We are very thankful for the many contributors](https://github.com/dockyard/pages/graphs/contributors)
|
76
|
+
|
59
77
|
## Versioning ##
|
60
78
|
|
61
79
|
This gem follows [Semantic Versioning](http://semver.org)
|
data/Rakefile
CHANGED
@@ -1,26 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
rescue LoadError
|
5
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
-
end
|
7
|
-
begin
|
8
|
-
require 'rdoc/task'
|
9
|
-
rescue LoadError
|
10
|
-
require 'rdoc/rdoc'
|
11
|
-
require 'rake/rdoctask'
|
12
|
-
RDoc::Task = Rake::RDocTask
|
13
|
-
end
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
Bundler::GemHelper.install_tasks
|
14
4
|
|
15
|
-
|
16
|
-
|
17
|
-
rdoc.title = 'Pages'
|
18
|
-
rdoc.options << '--line-numbers'
|
19
|
-
rdoc.rdoc_files.include('README.rdoc')
|
20
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
5
|
+
RSpec::Core::RakeTask.new('default') do |t|
|
6
|
+
t.pattern = FileList['spec/**/*_spec.rb']
|
21
7
|
end
|
22
8
|
|
23
9
|
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
24
10
|
load 'rails/tasks/engine.rake'
|
25
|
-
|
26
|
-
Bundler::GemHelper.install_tasks
|
data/lib/pages/routes.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
module ActionDispatch::Routing
|
2
2
|
class Mapper
|
3
|
-
def page(_page)
|
4
|
-
|
3
|
+
def page(_page, options={})
|
4
|
+
_route = options[:transform].call(_page.to_s) if options[:transform]
|
5
|
+
_route ||= _page
|
6
|
+
get "/#{_route}" => "pages##{_page}", :as => _page
|
5
7
|
end
|
6
8
|
|
7
9
|
def pages(*_pages)
|
10
|
+
options = _pages.extract_options!
|
8
11
|
_pages.each do |_page|
|
9
|
-
page(_page)
|
12
|
+
page(_page, options)
|
10
13
|
end
|
11
14
|
end
|
12
15
|
end
|
data/lib/pages/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -60,7 +60,7 @@ dependencies:
|
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: generator_spec
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
@@ -83,12 +83,12 @@ extensions: []
|
|
83
83
|
extra_rdoc_files: []
|
84
84
|
files:
|
85
85
|
- app/controllers/pages_controller.rb
|
86
|
+
- lib/generators/pages/setup_generator.rb
|
86
87
|
- lib/pages/engine.rb
|
87
88
|
- lib/pages/routes.rb
|
88
89
|
- lib/pages/version.rb
|
89
90
|
- lib/pages.rb
|
90
91
|
- lib/tasks/pages_tasks.rake
|
91
|
-
- MIT-LICENSE
|
92
92
|
- Rakefile
|
93
93
|
- README.md
|
94
94
|
homepage: https://github.com/dockyard/pages
|
@@ -105,7 +105,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
segments:
|
107
107
|
- 0
|
108
|
-
hash: -
|
108
|
+
hash: -1906479651514391796
|
109
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
110
|
none: false
|
111
111
|
requirements:
|
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
version: '0'
|
115
115
|
segments:
|
116
116
|
- 0
|
117
|
-
hash: -
|
117
|
+
hash: -1906479651514391796
|
118
118
|
requirements: []
|
119
119
|
rubyforge_project:
|
120
120
|
rubygems_version: 1.8.23
|
data/MIT-LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright 2012 YOURNAME
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|