pages 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +15 -0
- data/lib/pages/routes.rb +16 -0
- data/lib/pages/version.rb +1 -1
- metadata +15 -32
- data/lib/tasks/pages_tasks.rake +0 -4
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 671075afc79d71f2a2f669600e31d7918adba939
|
4
|
+
data.tar.gz: 44ffc5d15f4ae9519dae70e5f2b680f3d7c922da
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b5da3cbfc80dfc85a52acff32aa72580c291d33e2fac347fe8f21a2f1621250d61631d61edffff6d837e5f55b1c856186abe2069b2e8f0701c35fd0ac2275680
|
7
|
+
data.tar.gz: 20b517597f339003bda62662e37b8ebc254781428025e82fe2169ae39cc450a61b561c58e5d82d938c3fdbd29d7bcb1dcca571c119f4668f2c4280ea229b6d5b
|
data/README.md
CHANGED
@@ -68,6 +68,21 @@ would expand to:
|
|
68
68
|
get '/press-kit' => 'pages#press_kit', :as => :press_kit
|
69
69
|
```
|
70
70
|
|
71
|
+
### Namespacing ###
|
72
|
+
|
73
|
+
You can easily namespace pages:
|
74
|
+
|
75
|
+
```
|
76
|
+
namespace :work do
|
77
|
+
pages :client_1, :client_2
|
78
|
+
end
|
79
|
+
```
|
80
|
+
|
81
|
+
This will create a `Work::PagesController` dynamically if one does not
|
82
|
+
already exist. If you chose to create your own it should always inherit
|
83
|
+
from `::PagesController`. Your views should be put into
|
84
|
+
`app/views/work/pages/`
|
85
|
+
|
71
86
|
## Authors ##
|
72
87
|
|
73
88
|
[Brian Cardarella](http://twitter.com/bcardarella)
|
data/lib/pages/routes.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module ActionDispatch::Routing
|
2
2
|
class Mapper
|
3
3
|
def page(_page, options={})
|
4
|
+
set_pages_namespace
|
4
5
|
_route = options[:transform].call(_page.to_s) if options[:transform]
|
5
6
|
_route ||= _page
|
6
7
|
get "/#{_route}" => "pages##{_page}", :as => _page
|
@@ -12,5 +13,20 @@ module ActionDispatch::Routing
|
|
12
13
|
page(_page, options)
|
13
14
|
end
|
14
15
|
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def set_pages_namespace
|
20
|
+
if @scope[:module]
|
21
|
+
mod = @scope[:module].classify
|
22
|
+
unless eval("defined? ::#{mod}")
|
23
|
+
Object.class_eval("module ::#{mod}; end")
|
24
|
+
end
|
25
|
+
|
26
|
+
unless eval("defined? ::#{mod}::PagesController")
|
27
|
+
Object.class_eval("class ::#{mod}::PagesController < ::PagesController; end")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
15
31
|
end
|
16
32
|
end
|
data/lib/pages/version.rb
CHANGED
metadata
CHANGED
@@ -1,78 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Brian Cardarella
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-10-06 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>'
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '3.2'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>'
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '3.2'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec-rails
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: capybara
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: generator_spec
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
description: Pages.
|
@@ -88,37 +79,29 @@ files:
|
|
88
79
|
- lib/pages/routes.rb
|
89
80
|
- lib/pages/version.rb
|
90
81
|
- lib/pages.rb
|
91
|
-
- lib/tasks/pages_tasks.rake
|
92
82
|
- Rakefile
|
93
83
|
- README.md
|
94
84
|
homepage: https://github.com/dockyard/pages
|
95
85
|
licenses: []
|
86
|
+
metadata: {}
|
96
87
|
post_install_message:
|
97
88
|
rdoc_options: []
|
98
89
|
require_paths:
|
99
90
|
- lib
|
100
91
|
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
-
none: false
|
102
92
|
requirements:
|
103
|
-
- -
|
93
|
+
- - '>='
|
104
94
|
- !ruby/object:Gem::Version
|
105
95
|
version: '0'
|
106
|
-
segments:
|
107
|
-
- 0
|
108
|
-
hash: 4283846489005725137
|
109
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
-
none: false
|
111
97
|
requirements:
|
112
|
-
- -
|
98
|
+
- - '>='
|
113
99
|
- !ruby/object:Gem::Version
|
114
100
|
version: '0'
|
115
|
-
segments:
|
116
|
-
- 0
|
117
|
-
hash: 4283846489005725137
|
118
101
|
requirements: []
|
119
102
|
rubyforge_project:
|
120
|
-
rubygems_version: 1.
|
103
|
+
rubygems_version: 2.1.5
|
121
104
|
signing_key:
|
122
|
-
specification_version:
|
105
|
+
specification_version: 4
|
123
106
|
summary: Pages
|
124
107
|
test_files: []
|
data/lib/tasks/pages_tasks.rake
DELETED