middleman 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/mm-build +14 -7
- data/lib/middleman.rb +16 -5
- data/middleman.gemspec +2 -2
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.3
|
data/bin/mm-build
CHANGED
@@ -26,15 +26,22 @@ module Generators
|
|
26
26
|
end
|
27
27
|
|
28
28
|
if (args[0] === args[1])
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
file_name_parts = File.basename(args.first).split('.')
|
30
|
+
|
31
|
+
if file_name_parts.length > 2
|
32
|
+
# static ext embedded in filename
|
33
|
+
newext = ""
|
34
34
|
else
|
35
|
-
|
35
|
+
# use defaults
|
36
|
+
newext = case file_name_parts.last
|
37
|
+
when 'haml', 'erb', 'mab', 'maruku'
|
38
|
+
'.html'
|
39
|
+
when 'sass'
|
40
|
+
'.css'
|
41
|
+
end
|
36
42
|
end
|
37
|
-
|
43
|
+
|
44
|
+
args[1] = args[0].gsub(".#{file_name_parts.last}", newext).gsub('views/', '')
|
38
45
|
end
|
39
46
|
|
40
47
|
super(name, *args, &block)
|
data/lib/middleman.rb
CHANGED
@@ -14,7 +14,7 @@ class Middleman < Sinatra::Base
|
|
14
14
|
set :static, true
|
15
15
|
set :root, Dir.pwd
|
16
16
|
set :environment, defined?(MIDDLEMAN_BUILDER) ? :build : :development
|
17
|
-
|
17
|
+
set :default_ext, 'html'
|
18
18
|
set :supported_formats, %w(haml erb builder)
|
19
19
|
|
20
20
|
helpers Sinatra::ContentFor
|
@@ -82,15 +82,20 @@ class Middleman < Sinatra::Base
|
|
82
82
|
|
83
83
|
# All other files
|
84
84
|
get /(.*)/ do |path|
|
85
|
-
path << "index.
|
85
|
+
path << "index.#{options.default_ext}" if path.match(%r{/$})
|
86
86
|
path.gsub!(%r{^/}, '')
|
87
|
-
path.gsub
|
87
|
+
path_without_ext = path.gsub(File.extname(path), '')
|
88
88
|
|
89
89
|
result = nil
|
90
90
|
begin
|
91
91
|
options.supported_formats.detect do |renderer|
|
92
|
-
|
93
|
-
|
92
|
+
if File.exists?(File.join(options.views, "#{path}.#{renderer}"))
|
93
|
+
result = send(renderer.to_sym, path.to_sym)
|
94
|
+
elsif File.exists?(File.join(options.views, "#{path_without_ext}.#{renderer}"))
|
95
|
+
result = send(renderer.to_sym, path_without_ext.to_sym)
|
96
|
+
else
|
97
|
+
false
|
98
|
+
end
|
94
99
|
end
|
95
100
|
rescue Haml::Error => e
|
96
101
|
result = "Haml Error: #{e}"
|
@@ -99,4 +104,10 @@ class Middleman < Sinatra::Base
|
|
99
104
|
|
100
105
|
result || pass
|
101
106
|
end
|
107
|
+
|
108
|
+
|
109
|
+
get %r{/(.*\.xml)} do |path|
|
110
|
+
content_type 'text/xml', :charset => 'utf-8'
|
111
|
+
haml(path.to_sym, :layout => false)
|
112
|
+
end
|
102
113
|
end
|
data/middleman.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{middleman}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Thomas Reynolds"]
|
12
|
-
s.date = %q{2009-09-
|
12
|
+
s.date = %q{2009-09-18}
|
13
13
|
s.email = %q{tdreyno@gmail.com}
|
14
14
|
s.executables = ["mm-init", "mm-build", "mm-server"]
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Reynolds
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-18 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|