middleman-core 3.1.0.beta.2 → 3.1.0.beta.3

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: 162338185650a24dbf63fc3f9e937c325696e8a4
4
- data.tar.gz: 4127281186efb590b13ffcbcab498ece1db4b418
3
+ metadata.gz: e8a279528f24b7e446198070bc0ea4c00013de60
4
+ data.tar.gz: e1d785013bb97799ccc2e43fbb706aeed5e0fc55
5
5
  SHA512:
6
- metadata.gz: a3e4a7d833d68f8e60a518db42e581a765197fa2904fbaaade630abdd69cdb2143e4dc058a7724fce4e022251ebd108d98e5ab94186e9ab0bffb61e7b8c31cf7
7
- data.tar.gz: 26736224cbb3f390c8be6877e357f6cc83daa09bdbcca78c8e9276b1bdfd25acf0a5cf5c215d793cb43be00320627119230b0a70dddbe6f4de40fb7cd5b997e5
6
+ metadata.gz: de01893c4f27a36317eab262666d6a148f9a46330fd8d94029055b0b57ea368a39d318b7fedf4d39ca7041132ba1508f1e8e078d4cd995d050944b79c61851c9
7
+ data.tar.gz: 34065ae04b71a48f48fe441fb56956bfb780b14b0ef76ccef277a1d2f981201d1a39b5f06a39af2e0a118746afc325fbd674e4b64af0fe99ec5cbd9921be899a
@@ -0,0 +1 @@
1
+ %h1 Welcome
@@ -179,7 +179,20 @@ module Middleman
179
179
 
180
180
  # Needed so that method_missing makes sense
181
181
  def respond_to?(method, include_private = false)
182
- super || @local_data.has_key?(method.to_s) || !!(data_for_path(method))
182
+ super || has_key?(method)
183
+ end
184
+
185
+ # Make DataStore act like a hash. Return requested data, or
186
+ # nil if data does not exist
187
+ #
188
+ # @param [String, Symbol] key The name of the data namespace
189
+ # @return [Hash, nil]
190
+ def [](key)
191
+ __send__(key) if has_key?(key)
192
+ end
193
+
194
+ def has_key?(key)
195
+ @local_data.has_key?(key.to_s) || !!(data_for_path(key))
183
196
  end
184
197
 
185
198
  # Convert all the data into a static hash
@@ -27,6 +27,8 @@ module Middleman
27
27
  def registered(app)
28
28
  app.send :include, InstanceMethods
29
29
 
30
+ app.config.define_setting :file_watcher_ignore, IGNORE_LIST, 'Regexes for paths that should be ignored when they change.'
31
+
30
32
  # Before parsing config, load the data/ directory
31
33
  app.before_configuration do
32
34
  files.reload_path(config[:data_dir])
@@ -146,7 +148,7 @@ module Middleman
146
148
  # @return [Boolean]
147
149
  def ignored?(path)
148
150
  path = path.to_s
149
- IGNORE_LIST.any? { |r| path =~ r }
151
+ app.config[:file_watcher_ignore].any? { |r| path =~ r }
150
152
  end
151
153
 
152
154
  # Notify callbacks for a file given an array of callbacks
@@ -413,7 +413,8 @@ module Middleman
413
413
  @_out_buf = _buf_was
414
414
  end
415
415
 
416
- concat_safe_content render_individual_file(layout_path, @current_locs || {}, @current_opts || {}, self) { content }
416
+ # concat_safe_content
417
+ concat_content render_individual_file(layout_path, @current_locs || {}, @current_opts || {}, self) { content }
417
418
  ensure
418
419
  @current_engine = engine_was
419
420
  end
@@ -184,28 +184,10 @@ module Middleman
184
184
  # @return [String]
185
185
  def extensionless_path(file)
186
186
  path = file.dup
187
-
188
- end_of_the_line = false
189
- while !end_of_the_line
190
- if !::Tilt[path].nil?
191
- path = path.sub(File.extname(path), "")
192
- else
193
- end_of_the_line = true
194
- end
195
- end
187
+ path = remove_templating_extensions(path)
196
188
 
197
189
  # If there is no extension, look for one
198
- if File.extname(path).empty?
199
- input_ext = File.extname(file)
200
-
201
- if !input_ext.empty?
202
- input_ext = input_ext.split(".").last.to_sym
203
- if @app.template_extensions.has_key?(input_ext)
204
- path << ".#{@app.template_extensions[input_ext]}"
205
- end
206
- end
207
- end
208
-
190
+ path = find_extension(path, file) if File.extname(strip_away_locale(path)).empty?
209
191
  path
210
192
  end
211
193
 
@@ -242,6 +224,46 @@ module Middleman
242
224
  @_lookup_by_destination_path = {}
243
225
  }
244
226
  end
