Skip to content
Browse files

Merge pull request #23 from bfalling/update-ruby1.9.3

Update for Ruby 1.9.3 and hoe gem. Add nil font check.
  • Loading branch information...
2 parents 223c7b7 + a6738e4 commit 719d989d91502925071c5b69aa7fa82a2b7112fb @topfunky committed Jun 12, 2012
Showing with 15 additions and 17 deletions.
  1. +10 −10 Rakefile
  2. +2 −2 lib/gruff/base.rb
  3. +1 −1 test/test_mini_bar.rb
  4. +1 −2 test/test_mini_pie.rb
  5. +1 −2 test/test_mini_side_bar.rb
View
20 Rakefile
@@ -3,16 +3,16 @@ require 'hoe'
$:.unshift(File.dirname(__FILE__) + "/lib")
require 'gruff'
-Hoe.new('Gruff', Gruff::VERSION) do |p|
- p.name = "gruff"
- p.author = "Geoffrey Grosenbach"
- p.description = "Beautiful graphs for one or multiple datasets. Can be used on websites or in documents."
- p.email = 'boss@topfunky.com'
- p.summary = "Beautiful graphs for one or multiple datasets."
- p.url = "http://nubyonrails.com/pages/gruff"
- p.clean_globs = ['test/output/*.png']
- p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
- p.remote_rdoc_dir = '' # Release to root
+Hoe.spec('Gruff') do
+ self.name = "gruff"
+ self.author = "Geoffrey Grosenbach"
+ self.description = "Beautiful graphs for one or multiple datasets. Can be used on websites or in documents."
+ self.email = 'boss@topfunky.com'
+ self.summary = "Beautiful graphs for one or multiple datasets."
+ self.url = "http://nubyonrails.com/pages/gruff"
+ self.clean_globs = ['test/output/*.png']
+ self.changes = self.paragraphs_of('History.txt', 0..1).join("\n\n")
+ self.remote_rdoc_dir = '' # Release to root
end
desc "Simple require on packaged files to make sure they are all there"
View
4 lib/gruff/base.rb
@@ -1088,7 +1088,7 @@ def label(value)
# handle.
def calculate_caps_height(font_size)
@d.pointsize = font_size
- @d.font = @font
+ @d.font = @font if @font
@d.get_type_metrics(@base_image, 'X').height
end
@@ -1098,7 +1098,7 @@ def calculate_caps_height(font_size)
# scaling will handle.
def calculate_width(font_size, text)
@d.pointsize = font_size
- @d.font = font
+ @d.font = @font if @font
@d.get_type_metrics(@base_image, text.to_s).width
end
View
2 test/test_mini_bar.rb
@@ -1,5 +1,5 @@
-require File.dirname(__FILE__) + "/gruff_test_case"
+require File.expand_path('../gruff_test_case', __FILE__)
class TestMiniBar < GruffTestCase
View
3 test/test_mini_pie.rb
@@ -1,5 +1,4 @@
-
-require File.dirname(__FILE__) + "/gruff_test_case"
+require File.expand_path('../gruff_test_case', __FILE__)
class TestMiniPie < GruffTestCase
View
3 test/test_mini_side_bar.rb
@@ -1,5 +1,4 @@
-
-require File.dirname(__FILE__) + "/gruff_test_case"
+require File.expand_path('../gruff_test_case', __FILE__)
class TestMiniSideBar < GruffTestCase

0 comments on commit 719d989

Please sign in to comment.
Something went wrong with that request. Please try again.