Permalink
Browse files

teach Albino to run on both Windows and *nix

  • Loading branch information...
1 parent 18545dd commit 81971c33427debb40cfe32949931a7b0bd980e28 @jonforums jonforums committed with mojombo Feb 13, 2010
Showing with 5 additions and 10 deletions.
  1. +0 −3 jekyll.gemspec
  2. +5 −7 lib/jekyll/albino.rb
View
@@ -129,22 +129,19 @@ Gem::Specification.new do |s|
s.add_runtime_dependency(%q<classifier>, [">= 1.3.1"])
s.add_runtime_dependency(%q<maruku>, [">= 0.5.9"])
s.add_runtime_dependency(%q<directory_watcher>, [">= 1.1.1"])
- s.add_runtime_dependency(%q<open4>, [">= 0.9.6"])
else
s.add_dependency(%q<RedCloth>, [">= 4.2.1"])
s.add_dependency(%q<liquid>, [">= 1.9.0"])
s.add_dependency(%q<classifier>, [">= 1.3.1"])
s.add_dependency(%q<maruku>, [">= 0.5.9"])
s.add_dependency(%q<directory_watcher>, [">= 1.1.1"])
- s.add_dependency(%q<open4>, [">= 0.9.6"])
end
else
s.add_dependency(%q<RedCloth>, [">= 4.2.1"])
s.add_dependency(%q<liquid>, [">= 1.9.0"])
s.add_dependency(%q<classifier>, [">= 1.3.1"])
s.add_dependency(%q<maruku>, [">= 0.5.9"])
s.add_dependency(%q<directory_watcher>, [">= 1.1.1"])
- s.add_dependency(%q<open4>, [">= 0.9.6"])
end
end
View
@@ -41,7 +41,6 @@
# Chris Wanstrath // chris@ozmm.org
# GitHub // http://github.com
#
-require 'open4'
class Albino
@@bin = Rails.development? ? 'pygmentize' : '/usr/bin/pygmentize' rescue 'pygmentize'
@@ -61,11 +60,10 @@ def initialize(target, lexer = :text, format = :html)
def execute(command)
output = ''
- Open4.popen4(command) do |pid, stdin, stdout, stderr|
- stdin.puts @target
- stdin.close
- output = stdout.read.strip
- [stdout, stderr].each { |io| io.close }
+ IO.popen(command, mode='r+') do |p|
+ p.write @target
+ p.close_write
+ output = p.read.strip
end
output
end
@@ -119,4 +117,4 @@ def convert_options(options = {})
assert_equal @syntaxer.colorize, Albino.colorize(__FILE__, :ruby)
end
end
-end
+end

0 comments on commit 81971c3

Please sign in to comment.