From 73913f0ace4ff6f90391a2ff09f4605c291d4069 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Thu, 29 Dec 2011 19:04:39 -0800 Subject: [PATCH] Start getting middleman-more tests passing. About 50% done --- .travis.yml | 4 ++ Gemfile | 10 ++++- Rakefile | 22 +++++++++- gem_rake_helper.rb | 18 ++++---- middleman-core/bin/middleman | 8 ++++ middleman-core/features/asset_host.feature | 12 ++++++ .../features/automatic_image_sizes.feature | 4 +- .../fixtures}/asset-host-app/config.rb | 0 .../fixtures}/asset-host-app/source/.htaccess | 0 .../asset-host-app/source/asset_host.html.erb | 1 + .../asset-host-app/source/images/blank.gif | Bin .../automatic-image-size-app}/config.rb | 0 .../source/auto-image-sizes.html.erb | 1 + .../source/images/blank.gif | Bin middleman-core/lib/middleman-core.rb | 31 ++++++++++---- middleman-core/lib/middleman-core/base.rb | 8 +++- middleman-core/lib/middleman-core/cli.rb | 2 +- .../middleman-core}/extensions/asset_host.rb | 10 ++--- .../extensions/automatic_image_sizes.rb | 0 .../automatic_image_sizes/fastimage.rb | 0 .../templates/shared/Gemfile.tt | 2 +- middleman-core/lib/middleman-core/version.rb | 16 ++++--- middleman-core/middleman-core.gemspec | 9 +++- middleman-more/Gemfile | 3 -- middleman-more/Rakefile | 20 ++------- ...ost.feature => asset_host_compass.feature} | 5 --- middleman-more/features/cache_buster.feature | 8 ++-- middleman-more/features/coffee-script.feature | 6 +-- middleman-more/features/content_for.feature | 5 --- middleman-more/features/scss-support.feature | 4 +- middleman-more/features/slim.feature | 2 +- middleman-more/features/sprockets.feature | 10 ++--- middleman-more/features/support/env.rb | 7 ++++ .../source/asset_host.html.haml | 1 - .../already-minified-app/config.rb | 0 .../source/javascripts/test.min.js | 0 .../source/stylesheets/test.min.css | 0 .../cache-buster-app}/config.rb | 0 .../source/cache-buster.html.erb | 2 + .../cache-buster-app/source/images/blank.gif | Bin 0 -> 43 bytes .../stylesheets/relative_assets.css.sass | 0 .../source/stylesheets/site.css.sass | 1 + .../fixtures/coffeescript-app/config.rb | 1 + .../source/inline-coffeescript.html.haml | 3 ++ .../javascripts/broken-coffee.js.coffee | 3 ++ .../source/javascripts/coffee_test.js.coffee | 3 ++ .../fixtures/content-for-app/config.rb | 7 ++-- .../source/content_for_erb.html.erb | 5 --- middleman-more/fixtures/fonts-app/config.rb | 0 .../fonts-app/source/fonts/StMarie-Thin.otf | Bin .../source/stylesheets/fonts.css.sass | 0 .../markdown-app/config.rb | 0 .../source/autolink.html.markdown | 0 .../source/fenced_code_blocks.html.markdown | 0 .../markdown-app/source/index.html.markdown | 0 .../source/no_intra_emphasis.html.markdown | 0 .../source/smarty_pants.html.markdown | 0 .../source/space_after_headers.html.markdown | 0 .../source/strikethrough.html.markdown | 0 .../source/superscript.html.markdown | 0 .../markdown-app/source/tables.html.markdown | 0 .../fixtures/relative-app/config.rb | 0 .../relative-app/source/images/blank.gif | Bin 0 -> 43 bytes .../stylesheets/relative_assets.css.sass} | 0 middleman-more/fixtures/scss-app/config.rb | 0 .../source/stylesheets/layout.css.sass | 2 + .../source/stylesheets/site_scss.css.scss | 1 + middleman-more/fixtures/slim-app/config.rb | 1 + .../fixtures/slim-app/source/slim.html.slim | 7 ++++ .../sprockets-app/config.rb | 0 .../library/css/bootstrap_include.css.scss | 0 .../source/library/css/plain.css | 0 .../library/css/sprockets_base1.css.scss | 0 .../library/css/sprockets_base2.css.scss | 0 .../source/library/css/sprockets_sub.css.scss | 0 .../source/library/js/jquery_include.js | 0 .../sprockets-app/source/library/js/plain.js | 0 .../source/library/js/sprockets_base.js | 0 .../source/library/js/sprockets_sub.js | 0 .../fixtures/sprockets-app2/config.rb | 0 .../fixtures/sprockets-app2/data/test.yml | 4 ++ .../fixtures/sprockets-app2/data/test2.json | 4 ++ .../multiple_engines.js.coffee.erb | 1 + .../source/javascripts/sprockets_base.js | 5 +++ .../source/javascripts/sprockets_sub.js | 3 ++ .../stylesheets/sprockets_base1.css.scss | 1 + .../stylesheets/sprockets_base2.css.scss | 1 + .../source/stylesheets/sprockets_sub.css.scss | 1 + middleman-more/lib/middleman-more.rb | 33 +++++++++++++-- .../compass.rb | 0 .../sprockets.rb | 0 .../lib/middleman-more/renderers/slim.rb | 15 +++++++ middleman-more/lib/middleman-more/setup.rb | 39 ------------------ middleman-more/lib/middleman-more/version.rb | 7 ---- middleman-more/middleman-more.gemspec | 23 ++--------- middleman-x86-mingw32.gemspec | 2 +- middleman/middleman.gemspec | 24 +++++++++++ 97 files changed, 267 insertions(+), 161 deletions(-) create mode 100644 middleman-core/features/asset_host.feature rename {middleman-more => middleman-core}/features/automatic_image_sizes.feature (82%) rename {middleman-more/fixtures-old => middleman-core/fixtures}/asset-host-app/config.rb (100%) rename {middleman-more/fixtures-old => middleman-core/fixtures}/asset-host-app/source/.htaccess (100%) create mode 100755 middleman-core/fixtures/asset-host-app/source/asset_host.html.erb rename {middleman-more/fixtures-old => middleman-core/fixtures}/asset-host-app/source/images/blank.gif (100%) rename {middleman-more/fixtures-old/fonts-app => middleman-core/fixtures/automatic-image-size-app}/config.rb (100%) create mode 100755 middleman-core/fixtures/automatic-image-size-app/source/auto-image-sizes.html.erb rename {middleman-more/fixtures-old/relative-app => middleman-core/fixtures/automatic-image-size-app}/source/images/blank.gif (100%) rename {middleman-more/lib/middleman-more => middleman-core/lib/middleman-core}/extensions/asset_host.rb (82%) rename {middleman-more/lib/middleman-more => middleman-core/lib/middleman-core}/extensions/automatic_image_sizes.rb (100%) rename {middleman-more/lib/middleman-more => middleman-core/lib/middleman-core}/extensions/automatic_image_sizes/fastimage.rb (100%) delete mode 100644 middleman-more/Gemfile rename middleman-more/features/{asset_host.feature => asset_host_compass.feature} (59%) create mode 100644 middleman-more/features/support/env.rb delete mode 100755 middleman-more/fixtures-old/asset-host-app/source/asset_host.html.haml rename middleman-more/{fixtures-old => fixtures}/already-minified-app/config.rb (100%) rename middleman-more/{fixtures-old => fixtures}/already-minified-app/source/javascripts/test.min.js (100%) rename middleman-more/{fixtures-old => fixtures}/already-minified-app/source/stylesheets/test.min.css (100%) rename middleman-more/{fixtures-old/relative-app => fixtures/cache-buster-app}/config.rb (100%) create mode 100755 middleman-more/fixtures/cache-buster-app/source/cache-buster.html.erb create mode 100755 middleman-more/fixtures/cache-buster-app/source/images/blank.gif rename middleman-more/{fixtures-old/relative-app => fixtures/cache-buster-app}/source/stylesheets/relative_assets.css.sass (100%) create mode 100755 middleman-more/fixtures/cache-buster-app/source/stylesheets/site.css.sass create mode 100644 middleman-more/fixtures/coffeescript-app/config.rb create mode 100644 middleman-more/fixtures/coffeescript-app/source/inline-coffeescript.html.haml create mode 100644 middleman-more/fixtures/coffeescript-app/source/javascripts/broken-coffee.js.coffee create mode 100644 middleman-more/fixtures/coffeescript-app/source/javascripts/coffee_test.js.coffee delete mode 100644 middleman-more/fixtures/content-for-app/source/content_for_erb.html.erb create mode 100644 middleman-more/fixtures/fonts-app/config.rb rename middleman-more/{fixtures-old => fixtures}/fonts-app/source/fonts/StMarie-Thin.otf (100%) rename middleman-more/{fixtures-old => fixtures}/fonts-app/source/stylesheets/fonts.css.sass (100%) rename middleman-more/{fixtures-old => fixtures}/markdown-app/config.rb (100%) rename middleman-more/{fixtures-old => fixtures}/markdown-app/source/autolink.html.markdown (100%) rename middleman-more/{fixtures-old => fixtures}/markdown-app/source/fenced_code_blocks.html.markdown (100%) rename middleman-more/{fixtures-old => fixtures}/markdown-app/source/index.html.markdown (100%) rename middleman-more/{fixtures-old => fixtures}/markdown-app/source/no_intra_emphasis.html.markdown (100%) rename middleman-more/{fixtures-old => fixtures}/markdown-app/source/smarty_pants.html.markdown (100%) rename middleman-more/{fixtures-old => fixtures}/markdown-app/source/space_after_headers.html.markdown (100%) rename middleman-more/{fixtures-old => fixtures}/markdown-app/source/strikethrough.html.markdown (100%) rename middleman-more/{fixtures-old => fixtures}/markdown-app/source/superscript.html.markdown (100%) rename middleman-more/{fixtures-old => fixtures}/markdown-app/source/tables.html.markdown (100%) create mode 100644 middleman-more/fixtures/relative-app/config.rb create mode 100755 middleman-more/fixtures/relative-app/source/images/blank.gif rename middleman-more/{fixtures-old/asset-host-app/source/stylesheets/asset_host.css.sass => fixtures/relative-app/source/stylesheets/relative_assets.css.sass} (100%) create mode 100644 middleman-more/fixtures/scss-app/config.rb create mode 100644 middleman-more/fixtures/scss-app/source/stylesheets/layout.css.sass create mode 100755 middleman-more/fixtures/scss-app/source/stylesheets/site_scss.css.scss create mode 100644 middleman-more/fixtures/slim-app/config.rb create mode 100644 middleman-more/fixtures/slim-app/source/slim.html.slim rename middleman-more/{fixtures-old => fixtures}/sprockets-app/config.rb (100%) rename middleman-more/{fixtures-old => fixtures}/sprockets-app/source/library/css/bootstrap_include.css.scss (100%) rename middleman-more/{fixtures-old => fixtures}/sprockets-app/source/library/css/plain.css (100%) rename middleman-more/{fixtures-old => fixtures}/sprockets-app/source/library/css/sprockets_base1.css.scss (100%) rename middleman-more/{fixtures-old => fixtures}/sprockets-app/source/library/css/sprockets_base2.css.scss (100%) rename middleman-more/{fixtures-old => fixtures}/sprockets-app/source/library/css/sprockets_sub.css.scss (100%) rename middleman-more/{fixtures-old => fixtures}/sprockets-app/source/library/js/jquery_include.js (100%) rename middleman-more/{fixtures-old => fixtures}/sprockets-app/source/library/js/plain.js (100%) rename middleman-more/{fixtures-old => fixtures}/sprockets-app/source/library/js/sprockets_base.js (100%) rename middleman-more/{fixtures-old => fixtures}/sprockets-app/source/library/js/sprockets_sub.js (100%) create mode 100644 middleman-more/fixtures/sprockets-app2/config.rb create mode 100644 middleman-more/fixtures/sprockets-app2/data/test.yml create mode 100644 middleman-more/fixtures/sprockets-app2/data/test2.json create mode 100644 middleman-more/fixtures/sprockets-app2/source/javascripts/multiple_engines.js.coffee.erb create mode 100644 middleman-more/fixtures/sprockets-app2/source/javascripts/sprockets_base.js create mode 100644 middleman-more/fixtures/sprockets-app2/source/javascripts/sprockets_sub.js create mode 100644 middleman-more/fixtures/sprockets-app2/source/stylesheets/sprockets_base1.css.scss create mode 100644 middleman-more/fixtures/sprockets-app2/source/stylesheets/sprockets_base2.css.scss create mode 100644 middleman-more/fixtures/sprockets-app2/source/stylesheets/sprockets_sub.css.scss rename middleman-more/lib/middleman-more/{extensions => core_extensions}/compass.rb (100%) rename middleman-more/lib/middleman-more/{extensions => core_extensions}/sprockets.rb (100%) create mode 100644 middleman-more/lib/middleman-more/renderers/slim.rb delete mode 100644 middleman-more/lib/middleman-more/setup.rb delete mode 100644 middleman-more/lib/middleman-more/version.rb create mode 100644 middleman/middleman.gemspec diff --git a/.travis.yml b/.travis.yml index 64b0693b..3f6d0093 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,3 +3,7 @@ rvm: - 1.9.2 - 1.9.3 script: "bundle exec rake test" + +branches: + only: + - master \ No newline at end of file diff --git a/Gemfile b/Gemfile index 13ba8238..59a0f87a 100644 --- a/Gemfile +++ b/Gemfile @@ -7,10 +7,18 @@ group :development do gem "rspec", "~> 2.7" gem "rdoc", "~> 3.9" gem "yard" +end +group :test do # For actual tests gem "sinatra" + gem "slim" + gem "coffee-filter", "~> 0.1.1" + gem "liquid", "~> 2.2" + gem "jquery-rails" + gem "bootstrap-rails", "0.0.5" end gem "middleman-core", :path => "middleman-core" -# gem "middleman-more", :path => "middleman-more" \ No newline at end of file +gem "middleman-more", :path => "middleman-more" +gem "middleman", :path => "middleman" \ No newline at end of file diff --git a/Rakefile b/Rakefile index 448f328b..67455046 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,25 @@ -ROOT = File.expand_path(File.dirname(__FILE__)) +require 'rubygems' unless defined?(Gem) +# require 'fileutils' unless defined?(FileUtils) +require 'rake' +require 'yard' +# require File.expand_path("../middleman-core/lib/middleman-core/version.rb", __FILE__) +ROOT = File.expand_path(File.dirname(__FILE__)) +GEM_NAME = 'middleman' + +middleman_gems = %w(middleman-core middleman-more) + +desc "Run tests for all middleman gems" task :test do - ["middleman-core"].each do |g| + middleman_gems.each do |g| sh "cd #{File.join(ROOT, g)} && bundle exec rake test" end +end + +desc "Run tests for all middleman gems" +task :default => :test + +desc "Generate documentation" +task :doc do + YARD::CLI::Yardoc.new.run end \ No newline at end of file diff --git a/gem_rake_helper.rb b/gem_rake_helper.rb index 293010ef..e3713ed7 100644 --- a/gem_rake_helper.rb +++ b/gem_rake_helper.rb @@ -5,19 +5,17 @@ require 'bundler/gem_tasks' require 'yard' # Skip the releasing tag -# class Bundler::GemHelper -# def release_gem -# guard_clean -# guard_already_tagged -# built_gem_path = build_gem -# rubygem_push(built_gem_path) -# end -# end +class Bundler::GemHelper + def release_gem + guard_clean + guard_already_tagged + built_gem_path = build_gem + rubygem_push(built_gem_path) + end +end Cucumber::Rake::Task.new(:test, 'Run features that should pass') do |t| t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}" end -YARD::Rake::YardocTask.new - task :default => :test \ No newline at end of file diff --git a/middleman-core/bin/middleman b/middleman-core/bin/middleman index fa92b65d..7b3e092b 100755 --- a/middleman-core/bin/middleman +++ b/middleman-core/bin/middleman @@ -36,6 +36,14 @@ ARGV << "server" if ARGV.length < 1 # Require Middleman require 'middleman-core' +begin + # Rubygems + require "middleman-more" +rescue LoadError + # Local + require File.expand_path(File.join(File.dirname(File.dirname(libdir)), "middleman-more", "lib", "middleman-more")) +end + # Change directory to the root Dir.chdir(ENV["MM_ROOT"] || Dir.pwd) do diff --git a/middleman-core/features/asset_host.feature b/middleman-core/features/asset_host.feature new file mode 100644 index 00000000..e3615d01 --- /dev/null +++ b/middleman-core/features/asset_host.feature @@ -0,0 +1,12 @@ +Feature: Alternate between multiple asset hosts + In order to speed up page loading + + # Scenario: Rendering css with the feature enabled + # Given the Server is running at "asset-host-app" + # When I go to "/stylesheets/asset_host.css" + # Then I should see "http://assets" + + Scenario: Rendering html with the feature enabled + Given the Server is running at "asset-host-app" + When I go to "/asset_host.html" + Then I should see "http://assets" \ No newline at end of file diff --git a/middleman-more/features/automatic_image_sizes.feature b/middleman-core/features/automatic_image_sizes.feature similarity index 82% rename from middleman-more/features/automatic_image_sizes.feature rename to middleman-core/features/automatic_image_sizes.feature index a4dc9681..89f9d7a5 100644 --- a/middleman-more/features/automatic_image_sizes.feature +++ b/middleman-core/features/automatic_image_sizes.feature @@ -3,14 +3,14 @@ Feature: Automatically detect and insert image dimensions into tags Scenario: Rendering an image with the feature disabled Given "automatic_image_sizes" feature is "disabled" - And the Server is running at "test-app" + And the Server is running at "automatic-image-size-app" When I go to "/auto-image-sizes.html" Then I should not see "width=" And I should not see "height=" Scenario: Rendering an image with the feature enabled Given "automatic_image_sizes" feature is "enabled" - And the Server is running at "test-app" + And the Server is running at "automatic-image-size-app" When I go to "/auto-image-sizes.html" Then I should see "width=" And I should see "height=" \ No newline at end of file diff --git a/middleman-more/fixtures-old/asset-host-app/config.rb b/middleman-core/fixtures/asset-host-app/config.rb similarity index 100% rename from middleman-more/fixtures-old/asset-host-app/config.rb rename to middleman-core/fixtures/asset-host-app/config.rb diff --git a/middleman-more/fixtures-old/asset-host-app/source/.htaccess b/middleman-core/fixtures/asset-host-app/source/.htaccess similarity index 100% rename from middleman-more/fixtures-old/asset-host-app/source/.htaccess rename to middleman-core/fixtures/asset-host-app/source/.htaccess diff --git a/middleman-core/fixtures/asset-host-app/source/asset_host.html.erb b/middleman-core/fixtures/asset-host-app/source/asset_host.html.erb new file mode 100755 index 00000000..fb441334 --- /dev/null +++ b/middleman-core/fixtures/asset-host-app/source/asset_host.html.erb @@ -0,0 +1 @@ +<%= image_tag "blank.gif" %> \ No newline at end of file diff --git a/middleman-more/fixtures-old/asset-host-app/source/images/blank.gif b/middleman-core/fixtures/asset-host-app/source/images/blank.gif similarity index 100% rename from middleman-more/fixtures-old/asset-host-app/source/images/blank.gif rename to middleman-core/fixtures/asset-host-app/source/images/blank.gif diff --git a/middleman-more/fixtures-old/fonts-app/config.rb b/middleman-core/fixtures/automatic-image-size-app/config.rb similarity index 100% rename from middleman-more/fixtures-old/fonts-app/config.rb rename to middleman-core/fixtures/automatic-image-size-app/config.rb diff --git a/middleman-core/fixtures/automatic-image-size-app/source/auto-image-sizes.html.erb b/middleman-core/fixtures/automatic-image-size-app/source/auto-image-sizes.html.erb new file mode 100755 index 00000000..fb441334 --- /dev/null +++ b/middleman-core/fixtures/automatic-image-size-app/source/auto-image-sizes.html.erb @@ -0,0 +1 @@ +<%= image_tag "blank.gif" %> \ No newline at end of file diff --git a/middleman-more/fixtures-old/relative-app/source/images/blank.gif b/middleman-core/fixtures/automatic-image-size-app/source/images/blank.gif similarity index 100% rename from middleman-more/fixtures-old/relative-app/source/images/blank.gif rename to middleman-core/fixtures/automatic-image-size-app/source/images/blank.gif diff --git a/middleman-core/lib/middleman-core.rb b/middleman-core/lib/middleman-core.rb index b9933088..73b71e34 100755 --- a/middleman-core/lib/middleman-core.rb +++ b/middleman-core/lib/middleman-core.rb @@ -20,8 +20,8 @@ require "middleman-core/vendor/hooks-0.2.0/lib/hooks" # Top-level Middleman object module Middleman - WINDOWS = !!(RUBY_PLATFORM =~ /(mingw|bccwin|wince|mswin32)/i) - JRUBY = !!(RbConfig::CONFIG["RUBY_INSTALL_NAME"] =~ /^jruby/i) + WINDOWS = !!(RUBY_PLATFORM =~ /(mingw|bccwin|wince|mswin32)/i) unless const_defined?(:WINDOWS) + JRUBY = !!(RbConfig::CONFIG["RUBY_INSTALL_NAME"] =~ /^jruby/i) unless const_defined?(:JRUBY) # Auto-load modules on-demand autoload :Base, "middleman-core/base" @@ -85,14 +85,24 @@ module Middleman module Extensions # Provide Apache-style index.html files for directories - autoload :DirectoryIndexes, "middleman-core/extensions/directory_indexes" + autoload :DirectoryIndexes, "middleman-core/extensions/directory_indexes" # Lorem provides a handful of helpful prototyping methods to generate # words, paragraphs, fake images, names and email addresses. - autoload :Lorem, "middleman-core/extensions/lorem" + autoload :Lorem, "middleman-core/extensions/lorem" + + # AutomaticImageSizes inspects the images used in your dynamic templates + # and automatically adds width and height attributes to their HTML + # elements. + autoload :AutomaticImageSizes, "middleman-core/extensions/automatic_image_sizes" + + # AssetHost allows you to setup multiple domains to host your static + # assets. Calls to asset paths in dynamic templates will then rotate + # through each of the asset servers to better spread the load. + autoload :AssetHost, "middleman-core/extensions/asset_host" end - module Extensions + module Extensions class << self def registered @_registered ||= {} @@ -117,7 +127,7 @@ module Middleman end registered[name.to_sym] = if !passed_version_check - "== #{name} failed version check. Requested #{version}, got #{Middleman::Core::VERSION}" + "== #{name} failed version check. Requested #{version}, got #{Middleman::VERSION}" elsif block_given? block elsif namespace @@ -141,7 +151,7 @@ module Middleman end # Where to look in gems for extensions to auto-register - EXTENSION_FILE = File.join("lib", "middleman_extension.rb") + EXTENSION_FILE = File.join("lib", "middleman_extension.rb") unless const_defined?(:EXTENSION_FILE) class << self @@ -175,7 +185,7 @@ module Middleman extensions = rubygems_latest_specs.select do |spec| spec_has_file?(spec, EXTENSION_FILE) end - + extensions.each do |spec| require spec.name end @@ -222,11 +232,15 @@ module Middleman # @param [Hash] options to pass to Rack::Server.new # @return [Rack::Server] def start_server(options={}) + require "webrick" + opts = { :Port => options[:port] || 4567, :Host => options[:host] || "0.0.0.0", :AccessLog => [] } + + opts[:Logger] = WEBrick::Log::new("/dev/null", 7) if !options[:logging] app_class = options[:app] ||= ::Middleman.server.inst opts[:app] = app_class @@ -235,6 +249,7 @@ module Middleman # require "thin" # ::Thin::Logging.silent = !options[:logging] # opts[:server] = 'thin' + opts[:server] = 'webrick' server = ::Rack::Server.new(opts) server.start diff --git a/middleman-core/lib/middleman-core/base.rb b/middleman-core/lib/middleman-core/base.rb index 25861626..7e7560d5 100644 --- a/middleman-core/lib/middleman-core/base.rb +++ b/middleman-core/lib/middleman-core/base.rb @@ -198,7 +198,7 @@ class Middleman::Base # Automatically loaded extensions # @return [Array] - set :default_extensions, [:lorem] + set :default_extensions, [ :lorem ] # Default layout name # @return [String, Symbold] @@ -242,6 +242,10 @@ class Middleman::Base Middleman::Extensions::DirectoryIndexes } Middleman::Extensions.register(:lorem) { Middleman::Extensions::Lorem } + Middleman::Extensions.register(:automatic_image_sizes) { + Middleman::Extensions::AutomaticImageSizes } + Middleman::Extensions.register(:asset_host) { + Middleman::Extensions::AssetHost } # Backwards-compatibility with old request.path signature attr :request @@ -258,7 +262,7 @@ class Middleman::Base # @return [void] def current_path=(path) @_current_path = path - @request = Thor::CoreExt::HashWithIndifferentAccess.new({ :path => path }) + @request = ::Thor::CoreExt::HashWithIndifferentAccess.new({ :path => path }) end # Initialize the Middleman project diff --git a/middleman-core/lib/middleman-core/cli.rb b/middleman-core/lib/middleman-core/cli.rb index 04ada583..5d890a65 100644 --- a/middleman-core/lib/middleman-core/cli.rb +++ b/middleman-core/lib/middleman-core/cli.rb @@ -11,7 +11,7 @@ module Middleman::Cli desc "version", "Show version" def version require 'middleman-core/version' - say "Middleman #{Middleman::Core::VERSION}" + say "Middleman #{Middleman::VERSION}" end # Override the Thor help method to find help for subtasks diff --git a/middleman-more/lib/middleman-more/extensions/asset_host.rb b/middleman-core/lib/middleman-core/extensions/asset_host.rb similarity index 82% rename from middleman-more/lib/middleman-more/extensions/asset_host.rb rename to middleman-core/lib/middleman-core/extensions/asset_host.rb index 94adef58..02a685ab 100644 --- a/middleman-more/lib/middleman-more/extensions/asset_host.rb +++ b/middleman-core/lib/middleman-core/extensions/asset_host.rb @@ -4,11 +4,11 @@ module Middleman::Extensions def registered(app) app.set :asset_host, false - app.compass_config do |config| - if asset_host.is_a?(Proc) - config.asset_host(&asset_host) - end - end + # app.compass_config do |config| + # if asset_host.is_a?(Proc) + # config.asset_host(&asset_host) + # end + # end app.send :include, InstanceMethods end diff --git a/middleman-more/lib/middleman-more/extensions/automatic_image_sizes.rb b/middleman-core/lib/middleman-core/extensions/automatic_image_sizes.rb similarity index 100% rename from middleman-more/lib/middleman-more/extensions/automatic_image_sizes.rb rename to middleman-core/lib/middleman-core/extensions/automatic_image_sizes.rb diff --git a/middleman-more/lib/middleman-more/extensions/automatic_image_sizes/fastimage.rb b/middleman-core/lib/middleman-core/extensions/automatic_image_sizes/fastimage.rb similarity index 100% rename from middleman-more/lib/middleman-more/extensions/automatic_image_sizes/fastimage.rb rename to middleman-core/lib/middleman-core/extensions/automatic_image_sizes/fastimage.rb diff --git a/middleman-core/lib/middleman-core/templates/shared/Gemfile.tt b/middleman-core/lib/middleman-core/templates/shared/Gemfile.tt index 36daa600..bd733a4f 100644 --- a/middleman-core/lib/middleman-core/templates/shared/Gemfile.tt +++ b/middleman-core/lib/middleman-core/templates/shared/Gemfile.tt @@ -1,3 +1,3 @@ source :rubygems -gem "middleman", "~><%= Middleman::Core::VERSION %>" \ No newline at end of file +gem "middleman", "~><%= Middleman::VERSION %>" \ No newline at end of file diff --git a/middleman-core/lib/middleman-core/version.rb b/middleman-core/lib/middleman-core/version.rb index a50227b5..306ff67a 100644 --- a/middleman-core/lib/middleman-core/version.rb +++ b/middleman-core/lib/middleman-core/version.rb @@ -1,7 +1,13 @@ +# Using for version parsing +require "rubygems" + module Middleman - module Core - # Current Version - # @return [String] - VERSION = "3.0.0.alpha.6" - end + # Current Version + # @return [String] + VERSION = "3.0.0.alpha.7" unless const_defined?(:VERSION) + + # Parsed version for RubyGems + # @private + # @return [String] + GEM_VERSION = ::Gem::Version.create(VERSION) unless const_defined?(:GEM_VERSION) end \ No newline at end of file diff --git a/middleman-core/middleman-core.gemspec b/middleman-core/middleman-core.gemspec index e376685a..98a60349 100644 --- a/middleman-core/middleman-core.gemspec +++ b/middleman-core/middleman-core.gemspec @@ -4,7 +4,7 @@ require "middleman-core/version" Gem::Specification.new do |s| s.name = "middleman-core" - s.version = Middleman::Core::VERSION + s.version = Middleman::VERSION s.platform = Gem::Platform::RUBY s.license = "MIT" s.authors = ["Thomas Reynolds"] @@ -18,11 +18,16 @@ Gem::Specification.new do |s| s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] + # Thin + # s.add_dependency("thin", ["~> 1.3.1"]) + # Core s.add_dependency("rack", ["~> 1.3.5"]) - s.add_dependency("rack-test", ["~> 0.6.1"]) s.add_dependency("tilt", ["~> 1.3.1"]) + # Builder + s.add_dependency("rack-test", ["~> 0.6.1"]) + # CLI s.add_dependency("thor", ["~> 0.14.0"]) diff --git a/middleman-more/Gemfile b/middleman-more/Gemfile deleted file mode 100644 index a2c18724..00000000 --- a/middleman-more/Gemfile +++ /dev/null @@ -1,3 +0,0 @@ -source :rubygems - -gemspec :name => "middleman-more" \ No newline at end of file diff --git a/middleman-more/Rakefile b/middleman-more/Rakefile index 0be3d96c..f33347d2 100644 --- a/middleman-more/Rakefile +++ b/middleman-more/Rakefile @@ -1,17 +1,5 @@ -require 'bundler' -Bundler::GemHelper.install_tasks :name => ENV["NAME"] || "middleman" +# coding:utf-8 +RAKE_ROOT = __FILE__ -require 'cucumber/rake/task' - -Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t| - t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}" -end - -require 'rake/clean' - -task :test => ["cucumber"] - -desc "Build HTML documentation" -task :doc do - sh 'bundle exec yard' -end +require 'rubygems' +require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper') \ No newline at end of file diff --git a/middleman-more/features/asset_host.feature b/middleman-more/features/asset_host_compass.feature similarity index 59% rename from middleman-more/features/asset_host.feature rename to middleman-more/features/asset_host_compass.feature index 71117ba3..7f477b63 100644 --- a/middleman-more/features/asset_host.feature +++ b/middleman-more/features/asset_host_compass.feature @@ -4,9 +4,4 @@ Feature: Alternate between multiple asset hosts Scenario: Rendering css with the feature enabled Given the Server is running at "asset-host-app" When I go to "/stylesheets/asset_host.css" - Then I should see "http://assets" - - Scenario: Rendering html with the feature enabled - Given the Server is running at "asset-host-app" - When I go to "/asset_host.html" Then I should see "http://assets" \ No newline at end of file diff --git a/middleman-more/features/cache_buster.feature b/middleman-more/features/cache_buster.feature index 514b541e..732902ee 100644 --- a/middleman-more/features/cache_buster.feature +++ b/middleman-more/features/cache_buster.feature @@ -3,24 +3,24 @@ Feature: Generate mtime-based query string for busting browser caches Scenario: Rendering css with the feature disabled Given "cache_buster" feature is "disabled" - And the Server is running at "test-app" + And the Server is running at "cache-buster-app" When I go to "/stylesheets/relative_assets.css" Then I should not see "?" Scenario: Rendering html with the feature disabled Given "cache_buster" feature is "disabled" - And the Server is running at "test-app" + And the Server is running at "cache-buster-app" When I go to "/cache-buster.html" Then I should not see "?" Scenario: Rendering css with the feature enabled Given "cache_buster" feature is "enabled" - And the Server is running at "test-app" + And the Server is running at "cache-buster-app" When I go to "/stylesheets/relative_assets.css" Then I should see "?" Scenario: Rendering html with the feature enabled Given "cache_buster" feature is "enabled" - And the Server is running at "test-app" + And the Server is running at "cache-buster-app" When I go to "/cache-buster.html" Then I should see "?" \ No newline at end of file diff --git a/middleman-more/features/coffee-script.feature b/middleman-more/features/coffee-script.feature index ed2c6a1b..547a6bc1 100644 --- a/middleman-more/features/coffee-script.feature +++ b/middleman-more/features/coffee-script.feature @@ -2,16 +2,16 @@ Feature: Support coffee-script In order to offer an alternative when writing Javascript Scenario: Rendering coffee script - Given the Server is running at "test-app" + Given the Server is running at "coffeescript-app" When I go to "/javascripts/coffee_test.js" Then I should see "Array.prototype.slice" Scenario: Rendering coffee-script with :coffeescript haml-filter - Given the Server is running at "test-app" + Given the Server is running at "coffeescript-app" When I go to "/inline-coffeescript.html" Then I should see "Array.prototype.slice" Scenario: Rendering broken coffee - Given the Server is running at "test-app" + Given the Server is running at "coffeescript-app" When I go to "/javascripts/broken-coffee.js" Then I should see "Error" \ No newline at end of file diff --git a/middleman-more/features/content_for.feature b/middleman-more/features/content_for.feature index 4dc806c9..bc7cfb58 100644 --- a/middleman-more/features/content_for.feature +++ b/middleman-more/features/content_for.feature @@ -1,9 +1,4 @@ Feature: Support content_for and yield_content helpers - - Scenario: content_for works as expected in erb - Given the Server is running at "content-for-app" - When I go to "/content_for_erb.html" - Then I should see "In Layout: I am the yielded content erb" Scenario: content_for works as expected in haml Given the Server is running at "content-for-app" diff --git a/middleman-more/features/scss-support.feature b/middleman-more/features/scss-support.feature index 44513c35..0b380f06 100644 --- a/middleman-more/features/scss-support.feature +++ b/middleman-more/features/scss-support.feature @@ -2,11 +2,11 @@ Feature: Support SCSS Syntax In order to offer an alternative when writing Sass Scenario: Rendering scss - Given the Server is running at "test-app" + Given the Server is running at "scss-app" When I go to "/stylesheets/site_scss.css" Then I should see "html" Scenario: Rendering scss - Given the Server is running at "test-app" + Given the Server is running at "scss-app" When I go to "/stylesheets/layout.css" Then I should see "html" \ No newline at end of file diff --git a/middleman-more/features/slim.feature b/middleman-more/features/slim.feature index 436050eb..5bf03d37 100644 --- a/middleman-more/features/slim.feature +++ b/middleman-more/features/slim.feature @@ -2,6 +2,6 @@ Feature: Support slim templating language In order to offer an alternative to Haml Scenario: Rendering Slim - Given the Server is running at "test-app" + Given the Server is running at "slim-app" When I go to "/slim.html" Then I should see "

