text-interpolator 1.1.5 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/CHANGES +4 -0
- data/lib/text_interpolator/text_interpolator.rb +5 -1
- data/lib/text_interpolator/version.rb +1 -1
- data/spec/spec_helper.rb +0 -4
- data/spec/text_interpolator_spec.rb +17 -6
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NGFkYWMxNzI2N2U5MTBiM2MzMTZhNWFjNjQwMThlNzAzZTYwMDJmZA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MmQ5NDgyNGE0ZDU4ZjEwZDExY2I0NzEwYzgzYTVmMDQ3OWY2MzAwZg==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NTJmN2I5NDc3Y2MzYWQyNWM0MDFkNWNiMzA3YzA2YTI4YWM3OWZjOTUyNDY1
|
10
|
+
MjkwZTYxOTRhYjI0NmFiMGMyNWNhMTA2ZjlhNTRmOWQyOTYyNTE4ODkwNWQy
|
11
|
+
MjJmYWM5YzVhZjUxZDc3YTY2YTQ0ZTYzNGVmOTlmYWY0MDMyYTY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YTc1ZWU5ZGU0ZmVjZWIxOGJiYmE1NmJlNDc3NzZkMTUzYTYxZjY2MDIxN2Y4
|
14
|
+
ZmZmMTM5YTBlZDRhYTk3Y2IwMWI4NzA5MDY4ZmY1NTk2NTQ3NTkwYzExMzI3
|
15
|
+
MWQ5ZDkyNzVkNThjNmMwMWM4MWJkMjliZjFiN2Q1YjMzNWU5ZGU=
|
data/CHANGES
CHANGED
@@ -107,6 +107,10 @@ class TextInterpolator
|
|
107
107
|
build_variable(var_table, key, key, value)
|
108
108
|
end
|
109
109
|
|
110
|
+
var_table.each do |key, value|
|
111
|
+
var_table[key] = interpolate_variable value.to_s, var_table
|
112
|
+
end
|
113
|
+
|
110
114
|
var_table
|
111
115
|
end
|
112
116
|
|
@@ -114,7 +118,7 @@ class TextInterpolator
|
|
114
118
|
if value.kind_of? Hash
|
115
119
|
build_hash var_table, compound_key, value
|
116
120
|
else
|
117
|
-
var_table[key] =
|
121
|
+
var_table[key] = value
|
118
122
|
end
|
119
123
|
end
|
120
124
|
|
data/spec/spec_helper.rb
CHANGED
@@ -2,9 +2,9 @@ require File.expand_path('spec_helper', File.dirname(__FILE__))
|
|
2
2
|
|
3
3
|
require 'text_interpolator'
|
4
4
|
|
5
|
-
describe TextInterpolator do
|
5
|
+
RSpec.describe TextInterpolator do
|
6
6
|
|
7
|
-
|
7
|
+
context "#interpolate_string" do
|
8
8
|
it "interpolates string with %{} symbol tokens" do
|
9
9
|
env = {name1: 'value1', name2: 'value2'}
|
10
10
|
|
@@ -63,7 +63,7 @@ describe TextInterpolator do
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
|
66
|
+
context "#interpolate_io" do
|
67
67
|
it "interpolates io stream" do
|
68
68
|
env = {name1: 'value1', name2: 'value2'}
|
69
69
|
ENV['name3'] = 'value3'
|
@@ -74,7 +74,7 @@ describe TextInterpolator do
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
|
77
|
+
context "#interpolate_hash" do
|
78
78
|
it "interpolates simple hash" do
|
79
79
|
hash = {
|
80
80
|
user: ENV['USER'],
|
@@ -116,7 +116,16 @@ describe TextInterpolator do
|
|
116
116
|
|
117
117
|
mysql: {
|
118
118
|
user: '#{credentials.settings.user}',
|
119
|
-
}
|
119
|
+
},
|
120
|
+
|
121
|
+
project: {
|
122
|
+
home: '/some_home'
|
123
|
+
},
|
124
|
+
|
125
|
+
instant_client: {
|
126
|
+
src_dir: '#{project.home}/downloads',
|
127
|
+
basic_zip: '#{instant_client.src_dir}/instantclient-basic-macos.x64-123.zip'
|
128
|
+
},
|
120
129
|
}
|
121
130
|
|
122
131
|
result = subject.interpolate hash
|
@@ -124,7 +133,9 @@ describe TextInterpolator do
|
|
124
133
|
expect(result[:postgres][:user]).to eq hash[:credentials][:user]
|
125
134
|
expect(result[:mysql][:user]).to eq hash[:credentials][:settings][:user]
|
126
135
|
|
136
|
+
expect(result[:instant_client][:basic_zip]).to eq "/some_home/downloads/instantclient-basic-macos.x64-123.zip"
|
137
|
+
|
127
138
|
expect(subject.errors).to be_empty
|
128
139
|
end
|
129
140
|
end
|
130
|
-
end
|
141
|
+
end
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: text-interpolator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Shvets
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gemspec_deps_gen
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: gemcutter
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0.7'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.7'
|
41
41
|
description: Simple library for interpolation of variables inside the text.
|
@@ -44,10 +44,10 @@ executables: []
|
|
44
44
|
extensions: []
|
45
45
|
extra_rdoc_files: []
|
46
46
|
files:
|
47
|
-
-
|
48
|
-
-
|
49
|
-
-
|
50
|
-
-
|
47
|
+
- .gitignore
|
48
|
+
- .idea/codeStyleSettings.xml
|
49
|
+
- .ruby-gemset
|
50
|
+
- .ruby-version
|
51
51
|
- CHANGES
|
52
52
|
- Gemfile
|
53
53
|
- LICENSE
|
@@ -70,12 +70,12 @@ require_paths:
|
|
70
70
|
- lib
|
71
71
|
required_ruby_version: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ! '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
|
-
- -
|
78
|
+
- - ! '>='
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|