mascot-rails 0.1.11 → 0.1.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 29781381e53ccaa59c4ad31f6d72f7d3758ce577
4
- data.tar.gz: a7fc2422181f3cdc8a92ddb2656f08dc16197f27
3
+ metadata.gz: af6e9c3364ea71baba94e6f5ef9bb1da5f6b9f1a
4
+ data.tar.gz: 2005e26040c90e08b059b47badb31892f9cd13d8
5
5
  SHA512:
6
- metadata.gz: 40015fba5b9569f3fe55000e73b497abfc3d3d1d90a44bb2171a2ce00b0f853319d008a0595235fbebe1e86c280152596a16d8cfa1a286289058b9d453753fce
7
- data.tar.gz: e1672053721e6092c34966dddae73f24170db1b1bf2fdd523965ec3552fd33d7cc65e9a8be67bb66ccd677cd79b4c5d57c9d2dbf1986d8007eb131db64a58a3b
6
+ metadata.gz: af3841f8d9b0e042e6ef4504fd4032e144ae40473caff36b0265db9ddbc05f8b4b6edc571c5c4055cdfe533ea16a7a7db149691b03d1c1459548e1166fc6c412
7
+ data.tar.gz: df370017cb3d2f457720c3a7126eeef85515d066278e6cb05b7bb1685dca3ceb3adb1850da4504e6f710c3c6fbb36bb9fb126e2cfefb9ffeecb92e6a22758707
@@ -29,7 +29,7 @@ module Mascot
29
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
- resource = resources.get(path)
32
+ resource = resources.get_resource(path)
33
33
  if resource.nil?
34
34
  # TODO: Display error in context of Reources class root.
35
35
  raise Mascot::PageNotFoundError, "No such page: #{path}"
@@ -9,11 +9,13 @@ module Mascot
9
9
  @file_name = file_name
10
10
  end
11
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
12
+ def process_resources(node)
13
+ node.each do |r|
14
+ asset = r.asset
15
+ if asset.path.basename.to_s.start_with? @file_name
16
+ request_path = Pathname.new("/").join(r.request_path).dirname.cleanpath.to_s
17
+ node.remove_resource(r)
18
+ node.add(path: request_path, asset: asset)
17
19
  end
18
20
  end
19
21
  end
@@ -7,7 +7,7 @@ module Mascot
7
7
 
8
8
  def process_resources(resources)
9
9
  resources.each do |r|
10
- resources.remove r if self.class.partial? r.asset.path # Looks like a smiley face, doesn't it?
10
+ r.node.remove if self.class.partial? r.asset.path # Looks like a smiley face, doesn't it?
11
11
  end
12
12
  end
13
13
 
@@ -5,7 +5,10 @@ module Mascot
5
5
  class RailsRequestPaths
6
6
  def process_resources(resources)
7
7
  resources.each do |r|
8
- r.request_path = self.class.format_path r.request_path
8
+ asset = r.asset
9
+ request_path = r.request_path
10
+ r.node.remove
11
+ resources.add path: self.class.format_path(request_path), asset: asset
9
12
  end
10
13
  end
11
14