pivotal_to_pdf-formatters 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ed3d8f8c904a7b44d1460829796bb10531bcc57
4
- data.tar.gz: f9966ea9491cd6f11d537c96af729d7ae46726e2
3
+ metadata.gz: 68453e0da114b8c319c56ab34479b9bb4eef1d01
4
+ data.tar.gz: 2a397227e30a875329a2006ef299d81cbd9ef02e
5
5
  SHA512:
6
- metadata.gz: 5d0f6fe67fa772e0d6ab3f03a99164fb9147aab0159070414d89309fb60e836c72d48c76a772b1fca9d2eebe2d914b64827b4c55f97b859145e30da67dc5300d
7
- data.tar.gz: 7b9efad85d8bf8fb9f26f03dbca662de211a6d18b76269eb0036a04ea5a8becb821e88c4ad4f48cf0cdd3a5d336a32a4eaa8af1372fdf9119a430eef84f739fb
6
+ metadata.gz: 8575397ff93e3c0b1c4bdbf35f907e85afaebc40b45ab0f4100df884dcbc28680e6194bbef4d64738466edf32a3c3dd132ecfb480fe9219eae1bcbcd2a78ac1c
7
+ data.tar.gz: bb859eae67b8f72c2231b00f2b0206e9447a64b70f02f4b43f6f05a17b3fd8bd875075170d7d7a3f646e457d45e56e48d6edce7e99872d9dfda4770ac93d72cf
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.0.0-p451
1
+ 2.0.0-p645
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ v 0.2
2
+ * Add LargeText support
3
+ ```yaml
4
+ formatter: PivotalToPdf::Formatters::LargeText
5
+ ```
6
+
1
7
  v 0.0.4
2
8
  * Add Asian font support as a new formatter Asian
