middleman 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,6 +16,7 @@ end
16
16
  Then /^I should see "([^\"]*)"$/ do |expected|
17
17
  @browser.last_response.body.should include(expected)
18
18
  end
19
+
19
20
  Then /^I should see '([^\']*)'$/ do |expected|
20
21
  @browser.last_response.body.should include(expected)
21
22
  end
@@ -0,0 +1,13 @@
1
+ @wip
2
+ Feature: Tiny Src
3
+ In order automatically scale images for mobile devices
4
+
5
+ Scenario: Rendering html with the feature disabled
6
+ Given "tiny_src" feature is "disabled"
7
+ When I go to "/tiny_src.html"
8
+ Then I should see "http://test.com/image.jpg"
9
+
10
+ Scenario: Rendering html with the feature enabled
11
+ Given "tiny_src" feature is "enabled"
12
+ When I go to "/tiny_src.html"
13
+ Then I should see "http://i.tinysrc.mobi/http://test.com/image.jpg"
@@ -0,0 +1 @@
1
+ = image_tag "http://test.com/image.jpg"
@@ -71,6 +71,9 @@ module Middleman::Features
71
71
  # to dynamic requests.
72
72
  autoload :Data, "middleman/features/data"
73
73
 
74
+ # Automatically resize images for mobile devises
75
+ # autoload :TinySrc, "middleman/features/tiny_src"
76
+
74
77
  # LiveReload will auto-reload browsers with the live reload extension installed after changes
75
78
  # Currently disabled and untested.
76
79
  #autoload :LiveReload, "middleman/features/live_reload"
@@ -18,9 +18,14 @@ module Middleman
18
18
  if env["PATH_INFO"].match(/\.js$/)
19
19
  compressor = ::YUI::JavaScriptCompressor.new(:munge => true)
20
20
 
21
- uncompressed_source = response.is_a?(::Rack::File) ? File.read(response.path) : response
22
- response = compressor.compress(uncompressed_source)
23
- headers["Content-Length"] = ::Rack::Utils.bytesize(response).to_s
21
+ if response.is_a?(::Rack::File) or response.is_a?(Sinatra::Helpers::StaticFile)
22
+ uncompressed_source = File.read(response.path)
23
+ else
24
+ uncompressed_source = response.join
25
+ end
26
+ minified = compressor.compress(uncompressed_source)
27
+ headers["Content-Length"] = ::Rack::Utils.bytesize(minified).to_s
28
+ response = [minified]
24
29
  end
25
30
 
26
31
  [status, headers, response]
@@ -28,4 +33,4 @@ module Middleman
28
33
  end
29
34
 
30
35
  end
31
- end
36
+ end
@@ -0,0 +1,11 @@
1
+ module Middleman::Features::TinySrc
2
+ class << self
3
+ def registered(app)
4
+ Middleman::Assets.register :tiny_src do |path, prefix, request|
5
+ original_output = Middleman::Assets.before(:tiny_src, path, prefix, request)
6
+ "http://i.tinysrc.mobi/#{original_output}"
7
+ end
8
+ end
9
+ alias :included :registered
10
+ end
11
+ end
@@ -147,7 +147,10 @@ module Middleman
147
147
  settings.layout(options[:layout]) if !options[:layout].nil?
148
148
  layout = settings.fetch_layout_path.to_sym
149
149
  layout = false if options[:layout] == false or path =~ /\.(css|js)$/
150
- result = render(path, :layout => layout, :layout_engine => options[:layout_engine])
150
+
151
+ render_options = { :layout => layout }
152
+ render_options[:layout_engine] = options[:layout_engine] if options.has_key? :layout_engine
153
+ result = render(path, render_options)
151
154
  settings.layout(old_layout)
152
155
 
153
156
  if result
@@ -33,4 +33,7 @@ require "middleman/templates/default"
33
33
  require "middleman/templates/html5"
34
34
 
35
35
  # Local templates
36
- require "middleman/templates/local"
36
+ require "middleman/templates/local"
37
+
38
+ # Compass templates
39
+ # require "middleman/templates/compass"
@@ -0,0 +1,18 @@
1
+ require 'compass'
2
+
3
+ class Middleman::Templates::Compass < Middleman::Templates::Base
4
+ def self.source_root
5
+ # Middleman.templates_path
6
+ end
7
+
8
+ def build_scaffold
9
+ # directory options[:template].to_s, location
10
+ end
11
+ end
12
+
13
+ $stderr.puts Compass::Frameworks::ALL.map { |f| f.name }.inspect
14
+
15
+ # Dir[File.join(Middleman.templates_path, "*")].each do |dir|
16
+ # next unless File.directory?(dir)
17
+ # Middleman::Templates.register(File.basename(dir).to_sym, Middleman::Templates::Local)
18
+ # end
@@ -1,3 +1,3 @@
1
1
  module Middleman
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.authors = ["Thomas Reynolds"]
10
10
  s.email = ["tdreyno@gmail.com"]