Welcome to Slim

" \ No newline at end of file diff --git a/middleman-more/features/sprockets.feature b/middleman-more/features/sprockets.feature index debd034f..d29b5088 100644 --- a/middleman-more/features/sprockets.feature +++ b/middleman-more/features/sprockets.feature @@ -1,7 +1,7 @@ Feature: Sprockets Scenario: Sprockets JS require - Given the Server is running at "test-app" + Given the Server is running at "sprockets-app2" When I go to "/javascripts/sprockets_base.js" Then I should see "sprockets_sub_function" @@ -16,23 +16,23 @@ Feature: Sprockets Then I should see "helloWorld" Scenario: Sprockets JS should have access to yaml data - Given the Server is running at "test-app" + Given the Server is running at "sprockets-app2" When I go to "/javascripts/multiple_engines.js" Then I should see "Hello One" Scenario: Multiple engine files should build correctly - Given a successfully built app at "test-app" + Given a successfully built app at "sprockets-app2" When I cd to "build" Then a file named "javascripts/multiple_engines.js" should exist And the file "javascripts/multiple_engines.js" should contain "Hello One" Scenario: Sprockets CSS require //require - Given the Server is running at "test-app" + Given the Server is running at "sprockets-app2" When I go to "/stylesheets/sprockets_base1.css" Then I should see "hello" Scenario: Sprockets CSS require @import - Given the Server is running at "test-app" + Given the Server is running at "sprockets-app2" When I go to "/stylesheets/sprockets_base2.css" Then I should see "hello" diff --git a/middleman-more/features/support/env.rb b/middleman-more/features/support/env.rb new file mode 100644 index 00000000..357228d3 --- /dev/null +++ b/middleman-more/features/support/env.rb @@ -0,0 +1,7 @@ +PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__))) + +core_root = File.expand_path("../../../../middleman-core/lib/middleman-core", __FILE__) + +require core_root +require File.join(core_root, "step_definitions") +require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-more') \ No newline at end of file diff --git a/middleman-more/fixtures-old/asset-host-app/source/asset_host.html.haml b/middleman-more/fixtures-old/asset-host-app/source/asset_host.html.haml deleted file mode 100755 index 7588118c..00000000 --- a/middleman-more/fixtures-old/asset-host-app/source/asset_host.html.haml +++ /dev/null @@ -1 +0,0 @@ -= image_tag "blank.gif" \ No newline at end of file diff --git a/middleman-more/fixtures-old/already-minified-app/config.rb b/middleman-more/fixtures/already-minified-app/config.rb similarity index 100% rename from middleman-more/fixtures-old/already-minified-app/config.rb rename to middleman-more/fixtures/already-minified-app/config.rb diff --git a/middleman-more/fixtures-old/already-minified-app/source/javascripts/test.min.js b/middleman-more/fixtures/already-minified-app/source/javascripts/test.min.js similarity index 100% rename from middleman-more/fixtures-old/already-minified-app/source/javascripts/test.min.js rename to middleman-more/fixtures/already-minified-app/source/javascripts/test.min.js diff --git a/middleman-more/fixtures-old/already-minified-app/source/stylesheets/test.min.css b/middleman-more/fixtures/already-minified-app/source/stylesheets/test.min.css similarity index 100% rename from middleman-more/fixtures-old/already-minified-app/source/stylesheets/test.min.css rename to middleman-more/fixtures/already-minified-app/source/stylesheets/test.min.css diff --git a/middleman-more/fixtures-old/relative-app/config.rb b/middleman-more/fixtures/cache-buster-app/config.rb similarity index 100% rename from middleman-more/fixtures-old/relative-app/config.rb rename to middleman-more/fixtures/cache-buster-app/config.rb diff --git a/middleman-more/fixtures/cache-buster-app/source/cache-buster.html.erb b/middleman-more/fixtures/cache-buster-app/source/cache-buster.html.erb new file mode 100755 index 00000000..056b7ae4 --- /dev/null +++ b/middleman-more/fixtures/cache-buster-app/source/cache-buster.html.erb @@ -0,0 +1,2 @@ +<%= stylesheet_link_tag "site.css" %> +<%= javascript_include_tag "empty-with-include.js" %> \ No newline at end of file diff --git a/middleman-more/fixtures/cache-buster-app/source/images/blank.gif b/middleman-more/fixtures/cache-buster-app/source/images/blank.gif new file mode 100755 index 0000000000000000000000000000000000000000..2498f1aac58dab923f0fd99b1c8ee6b8c53c7158 GIT binary patch literal 43 scmZ?wbhEHbWMp7uXkcKtd-pB_1B2pE79h#MpaUX6G7L;iE{qJ;0KEqWk^lez literal 0 HcmV?d00001 diff --git a/middleman-more/fixtures-old/relative-app/source/stylesheets/relative_assets.css.sass b/middleman-more/fixtures/cache-buster-app/source/stylesheets/relative_assets.css.sass similarity index 100% rename from middleman-more/fixtures-old/relative-app/source/stylesheets/relative_assets.css.sass rename to middleman-more/fixtures/cache-buster-app/source/stylesheets/relative_assets.css.sass diff --git a/middleman-more/fixtures/cache-buster-app/source/stylesheets/site.css.sass b/middleman-more/fixtures/cache-buster-app/source/stylesheets/site.css.sass new file mode 100755 index 00000000..d143e05e --- /dev/null +++ b/middleman-more/fixtures/cache-buster-app/source/stylesheets/site.css.sass @@ -0,0 +1 @@ +@import "compass/reset" \ No newline at end of file diff --git a/middleman-more/fixtures/coffeescript-app/config.rb b/middleman-more/fixtures/coffeescript-app/config.rb new file mode 100644 index 00000000..e80254e0 --- /dev/null +++ b/middleman-more/fixtures/coffeescript-app/config.rb @@ -0,0 +1 @@ +require "coffee-filter" \ No newline at end of file diff --git a/middleman-more/fixtures/coffeescript-app/source/inline-coffeescript.html.haml b/middleman-more/fixtures/coffeescript-app/source/inline-coffeescript.html.haml new file mode 100644 index 00000000..5204064c --- /dev/null +++ b/middleman-more/fixtures/coffeescript-app/source/inline-coffeescript.html.haml @@ -0,0 +1,3 @@ +:coffeescript + race = (winner, runners...) -> + print winner, runners \ No newline at end of file diff --git a/middleman-more/fixtures/coffeescript-app/source/javascripts/broken-coffee.js.coffee b/middleman-more/fixtures/coffeescript-app/source/javascripts/broken-coffee.js.coffee new file mode 100644 index 00000000..1af7bf2a --- /dev/null +++ b/middleman-more/fixtures/coffeescript-app/source/javascripts/broken-coffee.js.coffee @@ -0,0 +1,3 @@ +function test() { + hello +} \ No newline at end of file diff --git a/middleman-more/fixtures/coffeescript-app/source/javascripts/coffee_test.js.coffee b/middleman-more/fixtures/coffeescript-app/source/javascripts/coffee_test.js.coffee new file mode 100644 index 00000000..4a00b030 --- /dev/null +++ b/middleman-more/fixtures/coffeescript-app/source/javascripts/coffee_test.js.coffee @@ -0,0 +1,3 @@ +# Splats: +race = (winner, runners...) -> + print winner, runners \ No newline at end of file diff --git a/middleman-more/fixtures/content-for-app/config.rb b/middleman-more/fixtures/content-for-app/config.rb index 83259448..dc3c517c 100644 --- a/middleman-more/fixtures/content-for-app/config.rb +++ b/middleman-more/fixtures/content-for-app/config.rb @@ -1,5 +1,6 @@ +require "slim" + with_layout :content_for do - page "/content_for_erb.html" - # page "/content_for_haml.html" - # page "/content_for_slim.html" + page "/content_for_haml.html" + page "/content_for_slim.html" end \ No newline at end of file diff --git a/middleman-more/fixtures/content-for-app/source/content_for_erb.html.erb b/middleman-more/fixtures/content-for-app/source/content_for_erb.html.erb deleted file mode 100644 index 0af8266a..00000000 --- a/middleman-more/fixtures/content-for-app/source/content_for_erb.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<% content_for :from_template do %> - I am the yielded content erb -<% end %> - -I am in the template \ No newline at end of file diff --git a/middleman-more/fixtures/fonts-app/config.rb b/middleman-more/fixtures/fonts-app/config.rb new file mode 100644 index 00000000..e69de29b diff --git a/middleman-more/fixtures-old/fonts-app/source/fonts/StMarie-Thin.otf b/middleman-more/fixtures/fonts-app/source/fonts/StMarie-Thin.otf similarity index 100% rename from middleman-more/fixtures-old/fonts-app/source/fonts/StMarie-Thin.otf rename to middleman-more/fixtures/fonts-app/source/fonts/StMarie-Thin.otf diff --git a/middleman-more/fixtures-old/fonts-app/source/stylesheets/fonts.css.sass b/middleman-more/fixtures/fonts-app/source/stylesheets/fonts.css.sass similarity index 100% rename from middleman-more/fixtures-old/fonts-app/source/stylesheets/fonts.css.sass rename to middleman-more/fixtures/fonts-app/source/stylesheets/fonts.css.sass diff --git a/middleman-more/fixtures-old/markdown-app/config.rb b/middleman-more/fixtures/markdown-app/config.rb similarity index 100% rename from middleman-more/fixtures-old/markdown-app/config.rb rename to middleman-more/fixtures/markdown-app/config.rb diff --git a/middleman-more/fixtures-old/markdown-app/source/autolink.html.markdown b/middleman-more/fixtures/markdown-app/source/autolink.html.markdown similarity index 100% rename from middleman-more/fixtures-old/markdown-app/source/autolink.html.markdown rename to middleman-more/fixtures/markdown-app/source/autolink.html.markdown diff --git a/middleman-more/fixtures-old/markdown-app/source/fenced_code_blocks.html.markdown b/middleman-more/fixtures/markdown-app/source/fenced_code_blocks.html.markdown similarity index 100% rename from middleman-more/fixtures-old/markdown-app/source/fenced_code_blocks.html.markdown rename to middleman-more/fixtures/markdown-app/source/fenced_code_blocks.html.markdown diff --git a/middleman-more/fixtures-old/markdown-app/source/index.html.markdown b/middleman-more/fixtures/markdown-app/source/index.html.markdown similarity index 100% rename from middleman-more/fixtures-old/markdown-app/source/index.html.markdown rename to middleman-more/fixtures/markdown-app/source/index.html.markdown diff --git a/middleman-more/fixtures-old/markdown-app/source/no_intra_emphasis.html.markdown b/middleman-more/fixtures/markdown-app/source/no_intra_emphasis.html.markdown similarity index 100% rename from middleman-more/fixtures-old/markdown-app/source/no_intra_emphasis.html.markdown rename to middleman-more/fixtures/markdown-app/source/no_intra_emphasis.html.markdown diff --git a/middleman-more/fixtures-old/markdown-app/source/smarty_pants.html.markdown b/middleman-more/fixtures/markdown-app/source/smarty_pants.html.markdown similarity index 100% rename from middleman-more/fixtures-old/markdown-app/source/smarty_pants.html.markdown rename to middleman-more/fixtures/markdown-app/source/smarty_pants.html.markdown diff --git a/middleman-more/fixtures-old/markdown-app/source/space_after_headers.html.markdown b/middleman-more/fixtures/markdown-app/source/space_after_headers.html.markdown similarity index 100% rename from middleman-more/fixtures-old/markdown-app/source/space_after_headers.html.markdown rename to middleman-more/fixtures/markdown-app/source/space_after_headers.html.markdown diff --git a/middleman-more/fixtures-old/markdown-app/source/strikethrough.html.markdown b/middleman-more/fixtures/markdown-app/source/strikethrough.html.markdown similarity index 100% rename from middleman-more/fixtures-old/markdown-app/source/strikethrough.html.markdown rename to middleman-more/fixtures/markdown-app/source/strikethrough.html.markdown diff --git a/middleman-more/fixtures-old/markdown-app/source/superscript.html.markdown b/middleman-more/fixtures/markdown-app/source/superscript.html.markdown similarity index 100% rename from middleman-more/fixtures-old/markdown-app/source/superscript.html.markdown rename to middleman-more/fixtures/markdown-app/source/superscript.html.markdown diff --git a/middleman-more/fixtures-old/markdown-app/source/tables.html.markdown b/middleman-more/fixtures/markdown-app/source/tables.html.markdown similarity index 100% rename from middleman-more/fixtures-old/markdown-app/source/tables.html.markdown rename to middleman-more/fixtures/markdown-app/source/tables.html.markdown diff --git a/middleman-more/fixtures/relative-app/config.rb b/middleman-more/fixtures/relative-app/config.rb new file mode 100644 index 00000000..e69de29b diff --git a/middleman-more/fixtures/relative-app/source/images/blank.gif b/middleman-more/fixtures/relative-app/source/images/blank.gif new file mode 100755 index 0000000000000000000000000000000000000000..2498f1aac58dab923f0fd99b1c8ee6b8c53c7158 GIT binary patch literal 43 scmZ?wbhEHbWMp7uXkcKtd-pB_1B2pE79h#MpaUX6G7L;iE{qJ;0KEqWk^lez literal 0 HcmV?d00001 diff --git a/middleman-more/fixtures-old/asset-host-app/source/stylesheets/asset_host.css.sass b/middleman-more/fixtures/relative-app/source/stylesheets/relative_assets.css.sass similarity index 100% rename from middleman-more/fixtures-old/asset-host-app/source/stylesheets/asset_host.css.sass rename to middleman-more/fixtures/relative-app/source/stylesheets/relative_assets.css.sass diff --git a/middleman-more/fixtures/scss-app/config.rb b/middleman-more/fixtures/scss-app/config.rb new file mode 100644 index 00000000..e69de29b diff --git a/middleman-more/fixtures/scss-app/source/stylesheets/layout.css.sass b/middleman-more/fixtures/scss-app/source/stylesheets/layout.css.sass new file mode 100644 index 00000000..aeab4b37 --- /dev/null +++ b/middleman-more/fixtures/scss-app/source/stylesheets/layout.css.sass @@ -0,0 +1,2 @@ +html + test: value \ No newline at end of file diff --git a/middleman-more/fixtures/scss-app/source/stylesheets/site_scss.css.scss b/middleman-more/fixtures/scss-app/source/stylesheets/site_scss.css.scss new file mode 100755 index 00000000..0cc04182 --- /dev/null +++ b/middleman-more/fixtures/scss-app/source/stylesheets/site_scss.css.scss @@ -0,0 +1 @@ +@import "compass/reset"; \ No newline at end of file diff --git a/middleman-more/fixtures/slim-app/config.rb b/middleman-more/fixtures/slim-app/config.rb new file mode 100644 index 00000000..39f9e64d --- /dev/null +++ b/middleman-more/fixtures/slim-app/config.rb @@ -0,0 +1 @@ +require "slim" \ No newline at end of file diff --git a/middleman-more/fixtures/slim-app/source/slim.html.slim b/middleman-more/fixtures/slim-app/source/slim.html.slim new file mode 100644 index 00000000..e13e5b60 --- /dev/null +++ b/middleman-more/fixtures/slim-app/source/slim.html.slim @@ -0,0 +1,7 @@ +doctype 5 +html lang='en' + head + meta charset="utf-8" + + body + h1 Welcome to Slim \ No newline at end of file diff --git a/middleman-more/fixtures-old/sprockets-app/config.rb b/middleman-more/fixtures/sprockets-app/config.rb similarity index 100% rename from middleman-more/fixtures-old/sprockets-app/config.rb rename to middleman-more/fixtures/sprockets-app/config.rb diff --git a/middleman-more/fixtures-old/sprockets-app/source/library/css/bootstrap_include.css.scss b/middleman-more/fixtures/sprockets-app/source/library/css/bootstrap_include.css.scss similarity index 100% rename from middleman-more/fixtures-old/sprockets-app/source/library/css/bootstrap_include.css.scss rename to middleman-more/fixtures/sprockets-app/source/library/css/bootstrap_include.css.scss diff --git a/middleman-more/fixtures-old/sprockets-app/source/library/css/plain.css b/middleman-more/fixtures/sprockets-app/source/library/css/plain.css similarity index 100% rename from middleman-more/fixtures-old/sprockets-app/source/library/css/plain.css rename to middleman-more/fixtures/sprockets-app/source/library/css/plain.css diff --git a/middleman-more/fixtures-old/sprockets-app/source/library/css/sprockets_base1.css.scss b/middleman-more/fixtures/sprockets-app/source/library/css/sprockets_base1.css.scss similarity index 100% rename from middleman-more/fixtures-old/sprockets-app/source/library/css/sprockets_base1.css.scss rename to middleman-more/fixtures/sprockets-app/source/library/css/sprockets_base1.css.scss diff --git a/middleman-more/fixtures-old/sprockets-app/source/library/css/sprockets_base2.css.scss b/middleman-more/fixtures/sprockets-app/source/library/css/sprockets_base2.css.scss similarity index 100% rename from middleman-more/fixtures-old/sprockets-app/source/library/css/sprockets_base2.css.scss rename to middleman-more/fixtures/sprockets-app/source/library/css/sprockets_base2.css.scss diff --git a/middleman-more/fixtures-old/sprockets-app/source/library/css/sprockets_sub.css.scss b/middleman-more/fixtures/sprockets-app/source/library/css/sprockets_sub.css.scss similarity index 100% rename from middleman-more/fixtures-old/sprockets-app/source/library/css/sprockets_sub.css.scss rename to middleman-more/fixtures/sprockets-app/source/library/css/sprockets_sub.css.scss diff --git a/middleman-more/fixtures-old/sprockets-app/source/library/js/jquery_include.js b/middleman-more/fixtures/sprockets-app/source/library/js/jquery_include.js similarity index 100% rename from middleman-more/fixtures-old/sprockets-app/source/library/js/jquery_include.js rename to middleman-more/fixtures/sprockets-app/source/library/js/jquery_include.js diff --git a/middleman-more/fixtures-old/sprockets-app/source/library/js/plain.js b/middleman-more/fixtures/sprockets-app/source/library/js/plain.js similarity index 100% rename from middleman-more/fixtures-old/sprockets-app/source/library/js/plain.js rename to middleman-more/fixtures/sprockets-app/source/library/js/plain.js diff --git a/middleman-more/fixtures-old/sprockets-app/source/library/js/sprockets_base.js b/middleman-more/fixtures/sprockets-app/source/library/js/sprockets_base.js similarity index 100% rename from middleman-more/fixtures-old/sprockets-app/source/library/js/sprockets_base.js rename to middleman-more/fixtures/sprockets-app/source/library/js/sprockets_base.js diff --git a/middleman-more/fixtures-old/sprockets-app/source/library/js/sprockets_sub.js b/middleman-more/fixtures/sprockets-app/source/library/js/sprockets_sub.js similarity index 100% rename from middleman-more/fixtures-old/sprockets-app/source/library/js/sprockets_sub.js rename to middleman-more/fixtures/sprockets-app/source/library/js/sprockets_sub.js diff --git a/middleman-more/fixtures/sprockets-app2/config.rb b/middleman-more/fixtures/sprockets-app2/config.rb new file mode 100644 index 00000000..e69de29b diff --git a/middleman-more/fixtures/sprockets-app2/data/test.yml b/middleman-more/fixtures/sprockets-app2/data/test.yml new file mode 100644 index 00000000..26cf591e --- /dev/null +++ b/middleman-more/fixtures/sprockets-app2/data/test.yml @@ -0,0 +1,4 @@ +- + title: "One" +- + title: "Two" \ No newline at end of file diff --git a/middleman-more/fixtures/sprockets-app2/data/test2.json b/middleman-more/fixtures/sprockets-app2/data/test2.json new file mode 100644 index 00000000..9f8b79c6 --- /dev/null +++ b/middleman-more/fixtures/sprockets-app2/data/test2.json @@ -0,0 +1,4 @@ +[ + { "title": "One" }, + { "title": "Two" } +] \ No newline at end of file diff --git a/middleman-more/fixtures/sprockets-app2/source/javascripts/multiple_engines.js.coffee.erb b/middleman-more/fixtures/sprockets-app2/source/javascripts/multiple_engines.js.coffee.erb new file mode 100644 index 00000000..360022a5 --- /dev/null +++ b/middleman-more/fixtures/sprockets-app2/source/javascripts/multiple_engines.js.coffee.erb @@ -0,0 +1 @@ +alert "Hello <%= data.test[0].title %>" \ No newline at end of file diff --git a/middleman-more/fixtures/sprockets-app2/source/javascripts/sprockets_base.js b/middleman-more/fixtures/sprockets-app2/source/javascripts/sprockets_base.js new file mode 100644 index 00000000..fc657dc0 --- /dev/null +++ b/middleman-more/fixtures/sprockets-app2/source/javascripts/sprockets_base.js @@ -0,0 +1,5 @@ +//= require "sprockets_sub" + +function base() { + +} \ No newline at end of file diff --git a/middleman-more/fixtures/sprockets-app2/source/javascripts/sprockets_sub.js b/middleman-more/fixtures/sprockets-app2/source/javascripts/sprockets_sub.js new file mode 100644 index 00000000..1b27ea83 --- /dev/null +++ b/middleman-more/fixtures/sprockets-app2/source/javascripts/sprockets_sub.js @@ -0,0 +1,3 @@ +function sprockets_sub_function() { + +} \ No newline at end of file diff --git a/middleman-more/fixtures/sprockets-app2/source/stylesheets/sprockets_base1.css.scss b/middleman-more/fixtures/sprockets-app2/source/stylesheets/sprockets_base1.css.scss new file mode 100644 index 00000000..8b56cb7d --- /dev/null +++ b/middleman-more/fixtures/sprockets-app2/source/stylesheets/sprockets_base1.css.scss @@ -0,0 +1 @@ +//= require "sprockets_sub" \ No newline at end of file diff --git a/middleman-more/fixtures/sprockets-app2/source/stylesheets/sprockets_base2.css.scss b/middleman-more/fixtures/sprockets-app2/source/stylesheets/sprockets_base2.css.scss new file mode 100644 index 00000000..eeb7e5c3 --- /dev/null +++ b/middleman-more/fixtures/sprockets-app2/source/stylesheets/sprockets_base2.css.scss @@ -0,0 +1 @@ +@import "sprockets_sub"; \ No newline at end of file diff --git a/middleman-more/fixtures/sprockets-app2/source/stylesheets/sprockets_sub.css.scss b/middleman-more/fixtures/sprockets-app2/source/stylesheets/sprockets_sub.css.scss new file mode 100644 index 00000000..7940d263 --- /dev/null +++ b/middleman-more/fixtures/sprockets-app2/source/stylesheets/sprockets_sub.css.scss @@ -0,0 +1 @@ +hello { world: "hi"; } \ No newline at end of file diff --git a/middleman-more/lib/middleman-more.rb b/middleman-more/lib/middleman-more.rb index ac00fc43..63a6c415 100644 --- a/middleman-more/lib/middleman-more.rb +++ b/middleman-more/lib/middleman-more.rb @@ -2,6 +2,8 @@ libdir = File.expand_path(File.dirname(__FILE__)) $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir) +require "middleman-core" + # Top-level Middleman object module Middleman @@ -11,15 +13,18 @@ module Middleman autoload :Sass, "middleman-more/renderers/sass" autoload :Markdown, "middleman-more/renderers/markdown" autoload :Liquid, "middleman-more/renderers/liquid" + autoload :Slim, "middleman-more/renderers/slim" end - module Extensions + module CoreExtensions # Compass framework for Sass - autoload :Compass, "middleman-more/core_extensions/compass" + autoload :Compass, "middleman-more/core_extensions/compass" # Sprockets 2 - autoload :Sprockets, "middleman-more/core_extensions/sprockets" + autoload :Sprockets, "middleman-more/core_extensions/sprockets" + end + module Extensions # RelativeAssets allow any asset path in dynamic templates to be either # relative to the root of the project or use an absolute URL. autoload :RelativeAssets, "middleman-more/extensions/relative_assets" @@ -44,4 +49,26 @@ module Middleman # MinifyJavascript uses the YUI compressor to shrink JS files autoload :MinifyJavascript, "middleman-more/extensions/minify_javascript" end + + require "coffee_script" + Base.register Middleman::Renderers::Haml + Base.register Middleman::Renderers::Sass + Base.register Middleman::Renderers::Markdown + Base.register Middleman::Renderers::Liquid + Base.register Middleman::Renderers::Slim + + # Compass framework + Base.register Middleman::CoreExtensions::Compass + + # Sprockets asset handling + Base.register Middleman::CoreExtensions::Sprockets + + Extensions.register(:cache_buster) { + ::Middleman::Extensions::CacheBuster } + Extensions.register(:minify_css) { + ::Middleman::Extensions::MinifyCss } + Extensions.register(:minify_javascript) { + ::Middleman::Extensions::MinifyJavascript } + Extensions.register(:relative_assets) { + ::Middleman::Extensions::RelativeAssets } end \ No newline at end of file diff --git a/middleman-more/lib/middleman-more/extensions/compass.rb b/middleman-more/lib/middleman-more/core_extensions/compass.rb similarity index 100% rename from middleman-more/lib/middleman-more/extensions/compass.rb rename to middleman-more/lib/middleman-more/core_extensions/compass.rb diff --git a/middleman-more/lib/middleman-more/extensions/sprockets.rb b/middleman-more/lib/middleman-more/core_extensions/sprockets.rb similarity index 100% rename from middleman-more/lib/middleman-more/extensions/sprockets.rb rename to middleman-more/lib/middleman-more/core_extensions/sprockets.rb diff --git a/middleman-more/lib/middleman-more/renderers/slim.rb b/middleman-more/lib/middleman-more/renderers/slim.rb new file mode 100644 index 00000000..1d3b0838 --- /dev/null +++ b/middleman-more/lib/middleman-more/renderers/slim.rb @@ -0,0 +1,15 @@ +module Middleman::Renderers::Slim + class << self + def registered(app) + # Slim is not included in the default gems, + # but we'll support it if available. + begin + require "slim" + + Slim::Engine.set_default_options(:buffer => '@_out_buf', :generator => Temple::Generators::StringBuffer) if defined?(Slim) + rescue LoadError + end + end + alias :included :registered + end +end \ No newline at end of file diff --git a/middleman-more/lib/middleman-more/setup.rb b/middleman-more/lib/middleman-more/setup.rb deleted file mode 100644 index c7c11464..00000000 --- a/middleman-more/lib/middleman-more/setup.rb +++ /dev/null @@ -1,39 +0,0 @@ - - -require "coffee_script" -app.register Middleman::Renderers::Haml -app.register Middleman::Renderers::Sass -app.register Middleman::Renderers::Markdown -app.register Middleman::Renderers::Liquid - - -set :default_extensions, [ - :lorem -] - - - -# Compass framework -register Middleman::CoreExtensions::Compass - -# Sprockets asset handling -register Middleman::CoreExtensions::Sprockets - -# Activate built-in helpers -register Middleman::CoreExtensions::DefaultHelpers - - - Middleman::Extensions.register(:asset_host) { - Middleman::Extensions::AssetHost } - Middleman::Extensions.register(:automatic_image_sizes) { - Middleman::Extensions::AutomaticImageSizes } - Middleman::Extensions.register(:cache_buster) { - Middleman::Extensions::CacheBuster } - Middleman::Extensions.register(:lorem) { - Middleman::Extensions::Lorem } - Middleman::Extensions.register(:minify_css) { - Middleman::Extensions::MinifyCss } - Middleman::Extensions.register(:minify_javascript) { - Middleman::Extensions::MinifyJavascript } - Middleman::Extensions.register(:relative_assets) { - Middleman::Extensions::RelativeAssets } \ No newline at end of file diff --git a/middleman-more/lib/middleman-more/version.rb b/middleman-more/lib/middleman-more/version.rb deleted file mode 100644 index a71306a2..00000000 --- a/middleman-more/lib/middleman-more/version.rb +++ /dev/null @@ -1,7 +0,0 @@ -module Middleman - module More - # Current Version - # @return [String] - VERSION = "3.0.0.alpha.6" - end -end \ No newline at end of file diff --git a/middleman-more/middleman-more.gemspec b/middleman-more/middleman-more.gemspec index c1ad39d1..44c2b138 100644 --- a/middleman-more/middleman-more.gemspec +++ b/middleman-more/middleman-more.gemspec @@ -1,10 +1,10 @@ # -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) -require "middleman-more/version" +require File.expand_path("../../middleman-core/lib/middleman-core/version.rb", __FILE__) Gem::Specification.new do |s| s.name = "middleman-more" - s.version = Middleman::More::VERSION + s.version = Middleman::VERSION s.platform = Gem::Platform::RUBY s.license = "MIT" s.authors = ["Thomas Reynolds"] @@ -18,30 +18,15 @@ Gem::Specification.new do |s| s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] - s.add_dependency("middleman-core") - s.add_dependency("thin", ["~> 1.3.1"]) - s.add_dependency("i18n", ["~> 0.6.0"]) + s.add_dependency("middleman-core", Middleman::VERSION) s.add_dependency("uglifier", ["~> 1.2.0"]) s.add_dependency("haml", ["~> 3.1.0"]) s.add_dependency("sass", ["~> 3.1.7"]) s.add_dependency("compass", ["~> 0.11.3"]) s.add_dependency("coffee-script", ["~> 2.2.0"]) s.add_dependency("execjs", ["~> 1.2.7"]) + s.add_dependency("sprockets", ["~> 2.1.0"]) s.add_dependency("sprockets-sass", ["~> 0.6.0"]) s.add_dependency("redcarpet", ["~> 2.0.0"]) - - # Development and test - s.add_development_dependency("slim") - s.add_development_dependency("sinatra") - s.add_development_dependency("coffee-filter", ["~> 0.1.1"]) - s.add_development_dependency("liquid", ["~> 2.2"]) - s.add_development_dependency("cucumber", ["~> 1.1.0"]) - s.add_development_dependency("aruba", ["~> 0.4.11"]) - s.add_development_dependency("rake", ["~> 0.9.2"]) - s.add_development_dependency("rspec", ["~> 2.7"]) - s.add_development_dependency("rdoc", ["~> 3.9"]) - s.add_development_dependency("yard") - s.add_development_dependency("jquery-rails") - s.add_development_dependency("bootstrap-rails", ["0.0.5"]) end diff --git a/middleman-x86-mingw32.gemspec b/middleman-x86-mingw32.gemspec index 113cfc61..7a5b729b 100644 --- a/middleman-x86-mingw32.gemspec +++ b/middleman-x86-mingw32.gemspec @@ -4,7 +4,7 @@ require "middleman-core/version" Gem::Specification.new do |s| s.name = "middleman" - s.version = Middleman::Core::VERSION + s.version = Middleman::VERSION s.platform = "x86-mingw32" s.license = "MIT" s.authors = ["Thomas Reynolds"] diff --git a/middleman/middleman.gemspec b/middleman/middleman.gemspec new file mode 100644 index 00000000..d798743e --- /dev/null +++ b/middleman/middleman.gemspec @@ -0,0 +1,24 @@ +# -*- encoding: utf-8 -*- +$:.push File.expand_path("../lib", __FILE__) +require File.expand_path("../../middleman-core/lib/middleman-core/version.rb", __FILE__) + +Gem::Specification.new do |s| + s.name = "middleman" + s.version = Middleman::VERSION + s.platform = Gem::Platform::RUBY + s.license = "MIT" + s.authors = ["Thomas Reynolds"] + s.email = ["me@tdreyno.com"] + s.homepage = "http://middlemanapp.com" + s.summary = "Hand-crafted frontend development" + s.description = "A static site generator based on Sinatra. Providing dozens of templating languages (Haml, Sass, Compass, Slim, CoffeeScript, and more). Makes minification, compression, cache busting, Yaml data (and more) an easy part of your development cycle." + + s.files = `git ls-files`.split("\n") + s.test_files = `git ls-files -- {fixtures,features}/*`.split("\n") + s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } + s.require_paths = ["lib"] + + s.add_dependency("middleman-core", Middleman::VERSION) + s.add_dependency("middleman-more", Middleman::VERSION) +end +