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 +4 -4
- data/lib/cli.rb +14 -0
- data/lib/textmerge/merge.rb +13 -1
- data/lib/textmerge/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 305d040451550c67c9fb08b34db81fd55f87f831
|
4
|
+
data.tar.gz: a35cf6aebb597b8b94d7f5bd89014839a856a900
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/textmerge/merge.rb
CHANGED
@@ -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
|
-
|
52
|
+
regex = /\{#{k}\:.*?\}/
|
53
|
+
data.gsub!(regex,v)
|
42
54
|
end
|
43
55
|
data
|
44
56
|
end
|
data/lib/textmerge/version.rb
CHANGED
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.
|
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-
|
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:
|