mascot-rails 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8f75b9c928c6100afdf542f5c1613d50599bce2
4
- data.tar.gz: 048b5189fbb78e517da38b523f4af3447bf31188
3
+ metadata.gz: 9d01108d929b171be4baedad66287fe49624c625
4
+ data.tar.gz: 5756960e8c3ff99aff2ad75ef1a6f7ead99e0c33
5
5
  SHA512:
6
- metadata.gz: f6883892fb9176d61dff68831542610b381b2faf829da5c9ce03aa44ff30d9ed48a5189b489d58778b3900a2fa09b470ca9ed11d08f9728338f3898b007df0ef
7
- data.tar.gz: 0a63879f28f859ab19faae79461eb29d17e989f54e1aafce8cbf8404111cc12cff74101ca4d06d89d3fb4ac1fea63912f30f5ba651bad610390e387c1b3077c4
6
+ metadata.gz: 7a60470d2fa4ef0787d25ae7f64833bfb624d5488d7d865646c2c42fd176840e109e262c6d5dc4a13029fd4ca715d94b8457a7436a5dd3b8fe51d69ba15c7e56
7
+ data.tar.gz: 5c0e8b15656a400a986369d2bc630bc399267dfd886691089c850c1c63c9fd746963f15627c0f414f5d5672d99e48c1de3056232bea18d0a9c105586e7aef834
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 "*path", controller: "mascot/sitemap", action: "show", as: :page, format: false
4
+ get "*resource_path", controller: "mascot/sitemap", action: "show", as: :page, format: false
5
5
  end
6
6
  end
7
7
  end
@@ -40,7 +40,7 @@ module Mascot
40
40
 
41
41
  # Default finder of the resource for the current controller context.###
42
42
  def find_resource
43
- get controller.params[:path]
43
+ get controller.params[:resource_path]
44
44
  end
45
45
 
46
46
  private
@@ -0,0 +1,22 @@
1
+ module Mascot
2
+ module Extensions
3
+ # Removes files beginning with "_" from the resource collection.
4
+ class IndexRequestPath
5
+ # Name of the file that we'll want to change to a / path
6
+ FILE_NAME = "index.html".freeze
7
+
8
+ def initialize(file_name: FILE_NAME)
9
+ @file_name = file_name
10
+ end
11
+
12
+ def process_resources(resources)
13
+ resources.each do |r|
14
+ if r.asset.path.basename.to_s.start_with? @file_name
15
+ # TODO: Conslidate this into SafeRoot.
16
+ r.request_path = Pathname.new("/").join(r.request_path).dirname.cleanpath.to_s
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,27 @@
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
data/lib/mascot/rails.rb CHANGED
@@ -13,6 +13,8 @@ module Mascot
13
13
  module Extensions
14
14
  autoload :RailsRequestPaths, "mascot/extensions/rails_request_paths"
15
15
  autoload :PartialsRemover, "mascot/extensions/partials_remover"
16
+ autoload :IndexRequestPath, "mascot/extensions/index_request_path"
17
+ autoload :Layouts, "mascot/extensions/layouts"
16
18
  end
17
19
 
18
20
  # Default configuration object for Mascot Rails integration.
