pivotal_to_pdf-formatters 0.1 → 0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +6 -0
- data/README.md +1 -0
- data/lib/pivotal_to_pdf-formatters/default.rb +8 -6
- data/lib/pivotal_to_pdf-formatters/large_text.rb +58 -0
- data/lib/pivotal_to_pdf-formatters/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68453e0da114b8c319c56ab34479b9bb4eef1d01
|
4
|
+
data.tar.gz: 2a397227e30a875329a2006ef299d81cbd9ef02e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8575397ff93e3c0b1c4bdbf35f907e85afaebc40b45ab0f4100df884dcbc28680e6194bbef4d64738466edf32a3c3dd132ecfb480fe9219eae1bcbcd2a78ac1c
|
7
|
+
data.tar.gz: bb859eae67b8f72c2231b00f2b0206e9447a64b70f02f4b43f6f05a17b3fd8bd875075170d7d7a3f646e457d45e56e48d6edce7e99872d9dfda4770ac93d72cf
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.0-
|
1
|
+
2.0.0-p645
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -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
|
12
|
-
:page_size
|
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
|
-
|
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,
|
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
|
-
|
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
|
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.
|
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:
|
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.
|
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:
|