mascot-rails 0.1.10 → 0.1.11
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 +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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29781381e53ccaa59c4ad31f6d72f7d3758ce577
|
4
|
+
data.tar.gz: a7fc2422181f3cdc8a92ddb2656f08dc16197f27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40015fba5b9569f3fe55000e73b497abfc3d3d1d90a44bb2171a2ce00b0f853319d008a0595235fbebe1e86c280152596a16d8cfa1a286289058b9d453753fce
|
7
|
+
data.tar.gz: e1672053721e6092c34966dddae73f24170db1b1bf2fdd523965ec3552fd33d7cc65e9a8be67bb66ccd677cd79b4c5d57c9d2dbf1986d8007eb131db64a58a3b
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Mascot
|
2
2
|
|
3
|
-
Mascot is a file-backed website content manager that can be embedded in popular web frameworks like Rails. Inspired by [Middleman](https://middlemanapp.com), Mascot is stripped down with less dependencies to work better within Rails. That mean it ships with Frontmatter, the
|
3
|
+
Mascot is a file-backed website content manager that can be embedded in popular web frameworks like Rails. Inspired by [Middleman](https://middlemanapp.com), Mascot is stripped down with less dependencies to work better within Rails. That mean it ships with Frontmatter, the Site API, and a few templating features. [Learn more about Mascot](https://github.com/bradgessler/mascot).
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
data/config/routes.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Mascot.configuration.parent_engine.routes.draw do
|
2
2
|
if Mascot.configuration.routes
|
3
3
|
constraints Mascot::RouteConstraint.new do
|
4
|
-
get "*resource_path", controller: "mascot/
|
4
|
+
get "*resource_path", controller: "mascot/site", action: "show", as: :page, format: false
|
5
5
|
end
|
6
6
|
end
|
7
7
|
end
|
@@ -26,7 +26,7 @@ module Mascot
|
|
26
26
|
content_type: resource.mime_type.to_s
|
27
27
|
end
|
28
28
|
|
29
|
-
# Mascot::PageNotFoundError is handled in the default Mascot::
|
29
|
+
# Mascot::PageNotFoundError is handled in the default Mascot::SiteController
|
30
30
|
# with an execption that Rails can use to display a 404 error.
|
31
31
|
def get(path)
|
32
32
|
resource = resources.get(path)
|
data/lib/mascot/rails.rb
CHANGED
@@ -2,7 +2,7 @@ require "mascot"
|
|
2
2
|
|
3
3
|
module Mascot
|
4
4
|
# Contains singletons for rails and some configuration data.
|
5
|
-
Configuration = Struct.new(:
|
5
|
+
Configuration = Struct.new(:site, :routes, :parent_engine)
|
6
6
|
|
7
7
|
# Rescued by ActionController to display page not found error.
|
8
8
|
PageNotFoundError = Class.new(StandardError)
|
@@ -14,7 +14,6 @@ module Mascot
|
|
14
14
|
autoload :RailsRequestPaths, "mascot/extensions/rails_request_paths"
|
15
15
|
autoload :PartialsRemover, "mascot/extensions/partials_remover"
|
16
16
|
autoload :IndexRequestPath, "mascot/extensions/index_request_path"
|
17
|
-
autoload :Layouts, "mascot/extensions/layouts"
|
18
17
|
end
|
19
18
|
|
20
19
|
# Default configuration object for Mascot Rails integration.
|
@@ -2,9 +2,9 @@ module Mascot
|
|
2
2
|
# Configuration object for rails application.
|
3
3
|
class RailsConfiguration
|
4
4
|
# Store in ./app/pages by default.
|
5
|
-
|
5
|
+
DEFAULT_SITE_ROOT = "app/pages".freeze
|
6
6
|
|
7
|
-
attr_accessor :
|
7
|
+
attr_accessor :site, :resources, :parent_engine, :routes, :cache_resources, :partials
|
8
8
|
|
9
9
|
# Set defaults.
|
10
10
|
def initialize
|
@@ -14,10 +14,10 @@ module Mascot
|
|
14
14
|
@partials = false
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
18
|
-
@
|
19
|
-
|
20
|
-
|
17
|
+
def site
|
18
|
+
@site ||= Site.new(root: default_root).tap do |site|
|
19
|
+
site.resources_pipeline << Extensions::PartialsRemover.new unless partials
|
20
|
+
site.resources_pipeline << Extensions::RailsRequestPaths.new
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -25,7 +25,7 @@ module Mascot
|
|
25
25
|
# Production will cache resources globally. This drastically speeds up
|
26
26
|
# the speed at which resources are served, but if they change it won't be updated.
|
27
27
|
@resources = nil unless cache_resources?
|
28
|
-
@resources ||=
|
28
|
+
@resources ||= site.resources
|
29
29
|
end
|
30
30
|
|
31
31
|
def cache_resources?
|
@@ -34,7 +34,7 @@ module Mascot
|
|
34
34
|
|
35
35
|
private
|
36
36
|
def default_root
|
37
|
-
Rails.root.join(
|
37
|
+
Rails.root.join(DEFAULT_SITE_ROOT)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -18,7 +18,7 @@ Rails.application.configure do
|
|
18
18
|
config.assets.js_compressor = :uglifier
|
19
19
|
# config.assets.css_compressor = :sass
|
20
20
|
|
21
|
-
# Do not fallback to assets
|
21
|
+
# Do not fallback to assets resources_pipeline if a precompiled asset is missed.
|
22
22
|
config.assets.compile = false
|
23
23
|
|
24
24
|
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|