middleman 1.1.0.beta.7 → 1.1.0.beta.8
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/mm-server +30 -2
- data/features/minify_css.feature +1 -1
- data/features/minify_javascript.feature +4 -4
- data/lib/middleman/builder.rb +16 -7
- data/lib/middleman/server.rb +13 -11
- data/lib/middleman/version.rb +1 -1
- data/middleman.gemspec +1 -1
- metadata +7 -7
data/bin/mm-server
CHANGED
@@ -44,13 +44,41 @@ OptionParser.new { |opts|
|
|
44
44
|
|
45
45
|
ENV['RACK_ENV'] = env
|
46
46
|
|
47
|
-
|
48
|
-
|
47
|
+
@current_path = Dir.pwd
|
48
|
+
@path_parts = @current_path.split("/")
|
49
|
+
@found_root = false
|
50
|
+
|
51
|
+
while (!@found_root && (@path_parts.length > 0))
|
52
|
+
@current_path = File.join(*@path_parts)
|
53
|
+
|
54
|
+
public_folder = File.join(@current_path, "public")
|
55
|
+
views_folder = File.join(@current_path, "views")
|
56
|
+
|
57
|
+
if File.exists?(public_folder) && File.exists?(views_folder)
|
58
|
+
@found_root = true
|
59
|
+
next
|
60
|
+
end
|
61
|
+
|
62
|
+
@path_parts.pop
|
63
|
+
end
|
64
|
+
|
65
|
+
if !@found_root
|
66
|
+
$stderr.puts "== Error: Could not find a Middleman project structure, perhaps you are in the wrong folder?"
|
67
|
+
exit
|
49
68
|
end
|
50
69
|
|
70
|
+
# If the old init.rb exists, use it, but issue warning
|
71
|
+
old_config = File.join(@current_path, "init.rb")
|
72
|
+
if File.exists? old_config
|
73
|
+
$stderr.puts "== Error: The init.rb file (deprecated) needs to be be renamed to config.rb"
|
74
|
+
exit
|
75
|
+
end
|
76
|
+
|
77
|
+
|
51
78
|
# require 'shotgun'
|
52
79
|
# config = File.join(File.dirname(__FILE__), '..', 'lib', 'middleman', 'config.ru')
|
53
80
|
# app = Shotgun.new(config, &lambda { |inner_app| Middleman::Server })
|
81
|
+
Middleman::Server.root = @current_path
|
54
82
|
app = Middleman::Server.new
|
55
83
|
|
56
84
|
require 'rubygems'
|
data/features/minify_css.feature
CHANGED
@@ -9,7 +9,7 @@ Feature: Minify CSS
|
|
9
9
|
Scenario: Rendering external css with the feature disabled
|
10
10
|
Given "minify_css" feature is "disabled"
|
11
11
|
When I go to "/stylesheets/site.css"
|
12
|
-
Then I should see "
|
12
|
+
Then I should see "56" lines
|
13
13
|
|
14
14
|
Scenario: Rendering inline css with the feature enabled
|
15
15
|
Given "minify_css" feature is "enabled"
|
@@ -6,7 +6,7 @@ Feature: Minify Javascript
|
|
6
6
|
When I go to "/inline-js.html"
|
7
7
|
Then I should see "10" lines
|
8
8
|
|
9
|
-
Scenario: Rendering inline js with the feature enabled
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
# Scenario: Rendering inline js with the feature enabled
|
10
|
+
# Given "minify_javascript" feature is "enabled"
|
11
|
+
# When I go to "/inline-js.html"
|
12
|
+
# Then I should see "1" lines
|
data/lib/middleman/builder.rb
CHANGED
@@ -78,28 +78,37 @@ module Middleman
|
|
78
78
|
end
|
79
79
|
|
80
80
|
protected
|
81
|
-
|
82
|
-
def execute!
|
83
|
-
lookup = config[:recursive] ? File.join(source, '**') : source
|
81
|
+
def handle_directory(lookup)
|
84
82
|
lookup = File.join(lookup, '{*,.[a-z]*}')
|
85
83
|
|
86
84
|
Dir[lookup].sort.each do |file_source|
|
87
|
-
|
85
|
+
if File.directory?(file_source)
|
86
|
+
handle_directory(file_source)
|
87
|
+
next
|
88
|
+
end
|
89
|
+
|
88
90
|
next if file_source.include?('layout')
|
89
91
|
next unless file_source.split('/').select { |p| p[0,1] == '_' }.empty?
|
90
|
-
|
92
|
+
|
91
93
|
file_extension = File.extname(file_source)
|
92
94
|
file_destination = File.join(given_destination, file_source.gsub(source, '.'))
|
93
95
|
file_destination.gsub!('/./', '/')
|
94
|
-
|
96
|
+
|
95
97
|
handled_by_tilt = ::Tilt.mappings.keys.include?(file_extension.gsub(/^\./, ""))
|
96
98
|
if handled_by_tilt || (file_extension == ".js")
|
97
|
-
|
99
|
+
new_file_extension = ""
|
100
|
+
next if file_source.split('/').last.split('.').length < 3
|
101
|
+
|
102
|
+
file_destination.gsub!(file_extension, new_file_extension)
|
98
103
|
destination = base.tilt_template(file_source, file_destination, config, &@block)
|
99
104
|
else
|
100
105
|
destination = base.copy_file(file_source, file_destination, config, &@block)
|
101
106
|
end
|
102
107
|
end
|
103
108
|
end
|
109
|
+
|
110
|
+
def execute!
|
111
|
+
handle_directory(source)
|
112
|
+
end
|
104
113
|
end
|
105
114
|
end
|
data/lib/middleman/server.rb
CHANGED
@@ -9,7 +9,7 @@ module Middleman
|
|
9
9
|
class Server < Sinatra::Base
|
10
10
|
# Basic Sinatra config
|
11
11
|
set :app_file, __FILE__
|
12
|
-
set :root, ENV["MM_DIR"] || Dir.pwd
|
12
|
+
#set :root, ENV["MM_DIR"] || Dir.pwd
|
13
13
|
set :reload, false
|
14
14
|
set :sessions, false
|
15
15
|
set :logging, false
|
@@ -117,9 +117,18 @@ module Middleman
|
|
117
117
|
def process_request(options={})
|
118
118
|
# Normalize the path and add index if we're looking at a directory
|
119
119
|
path = request.path
|
120
|
-
|
120
|
+
parts = path ? path.split('/') : []
|
121
|
+
if parts.last.nil? || parts.last.split('.').length == 1
|
122
|
+
path = File.join(path, settings.index_file)
|
123
|
+
end
|
121
124
|
path.gsub!(%r{^/}, '')
|
122
125
|
|
126
|
+
static_path = File.join(Middleman::Server.public, path)
|
127
|
+
# if File.exists? static_path
|
128
|
+
# send_file static_path
|
129
|
+
# return
|
130
|
+
# end
|
131
|
+
|
123
132
|
old_layout = settings.current_layout
|
124
133
|
settings.layout(options[:layout]) if !options[:layout].nil?
|
125
134
|
layout = settings.fetch_layout_path.to_sym
|
@@ -145,16 +154,9 @@ require "middleman/assets"
|
|
145
154
|
|
146
155
|
# The Rack App
|
147
156
|
class Middleman::Server
|
148
|
-
def self.new(*args, &block)
|
149
|
-
# If the old init.rb exists, use it, but issue warning
|
150
|
-
old_config = File.join(self.root, "init.rb")
|
151
|
-
if File.exists? old_config
|
152
|
-
$stderr.puts "== Warning: The init.rb file has been renamed to config.rb"
|
153
|
-
local_config = old_config
|
154
|
-
end
|
155
|
-
|
157
|
+
def self.new(*args, &block)
|
156
158
|
# Check for and evaluate local configuration
|
157
|
-
local_config
|
159
|
+
local_config = File.join(self.root, "config.rb")
|
158
160
|
if File.exists? local_config
|
159
161
|
$stderr.puts "== Reading: Local config" if logging?
|
160
162
|
Middleman::Server.class_eval File.read(local_config)
|
data/lib/middleman/version.rb
CHANGED
data/middleman.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.add_runtime_dependency("yui-compressor", ["~> 0.9.0"])
|
32
32
|
s.add_runtime_dependency("haml", ["3.1.0.alpha.147"])
|
33
33
|
s.add_runtime_dependency("sass", ["3.1.0.alpha.249"])
|
34
|
-
s.add_runtime_dependency("compass", ["0.11.beta.
|
34
|
+
s.add_runtime_dependency("compass", ["0.11.beta.6"])
|
35
35
|
s.add_runtime_dependency("chunky_png", ["~> 1.1.0"])
|
36
36
|
s.add_runtime_dependency("oily_png", ["~> 1.0"]) unless defined?(JRUBY_VERSION)
|
37
37
|
s.add_runtime_dependency("json_pure", ["~> 1.4.0"])
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 62196355
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
9
|
- 0
|
10
10
|
- beta
|
11
|
-
-
|
12
|
-
version: 1.1.0.beta.
|
11
|
+
- 8
|
12
|
+
version: 1.1.0.beta.8
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Thomas Reynolds
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-04-
|
20
|
+
date: 2011-04-10 00:00:00 -07:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -223,13 +223,13 @@ dependencies:
|
|
223
223
|
requirements:
|
224
224
|
- - "="
|
225
225
|
- !ruby/object:Gem::Version
|
226
|
-
hash:
|
226
|
+
hash: 62196231
|
227
227
|
segments:
|
228
228
|
- 0
|
229
229
|
- 11
|
230
230
|
- beta
|
231
|
-
-
|
232
|
-
version: 0.11.beta.
|
231
|
+
- 6
|
232
|
+
version: 0.11.beta.6
|
233
233
|
type: :runtime
|
234
234
|
version_requirements: *id013
|
235
235
|
- !ruby/object:Gem::Dependency
|