@@ -1248,3 +1248,59 @@ I, [2016-07-31T23:28:55.218581 #23080] INFO -- : Processing by Mascot::SitemapC
1248
1248
  I, [2016-07-31T23:28:55.218613 #23080] INFO -- : Parameters: {"path"=>"page-9999.html"}
1249
1249
  I, [2016-07-31T23:28:57.825229 #23080] INFO -- : Rendered inline template within layouts/application (1153.3ms)
1250
1250
  I, [2016-07-31T23:28:57.826056 #23080] INFO -- : Completed 200 OK in 2607ms (Views: 1154.2ms | ActiveRecord: 0.0ms)
1251
+ I, [2016-08-02T15:28:49.239877 #82906] INFO -- : Started GET "/baseline/render" for 127.0.0.1 at 2016-08-02 15:28:49 -0700
1252
+ I, [2016-08-02T15:28:49.252320 #82906] INFO -- : Processing by BaselineController#show as HTML
1253
+ I, [2016-08-02T15:28:49.256779 #82906] INFO -- : Rendered baseline/show.html.erb within layouts/application (0.3ms)
1254
+ I, [2016-08-02T15:28:49.263443 #82906] INFO -- : Completed 200 OK in 11ms (Views: 10.7ms | ActiveRecord: 0.0ms)
1255
+ I, [2016-08-02T15:28:49.265997 #82906] INFO -- : Started GET "/page-1.html" for 127.0.0.1 at 2016-08-02 15:28:49 -0700
1256
+ I, [2016-08-02T15:28:49.267297 #82906] INFO -- : Processing by Mascot::SitemapController#show as HTML
1257
+ I, [2016-08-02T15:28:49.267372 #82906] INFO -- : Parameters: {"path"=>"page-1.html"}
1258
+ I, [2016-08-02T15:28:53.130167 #82906] INFO -- : Rendered inline template within layouts/application (3857.5ms)
1259
+ I, [2016-08-02T15:28:53.132209 #82906] INFO -- : Completed 200 OK in 3865ms (Views: 3861.8ms | ActiveRecord: 0.0ms)
1260
+ I, [2016-08-02T15:28:53.135581 #82906] INFO -- : Started GET "/page-9999.html" for 127.0.0.1 at 2016-08-02 15:28:53 -0700
1261
+ I, [2016-08-02T15:28:53.136057 #82906] INFO -- : Processing by Mascot::SitemapController#show as HTML
1262
+ I, [2016-08-02T15:28:53.136088 #82906] INFO -- : Parameters: {"path"=>"page-9999.html"}
1263
+ I, [2016-08-02T15:28:53.244549 #82906] INFO -- : Rendered inline template within layouts/application (107.9ms)
1264
+ I, [2016-08-02T15:28:53.245972 #82906] INFO -- : Completed 200 OK in 110ms (Views: 109.4ms | ActiveRecord: 0.0ms)
1265
+ I, [2016-08-02T15:28:53.536255 #82906] INFO -- : Started GET "/baseline/render" for 127.0.0.1 at 2016-08-02 15:28:53 -0700
1266
+ I, [2016-08-02T15:28:53.536910 #82906] INFO -- : Processing by BaselineController#show as HTML
1267
+ I, [2016-08-02T15:28:53.537335 #82906] INFO -- : Rendered baseline/show.html.erb within layouts/application (0.0ms)
1268
+ I, [2016-08-02T15:28:53.538976 #82906] INFO -- : Completed 200 OK in 2ms (Views: 1.8ms | ActiveRecord: 0.0ms)
1269
+ I, [2016-08-02T15:28:53.596571 #82906] INFO -- : Started GET "/page-1.html" for 127.0.0.1 at 2016-08-02 15:28:53 -0700
1270
+ I, [2016-08-02T15:28:53.597074 #82906] INFO -- : Processing by Mascot::SitemapController#show as HTML
1271
+ I, [2016-08-02T15:28:53.597107 #82906] INFO -- : Parameters: {"path"=>"page-1.html"}
1272
+ I, [2016-08-02T15:28:53.685423 #82906] INFO -- : Rendered inline template within layouts/application (87.9ms)
1273
+ I, [2016-08-02T15:28:53.686357 #82906] INFO -- : Completed 200 OK in 89ms (Views: 88.9ms | ActiveRecord: 0.0ms)
1274
+ I, [2016-08-02T15:28:53.761308 #82906] INFO -- : Started GET "/page-9999.html" for 127.0.0.1 at 2016-08-02 15:28:53 -0700
1275
+ I, [2016-08-02T15:28:53.761775 #82906] INFO -- : Processing by Mascot::SitemapController#show as HTML
1276
+ I, [2016-08-02T15:28:53.761807 #82906] INFO -- : Parameters: {"path"=>"page-9999.html"}
1277
+ I, [2016-08-02T15:28:53.852588 #82906] INFO -- : Rendered inline template within layouts/application (90.4ms)
1278
+ I, [2016-08-02T15:28:53.854070 #82906] INFO -- : Completed 200 OK in 92ms (Views: 92.0ms | ActiveRecord: 0.0ms)
1279
+ I, [2016-08-02T15:28:56.646916 #82906] INFO -- : Started GET "/baseline/render" for 127.0.0.1 at 2016-08-02 15:28:56 -0700
1280
+ I, [2016-08-02T15:28:56.647492 #82906] INFO -- : Processing by BaselineController#show as HTML
1281
+ I, [2016-08-02T15:28:56.647863 #82906] INFO -- : Rendered baseline/show.html.erb within layouts/application (0.0ms)
1282
+ I, [2016-08-02T15:28:56.648281 #82906] INFO -- : Completed 200 OK in 1ms (Views: 0.6ms | ActiveRecord: 0.0ms)
1283
+ I, [2016-08-02T15:28:56.649138 #82906] INFO -- : Started GET "/page-1.html" for 127.0.0.1 at 2016-08-02 15:28:56 -0700
1284
+ I, [2016-08-02T15:28:56.649576 #82906] INFO -- : Processing by Mascot::SitemapController#show as HTML
1285
+ I, [2016-08-02T15:28:56.649607 #82906] INFO -- : Parameters: {"path"=>"page-1.html"}
1286
+ I, [2016-08-02T15:29:01.588282 #82906] INFO -- : Rendered inline template within layouts/application (3418.5ms)
1287
+ I, [2016-08-02T15:29:01.589245 #82906] INFO -- : Completed 200 OK in 4940ms (Views: 3419.6ms | ActiveRecord: 0.0ms)
1288
+ I, [2016-08-02T15:29:01.592650 #82906] INFO -- : Started GET "/page-9999.html" for 127.0.0.1 at 2016-08-02 15:29:01 -0700
1289
+ I, [2016-08-02T15:29:01.593184 #82906] INFO -- : Processing by Mascot::SitemapController#show as HTML
1290
+ I, [2016-08-02T15:29:01.593223 #82906] INFO -- : Parameters: {"path"=>"page-9999.html"}
1291
+ I, [2016-08-02T15:29:05.328473 #82906] INFO -- : Rendered inline template within layouts/application (1890.2ms)
1292
+ I, [2016-08-02T15:29:05.330198 #82906] INFO -- : Completed 200 OK in 3737ms (Views: 1892.0ms | ActiveRecord: 0.0ms)
1293
+ I, [2016-08-02T15:29:07.365328 #82906] INFO -- : Started GET "/baseline/render" for 127.0.0.1 at 2016-08-02 15:29:07 -0700
1294
+ I, [2016-08-02T15:29:07.365924 #82906] INFO -- : Processing by BaselineController#show as HTML
1295
+ I, [2016-08-02T15:29:07.366314 #82906] INFO -- : Rendered baseline/show.html.erb within layouts/application (0.0ms)
1296
+ I, [2016-08-02T15:29:07.366731 #82906] INFO -- : Completed 200 OK in 1ms (Views: 0.6ms | ActiveRecord: 0.0ms)
1297
+ I, [2016-08-02T15:29:07.497249 #82906] INFO -- : Started GET "/page-1.html" for 127.0.0.1 at 2016-08-02 15:29:07 -0700
1298
+ I, [2016-08-02T15:29:07.497815 #82906] INFO -- : Processing by Mascot::SitemapController#show as HTML
1299
+ I, [2016-08-02T15:29:07.497850 #82906] INFO -- : Parameters: {"path"=>"page-1.html"}
1300
+ I, [2016-08-02T15:29:09.879877 #82906] INFO -- : Rendered inline template within layouts/application (1062.0ms)
1301
+ I, [2016-08-02T15:29:09.892622 #82906] INFO -- : Completed 200 OK in 2395ms (Views: 1062.9ms | ActiveRecord: 0.0ms)
1302
+ I, [2016-08-02T15:29:10.153048 #82906] INFO -- : Started GET "/page-9999.html" for 127.0.0.1 at 2016-08-02 15:29:10 -0700
1303
+ I, [2016-08-02T15:29:10.153649 #82906] INFO -- : Processing by Mascot::SitemapController#show as HTML
1304
+ I, [2016-08-02T15:29:10.153762 #82906] INFO -- : Parameters: {"path"=>"page-9999.html"}
1305
+ I, [2016-08-02T15:29:12.455826 #82906] INFO -- : Rendered inline template within layouts/application (1021.0ms)
1306
+ I, [2016-08-02T15:29:12.457463 #82906] INFO -- : Completed 200 OK in 2304ms (Views: 1022.7ms | ActiveRecord: 0.0ms)