locomotivecms_mounter 1.3.0 → 1.3.1

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: a544f668acb9f469e36dbbc2481f94ca5be4e6b2
4
- data.tar.gz: 2435a7ca2b750f20afbcafe77b5238b31090dbcf
3
+ metadata.gz: bd805b0725f79d360e2dca56b557700f21345f3f
4
+ data.tar.gz: f437f1070d2c438ae866e4bd686b1a5d32407103
5
5
  SHA512:
6
- metadata.gz: 5e24cb2022d27e11b981eb7e3b7c2c62786f562fb16fe71a8a5707e4d51e22b02b5c821f048c899727ef91919d495035eea36b55c3ba08b924aa61ab89ca16d7
7
- data.tar.gz: 0f86671a344ac51f294eae9db59a04fabe5a6d2a0947dde51cb20be3b602dfe1f76d0948ff95dfb5eb24e8faa2b89273ec518c849f68391e1a9cd27b83a8504a
6
+ metadata.gz: c65468b6d09942dc0f7628990530d74a5f0467da2e3e6b77479526cade925d1e77c0a563c9d22494f625e8ef531f20ba7f8e4217504455381f6a05ba2a5d2ece
7
+ data.tar.gz: 223bdc863a4e1acc7dcac5f075807441c81599a4ec292ab3126a94269052335c0212b86162eb08292b16eb95c8d004734ce4b64ee7d0228501d1fa03f4376306
@@ -150,7 +150,7 @@ module Locomotive
150
150
  # @return [ Integer ] An unique id corresponding to the depth and position
151
151
  #
152
152
  def depth_and_position
153
- self.depth * 100 + (self.position || 100)
153
+ self.depth * 1000 + (self.position || 199)
154
154
  end
155
155
 
156
156
  # A layout is a page whose the template does
@@ -64,7 +64,7 @@ module Locomotive
64
64
 
65
65
  asset = Locomotive::Mounter::Models::ContentAsset.new(uri: url, folder: folder)
66
66
 
67
- content_assets[url.to_s] = asset
67
+ content_assets[url.path] = asset
68
68
 
69
69
  asset.local_filepath
70
70
  end
@@ -69,10 +69,16 @@ module Locomotive
69
69
 
70
70
  # Record pages found in file system
71
71
  def fetch
72
- Dir.glob(File.join(self.root_dir, '**/*')).each do |filepath|
72
+ position, last_dirname = nil, nil
73
+
74
+ Dir.glob(File.join(self.root_dir, '**/*')).sort.each do |filepath|
73
75
  next unless File.directory?(filepath) || filepath =~ /\.(#{Locomotive::Mounter::TEMPLATE_EXTENSIONS.join('|')})$/
74
76
 
75
- page = self.add(filepath)
77
+ if last_dirname != File.dirname(filepath)
78
+ position, last_dirname = 100, File.dirname(filepath)
79
+ end
80
+
81
+ page = self.add(filepath, position: position)
76
82
 
77
83
  next if File.directory?(filepath) || page.nil?
78
84
 
@@ -83,6 +89,8 @@ module Locomotive
83
89
  else
84
90
  Locomotive::Mounter.logger.warn "Unknown locale in the '#{File.basename(filepath)}' file."
85
91
  end
92
+
93
+ position += 1
86
94
  end
87
95
  end
88
96
 
@@ -105,6 +113,8 @@ module Locomotive
105
113
  page.mounting_point = self.mounting_point
106
114
  page.filepath = File.expand_path(filepath)
107
115
 
116
+ page.template = OpenStruct.new(raw_source: '') if File.directory?(filepath)
117
+
108
118
  self.pages[fullpath] = page
109
119
  end
110
120
 
@@ -2,7 +2,7 @@
2
2
  module Locomotive
3
3
  module Mounter #:nodoc
4
4
 
5
- VERSION = '1.3.0'
5
+ VERSION = '1.3.1'
6
6
 
7
7
  end
8
8
  end
@@ -227,7 +227,7 @@ module Locomotive
227
227
 
228
228
  # editable elements
229
229
  (params[:editable_elements] || []).each do |element|
230
- if element[:content] =~ /$\/samples\//
230
+ if element[:content] =~ /^\/samples\//
231
231
  element[:source] = self.path_to_file(element.delete(:content))
232
232
  elsif element[:content] =~ %r($http://)
233
233
  element[:source_url] = element.delete(:content)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locomotivecms_mounter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Didier Lafforgue
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-07 00:00:00.000000000 Z
11
+ date: 2013-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tilt