pivotal_to_pdf 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,6 +3,7 @@ gem 'rainbow'
3
3
  gem 'activeresource', "3.0.9"
4
4
  gem 'prawn'
5
5
  gem 'thor'
6
+ gem "pivotal_to_pdf-formatters"
6
7
  group :test do
7
8
  gem 'rspec'
8
9
  gem "guard-spork"
data/Gemfile.lock CHANGED
@@ -29,6 +29,7 @@ GEM
29
29
  pdf-reader (1.1.0)
30
30
  Ascii85 (~> 1.0.0)
31
31
  ruby-rc4
32
+ pivotal_to_pdf-formatters (0.0.1)
32
33
  prawn (0.12.0)
33
34
  pdf-reader (>= 0.9.0)
34
35
  ttfunk (~> 1.0.2)
@@ -55,6 +56,7 @@ DEPENDENCIES
55
56
  growl-rspec
56
57
  guard-rspec
57
58
  guard-spork
59
+ pivotal_to_pdf-formatters
58
60
  prawn
59
61
  rainbow
60
62
  rake
data/README.md CHANGED
@@ -75,14 +75,17 @@ In the ```.pivotal.yml``` file, if you define a key like
75
75
  formatter: PivotalToPdf::MyPrettyHtmlWriter
76
76
  ```
77
77
 
78
- The gem will use ```PivotalToPdf::MyPrettyHtmlWriter``` to generate the output.
78
+ The gem will use ```PivotalToPdf::Formatters::MyPrettyHtmlWriter``` to generate the output.
79
79
 
80
- The class implementation should have the same interface as the ```DefaultFormatter```
80
+ This feature is associated to the [issue #14](pivotal_to_pdf/issues/14). I basically rewrite the code to implement this myself.
81
81
 
82
- - The ```initialize``` should take an array of stories
83
- - The ```write_to``` method write the output
82
+ The actual formatters live in a [ seperate gem ](https://github.com/ywen/pivotal_to_pdf-formatters) so that only that gem needs to be updated when needed. Once that gem is updated, you can do:
84
83
 
85
- This feature is associated to the [issue #14](pivotal_to_pdf/issues/14). I basically rewrite the code to implement this myself.
84
+ ```bash
85
+ $ gem update pivotal_to_pdf-formatters
86
+ ```
87
+
88
+ to use the new formatters being added
86
89
 
87
90
  ##Contributors
88
91
  * [Yi Wen](https://github.com/ywen)
@@ -5,7 +5,7 @@ module PivotalToPdf
5
5
  config = Configure.new
6
6
  config.respond_to?(:formatter) ?
7
7
  config.formatter.constantize :
8
- PivotalToPdf::DefaultFormatter
8
+ PivotalToPdf::Formatters::Default
9
9
  end
10
10
  end
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module PivotalToPdf
2
- VERSION = "1.2.0"
2
+ VERSION = "1.3.0"
3
3
  end
@@ -3,13 +3,13 @@ require "pivotal_to_pdf/version"
3
3
  require 'rainbow'
4
4
  require 'thor'
5
5
  require 'active_resource'
6
+ require "pivotal_to_pdf-formatters"
6
7
  require 'pivotal_to_pdf/configure'
7
8
  require 'pivotal_to_pdf/formatter_factory'
8
9
  require 'pivotal_to_pdf/simple_text_formatter'
9
10
  require 'pivotal_to_pdf/pivotal'
10
11
  require 'pivotal_to_pdf/iteration'
11
12
  require 'pivotal_to_pdf/story'
12
- require 'pivotal_to_pdf/default_formatter'
13
13
  require 'pivotal_to_pdf/pt-workarounds'
14
14
 
15
15
  module PivotalToPdf
@@ -15,6 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
16
16
  s.require_paths = ["lib"]
17
17
  s.author = "Yi Wen"
18
+ s.add_runtime_dependency(%q<pivotal_to_pdf-formatters>)
18
19
  s.add_runtime_dependency(%q<activeresource>, "3.0.9")
19
20
  s.add_runtime_dependency(%q<prawn>, "0.12.0")
20
21
  s.add_runtime_dependency(%q<rainbow>, ">= 0")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivotal_to_pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-22 00:00:00.000000000 Z
12
+ date: 2012-04-23 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: pivotal_to_pdf-formatters
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
14
30
  - !ruby/object:Gem::Dependency
15
31
  name: activeresource
16
32
  requirement: !ruby/object:Gem::Requirement
@@ -116,7 +132,6 @@ files:
116
132
  - bin/pivotal_to_pdf
117
133
  - lib/pivotal_to_pdf.rb
118
134
  - lib/pivotal_to_pdf/configure.rb
119
- - lib/pivotal_to_pdf/default_formatter.rb
120
135
  - lib/pivotal_to_pdf/formatter_factory.rb
121
136
  - lib/pivotal_to_pdf/iteration.rb
122
137
  - lib/pivotal_to_pdf/pivotal.rb
@@ -1,62 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require 'prawn'
5
- require 'rainbow'
6
-
7
- module PivotalToPdf
8
- class DefaultFormatter
9
- attr_reader :stories
10
- private :stories
11
- def initialize(stories)
12
- @stories = stories
13
- p stories.size
14
- end
15
-
16
- def write_to(destination)
17
- Prawn::Document.generate("#{destination}.pdf",
18
- :page_layout => :landscape,
19
- :margin => [25, 25, 50, 25],
20
- :page_size => [302, 432]) do |pdf|
21
-
22
- # pdf.font "#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf"
23
- # pdf.start_new_page
24
-
25
- stories.each_with_index do |story, index|
26
- padding = 10
27
- pdf.stroke_color = story.story_color
28
- pdf.stroke_bounds
29
- width = 370
30
- pdf.line_width=6
31
- # --- Write content
32
- pdf.bounding_box [pdf.bounds.left+padding, pdf.bounds.top-padding], :width => width do
33
- pdf.text story.formatted_name, :size => 14, :inline_format => true
34
- pdf.fill_color "52D017"
35
- pdf.text story.label_text, :size => 8
36
- pdf.text "\n", :size => 14
37
- pdf.fill_color "444444"
38
- pdf.text story.formatted_description || "", :size => 10, :inline_format => true
39
- pdf.fill_color "000000"
40
- end
41
- pdf.line(pdf.bounds.bottom_left, pdf.bounds.bottom_right)
42
- pdf.stroke_bounds
43
-
44
- pdf.text_box story.points, :size => 12, :at => [12, 50], :width => width-18 unless story.points.nil?
45
- pdf.text_box "Owner: " + (story.respond_to?(:owned_by) ? story.owned_by : "None"),
46
- :size => 8, :at => [12, 18], :width => width-18
47
-
48
- pdf.fill_color "999999"
49
- pdf.text_box story.story_type.capitalize, :size => 8, :align => :right, :at => [12, 18], :width => width-18
50
- pdf.fill_color "000000"
51
- pdf.start_new_page unless index == stories.size - 1
52
- end
53
- # pdf.number_pages "<page>/<total>", {:at => [pdf.bounds.right - 16, -28]}
54
-
55
- puts ">>> Generated PDF file in '#{destination}.pdf'".foreground(:green)
56
- end
57
- rescue Exception
58
- puts "[!] There was an error while generating the PDF file... What happened was:".foreground(:red)
59
- raise
60
- end
61
- end
62
- end