artii 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm --create ruby-1.9.2@artii
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "http://rubygems.org"
2
+
3
+ group :development do
4
+ gem "rspec", "~> 2.3.0"
5
+ gem "bundler", "~> 1.0.0"
6
+ gem "jeweler", "~> 1.6.4"
7
+ gem "rcov", ">= 0"
8
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,28 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ diff-lcs (1.1.3)
5
+ git (1.2.5)
6
+ jeweler (1.6.4)
7
+ bundler (~> 1.0)
8
+ git (>= 1.2.5)
9
+ rake
10
+ rake (0.9.2.2)
11
+ rcov (0.9.11)
12
+ rspec (2.3.0)
13
+ rspec-core (~> 2.3.0)
14
+ rspec-expectations (~> 2.3.0)
15
+ rspec-mocks (~> 2.3.0)
16
+ rspec-core (2.3.1)
17
+ rspec-expectations (2.3.0)
18
+ diff-lcs (~> 1.1.2)
19
+ rspec-mocks (2.3.0)
20
+
21
+ PLATFORMS
22
+ ruby
23
+
24
+ DEPENDENCIES
25
+ bundler (~> 1.0.0)
26
+ jeweler (~> 1.6.4)
27
+ rcov
28
+ rspec (~> 2.3.0)
data/History.txt CHANGED
@@ -33,4 +33,12 @@
33
33
 
34
34
  === 1.0.1 / 2010-08-18
35
35
 
36
- * No functional changes.
36
+ * No functional changes.
37
+
38
+ === 1.0.2 / 2011-03-04
39
+
40
+ * No functional changes.
41
+
42
+ === 1.0.3 / 2012-01-04
43
+
44
+ * Updates for Ruby 1.9 compatibility.
data/Rakefile CHANGED
@@ -1,40 +1,43 @@
1
1
  # -*- ruby -*-
2
+ # encoding: utf-8
2
3
 
3
4
  require 'rubygems'
4
- require 'rake'
5
- require './lib/artii.rb'
5
+ require 'bundler'
6
6
 
7
7
  begin
8
- require 'jeweler'
9
- Jeweler::Tasks.new do |gem|
10
- gem.name = "artii"
11
- gem.executables = ["artii"]
12
- gem.summary = "A little Figlet-based ASCII art generator."
13
- gem.description = "A Figlet-based ASCII art generator, useful for command-line based ASCII Art Generation."
14
- gem.email = "mike@panpainter.com"
15
- gem.homepage = "http://github.com/miketierney/artii"
16
- gem.authors = ["Mike Tierney"]
17
- gem.add_development_dependency "rspec", ">= 1.2.9"
18
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
19
- end
20
- Jeweler::GemcutterTasks.new
21
- rescue LoadError
22
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
8
+ Bundler.setup(:default, :development)
9
+ rescue Bundler::BundlerError => e
10
+ $stderr.puts e.message
11
+ $stderr.puts "Run `bundle install` to install missing gems"
12
+ exit e.status_code
23
13
  end
14
+ require 'rake'
24
15
 
25
- require 'spec/rake/spectask'
26
- Spec::Rake::SpecTask.new(:spec) do |spec|
27
- spec.libs << 'lib' << 'spec'
28
- spec.spec_files = FileList['spec/**/*_spec.rb']
16
+ require 'jeweler'
17
+ Jeweler::Tasks.new do |gem|
18
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
19
+ gem.name = "artii"
20
+ gem.executables = ["artii"]
21
+ gem.summary = "A little Figlet-based ASCII art generator."
22
+ gem.description = "A Figlet-based ASCII art generator, useful for comand-line based ASCII Art Generation."
23
+ gem.email = "mike@panpainter.com"
24
+ gem.homepage = "http://github.com/miketierney/artii"
25
+ gem.authors = ["Mike Tierney"]
26
+ gem.license = "MIT"
27
+ # dependencies defined in Gemfile
29
28
  end
29
+ Jeweler::RubygemsDotOrgTasks.new
30
30
 
