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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8de0ab802b5846e6c2c6ef7d65a254b6515803cc
4
- data.tar.gz: 4240ab789b88a6fc281e4217b897c7effed15a2e
3
+ metadata.gz: ccf9a037bb6e640626cede1f356045b0adb2162a
4
+ data.tar.gz: 49ed452769c16dcca2f1dba2d3ff4c942470789a
5
5
  SHA512:
6
- metadata.gz: 825187871496b970ea789fda0a11416b13b6f66e08269dfe3b1cc930689b3f9bee3cfd48474e8d11a1550f490b8c06501885627cc0b143242bb90f4f81397229
7
- data.tar.gz: cd89852f2474baa12dedacaf31e74e4d8c9465915693cb2519cdf1d464005460e262c434594fcb1399c6a6adbbe6b3cdfaf9f42d4659be755c0bd9463f623489
6
+ metadata.gz: 971845655e0ee7bc7f6becace56c21130549b3be8c0d28da5b5708eba84021b45077d4105e1c5ca525862a3748a5f47c07cad59d895f09ab939d0558126ebe98
7
+ data.tar.gz: 5f94f7ab7e608b05955c474fb1eda13c5bf2037d4bf738db800f7eaab7324fb0eedd17f0925c0b305cb3f0eba12035c099bcc612f6622fb83514d88709dddb0f
@@ -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.2"
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
  }
@@ -96,7 +96,7 @@ module DocxTemplate
96
96
  attr_writer :type
97
97
  def initialize(src, dest, occurances)
98
98
  @src_entity = src
99
- @dest_entity = dest
99
+ @dest_entity = ( dest ? dest : "" )
100
100
  @occurances = occurances
101
101
  end
102
102
 
@@ -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.2'
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-21 00:00:00.000000000 Z
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: