Merge branch 'master' of github.com:tdreyno/middleman

This commit is contained in:
Thomas Reynolds 2011-11-03 10:50:41 -07:00
commit b3a61a299f
6 changed files with 31 additions and 8 deletions

View file

@ -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/js/jquery_include.js"
Then I should see "var jQuery ="
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/css/bootstrap_include.css"
# Then I should see "Bootstrap"

View file

@ -0,0 +1 @@
//= require "bootstrap.scss"

View file

@ -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'

View file

@ -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

View file

@ -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

View file

@ -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