From 08a9f45164f932a79499d49c5ac5f8eb9e56b2db Mon Sep 17 00:00:00 2001 From: Travis Tilley Date: Mon, 21 Feb 2011 10:19:18 -0500 Subject: [PATCH] make middleman not be so outright jruby hostile --- Rakefile | 58 +++++++++++++++++++++------------------- bin/mm-server | 19 ++++++++----- lib/middleman/version.rb | 2 +- middleman.gemspec | 14 +++++----- 4 files changed, 52 insertions(+), 41 deletions(-) diff --git a/Rakefile b/Rakefile index 5da2bf2a..75357907 100644 --- a/Rakefile +++ b/Rakefile @@ -14,39 +14,41 @@ require 'rake/clean' task :test => :cucumber -# Bring in Rocco tasks -require 'rocco/tasks' -Rocco::make 'docs/' +# rocco depends on rdiscount, which makes me sad. +unless defined?(JRUBY_VERSION) + # Bring in Rocco tasks + require 'rocco/tasks' + Rocco::make 'docs/' -desc 'Build rocco docs' -task :docs => :rocco -directory 'docs/' + desc 'Build rocco docs' + task :docs => :rocco + directory 'docs/' + # Make index.html a copy of rocco.html + file 'docs/index.html' => 'docs/middleman.html' do |f| + cp 'docs/middleman.html', 'docs/index.html', :preserve => true + end + task :docs => 'docs/index.html' + CLEAN.include 'docs/index.html' -# Make index.html a copy of rocco.html -file 'docs/index.html' => 'docs/middleman.html' do |f| - cp 'docs/middleman.html', 'docs/index.html', :preserve => true -end -task :docs => 'docs/index.html' -CLEAN.include 'docs/index.html' - -desc 'Update gh-pages branch' -task :pages => ['docs/.git', :docs] do - rev = `git rev-parse --short HEAD`.strip - Dir.chdir 'docs' do - sh "git add *.html" - sh "git commit -m 'rebuild pages from #{rev}'" do |ok,res| - if ok - verbose { puts "gh-pages updated" } - sh "git push -q o HEAD:gh-pages" + desc 'Update gh-pages branch' + task :pages => ['docs/.git', :docs] do + rev = `git rev-parse --short HEAD`.strip + Dir.chdir 'docs' do + sh "git add *.html" + sh "git commit -m 'rebuild pages from #{rev}'" do |ok,res| + if ok + verbose { puts "gh-pages updated" } + sh "git push -q o HEAD:gh-pages" + end end end end -end -# Update the pages/ directory clone -file 'docs/.git' => ['docs/', '.git/refs/heads/gh-pages'] do |f| - sh "cd docs && git init -q && git remote add o ../.git" if !File.exist?(f.name) - sh "cd docs && git fetch -q o && git reset -q --hard o/gh-pages && touch ." + # Update the pages/ directory clone + file 'docs/.git' => ['docs/', '.git/refs/heads/gh-pages'] do |f| + sh "cd docs && git init -q && git remote add o ../.git" if !File.exist?(f.name) + sh "cd docs && git fetch -q o && git reset -q --hard o/gh-pages && touch ." + end + CLOBBER.include 'docs/.git' end -CLOBBER.include 'docs/.git' diff --git a/bin/mm-server b/bin/mm-server index 26f0e1c2..50b3ca1c 100755 --- a/bin/mm-server +++ b/bin/mm-server @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # Non-blocking site rebuilding -trap("TSTP") do +trap("TSTP") do fork do require "open3" first_run = true @@ -38,7 +38,7 @@ OptionParser.new { |opts| opts.on("--debug", "Debug mode") { ::Middleman::Server.set :logging, true } - + opts.parse! ARGV } @@ -54,9 +54,16 @@ end app = Middleman::Server.new require 'rubygems' -require 'thin' -Thin::Logging.silent = true -Rack::Handler::Thin.run app, options do |inst| +unless defined?(JRUBY_VERSION) + require 'thin' + handler = Rack::Handler::Thin +else + require 'kirk' + require 'rack/handler/kirk' + handler = Rack::Handler::Kirk +end + +handler.run app, options do |inst| puts "== The Middleman is standing watch on port #{options[:Port]}" -end \ No newline at end of file +end diff --git a/lib/middleman/version.rb b/lib/middleman/version.rb index 1fbc65e1..5b3273ff 100644 --- a/lib/middleman/version.rb +++ b/lib/middleman/version.rb @@ -1,3 +1,3 @@ module Middleman - VERSION = "1.1.0.beta.4" + VERSION = "1.1.0.beta.4.1" end diff --git a/middleman.gemspec b/middleman.gemspec index ad004b3b..022efaa0 100644 --- a/middleman.gemspec +++ b/middleman.gemspec @@ -10,16 +10,17 @@ Gem::Specification.new do |s| s.email = ["tdreyno@gmail.com"] s.homepage = "http://wiki.github.com/tdreyno/middleman" s.summary = "A static site generator utilizing Haml, Sass and providing YUI compression and cache busting" - + s.rubyforge_project = "middleman" - + 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_runtime_dependency("rack", ["~> 1.0"]) - s.add_runtime_dependency("thin", ["~> 1.2.0"]) + s.add_runtime_dependency("thin", ["~> 1.2.0"]) unless defined?(JRUBY_VERSION) + s.add_runtime_dependency("kirk", ["~> 0.1.8"]) if defined?(JRUBY_VERSION) s.add_runtime_dependency("shotgun", ["~> 0.8.0"]) s.add_runtime_dependency("thor", ["~> 0.14.0"]) s.add_runtime_dependency("tilt", ["~> 1.2.0"]) @@ -31,7 +32,8 @@ Gem::Specification.new do |s| s.add_runtime_dependency("haml", [">= 3.1.0.alpha.147"]) s.add_runtime_dependency("sass", [">= 3.1.0.alpha.218"]) s.add_runtime_dependency("compass", ["0.11.beta.2"]) - s.add_runtime_dependency("oily_png", ["~> 0.3.0"]) + s.add_runtime_dependency("chunky_png", ["~> 0.12.0"]) + s.add_runtime_dependency("oily_png", ["~> 0.3.0"]) unless defined?(JRUBY_VERSION) s.add_runtime_dependency("json_pure", ["~> 1.4.0"]) s.add_runtime_dependency("smusher", ["~> 0.4.5"]) s.add_runtime_dependency("compass-slickmap", ["~> 0.4.0"]) @@ -39,6 +41,6 @@ Gem::Specification.new do |s| s.add_runtime_dependency("less", ["~> 1.2.0"]) s.add_development_dependency("cucumber", ["~> 0.10.0"]) s.add_development_dependency("rspec", [">= 0"]) - s.add_development_dependency("rocco", [">= 0"]) + s.add_development_dependency("rocco", [">= 0"]) unless defined?(JRUBY_VERSION) end