31
- Spec::Rake::SpecTask.new(:rcov) do |spec|
32
- spec.libs << 'lib' << 'spec'
33
- spec.pattern = 'spec/**/*_spec.rb'
34
- spec.rcov = true
31
+ require 'rspec/core'
32
+ require 'rspec/core/rake_task'
33
+ RSpec::Core::RakeTask.new(:spec) do |spec|
34
+ spec.pattern = FileList["spec/**/*_spec.rb"]
35
35
  end
36
36
 
37
- task :spec => :check_dependencies
37
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
38
+ spec.pattern = "spec/**/*_spec.rb"
39
+ spec.rcov = true
40
+ end
38
41
 
39
42
  task :default => :spec
40
43
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.3
data/artii.gemspec CHANGED
@@ -4,20 +4,23 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{artii}
8
- s.version = "1.0.2"
7
+ s.name = "artii"
8
+ s.version = "1.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mike Tierney"]
12
- s.date = %q{2011-03-02}
13
- s.default_executable = %q{artii}
14
- s.description = %q{A Figlet-based ASCII art generator, useful for command-line based ASCII Art Generation.}
15
- s.email = %q{mike@panpainter.com}
12
+ s.date = "2012-01-05"
13
+ s.description = "A Figlet-based ASCII art generator, useful for comand-line based ASCII Art Generation."
14
+ s.email = "mike@panpainter.com"
16
15
  s.executables = ["artii"]
17
16
  s.extra_rdoc_files = [
18
17
  "README.rdoc"
19
18
  ]
20
19
  s.files = [
20
+ ".rspec",
21
+ ".rvmrc",
22
+ "Gemfile",
23
+ "Gemfile.lock",
21
24
  "History.txt",
22
25
  "README.rdoc",
23
26
  "Rakefile",
@@ -703,28 +706,31 @@ Gem::Specification.new do |s|
703
706
  "spec/spec.opts",
704
707
  "spec/spec_helper.rb"
705
708
  ]
706
- s.homepage = %q{http://github.com/miketierney/artii}
709
+ s.homepage = "http://github.com/miketierney/artii"
710
+ s.licenses = ["MIT"]
707
711
  s.require_paths = ["lib"]
708
- s.rubygems_version = %q{1.3.7}
709
- s.summary = %q{A little Figlet-based ASCII art generator.}
710
- s.test_files = [
711
- "spec/artii/base_spec.rb",
712
- "spec/artii_spec.rb",
713
- "spec/figlet_spec.rb",
714
- "spec/spec_helper.rb"
715
- ]
712
+ s.rubygems_version = "1.8.10"
713
+ s.summary = "A little Figlet-based ASCII art generator."
716
714
 
717
715
  if s.respond_to? :specification_version then
718
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
719
716
  s.specification_version = 3
720
717
 
721
718
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
722
- s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
719
+ s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
720
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
721
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
722
+ s.add_development_dependency(%q<rcov>, [">= 0"])
723
723
  else
724
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
724
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
725
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
726
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
727
+ s.add_dependency(%q<rcov>, [">= 0"])
725
728
  end
726
729
  else
727
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
730
+ s.add_dependency(%q<rspec>, ["~> 2.3.0"])
731
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
732
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
733
+ s.add_dependency(%q<rcov>, [">= 0"])
728
734
  end
729
735
  end
730
736
 
data/bin/artii CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + "/../lib/artii")
3
+ require 'artii'
4
4
 
5
5
  begin
6
6
  a = Artii::Base.new *ARGV.dup
data/lib/artii.rb CHANGED
@@ -12,11 +12,8 @@
12
12
  # Copyright:: Copyright (c) 2010 Michael Tierney
13
13
  # License:: Distributed under the MIT License
14
14
 
15
- require 'rubygems'
16
-
17
- $: << File.dirname(__FILE__)
18
-
19
15
  require 'artii/base'
16
+ require 'artii/figlet'
20
17
 
21
18
  module Artii
22
19
  FONTPATH = File.expand_path(File.dirname(__FILE__) + '/../lib/figlet/fonts')
@@ -27,19 +24,10 @@ module Artii
27
24
 
28
25
  def self.encoding_of(string)
