make middleman not be so outright jruby hostile

This commit is contained in:
Travis Tilley 2011-02-21 10:19:18 -05:00
parent 1a15147f67
commit 08a9f45164
4 changed files with 52 additions and 41 deletions

View file

@ -14,39 +14,41 @@ require 'rake/clean'
task :test => :cucumber task :test => :cucumber
# Bring in Rocco tasks # rocco depends on rdiscount, which makes me sad.
require 'rocco/tasks' unless defined?(JRUBY_VERSION)
Rocco::make 'docs/' # Bring in Rocco tasks
require 'rocco/tasks'
Rocco::make 'docs/'
desc 'Build rocco docs' desc 'Build rocco docs'
task :docs => :rocco task :docs => :rocco
directory 'docs/' 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 desc 'Update gh-pages branch'
file 'docs/index.html' => 'docs/middleman.html' do |f| task :pages => ['docs/.git', :docs] do
cp 'docs/middleman.html', 'docs/index.html', :preserve => true rev = `git rev-parse --short HEAD`.strip
end Dir.chdir 'docs' do
task :docs => 'docs/index.html' sh "git add *.html"
CLEAN.include 'docs/index.html' sh "git commit -m 'rebuild pages from #{rev}'" do |ok,res|
if ok
desc 'Update gh-pages branch' verbose { puts "gh-pages updated" }
task :pages => ['docs/.git', :docs] do sh "git push -q o HEAD:gh-pages"
rev = `git rev-parse --short HEAD`.strip end
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 end
end
# Update the pages/ directory clone # Update the pages/ directory clone
file 'docs/.git' => ['docs/', '.git/refs/heads/gh-pages'] do |f| 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 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 ." sh "cd docs && git fetch -q o && git reset -q --hard o/gh-pages && touch ."
end
CLOBBER.include 'docs/.git'
end end
CLOBBER.include 'docs/.git'

View file

@ -54,9 +54,16 @@ end
app = Middleman::Server.new app = Middleman::Server.new
require 'rubygems' 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]}" puts "== The Middleman is standing watch on port #{options[:Port]}"
end end

View file

@ -1,3 +1,3 @@
module Middleman module Middleman
VERSION = "1.1.0.beta.4" VERSION = "1.1.0.beta.4.1"
end end

View file

@ -19,7 +19,8 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"] s.require_paths = ["lib"]
s.add_runtime_dependency("rack", ["~> 1.0"]) 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("shotgun", ["~> 0.8.0"])
s.add_runtime_dependency("thor", ["~> 0.14.0"]) s.add_runtime_dependency("thor", ["~> 0.14.0"])
s.add_runtime_dependency("tilt", ["~> 1.2.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("haml", [">= 3.1.0.alpha.147"])
s.add_runtime_dependency("sass", [">= 3.1.0.alpha.218"]) s.add_runtime_dependency("sass", [">= 3.1.0.alpha.218"])
s.add_runtime_dependency("compass", ["0.11.beta.2"]) 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("json_pure", ["~> 1.4.0"])
s.add_runtime_dependency("smusher", ["~> 0.4.5"]) s.add_runtime_dependency("smusher", ["~> 0.4.5"])
s.add_runtime_dependency("compass-slickmap", ["~> 0.4.0"]) 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_runtime_dependency("less", ["~> 1.2.0"])
s.add_development_dependency("cucumber", ["~> 0.10.0"]) s.add_development_dependency("cucumber", ["~> 0.10.0"])
s.add_development_dependency("rspec", [">= 0"]) s.add_development_dependency("rspec", [">= 0"])
s.add_development_dependency("rocco", [">= 0"]) s.add_development_dependency("rocco", [">= 0"]) unless defined?(JRUBY_VERSION)
end end