textmerge 0.1.2 → 0.1.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: a6217090ac00259d857d4ef998ce718d59c86a65
4
- data.tar.gz: 374a4298efa86e8240306c5b68b8672e003f5ee4
3
+ metadata.gz: 305d040451550c67c9fb08b34db81fd55f87f831
4
+ data.tar.gz: a35cf6aebb597b8b94d7f5bd89014839a856a900
5
5
  SHA512:
6
- metadata.gz: abaed3ecc4462d2a5848cec6f333ffaef524dbd3e6c1ba169eff56278e7904c17c1dcfe2e3f42f68f77c7e1fd9a1e3d4b86125e65906ac3e1656d26c49b126d5
7
- data.tar.gz: bebc264a4512e9f7beb235a962f50138abf263f10dd159f0b133b20adf4b34866cbc91c0ed575bd7584e609de8381039661c8c418ae4e8ed5716245e33f1b419
6
+ metadata.gz: ab6e9f0fe0e3eed72b57827081539e3d4a5d6c5197479a42e28a4d21db005dd7c8eb31fde3cb4d3c75bb0cd32f7c8e140a49ba2c2307af539e2055c2d8ea0fa7
7
+ data.tar.gz: b6639f6ede6020323283cbd830a5783dcd9fe30db4c4c07bbb23e9fef17d6044c3d3cbc2279dda97782a433637086901621136d45e2cd35bafe34d20c5ee1e0a
data/lib/cli.rb CHANGED
@@ -39,6 +39,20 @@ module Textmerge
39
39
  say e.message, :red
40
40
  end
41
41
  end
42
+
43
+ desc 'build', 'Build input file template from a config template'
44
+ method_option :template, aliases: '-t', type: 'string', default: '', :required => true, desc: 'path to your template file'
45
+ def build
46
+ begin
47
+ raise ArgumentError, "Missing template" unless !options[:template].empty?
48
+ template = options[:template]
49
+ if File.exists?(template)
50
+ TextMerge::Build.new(template)
51
+ end
52
+ rescue Exception => e
53
+ say e.message, :red
54
+ end
55
+ end
42
56
  end
43
57
  end
44
58
  end
@@ -7,6 +7,17 @@ module Textmerge
7
7
  @template_file = options[:template]
8
8
  @input_file = options[:input]
9
9
  @output_file = options[:output]
10
+ # @sections = options[:sections]
11
+ end
12
+
13
+ def build_input_from_sections
14
+ #Returns input file
15
+ if @sections
16
+ section_array = @sections.split(" ")
17
+ section_array.each do |sect|
18
+
19
+ end
20
+ end
10
21
  end
11
22
 
12
23
  def read_template
@@ -38,7 +49,8 @@ module Textmerge
38
49
 
39
50
  def merge_responses(responses,data)
40
51
  responses.each do |k,v|
41
- data.gsub!(/\{#{k}\:.*?\}/,v)
52
+ regex = /\{#{k}\:.*?\}/
53
+ data.gsub!(regex,v)
42
54
  end
43
55
  data
44
56
  end
@@ -1,3 +1,3 @@
1
1
  module Textmerge
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textmerge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Simpson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-13 00:00:00.000000000 Z
11
+ date: 2015-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -155,4 +155,3 @@ test_files:
155
155
  - spec/lib/test_input.txt
156
156
  - spec/lib/textmerge_spec.rb
157
157
  - spec/spec_helper.rb
158
- has_rdoc: