pdf_ravager 0.0.1-java → 0.0.2-java
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.
- data/.travis.yml +8 -0
- data/Gemfile +9 -5
- data/README.md +1 -1
- data/lib/pdf_ravager/pdf.rb +6 -6
- data/lib/pdf_ravager/ravager.rb +3 -3
- data/lib/pdf_ravager/version.rb +2 -2
- data/pdf_ravager.gemspec +2 -2
- data/spec/pdf_spec.rb +14 -14
- metadata +5 -1
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
source :rubygems
|
2
2
|
|
3
3
|
group :development, :test do
|
4
|
-
gem "minitest",
|
5
|
-
gem "rspec",
|
6
|
-
gem "turn",
|
7
|
-
gem "bundler",
|
8
|
-
|
4
|
+
gem "minitest", "~> 4.1.0"
|
5
|
+
gem "rspec", "~> 2.11.0"
|
6
|
+
gem "turn", "~> 0.9.6", :require => false
|
7
|
+
gem "bundler", ">= 1.0.0"
|
8
|
+
gem "rake", "~> 0.9.2.2"
|
9
|
+
gem "json", "~> 1.7.5"
|
10
|
+
# Necessary for `rake release`
|
11
|
+
gem "jruby-openssl", "~> 0.7.7", :platforms => :jruby
|
12
|
+
end
|
data/README.md
CHANGED
data/lib/pdf_ravager/pdf.rb
CHANGED
@@ -17,15 +17,15 @@ module PDFRavager
|
|
17
17
|
@fields << {:name => name, :value => value, :type => :text}
|
18
18
|
end
|
19
19
|
|
20
|
-
def radio_group(
|
20
|
+
def radio_group(gname, &blk)
|
21
21
|
fields = []
|
22
22
|
# TODO: replace w/ singleton method?
|
23
23
|
PDF.instance_eval do
|
24
|
-
send(:define_method, :fill) do |
|
24
|
+
send(:define_method, :fill) do |name, opts={}|
|
25
25
|
return if opts.has_key?(:when) && !opts[:when]
|
26
26
|
return if opts.has_key?(:if) && !opts[:if]
|
27
27
|
return if opts.has_key?(:unless) && opts[:unless]
|
28
|
-
fields << {:name => name, :value =>
|
28
|
+
fields << {:name => "#{gname}.#{name}", :value => true, :type => :radio}
|
29
29
|
end
|
30
30
|
blk.call
|
31
31
|
send(:undef_method, :fill)
|
@@ -34,15 +34,15 @@ module PDFRavager
|
|
34
34
|
@fields += fields
|
35
35
|
end
|
36
36
|
|
37
|
-
def checkbox_group(
|
37
|
+
def checkbox_group(gname, &blk)
|
38
38
|
fields = []
|
39
39
|
# TODO: replace w/ singleton method?
|
40
40
|
PDF.instance_eval do
|
41
|
-
send(:define_method, :check) do |
|
41
|
+
send(:define_method, :check) do |name, opts={}|
|
42
42
|
return if opts.has_key?(:when) && !opts[:when]
|
43
43
|
return if opts.has_key?(:if) && !opts[:if]
|
44
44
|
return if opts.has_key?(:unless) && opts[:unless]
|
45
|
-
fields << {:name => name, :value =>
|
45
|
+
fields << {:name => "#{gname}.#{name}", :value => true, :type => :checkbox}
|
46
46
|
end
|
47
47
|
blk.call
|
48
48
|
send(:undef_method, :check)
|
data/lib/pdf_ravager/ravager.rb
CHANGED
@@ -32,9 +32,9 @@ module PDFRavager
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def set_field_value(name, value)
|
35
|
-
#
|
36
|
-
if
|
37
|
-
value = value
|
35
|
+
# Convert boolean values to default checkbox string value
|
36
|
+
if value.instance_of?(TrueClass) || value.instance_of?(FalseClass)
|
37
|
+
value = !!value ? '1' : '0'
|
38
38
|
end
|
39
39
|
# First use AcroForms method
|
40
40
|
begin
|
data/lib/pdf_ravager/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module PDFRavager
|
2
|
-
VERSION = "0.0.
|
3
|
-
end
|
2
|
+
VERSION = "0.0.2"
|
3
|
+
end
|
data/pdf_ravager.gemspec
CHANGED
@@ -12,11 +12,11 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.summary = %q{DSL to aid filling out AcroForms PDF and XFA documents}
|
13
13
|
s.description = %q{DSL to aid filling out AcroForms PDF and XFA documents}
|
14
14
|
|
15
|
-
s.
|
15
|
+
s.add_dependency "json"
|
16
16
|
s.add_development_dependency "bundler", ">= 1.0.0"
|
17
17
|
|
18
18
|
s.files = `git ls-files`.split("\n")
|
19
19
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
20
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
21
|
s.require_paths = ["lib"]
|
22
|
-
end
|
22
|
+
end
|
data/spec/pdf_spec.rb
CHANGED
@@ -79,59 +79,59 @@ class TestPDF < MiniTest::Unit::TestCase
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def test_that_radio_group_always_filled_is_filled
|
82
|
-
assert_includes @pdf.fields, {:name => 'radio_group_always_filled', :value =>
|
82
|
+
assert_includes @pdf.fields, {:name => 'radio_group_always_filled.foo', :value => true, :type => :radio}
|
83
83
|
end
|
84
84
|
|
85
85
|
def test_that_radio_group_when_true_is_set
|
86
|
-
assert_includes @pdf.fields, {:name => 'radio_group_when', :value =>
|
86
|
+
assert_includes @pdf.fields, {:name => 'radio_group_when.true', :value => true, :type => :radio}
|
87
87
|
end
|
88
88
|
|
89
89
|
def test_that_radio_group_when_false_is_not_set
|
90
|
-
refute_includes @pdf.fields, {:name => 'radio_group_when', :value =>
|
90
|
+
refute_includes @pdf.fields, {:name => 'radio_group_when.false', :value => true, :type => :radio}
|
91
91
|
end
|
92
92
|
|
93
93
|
def test_that_radio_group_if_true_is_set
|
94
|
-
assert_includes @pdf.fields, {:name => 'radio_group_if', :value =>
|
94
|
+
assert_includes @pdf.fields, {:name => 'radio_group_if.true', :value => true, :type => :radio}
|
95
95
|
end
|
96
96
|
|
97
97
|
def test_that_radio_group_if_false_is_not_set
|
98
|
-
refute_includes @pdf.fields, {:name => 'radio_group_if', :value =>
|
98
|
+
refute_includes @pdf.fields, {:name => 'radio_group_if.false', :value => true, :type => :radio}
|
99
99
|
end
|
100
100
|
|
101
101
|
def test_that_radio_group_unless_true_is_not_set
|
102
|
-
refute_includes @pdf.fields, {:name => 'radio_group_unless', :value =>
|
102
|
+
refute_includes @pdf.fields, {:name => 'radio_group_unless.true', :value => true, :type => :radio}
|
103
103
|
end
|
104
104
|
|
105
105
|
def test_that_radio_group_unless_false_is_set
|
106
|
-
assert_includes @pdf.fields, {:name => 'radio_group_unless', :value =>
|
106
|
+
assert_includes @pdf.fields, {:name => 'radio_group_unless.false', :value => true, :type => :radio}
|
107
107
|
end
|
108
108
|
|
109
109
|
def test_that_checkbox_group_always_checked_is_checked
|
110
|
-
assert_includes @pdf.fields, {:name => 'checkbox_group_always_checked', :value =>
|
110
|
+
assert_includes @pdf.fields, {:name => 'checkbox_group_always_checked.foo', :value => true, :type => :checkbox}
|
111
111
|
end
|
112
112
|
|
113
113
|
def test_that_checkbox_group_when_true_is_set
|
114
|
-
assert_includes @pdf.fields, {:name => 'checkbox_group_when', :value =>
|
114
|
+
assert_includes @pdf.fields, {:name => 'checkbox_group_when.true', :value => true, :type => :checkbox}
|
115
115
|
end
|
116
116
|
|
117
117
|
def test_that_checkbox_group_when_false_is_not_set
|
118
|
-
refute_includes @pdf.fields, {:name => 'checkbox_group_when', :value =>
|
118
|
+
refute_includes @pdf.fields, {:name => 'checkbox_group_when.false', :value => true, :type => :checkbox}
|
119
119
|
end
|
120
120
|
|
121
121
|
def test_that_checkbox_group_if_true_is_set
|
122
|
-
assert_includes @pdf.fields, {:name => 'checkbox_group_if', :value =>
|
122
|
+
assert_includes @pdf.fields, {:name => 'checkbox_group_if.true', :value => true, :type => :checkbox}
|
123
123
|
end
|
124
124
|
|
125
125
|
def test_that_checkbox_group_if_false_is_not_set
|
126
|
-
refute_includes @pdf.fields, {:name => 'checkbox_group_if', :value =>
|
126
|
+
refute_includes @pdf.fields, {:name => 'checkbox_group_if.false', :value => true, :type => :checkbox}
|
127
127
|
end
|
128
128
|
|
129
129
|
def test_that_checkbox_group_unless_true_is_not_set
|
130
|
-
refute_includes @pdf.fields, {:name => 'checkbox_group_unless', :value =>
|
130
|
+
refute_includes @pdf.fields, {:name => 'checkbox_group_unless.true', :value => true, :type => :checkbox}
|
131
131
|
end
|
132
132
|
|
133
133
|
def test_that_checkbox_group_unless_false_is_set
|
134
|
-
assert_includes @pdf.fields, {:name => 'checkbox_group_unless', :value =>
|
134
|
+
assert_includes @pdf.fields, {:name => 'checkbox_group_unless.false', :value => true, :type => :checkbox}
|
135
135
|
end
|
136
136
|
|
137
137
|
def test_json_serialization
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: pdf_ravager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: java
|
7
7
|
authors:
|
8
8
|
- Abe Voelker
|
@@ -50,6 +50,7 @@ extensions: []
|
|
50
50
|
extra_rdoc_files: []
|
51
51
|
files:
|
52
52
|
- .gitignore
|
53
|
+
- .travis.yml
|
53
54
|
- Gemfile
|
54
55
|
- LICENSE
|
55
56
|
- README.md
|
@@ -72,6 +73,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
72
73
|
requirements:
|
73
74
|
- - ! '>='
|
74
75
|
- !ruby/object:Gem::Version
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
hash: 2
|
75
79
|
version: '0'
|
76
80
|
none: false
|
77
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|