teach Albino to run on both Windows and *nix

This commit is contained in:
Jon 2010-02-13 09:05:14 -05:00 committed by Tom Preston-Werner
parent 18545ddf71
commit 81971c3342
2 changed files with 5 additions and 10 deletions

View File

@ -129,14 +129,12 @@ 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"])
@ -144,7 +142,6 @@ Gem::Specification.new do |s|
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 File

@ -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 @@ class Albino
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 @@ if $0 == __FILE__
assert_equal @syntaxer.colorize, Albino.colorize(__FILE__, :ruby)
end
end
end
end