From 8aa4765524f05a24c6f7fc946fe35f7f6f866bef Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Wed, 19 Oct 2011 20:45:11 -0700 Subject: [PATCH 1/3] try to test sprockets vendored css --- features/sprockets_gems.feature | 7 ++++++- .../source/library/stylesheets/bootstrap_include.css.scss | 1 + middleman-x86-mingw32.gemspec | 1 + middleman.gemspec | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 fixtures/sprockets-app/source/library/stylesheets/bootstrap_include.css.scss diff --git a/features/sprockets_gems.feature b/features/sprockets_gems.feature index 720d12fa..4a05ecfb 100644 --- a/features/sprockets_gems.feature +++ b/features/sprockets_gems.feature @@ -2,4 +2,9 @@ Feature: Sprockets Gems Scenario: Sprockets can pull jQuery from gem Given the Server is running at "sprockets-app" When I go to "/library/javascripts/jquery_include.js" - Then I should see "var jQuery =" \ No newline at end of file + Then I should see "var jQuery =" + + Scenario: Sprockets can pull CSS from gem + Given the Server is running at "sprockets-app" + When I go to "/library/stylesheets/bootstrap_include.css" + Then I should see "Bootstrap" \ No newline at end of file diff --git a/fixtures/sprockets-app/source/library/stylesheets/bootstrap_include.css.scss b/fixtures/sprockets-app/source/library/stylesheets/bootstrap_include.css.scss new file mode 100644 index 00000000..e8b1875e --- /dev/null +++ b/fixtures/sprockets-app/source/library/stylesheets/bootstrap_include.css.scss @@ -0,0 +1 @@ +//= require "bootstrap.scss" \ No newline at end of file diff --git a/middleman-x86-mingw32.gemspec b/middleman-x86-mingw32.gemspec index 64a0712b..c3cac308 100644 --- a/middleman-x86-mingw32.gemspec +++ b/middleman-x86-mingw32.gemspec @@ -70,5 +70,6 @@ eos s.add_development_dependency("rake", ["~> 0.9.2"]) s.add_development_dependency("rspec", ["~> 2.6.0"]) s.add_development_dependency("jquery-rails") + s.add_development_dependency("bootstrap-rails") end diff --git a/middleman.gemspec b/middleman.gemspec index 28e426c4..be641bb6 100644 --- a/middleman.gemspec +++ b/middleman.gemspec @@ -67,5 +67,6 @@ eos s.add_development_dependency("rake", ["~> 0.9.2"]) s.add_development_dependency("rspec", ["~> 2.6.0"]) s.add_development_dependency("jquery-rails") + s.add_development_dependency("bootstrap-rails") end From 87035b2ae52887aef0d11f3011c8685b63595033 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Thu, 27 Oct 2011 23:32:45 -0700 Subject: [PATCH 2/3] watch app/assets too --- lib/middleman/core_extensions/sprockets.rb | 27 +++++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/lib/middleman/core_extensions/sprockets.rb b/lib/middleman/core_extensions/sprockets.rb index 7ba27766..46836bf4 100644 --- a/lib/middleman/core_extensions/sprockets.rb +++ b/lib/middleman/core_extensions/sprockets.rb @@ -23,11 +23,18 @@ module Middleman::CoreExtensions::Sprockets app.after_configuration do js_env = Middleman::CoreExtensions::Sprockets::JavascriptEnvironment.new(app) - js_dir = File.join("vendor", "assets", "javascripts") + vendor_dir = File.join("vendor", "assets", "javascripts") gems_with_js = ::Middleman.rubygems_latest_specs.select do |spec| - ::Middleman.spec_has_file?(spec, js_dir) + ::Middleman.spec_has_file?(spec, vendor_dir) end.each do |spec| - js_env.append_path File.join(spec.full_gem_path, js_dir) + js_env.append_path File.join(spec.full_gem_path, vendor_dir) + end + + app_dir = File.join("app", "assets", "javascripts") + gems_with_js = ::Middleman.rubygems_latest_specs.select do |spec| + ::Middleman.spec_has_file?(spec, app_dir) + end.each do |spec| + js_env.append_path File.join(spec.full_gem_path, app_dir) end # add paths to js_env (vendor/assets/javascripts) @@ -38,11 +45,19 @@ module Middleman::CoreExtensions::Sprockets app.after_compass_config do css_env = Middleman::CoreExtensions::Sprockets::StylesheetEnvironment.new(app) - css_dir = File.join("vendor", "assets", "stylesheets") + + vendor_dir = File.join("vendor", "assets", "stylesheets") gems_with_css = ::Middleman.rubygems_latest_specs.select do |spec| - ::Middleman.spec_has_file?(spec, css_dir) + ::Middleman.spec_has_file?(spec, vendor_dir) end.each do |spec| - css_env.append_path File.join(spec.full_gem_path, css_dir) + css_env.append_path File.join(spec.full_gem_path, vendor_dir) + end + + app_dir = File.join("app", "assets", "stylesheets") + gems_with_css = ::Middleman.rubygems_latest_specs.select do |spec| + ::Middleman.spec_has_file?(spec, app_dir) + end.each do |spec| + css_env.append_path File.join(spec.full_gem_path, app_dir) end app.map "/#{app.css_dir}" do From 1174876c7af485271e088260207ade472d43d987 Mon Sep 17 00:00:00 2001 From: dznz Date: Mon, 31 Oct 2011 17:03:22 +1300 Subject: [PATCH 3/3] Minor tweak to make explicit order of arguments to middleman init --- lib/middleman/cli.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/middleman/cli.rb b/lib/middleman/cli.rb index 9a5846af..ac588200 100644 --- a/lib/middleman/cli.rb +++ b/lib/middleman/cli.rb @@ -12,7 +12,7 @@ module Middleman help_check if options[:help] end - desc "init NAME", "Create new Middleman project directory NAME" + desc "init NAME [options]", "Create new Middleman project directory NAME" available_templates = Middleman::Templates.registered_names.join(", ") method_option "template", :aliases => "-T", :default => "default", :desc => "Optionally use a pre-defined project template: #{available_templates}" method_option "css_dir", :default => "stylesheets", :desc => 'The path to the css files'