docx_template 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docx_template.gemspec +2 -1
- data/lib/docx_template/docx.rb +1 -1
- data/spec/docx_spec.rb +10 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccf9a037bb6e640626cede1f356045b0adb2162a
|
4
|
+
data.tar.gz: 49ed452769c16dcca2f1dba2d3ff4c942470789a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 971845655e0ee7bc7f6becace56c21130549b3be8c0d28da5b5708eba84021b45077d4105e1c5ca525862a3748a5f47c07cad59d895f09ab939d0558126ebe98
|
7
|
+
data.tar.gz: 5f94f7ab7e608b05955c474fb1eda13c5bf2037d4bf738db800f7eaab7324fb0eedd17f0925c0b305cb3f0eba12035c099bcc612f6622fb83514d88709dddb0f
|
data/docx_template.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'docx_template/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "docx_template"
|
8
|
-
spec.version = "0.
|
8
|
+
spec.version = "0.3"
|
9
9
|
spec.authors = ["Maniankara"]
|
10
10
|
spec.email = ["Maniankara@gmail.com"]
|
11
11
|
spec.summary = %q{Docx templating library which could replace docx contents such as text, images etc. in one go.}
|
@@ -13,6 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
template = DocxTemplate::Docx.new "/opt/docx_template.docx"
|
14
14
|
template.replace_text("##SINGLE_REPLACE_TEXT##", "ACTUAL TEXT HERE")
|
15
15
|
template.replace_text("##MULTI_REPLACE_TEXT##", "ACTUAL TEXT HERE", true)
|
16
|
+
template.replace_header("##HEADER_REPLACE_TEXT##", "ACTUAL TEXT HERE", true)
|
16
17
|
template.replace_image("image1.jpeg", "/opt/image5.jpg")
|
17
18
|
template.save('/opt/final.docx')
|
18
19
|
}
|
data/lib/docx_template/docx.rb
CHANGED
data/spec/docx_spec.rb
CHANGED
@@ -33,4 +33,14 @@ RSpec.describe DocxTemplate::Docx do
|
|
33
33
|
template.save("/tmp/a.docx")
|
34
34
|
expect(@docx_verifier.verify_text_exists?("/tmp/a.docx", "##HEADER_REPLACE_TEXT##")).to be(false)
|
35
35
|
end
|
36
|
+
|
37
|
+
# Negative cases
|
38
|
+
it "Handling nil substitutions" do
|
39
|
+
template = DocxTemplate::Docx.new "spec/unit/templates/docx_template.docx"
|
40
|
+
template.replace_text("##MULTIPLE_REPLACE_TEXT##", nil)
|
41
|
+
template.save("/tmp/a.docx")
|
42
|
+
expect(@docx_verifier.verify_text_exists?("/tmp/a.docx", "##MULTIPLE_REPLACE_TEXT##")).to be(false)
|
43
|
+
end
|
44
|
+
|
45
|
+
|
36
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docx_template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maniankara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -40,6 +40,7 @@ dependencies:
|
|
40
40
|
version: '0'
|
41
41
|
description: "\n template = DocxTemplate::Docx.new \"/opt/docx_template.docx\"\n
|
42
42
|
\ template.replace_text(\"##SINGLE_REPLACE_TEXT##\", \"ACTUAL TEXT HERE\")\n template.replace_text(\"##MULTI_REPLACE_TEXT##\",
|
43
|
+
\"ACTUAL TEXT HERE\", true)\n template.replace_header(\"##HEADER_REPLACE_TEXT##\",
|
43
44
|
\"ACTUAL TEXT HERE\", true)\n template.replace_image(\"image1.jpeg\", \"/opt/image5.jpg\")\n
|
44
45
|
\ template.save('/opt/final.docx')\n "
|
45
46
|
email:
|