albino 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/albino.gemspec +2 -2
- data/lib/albino.rb +5 -6
- data/test/albino_test.rb +6 -5
- metadata +2 -2
data/albino.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'albino'
|
16
|
-
s.version = '1.
|
16
|
+
s.version = '1.1'
|
17
17
|
s.date = '2010-05-04'
|
18
18
|
s.rubyforge_project = 'albino'
|
19
19
|
|
@@ -52,4 +52,4 @@ Gem::Specification.new do |s|
|
|
52
52
|
## Test files will be grabbed from the file list. Make sure the path glob
|
53
53
|
## matches what you actually use.
|
54
54
|
s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
|
55
|
-
end
|
55
|
+
end
|
data/lib/albino.rb
CHANGED
@@ -42,7 +42,7 @@
|
|
42
42
|
# GitHub // http://github.com
|
43
43
|
#
|
44
44
|
class Albino
|
45
|
-
VERSION = '1.
|
45
|
+
VERSION = '1.1'
|
46
46
|
|
47
47
|
class << self
|
48
48
|
attr_accessor :bin
|
@@ -80,10 +80,9 @@ class Albino
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def write_target_to_stream(stream)
|
83
|
-
if
|
84
|
-
|
85
|
-
|
86
|
-
end
|
83
|
+
if @target.respond_to?(:read)
|
84
|
+
@target.each { |l| stream << l }
|
85
|
+
@target.close
|
87
86
|
else
|
88
87
|
stream << @target
|
89
88
|
end
|
@@ -92,4 +91,4 @@ class Albino
|
|
92
91
|
def bin
|
93
92
|
self.class.bin
|
94
93
|
end
|
95
|
-
end
|
94
|
+
end
|
data/test/albino_test.rb
CHANGED
@@ -6,11 +6,11 @@ require 'mocha'
|
|
6
6
|
|
7
7
|
class AlbinoTest < Test::Unit::TestCase
|
8
8
|
def setup
|
9
|
-
@syntaxer = Albino.new(__FILE__, :ruby)
|
9
|
+
@syntaxer = Albino.new(File.new(__FILE__), :ruby)
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_defaults_to_text
|
13
|
-
syntaxer = Albino.new(__FILE__)
|
13
|
+
syntaxer = Albino.new(File.new(__FILE__))
|
14
14
|
syntaxer.expects(:execute).with('pygmentize -f html -l text').returns(true)
|
15
15
|
syntaxer.colorize
|
16
16
|
end
|
@@ -33,16 +33,17 @@ class AlbinoTest < Test::Unit::TestCase
|
|
33
33
|
Tempfile.open 'albino-test' do |tmp|
|
34
34
|
tmp << contents
|
35
35
|
tmp.flush
|
36
|
-
syntaxer = Albino.new(tmp.path, :ruby)
|
36
|
+
syntaxer = Albino.new(File.new(tmp.path), :ruby)
|
37
37
|
assert_equal file_output, syntaxer.colorize
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
def test_aliases_to_s
|
42
|
-
|
42
|
+
syntaxer = Albino.new(File.new(__FILE__), :ruby)
|
43
|
+
assert_equal @syntaxer.colorize, syntaxer.to_s
|
43
44
|
end
|
44
45
|
|
45
46
|
def test_class_method_colorize
|
46
|
-
assert_equal @syntaxer.colorize, Albino.colorize(__FILE__, :ruby)
|
47
|
+
assert_equal @syntaxer.colorize, Albino.colorize(File.new(__FILE__), :ruby)
|
47
48
|
end
|
48
49
|
end
|