227
+
228
+ # Removes the templating extensions, while keeping the others
229
+ # @param [String] path
230
+ # @return [String]
231
+ def remove_templating_extensions(path)
232
+ # Strip templating extensions as long as Tilt knows them
233
+ path = path.sub(File.extname(path), "") while ::Tilt[path]
234
+ path
235
+ end
236
+
237
+ # Remove the locale token from the end of the path
238
+ # @param [String] path
239
+ # @return [String]
240
+ def strip_away_locale(path)
241
+ if app.respond_to? :langs
242
+ path_bits = path.split('.')
243
+ lang = path_bits.last
244
+ if app.langs.include?(lang.to_sym)
245
+ return path_bits[0..-1].join('.')
246
+ end
247
+ end
248
+
249
+ path
250
+ end
251
+
252
+ # Finds an extension for path according to file's extension
253
+ # @param [String] path without extension
254
+ # @param [String] file path with original extensions
255
+ def find_extension(path, file)
256
+ input_ext = File.extname(file)
257
+
258
+ if !input_ext.empty?
259
+ input_ext = input_ext.split(".").last.to_sym
260
+ if @app.template_extensions.has_key?(input_ext)
261
+ path << ".#{@app.template_extensions[input_ext]}"
262
+ end
263
+ end
264
+
265
+ path
266
+ end
245
267
  end
246
268
  end
247
269
  end
@@ -24,10 +24,9 @@
24
24
  # page "/admin/*"
25
25
  # end
26
26
 
27
- # Proxy (fake) files
28
- # page "/this-page-has-no-template.html", :proxy => "/template-file.html" do
29
- # @which_fake_page = "Rendering a fake page with a variable"
30
- # end
27
+ # Proxy pages (http://middlemanapp.com/dynamic-pages/)
28
+ # proxy "/this-page-has-no-template.html", "/template-file.html", :locals => {
29
+ # :which_fake_page => "Rendering a fake page with a local variable" }
31
30
 
32
31
  ###
33
32
  # Helpers
@@ -36,6 +35,9 @@
36
35
  # Automatic image dimensions on image_tag helper
37
36
  # activate :automatic_image_sizes
38
37
 
38
+ # Reload the browser automatically whenever files change
39
+ # activate :livereload
40
+
39
41
  # Methods defined in the helpers block are available in templates
40
42
  # helpers do
41
43
  # def some_helper
@@ -73,11 +75,11 @@ configure :build do
73
75
  # activate :minify_javascript
74
76
 
75
77
  # Enable cache buster
76
- # activate :cache_buster
78
+ # activate :asset_hash
77
79
 
78
80
  # Use relative URLs
79
81
  # activate :relative_assets
80
82
 
81
83
  # Or use a different image path
82
84
  # set :http_path, "/Content/images/"
83
- end
85
+ end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  # Current Version
3
3
  # @return [String]
4
- VERSION = '3.1.0.beta.2' unless const_defined?(:VERSION)
4
+ VERSION = '3.1.0.beta.3' unless const_defined?(:VERSION)
5
5
  end
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.add_dependency("rack-test", ["~> 0.6.1"])
27
27
 
28
28
  # CLI
29
- s.add_dependency("thor", ["~> 0.17.0"])
29
+ s.add_dependency("thor", ["~> 0.15.2"])
30
30
 
31
31
  # Helpers
32
32
  s.add_dependency("activesupport", ["~> 3.2.6"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.beta.2
4
+ version: 3.1.0.beta.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Reynolds
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-01 00:00:00.000000000 Z
12
+ date: 2013-05-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -73,14 +73,14 @@ dependencies:
73
73
  requirements:
74
74
  - - ~>
75
75
  - !ruby/object:Gem::Version
76
- version: 0.17.0
76
+ version: 0.15.2
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - ~>
82
82
  - !ruby/object:Gem::Version
83
- version: 0.17.0
83
+ version: 0.15.2
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: activesupport
86
86
  requirement: !ruby/object:Gem::Requirement
@@ -219,7 +219,7 @@ files:
219
219
  - fixtures/data-app/source/index.html.erb
220
220
  - fixtures/data-app/source/layout.erb
221
221
  - fixtures/different-engine-layout/config.rb
222
- - fixtures/different-engine-layout/source/index.html.str
222
+ - fixtures/different-engine-layout/source/index.haml
223
223
  - fixtures/different-engine-layout/source/layout.erb
224
224
  - fixtures/dynamic-pages-app/config.rb
225
225
  - fixtures/dynamic-pages-app/source/real.html
@@ -739,7 +739,7 @@ test_files:
739
739
  - fixtures/data-app/source/index.html.erb
740
740
  - fixtures/data-app/source/layout.erb
741
741
  - fixtures/different-engine-layout/config.rb
742
- - fixtures/different-engine-layout/source/index.html.str
742
+ - fixtures/different-engine-layout/source/index.haml
743
743
  - fixtures/different-engine-layout/source/layout.erb
744
744
  - fixtures/dynamic-pages-app/config.rb
745
745
  - fixtures/dynamic-pages-app/source/real.html
@@ -1 +0,0 @@
1
- <h1>Welcome</h1>