29
26
  if is_19?
30
- string.encoding.to_s
31
- else
27
+ string.encoding.to_s
28
+ else
32
29
  $KCODE
33
30
  end
34
31
  end
35
32
 
36
- def self.raise_19_incompat
37
- if is_19?
38
- raise "Artii::Figlet is not compatible with Ruby 1.9 at this time"
39
- end
40
- end
41
33
  end
42
-
43
- if !Artii.is_19?
44
- require 'artii/figlet'
45
- end
data/lib/artii/base.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  require 'find'
2
2
  require 'optparse'
3
+ require 'figlet/font'
4
+ require 'figlet/smusher'
5
+ require 'figlet/typesetter'
3
6
 
4
7
  module Artii
5
8
  class Base
@@ -82,4 +85,4 @@ module Artii
82
85
  font_faces
83
86
  end
84
87
  end
85
- end
88
+ end
data/lib/artii/figlet.rb CHANGED
@@ -6,9 +6,9 @@
6
6
  # Usage:
7
7
  #
8
8
  # big_font = Artii::Figlet::Font.new('big.flf')
9
- #
9
+ #
10
10
  # figlet = Artii::Figlet::Typesetter.new(big_font)
11
- #
11
+ #
12
12
  # puts figlet['hello world']
13
13
  #
14
14
  #
data/lib/figlet/font.rb CHANGED
@@ -1,119 +1,117 @@
1
1
  module Artii
2
- module Figlet
3
-
4
- class UnknownFontFormat < StandardError
5
- end
6
-
7
- class Font
8
- def initialize(filename, load_german = true)
9
- Artii.raise_19_incompat
10
-
11
- file = File.open(filename, 'rb')
12
-
13
- header = file.gets.strip.split(/ /)
14
-
15
- raise UnknownFontFormat if 'flf2a' != header[0][0, 5]
16
-
17
- @hard_blank = header.shift[-1, 1]
18
- @height = header.shift.to_i
19
- @baseline = header.shift
20
- @max_length = header.shift
21
- @old_layout = header.shift.to_i
22
- @comment_count = header.shift.to_i
23
- @right_to_left = header.shift
24
- @right_to_left = !@right_to_left.nil? && @right_to_left.to_i == 1
25
-
26
- @load_german, @characters = load_german, {}
27
-
28
- load_comments file
29
- load_ascii_characters file
30
- load_german_characters file
31
- load_extended_characters file
32
-
33
- file.close
34
- end
2
+ module Figlet
35
3
 
36
- def [](char)
37
- @characters[char]
38
- end
39
-
40
- def has_char?(char)
41
- @characters.has_key? char
4
+ class UnknownFontFormat < StandardError
42
5
  end
43
6
 
44
- attr_reader :height, :hard_blank, :old_layout
45
-
46
- def right_to_left?
47
- @right_to_left
48
- end
7
+ class Font
8
+ def initialize(filename, load_german = true)
9
+ file = File.open(filename, 'rb')
49
10
 
11
+ header = file.gets.strip.split(/ /)
50
12
 
51
- private
52
-
53
- def load_comments(file)
54
- @comment_count.times { file.gets.strip }
55
- end
56
-
57
- def load_ascii_characters(file)
58
- (32..126).each { |i| @characters[i] = load_char(file) }
59
- end
13
+ raise UnknownFontFormat if 'flf2a' != header[0][0, 5]
14
+
15
+ @hard_blank = header.shift[-1, 1]
16
+ @height = header.shift.to_i
17
+ @baseline = header.shift
18
+ @max_length = header.shift
19
+ @old_layout = header.shift.to_i
20
+ @comment_count = header.shift.to_i
21
+ @right_to_left = header.shift
22
+ @right_to_left = !@right_to_left.nil? && @right_to_left.to_i == 1
23
+
24
+ @load_german, @characters = load_german, {}
25
+
26
+ load_comments file
27
+ load_ascii_characters file
28
+ load_german_characters file
29
+ load_extended_characters file
30
+
31
+ file.close
32
+ end
33
+
34
+ def [](char)
35
+ @characters[char]
36
+ end
37
+
38
+ def has_char?(char)
39
+ @characters.has_key? char
40
+ end
41
+
42
+ attr_reader :height, :hard_blank, :old_layout
43
+
44
+ def right_to_left?
45
+ @right_to_left
46
+ end
60
47
 
61
- def load_german_characters(file)
62
- [91, 92, 93, 123, 124, 125, 126].each do |i|
63
- if @load_german
64
- unless char = load_char(file)
65
- return
48
+
49
+ private
50
+
51
+ def load_comments(file)
52
+ @comment_count.times { file.gets.strip }
53
+ end
54
+
55
+ def load_ascii_characters(file)
56
+ (32..126).each { |i| @characters[i] = load_char(file) }
57
+ end
58
+
59
+ def load_german_characters(file)
60
+ [91, 92, 93, 123, 124, 125, 126].each do |i|
61
+ if @load_german
62
+ unless char = load_char(file)
63
+ return
64
+ end
65
+ @characters[i] = char
66
+ else
67
+ skip_char file
66
68
  end
67
- @characters[i] = char
68
- else
69
- skip_char file
70
69
  end
71
70
  end
72
- end
73
-
74
- def load_extended_characters(file)
75
- until file.eof?
76
- i = file.gets.strip.split(/ /).first
77
- if i.empty?
78
- next
79
- elsif /^\-0x/i =~ i # comment
80
- skip_char file
81
- else
82
- if /^0x/i =~ i
83
- i = i[2, 1].hex
84
- elsif '0' == i[0] && '0' != i || '-0' == i[0, 2]
85
- i = i.oct
86
- end
87
- unless char = load_char(file)
88
- return
71
+
72
+ def load_extended_characters(file)
73
+ until file.eof?
74
+ i = file.gets.strip.split(/ /).first
75
+ if i.empty?
76
+ next
77
+ elsif /^\-0x/i =~ i # comment
78
+ skip_char file
79
+ else
80
+ if /^0x/i =~ i
81
+ i = i[2, 1].hex
82
+ elsif '0' == i[0] && '0' != i || '-0' == i[0, 2]
83
+ i = i.oct
84
+ end
85
+ unless char = load_char(file)
86
+ return
87
+ end
88
+ @characters[i] = char
89
89
  end
90
- @characters[i] = char
91
90
  end
92
91
  end
93
- end
94
-
95
- def load_char(file)
96
- char = []
97
- @height.times do
98
- return false if file.eof?
99
- line = file.gets.rstrip
100
- if match = /(.){1,2}$/.match(line)
101
- line.gsub! match[1], ''
92
+
93
+ def load_char(file)
94
+ char = []
95
+ @height.times do
96
+ return false if file.eof?
97
+ line = file.gets.rstrip
98
+ if match = /(.){1,2}$/.match(line)
99
+ line.gsub! match[1], ''
100
+ end
101
+ line << "\x00"
102
+ char << line
102
103
  end
103
- line << "\x00"
104
- char << line
104
+ return char
105
105
  end
106
- return char
107
- end
108
106
 
109
- def skip_char(file)
110
- @height.times do
111
- return if file.eof?
112
- return if file.gets.strip.nil?
107
+ def skip_char(file)
108
+ @height.times do
109
+ return if file.eof?
110
+ return if file.gets.strip.nil?
111
+ end
113
112
  end
114
- end
115
113
 
116
- end
114
+ end
117
115
 
118
- end # module Figlet
119
- end # module Artii
116
+ end # module Figlet
117
+ end # module Artii
@@ -1,65 +1,64 @@
1
1
  module Artii
2
- module Figlet
2
+ module Figlet
3
3
 
4
- class Smusher
4
+ class Smusher
5
5
 
6
- def initialize(font)
7
- Artii.raise_19_incompat
8
- @font = font
9
- end
6
+ def initialize(font)
7
+ @font = font
8
+ end
10
9
 
11
- def [](result)
12
- todo = false
10
+ def [](result)
11
+ todo = false
13
12
 