3
9
  ```yaml
data/README.md CHANGED
@@ -39,6 +39,7 @@ Design it good, do not afraid adding more help classes when needed.
39
39
  ##Contributors
40
40
  * [Yi Wen](https://github.com/ywen)
41
41
  * [Luke brown](https://github.com/tsdbrown)
42
+ * [Magne Land](https://github.com/magneland)
42
43
 
43
44
  ## Contributing
44
45
 
@@ -5,11 +5,12 @@ require 'rainbow'
5
5
  module PivotalToPdf
6
6
  module Formatters
7
7
  class Default < Base
8
+
8
9
  def write_to(destination)
9
10
  Prawn::Document.generate("#{destination}.pdf",
10
11
  :page_layout => :landscape,
11
- :margin => [25, 25, 50, 25],
12
- :page_size => [302, 432]) do |pdf|
12
+ :margin => [25, 25, 50, 25],
13
+ :page_size => [302, 432]) do |pdf|
13
14
 
14
15
  setup_font(pdf)
15
16
 
@@ -34,25 +35,26 @@ module PivotalToPdf
34
35
 
35
36
  pdf.text_box story.points, :size => 12, :at => [12, 50], :width => width-18 unless story.points.nil?
36
37
  pdf.text_box "Owner: " + (story.respond_to?(:owned_by) ? story.owned_by : "None"),
37
- :size => 8, :at => [12, 18], :width => width-18
38
+ :size => 8, :at => [12, 18], :width => width-18
38
39
 
39
40
  pdf.fill_color "999999"
40
- pdf.text_box story.story_type.capitalize, :size => 8, :align => :right, :at => [12, 18], :width => width-18
41
+ pdf.text_box story.story_type.capitalize, :size => 8, :align => :right, :at => [12, 18], :width => width-18
41
42
  pdf.fill_color "000000"
42
43
  pdf.start_new_page unless index == stories.size - 1
43
44
  end
44
- # pdf.number_pages "<page>/<total>", {:at => [pdf.bounds.right - 16, -28]}
45
45
 
46
46
  puts Rainbow(">>> Generated PDF file in '#{destination}.pdf'").foreground(:green)
47
- end
47
+ end
48
48
  rescue Exception
49
49
  puts Rainbow("[!] There was an error while generating the PDF file... What happened was:").foreground(:red)
50
50
  raise
51
51
  end
52
52
 
53
53
  private
54
+
54
55
  def setup_font(pdf)
55
56
  end
57
+
56
58
  end
57
59
  end
58
60
  end
@@ -0,0 +1,58 @@
1
+ require 'rubygems'
2
+ require 'prawn'
3
+ require 'rainbow'
4
+
5
+ module PivotalToPdf
6
+ module Formatters
7
+ class LargeText < Default # same as Default but larger text and no description
8
+
9
+ def write_to(destination)
10
+ Prawn::Document.generate("#{destination}.pdf",
11
+ :page_layout => :landscape,
12
+ :margin => [25, 25, 50, 25],
13
+ :page_size => [302, 432]) do |pdf|
14
+
15
+ setup_font(pdf)
16
+
17
+ stories.each_with_index do |story, index|
18
+ next if story.story_type == 'release' # save some trees
19
+
20
+ padding = 10
21
+ pdf.stroke_color = story.story_color
22
+ pdf.stroke_bounds
23
+ width = 370
24
+ pdf.line_width=6
25
+ # --- Write content
26
+ pdf.bounding_box [pdf.bounds.left+padding, pdf.bounds.top-padding], :width => width do
27
+ pdf.text max_len_str(story.formatted_name, 120), :size => 28, :inline_format => true
28
+ pdf.fill_color "52D017"
29
+ pdf.text story.formatted_labels, :size => 16
30
+ pdf.text "\n", :size => 28
31
+ pdf.fill_color "444444"
32
+ end
33
+ pdf.line(pdf.bounds.bottom_left, pdf.bounds.bottom_right)
34
+ pdf.stroke_bounds
35
+
36
+ pdf.text_box story.points, :size => 24, :at => [12, 30], :width => width-18 unless story.points.nil?
37
+ pdf.fill_color "999999"
38
+ pdf.text_box story.story_type.capitalize, :size => 16, :align => :right, :at => [12, 18], :width => width-18
39
+ pdf.fill_color "000000"
40
+ pdf.start_new_page unless index == stories.size - 1
41
+ end
42
+
43
+ puts Rainbow(">>> Generated PDF file in '#{destination}.pdf'").foreground(:green)
44
+ end
45
+ rescue Exception
46
+ puts Rainbow("[!] There was an error while generating the PDF file... What happened was:").foreground(:red)
47
+ raise
48
+ end
49
+
50
+ private
51
+
52
+ def max_len_str(str, max_len)
53
+ str.length <= max_len ? str : str[0...max_len-1] + '…'
54
+ end
55
+
56
+ end
57
+ end
58
+ end
@@ -1,5 +1,5 @@
1
1
  module PivotalToPdf
2
2
  module Formatters
3
- VERSION = "0.1"
3
+ VERSION = "0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivotal_to_pdf-formatters
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yi Wen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-01 00:00:00.000000000 Z
11
+ date: 2015-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -143,6 +143,7 @@ files:
143
143
  - lib/pivotal_to_pdf-formatters/asian.rb
144
144
  - lib/pivotal_to_pdf-formatters/base.rb
145
145
  - lib/pivotal_to_pdf-formatters/default.rb
146
+ - lib/pivotal_to_pdf-formatters/large_text.rb
146
147
  - lib/pivotal_to_pdf-formatters/teaser.rb
147
148
  - lib/pivotal_to_pdf-formatters/version.rb
148
149
  - pivotal_to_pdf-formatters.gemspec
@@ -168,9 +169,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
169
  version: '0'
169
170
  requirements: []
170
171
  rubyforge_project:
171
- rubygems_version: 2.2.2
172
+ rubygems_version: 2.0.14
172
173
  signing_key:
173
174
  specification_version: 4
174
175
  summary: The gem is a collection of possible formatters for the pivotal_to_pdf gem
175
176
  test_files:
176
177
  - spec/spec_helper.rb
178
+ has_rdoc: