mascot-rails 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/controllers/mascot/{sitemap_controller.rb → site_controller.rb} +1 -1
- data/config/routes.rb +1 -1
- data/lib/mascot/action_controller_context.rb +1 -1
- data/lib/mascot/rails.rb +1 -2
- data/lib/mascot/rails_configuration.rb +8 -8
- data/spec/dummy/config/environments/production.rb +1 -1
- data/spec/dummy/log/production.log +233 -105
- data/spec/dummy/log/test.log +17042 -2046
- data/spec/mascot/action_controller_context_spec.rb +1 -1
- data/spec/mascot/extensions/index_request_path_spec.rb +1 -1
- data/spec/mascot/{mascot_sitemap_controller_spec.rb → mascot_site_controller_spec.rb} +3 -3
- data/spec/mascot/routes_spec.rb +1 -1
- data/spec/mascot-rails_spec.rb +2 -2
- metadata +7 -10
- data/lib/mascot/extensions/layouts.rb +0 -27
- data/spec/mascot/extensions/layouts_spec.rb +0 -22
@@ -3,7 +3,7 @@ require "spec_helper"
|
|
3
3
|
describe Mascot::ActionControllerContext do
|
4
4
|
subject { Mascot::ActionControllerContext.new(controller: controller, resources: resources) }
|
5
5
|
let(:resources) { Mascot.configuration.resources }
|
6
|
-
let(:
|
6
|
+
let(:site) { Mascot.configuration.site }
|
7
7
|
let(:resource) { resources.glob("**.erb*").first }
|
8
8
|
context "#render" do
|
9
9
|
let(:controller) { instance_double("Controller", render: true, _layout: "application") }
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Mascot::Extensions::IndexRequestPath do
|
4
4
|
subject { Mascot::Extensions::IndexRequestPath.new }
|
5
|
-
let(:resources) { Mascot::
|
5
|
+
let(:resources) { Mascot::Site.new(root: "spec/pages").resources.glob("**/index*") }
|
6
6
|
let(:resource) { resources.first }
|
7
7
|
|
8
8
|
context "#process_resources" do
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe Mascot::
|
3
|
+
describe Mascot::SiteController, type: :controller do
|
4
4
|
context "existing templated page" do
|
5
5
|
render_views
|
6
6
|
before { get :show, resource_path: "/time" }
|
7
|
-
let(:resource) { Mascot.configuration.
|
7
|
+
let(:resource) { Mascot.configuration.site.get("/time") }
|
8
8
|
it "is status 200" do
|
9
9
|
expect(response.status).to eql(200)
|
10
10
|
end
|
@@ -22,7 +22,7 @@ describe Mascot::SitemapController, type: :controller do
|
|
22
22
|
it ":current_page" do
|
23
23
|
expect(subject[:current_page].asset.path).to eql(resource.asset.path)
|
24
24
|
end
|
25
|
-
it ":
|
25
|
+
it ":site" do
|
26
26
|
expect(subject[:resources]).to eql(Mascot.configuration.resources)
|
27
27
|
end
|
28
28
|
end
|
data/spec/mascot/routes_spec.rb
CHANGED
@@ -10,7 +10,7 @@ describe "Mascot routes", type: :routing do
|
|
10
10
|
expect(page_path("hi")).to eql("/hi")
|
11
11
|
end
|
12
12
|
it "is routable" do
|
13
|
-
expect(get("/hi")).to route_to(controller: "mascot/
|
13
|
+
expect(get("/hi")).to route_to(controller: "mascot/site", action: "show", resource_path: "hi")
|
14
14
|
end
|
15
15
|
end
|
16
16
|
context "routes disabled" do
|
data/spec/mascot-rails_spec.rb
CHANGED
@@ -5,8 +5,8 @@ require "mascot-rails"
|
|
5
5
|
describe Mascot do
|
6
6
|
context "default configuration" do
|
7
7
|
subject{ Mascot.configuration }
|
8
|
-
it "has
|
9
|
-
expect(subject.
|
8
|
+
it "has site" do
|
9
|
+
expect(subject.site.root).to eql(Rails.root.join("app/pages"))
|
10
10
|
end
|
11
11
|
it "has Rails.application as parent engine" do
|
12
12
|
expect(subject.parent_engine).to eql(Rails.application)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mascot-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brad Gessler
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sqlite3
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.1.
|
61
|
+
version: 0.1.11
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.1.
|
68
|
+
version: 0.1.11
|
69
69
|
description:
|
70
70
|
email:
|
71
71
|
- bradgessler@gmail.com
|
@@ -75,14 +75,13 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- README.md
|
77
77
|
- Rakefile
|
78
|
-
- app/controllers/mascot/
|
78
|
+
- app/controllers/mascot/site_controller.rb
|
79
79
|
- app/helpers/mascot/application_helper.rb
|
80
80
|
- config/routes.rb
|
81
81
|
- lib/mascot-rails.rb
|
82
82
|
- lib/mascot/action_controller_context.rb
|
83
83
|
- lib/mascot/engine.rb
|
84
84
|
- lib/mascot/extensions/index_request_path.rb
|
85
|
-
- lib/mascot/extensions/layouts.rb
|
86
85
|
- lib/mascot/extensions/partials_remover.rb
|
87
86
|
- lib/mascot/extensions/rails_request_paths.rb
|
88
87
|
- lib/mascot/rails.rb
|
@@ -150,10 +149,9 @@ files:
|
|
150
149
|
- spec/mascot-rails_spec.rb
|
151
150
|
- spec/mascot/action_controller_context_spec.rb
|
152
151
|
- spec/mascot/extensions/index_request_path_spec.rb
|
153
|
-
- spec/mascot/extensions/layouts_spec.rb
|
154
152
|
- spec/mascot/extensions/partials_remover_spec.rb
|
155
153
|
- spec/mascot/extensions/rails_request_paths_spec.rb
|
156
|
-
- spec/mascot/
|
154
|
+
- spec/mascot/mascot_site_controller_spec.rb
|
157
155
|
- spec/mascot/rails_configuration_spec.rb
|
158
156
|
- spec/mascot/route_constraint_spec.rb
|
159
157
|
- spec/mascot/routes_spec.rb
|
@@ -248,10 +246,9 @@ test_files:
|
|
248
246
|
- spec/dummy/Rakefile
|
249
247
|
- spec/mascot/action_controller_context_spec.rb
|
250
248
|
- spec/mascot/extensions/index_request_path_spec.rb
|
251
|
-
- spec/mascot/extensions/layouts_spec.rb
|
252
249
|
- spec/mascot/extensions/partials_remover_spec.rb
|
253
250
|
- spec/mascot/extensions/rails_request_paths_spec.rb
|
254
|
-
- spec/mascot/
|
251
|
+
- spec/mascot/mascot_site_controller_spec.rb
|
255
252
|
- spec/mascot/rails_configuration_spec.rb
|
256
253
|
- spec/mascot/route_constraint_spec.rb
|
257
254
|
- spec/mascot/routes_spec.rb
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module Mascot
|
2
|
-
module Extensions
|
3
|
-
# Register layouts with resources that match certain patterns.
|
4
|
-
class Layouts
|
5
|
-
Rule = Struct.new(:layout, :processor)
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
@rules = Array.new
|
9
|
-
end
|
10
|
-
|
11
|
-
# Register a layout for a set of resources.
|
12
|
-
def layout(layout, &block)
|
13
|
-
@rules << Rule.new(layout, block)
|
14
|
-
end
|
15
|
-
|
16
|
-
def process_resources(resources)
|
17
|
-
resources.each do |resource|
|
18
|
-
@rules.each do |rule|
|
19
|
-
if rule.processor.call(resource)
|
20
|
-
resource.data["layout"] ||= rule.layout
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Mascot::Extensions::Layouts do
|
4
|
-
subject { Mascot::Extensions::Layouts.new }
|
5
|
-
let(:resources) { Mascot::Sitemap.new(root: "spec/pages").resources }
|
6
|
-
let(:resource) { resources.first }
|
7
|
-
before do
|
8
|
-
subject.layout("blah-set-by-rspec"){ |r| r == resource }
|
9
|
-
subject.process_resources resources
|
10
|
-
end
|
11
|
-
context "without layout in frontmatter" do
|
12
|
-
it "sets resource.data['layout'] key" do
|
13
|
-
expect(resource.data['layout']).to eql("blah-set-by-rspec")
|
14
|
-
end
|
15
|
-
end
|
16
|
-
context "with layout in frontmatter" do
|
17
|
-
let(:resource) { resources.first.tap{ |r| r.data["layout"] = "kung-fu"} }
|
18
|
-
it "does not set resource.data['layout'] key" do
|
19
|
-
expect(resource.data['layout']).to eql("kung-fu")
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|