14
- @font.height.times do |j|
15
- result[j] = result[j].sub(pattern) { todo, x = callback(todo, $1, $2); x }
16
- end
17
- @font.height.times do |j|
18
- result[j] = if todo
19
- result[j].sub(/\s\x00(?!$)|\x00\s/, '').sub(/\x00(?!$)/, '')
20
- else
21
- result[j].sub(/\x00(?!$)/, '')
13
+ @font.height.times do |j|
14
+ result[j] = result[j].sub(pattern) { todo, x = callback(todo, $1, $2); x }
15
+ end
16
+ @font.height.times do |j|
17
+ result[j] = if todo
18
+ result[j].sub(/\s\x00(?!$)|\x00\s/, '').sub(/\x00(?!$)/, '')
19
+ else
20
+ result[j].sub(/\x00(?!$)/, '')
21
+ end
22
22
  end
23
23
  end
24
- end
25
24
 
26
- def pattern
27
- @pattern ||= /([^#{@font.hard_blank}\x00\s])\x00([^#{@font.hard_blank}\x00\s])/
28
- end
25
+ def pattern
26
+ @pattern ||= /([^#{@font.hard_blank}\x00\s])\x00([^#{@font.hard_blank}\x00\s])/
27
+ end
29
28
 
30
- def symbols
31
- @@symbols ||= {
32
- 24 => '|/\\[]{}()<>',
33
- 8 => {'[' => ']', ']' => '[', '{' => '}', '}' => '{', '(' => ')', ')' => '('},
34
- 16 => {"/\\" => '|', "\\/" => 'Y', '><' => 'X'}
35
- }
36
- end
29
+ def symbols
30
+ @@symbols ||= {
31
+ 24 => '|/\\[]{}()<>',
32
+ 8 => {'[' => ']', ']' => '[', '{' => '}', '}' => '{', '(' => ')', ')' => '('},
33
+ 16 => {"/\\" => '|', "\\/" => 'Y', '><' => 'X'}
34
+ }
35
+ end
37
36
 
38
- def old_layout?(n)
39
- @font.old_layout & n > 0
40
- end
37
+ def old_layout?(n)
38
+ @font.old_layout & n > 0
39
+ end
40
+
41
+ def callback(s, a, b)
42
+ combined = a + b
41
43
 
42
- def callback(s, a, b)
43
- combined = a + b
44
-
45
- if old_layout?(1) && a == b
46
- return true, a
47
- elsif old_layout?(2) && ('_' == a && symbols[24].include?(b) || '_' == b && symbols[24].include?(a))
48
- return true, a
49
- elsif old_layout?(4) && ((left = symbols[24].index(a)) && (right = symbols[24].index(b)))
50
- return true, (right > left ? b : a)
51
- elsif old_layout?(8) && (symbols[8].has_key?(b) && symbols[8][b] == a)
52
- return true, '|'
53
- elsif old_layout?(16) && symbols[16].has_key?(combined)
54
- return true, symbols[16][combined]
55
- elsif old_layout?(32) && (a == b && @font.hard_blank == a)
56
- return true, @font.hard_blank
57
- else
58
- return s, "#{a}\00#{b}"
44
+ if old_layout?(1) && a == b
45
+ return true, a
46
+ elsif old_layout?(2) && ('_' == a && symbols[24].include?(b) || '_' == b && symbols[24].include?(a))
47
+ return true, a
48
+ elsif old_layout?(4) && ((left = symbols[24].index(a)) && (right = symbols[24].index(b)))
49
+ return true, (right > left ? b : a)
50
+ elsif old_layout?(8) && (symbols[8].has_key?(b) && symbols[8][b] == a)
51
+ return true, '|'
52
+ elsif old_layout?(16) && symbols[16].has_key?(combined)
53
+ return true, symbols[16][combined]
54
+ elsif old_layout?(32) && (a == b && @font.hard_blank == a)
55
+ return true, @font.hard_blank
56
+ else
57
+ return s, "#{a}\00#{b}"
58
+ end
59
59
  end
60
- end
61
60
 
62
- end
61
+ end
63
62
 
64
- end # module Figlet
65
- end # module Artii
63
+ end # module Figlet
64
+ end # module Artii
@@ -1,69 +1,68 @@
1
1
  module Artii
2
- module Figlet
2
+ module Figlet
3
3
 
4
- class Typesetter
4
+ class Typesetter
5
5
 
6
- def initialize(font, options = nil)
7
- Artii.raise_19_incompat
8
- @font = font
9
- @options = options || {}
10
- @smush = @options.has_key?(:smush) ? @options[:smush] : true
11
- end
6
+ def initialize(font, options = nil)
7
+ @font = font
8
+ @options = options || {}
9
+ @smush = @options.has_key?(:smush) ? @options[:smush] : true
10
+ end
12
11
 
13
- def [](str)
14
- result = []
15
- str.length.times do |i|
16
- char = str[i]
17
- unless @font.has_char?(char)
18
- if @font.has_char?(0)
19
- char = 0
20
- else
21
- next
22
- end
23
- end
24
- @font.height.times do |j|
25
- line = @font[char][j]
26
- if result[j].nil?
27
- result[j] = line
28
- else
29
- result[j] = @font.right_to_left?? (line + result[j]) : (result[j] + line)
12
+ def [](str)
13
+ result = []
14
+ str.length.times do |i|
15
+ char = str[i]
16
+ unless @font.has_char?(char.ord)
17
+ if @font.has_char?(0)
18
+ char = 0
19
+ else
20
+ next
21
+ end
30
22
  end
31
- end
32
- if @font.old_layout > -1 && i > 0
33
- diff = -1
34
23
  @font.height.times do |j|
35
- if match = /\S(\s*\x00\s*)\S/.match(result[j])
36
- len = match[1].length
37
- diff = (diff == -1 ? len : min(diff, len))
24
+ line = @font[char.ord][j]
25
+ if result[j].nil?
26
+ result[j] = line
27
+ else
28
+ result[j] = @font.right_to_left?? (line + result[j]) : (result[j] + line)
38
29
  end
39
30
  end
40
- diff -= 1
41
- if diff > 0
31
+ if @font.old_layout > -1 && i > 0
32
+ diff = -1
42
33
  @font.height.times do |j|
43
- if match = /\x00(\s{0,#{diff}})/.match(result[j])
44
- b = diff - match[1].length
45
- result[j] = result[j].sub(/\s{0,#{b}}\x00\s{#{match[1].length}}/, "\0")
34
+ if match = /\S(\s*\x00\s*)\S/.match(result[j])
35
+ len = match[1].length
36
+ diff = (diff == -1 ? len : min(diff, len))
37
+ end
38
+ end
39
+ diff -= 1
40
+ if diff > 0
41
+ @font.height.times do |j|
42
+ if match = /\x00(\s{0,#{diff}})/.match(result[j])
43
+ b = diff - match[1].length
44
+ result[j] = result[j].sub(/\s{0,#{b}}\x00\s{#{match[1].length}}/, "\0")
45
+ end
46
46
  end
47
47
  end
48
+ smush[result] if @smush
48
49
  end
49
- smush[result] if @smush
50
50
  end
51
+ return result.join("\n").gsub(/\0/, '').gsub(@font.hard_blank, ' ')
51
52
  end
52
- return result.join("\n").gsub(/\0/, '').gsub(@font.hard_blank, ' ')
53
- end
54
53
 
55
54
 
56
- private
55
+ private
57
56
 
58
- def min(a, b)
59
- a > b ? b : a
60
- end
57
+ def min(a, b)
58
+ a > b ? b : a
59
+ end
61
60
 
62
- def smush
63
- @smusher ||= Smusher.new(@font)
64
- end
61
+ def smush
62
+ @smusher ||= Smusher.new(@font)
63
+ end
65
64
 
66
- end
65
+ end
67
66
 
68
- end # module Figlet
69
- end # module Artii
67
+ end # module Figlet
68
+ end # module Artii
data/spec/spec_helper.rb CHANGED
@@ -1,14 +1,11 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__))
2
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
1
  require 'artii'
4
- require 'spec'
5
- require 'spec/autorun'
2
+ require 'rspec'
6
3
 
7
- Spec::Runner.configure do |config|
4
+ RSpec.configure do |config|
8
5
  end
9
6
 
10
7
  class File
11
8
  def self.rel(*path)
12
9
  join(dirname(__FILE__), *path)
13
10
  end
14
- end
11
+ end
metadata CHANGED
@@ -1,48 +1,73 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: artii
3
- version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 0
9
- - 2
10
- version: 1.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Mike Tierney
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-03-02 00:00:00 -08:00
19
- default_executable: artii
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-01-05 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: rspec
16
+ requirement: &70246026050280 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 2.3.0
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70246026050280
25
+ - !ruby/object:Gem::Dependency
26
+ name: bundler
27
+ requirement: &70246026049800 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 1.0.0
33
+ type: :development
23
34
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
35
+ version_requirements: *70246026049800
36
+ - !ruby/object:Gem::Dependency
37
+ name: jeweler
38
+ requirement: &70246026049320 !ruby/object:Gem::Requirement
25
39
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 13
30
- segments:
31
- - 1
32
- - 2
33
- - 9
34
- version: 1.2.9
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.6.4
35
44
  type: :development
36
- version_requirements: *id001
37
- description: A Figlet-based ASCII art generator, useful for command-line based ASCII Art Generation.
45
+ prerelease: false
46
+ version_requirements: *70246026049320
47
+ - !ruby/object:Gem::Dependency
48
+ name: rcov
49
+ requirement: &70246026048800 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70246026048800
58
+ description: A Figlet-based ASCII art generator, useful for comand-line based ASCII
59
+ Art Generation.
38
60
  email: mike@panpainter.com
39
- executables:
61
+ executables:
40
62
  - artii
41
63
  extensions: []
42
-
43
- extra_rdoc_files:
64
+ extra_rdoc_files:
44
65
  - README.rdoc
45
- files:
66
+ files:
67
+ - .rspec
68
+ - .rvmrc
69
+ - Gemfile
70
+ - Gemfile.lock
46
71
  - History.txt
47
72
  - README.rdoc
48
73
  - Rakefile
@@ -727,42 +752,32 @@ files:
727
752
  - spec/figlet_spec.rb
728
753
  - spec/spec.opts
729
754
  - spec/spec_helper.rb
730
- has_rdoc: true
731
755
  homepage: http://github.com/miketierney/artii
732
- licenses: []
733
-
756
+ licenses:
757
+ - MIT
734
758
  post_install_message:
735
759
  rdoc_options: []
736
-
737
- require_paths:
760
+ require_paths:
738
761
  - lib
739
- required_ruby_version: !ruby/object:Gem::Requirement
762
+ required_ruby_version: !ruby/object:Gem::Requirement
740
763
  none: false
741
- requirements:
742
- - - ">="
743
- - !ruby/object:Gem::Version
744
- hash: 3
745
- segments:
764
+ requirements:
765
+ - - ! '>='
766
+ - !ruby/object:Gem::Version
767
+ version: '0'
768
+ segments:
746
769
  - 0
747
- version: "0"
748
- required_rubygems_version: !ruby/object:Gem::Requirement
770
+ hash: -2121241110675444317
771
+ required_rubygems_version: !ruby/object:Gem::Requirement
749
772
  none: false
750
- requirements:
751
- - - ">="
752
- - !ruby/object:Gem::Version
753
- hash: 3
754
- segments:
755
- - 0
756
- version: "0"
773
+ requirements:
774
+ - - ! '>='
775
+ - !ruby/object:Gem::Version
776
+ version: '0'
757
777
  requirements: []
758
-
759
778
  rubyforge_project:
760
- rubygems_version: 1.3.7
779
+ rubygems_version: 1.8.10
761
780
  signing_key:
762
781
  specification_version: 3
763
782
  summary: A little Figlet-based ASCII art generator.
764
- test_files:
765
- - spec/artii/base_spec.rb
766
- - spec/artii_spec.rb
767
- - spec/figlet_spec.rb
768
- - spec/spec_helper.rb
783
+ test_files: []