thinreports 0.7.5 → 0.7.6

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ Gemfile.lock
5
5
 
6
6
  doc/yardoc
7
7
  .yardoc/
8
+ coverage
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = ThinReports Generator
2
2
 
3
- {<img src="https://secure.travis-ci.org/thinreports/thinreports-generator.png" />}[http://travis-ci.org/thinreports/thinreports-generator]
3
+ {<img src="https://secure.travis-ci.org/thinreports/thinreports-generator.png" />}[http://travis-ci.org/thinreports/thinreports-generator] {<img src="https://codeclimate.com/badge.png" />}[https://codeclimate.com/github/thinreports/thinreports-generator]
4
4
 
5
5
  {ThinReports}[http://www.thinreports.org/] is Open Source Reporting Solution for Ruby.
6
6
 
@@ -129,6 +129,10 @@ More simply,
129
129
 
130
130
  {Learn more}[http://osc.matsukei.net/projects/thinreports/wiki/Getting_Started].
131
131
 
132
+ === Rails3
133
+
134
+ * Rails Template handler for ThinReports DSL: {thinreports-rails}[https://github.com/takeshinoda/thinreports-rails]
135
+
132
136
  == For more information
133
137
 
134
138
  === Release information
data/Rakefile CHANGED
@@ -1,10 +1,10 @@
1
- # coding: utf-8
2
-
3
- # Load thinreports
4
- $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/lib'))
5
- require 'thinreports'
6
-
7
- # Load tasks
8
- Dir.glob('tasks/**/*.rake').each do |r|
9
- Rake.application.add_import r
1
+ # coding: utf-8
2
+
3
+ # Load thinreports
4
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/lib'))
5
+ require 'thinreports'
6
+
7
+ # Load tasks
8
+ Dir.glob('tasks/**/*.rake').each do |r|
9
+ Rake.application.add_import r
10
10
  end
@@ -18,8 +18,10 @@ module ThinReports
18
18
  # See Prawn::Document#encrypt_document
19
19
  def initialize(report, options)
20
20
  super
21
- @pdf = Document.new(options, :Title => default_layout.format.report_title)
22
21
 
22
+ title = default_layout ? default_layout.format.report_title : nil
23
+
24
+ @pdf = Document.new(options, :Title => title)
23
25
  @drawers = {}
24
26
  end
25
27
 
@@ -1,43 +1,43 @@
1
- # coding: utf-8
2
-
3
- module ThinReports
4
- module Layout
5
-
6
- # @private
7
- module Version
8
- REQUIRED_RULES = ['>= 0.6.0.pre3', '< 0.8.0']
9
-
10
- # @param [String] version
11
- # @return [Boolean]
12
- def self.compatible?(version)
13
- compare(version, *REQUIRED_RULES)
14
- end
15
-
16
- # @param [String] base
17
- # @param [Array<String>] rules
18
- # @return [Boolean]
19
- def self.compare(base, *rules)
20
- rules.all? do |rule|
21
- op, ver = rule.split(' ')
22
- comparable_version(base).send(op.to_sym, comparable_version(ver))
23
- end
24
- end
25
-
26
- # @return [String]
27
- def self.inspect_required_rules
28
- '(' + REQUIRED_RULES.join(' and ') + ')'
29
- end
30
-
31
- # @param [String] version
32
- # @return [String]
33
- def self.comparable_version(version)
34
- if version =~ /pre/
35
- version.sub(/pre(\d*)$/) { $1 == '' ? '1' : $1 }
36
- else
37
- "#{version}.99"
38
- end
39
- end
40
- end
41
-
42
- end
43
- end
1
+ # coding: utf-8
2
+
3
+ module ThinReports
4
+ module Layout
5
+
6
+ # @private
7
+ module Version
8
+ REQUIRED_RULES = ['>= 0.6.0.pre3', '< 0.8.0']
9
+
10
+ # @param [String] version
11
+ # @return [Boolean]
12
+ def self.compatible?(version)
13
+ compare(version, *REQUIRED_RULES)
14
+ end
15
+
16
+ # @param [String] base
17
+ # @param [Array<String>] rules
18
+ # @return [Boolean]
19
+ def self.compare(base, *rules)
20
+ rules.all? do |rule|
21
+ op, ver = rule.split(' ')
22
+ comparable_version(base).send(op.to_sym, comparable_version(ver))
23
+ end
24
+ end
25
+
26
+ # @return [String]
27
+ def self.inspect_required_rules
28
+ '(' + REQUIRED_RULES.join(' and ') + ')'
29
+ end
30
+
31
+ # @param [String] version
32
+ # @return [String]
33
+ def self.comparable_version(version)
34
+ if version =~ /pre/
35
+ version.sub(/pre(\d*)$/) { $1 == '' ? '1' : $1 }
36
+ else
37
+ "#{version}.99"
38
+ end
39
+ end
40
+ end
41
+
42
+ end
43
+ end
@@ -31,9 +31,6 @@ module ThinReports
31
31
  # @see ThinReports::Report::Base#use_layout
32
32
  def register_layout(layout, options = {}, &block)
33
33
  layout = if options.empty? || options[:default]
34
- if @default_layout
35
- raise ArgumentError, 'The default layout is already set.'
36
- end
37
34
  @default_layout = init_layout(layout)
38
35
  else
39
36
  id = options[:id].to_sym
@@ -128,4 +125,4 @@ module ThinReports
128
125
  end
129
126
 
130
127
  end
131
- end
128
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module ThinReports
4
4
  # The current version.
5
- VERSION = '0.7.5'
5
+ VERSION = '0.7.6'
6
6
  end
@@ -8,6 +8,16 @@ class ThinReports::Generator::TestPDF < MiniTest::Unit::TestCase
8
8
  # Alias
9
9
  PDF = ThinReports::Generator::PDF
10
10
 
11
+ def test_new_should_set_empty_title_when_the_default_layout_is_not_set
12
+ report = ThinReports::Report.new
13
+ report.start_new_page :layout => data_file('basic_layout1.tlf')
14
+
15
+ flexmock(PDF::Document).should_receive(:new).
16
+ with(Hash, :Title => nil).once
17
+
18
+ PDF.new(report, {})
19
+ end
20
+
11
21
  def test_new_should_set_title_as_metadata
12
22
  report = create_basic_report('basic_layout1.tlf') {|r| r.start_new_page }
13
23
 
@@ -16,4 +26,4 @@ class ThinReports::Generator::TestPDF < MiniTest::Unit::TestCase
16
26
 
17
27
  PDF.new(report, {})
18
28
  end
19
- end
29
+ end
data/test/unit/helper.rb CHANGED
@@ -1,14 +1,18 @@
1
1
  # coding: utf-8
2
2
 
3
- begin
4
- require 'rubygems'
5
- require 'minitest/spec'
6
- require 'minitest/unit'
7
- require 'turn'
8
- require 'flexmock'
9
- rescue LoadError => e
10
- $stderr.puts 'To run the unit tests, you need minitest and flexmock.'
11
- raise e
3
+ require 'rubygems'
4
+ require 'minitest/spec'
5
+ require 'minitest/unit'
6
+ require 'turn'
7
+ require 'flexmock'
8
+
9
+ require 'simplecov'
10
+ SimpleCov.start do
11
+ add_filter 'test/'
12
+ add_group 'Core', 'lib/thinreports/core'
13
+ add_group 'Generator', 'lib/thinreports/generator'
14
+ add_group 'Layout', 'lib/thinreports/layout'
15
+ add_group 'Report', 'lib/thinreports/report'
12
16
  end
13
17
 
14
18
  Turn.config.format = :progress