11
11
  s.homepage = "http://wiki.github.com/tdreyno/middleman"
12
- s.summary = "A static site generator utilizing Haml, Sass and providing YUI compression and cache busting"
12
+ s.summary = "A static site generator based on Sinatra. Providing Haml, Sass, Compass, Less, Coffee Script and including minification, compression and cache busting."
13
13
 
14
14
  s.rubyforge_project = "middleman"
15
15
 
@@ -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"])
33
33
  s.add_runtime_dependency("sass", ["~> 3.1.0"])
34
- s.add_runtime_dependency("compass", [">= 0.11.0"])
34
+ s.add_runtime_dependency("compass", ["~> 0.11.1"])
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("coffee-script", ["~> 2.1.0"])
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 0
10
- version: 1.2.0
9
+ - 1
10
+ version: 1.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Thomas Reynolds
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-25 00:00:00 -07:00
18
+ date: 2011-04-26 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -215,14 +215,14 @@ dependencies:
215
215
  requirement: &id013 !ruby/object:Gem::Requirement
216
216
  none: false
217
217
  requirements:
218
- - - ">="
218
+ - - ~>
219
219
  - !ruby/object:Gem::Version
220
- hash: 51
220
+ hash: 49
221
221
  segments:
222
222
  - 0
223
223
  - 11
224
- - 0
225
- version: 0.11.0
224
+ - 1
225
+ version: 0.11.1
226
226
  type: :runtime
227
227
  version_requirements: *id013
228
228
  - !ruby/object:Gem::Dependency
@@ -372,6 +372,7 @@ files:
372
372
  - features/step_definitions/generator_steps.rb
373
373
  - features/step_definitions/middleman_steps.rb
374
374
  - features/step_definitions/page_layout_steps.rb
375
+ - features/tiny_src.feature
375
376
  - features/w_asset_host.feature
376
377
  - features/x_automatic_image_sizes.feature
377
378
  - features/y_cache_buster.feature
@@ -404,6 +405,7 @@ files:
404
405
  - fixtures/test-app/views/stylesheets/site.css.sass
405
406
  - fixtures/test-app/views/stylesheets/site_scss.css.scss
406
407
  - fixtures/test-app/views/stylesheets/test_less.css.less
408
+ - fixtures/test-app/views/tiny_src.html.haml
407
409
  - lib/middleman.rb
408
410
  - lib/middleman/assets.rb
409
411
  - lib/middleman/builder.rb
@@ -422,11 +424,13 @@ files:
422
424
  - lib/middleman/features/minify_javascript.rb
423
425
  - lib/middleman/features/minify_javascript/rack.rb
424
426
  - lib/middleman/features/relative_assets.rb
427
+ - lib/middleman/features/tiny_src.rb
425
428
  - lib/middleman/features/ugly_haml.rb
426
429
  - lib/middleman/renderers/haml.rb
427
430
  - lib/middleman/renderers/sass.rb
428
431
  - lib/middleman/server.rb
429
432
  - lib/middleman/templates.rb
433
+ - lib/middleman/templates/compass.rb
430
434
  - lib/middleman/templates/default.rb
431
435
  - lib/middleman/templates/default/config.ru
432
436
  - lib/middleman/templates/default/config.tt
@@ -489,7 +493,7 @@ rubyforge_project: middleman
489
493
  rubygems_version: 1.5.0
490
494
  signing_key:
491
495
  specification_version: 3
492
- summary: A static site generator utilizing Haml, Sass and providing YUI compression and cache busting
496
+ summary: A static site generator based on Sinatra. Providing Haml, Sass, Compass, Less, Coffee Script and including minification, compression and cache busting.
493
497
  test_files:
494
498
  - features/builder.feature
495
499
  - features/coffee-script.feature
@@ -508,6 +512,7 @@ test_files:
508
512
  - features/step_definitions/generator_steps.rb
509
513
  - features/step_definitions/middleman_steps.rb
510
514
  - features/step_definitions/page_layout_steps.rb
515
+ - features/tiny_src.feature
511
516
  - features/w_asset_host.feature
512
517
  - features/x_automatic_image_sizes.feature
513
518
  - features/y_cache_buster.feature
@@ -540,3 +545,4 @@ test_files:
540
545
  - fixtures/test-app/views/stylesheets/site.css.sass
541
546
  - fixtures/test-app/views/stylesheets/site_scss.css.scss
542
547
  - fixtures/test-app/views/stylesheets/test_less.css.less
548
+ - fixtures/test-app/views/tiny_src.html.haml