ditto_code 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dittocode/environments.rb +11 -5
- data/lib/dittocode/parse.rb +11 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad4ecfcfac429c037a6d0c9bb543e2ade3594fea
|
4
|
+
data.tar.gz: 3de061072bc52d8052dfe5f55c9cfcff09671b6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44ab1072370ac9e39ffcb1950b529d1ee06dba58823454701523d5b0e03334ab02fd7667d71aa9c73abc2e827133ebf4fb867a29d9fd10dfb87a7569f3dda3e1
|
7
|
+
data.tar.gz: 02f84b8d808f653b83667f189c6766f22a1a4801e0ee78eaf779c3358dc7c058aab794fac51e3c9b73303d2def68a03b2858807e52105e2cb7b9ba974f278fc8
|
@@ -13,12 +13,18 @@ module DittoCode
|
|
13
13
|
# True if the environment is included
|
14
14
|
def isIncluded? (environment)
|
15
15
|
|
16
|
-
ENV["DITTOCODE_ENV"]
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
if ENV["DITTOCODE_ENV"]
|
17
|
+
|
18
|
+
ENV["DITTOCODE_ENV"].split(',').each do |env|
|
19
|
+
if environment.split(",").include? env
|
20
|
+
return true
|
21
|
+
else
|
22
|
+
return false
|
23
|
+
end
|
21
24
|
end
|
25
|
+
else
|
26
|
+
# Undefined environment, always true
|
27
|
+
return true
|
22
28
|
end
|
23
29
|
end
|
24
30
|
end
|
data/lib/dittocode/parse.rb
CHANGED
@@ -57,6 +57,7 @@ module DittoCode
|
|
57
57
|
rem = /[\s]*DittoCode::(?<action>Remove|Hold)File.if[\s]+['|"](?<environment>[a-zA-Z,]+)['|"][\s]*/.match(line)
|
58
58
|
is = /[\s]*(?<action>if|unless)[\s]+DittoCode::Exec.is[\s]+['|"](?<environment>[a-zA-Z,]+)['|"]/.match(line)
|
59
59
|
m = /[\s]*DittoCode::Exec.if[\s]+['|"](?<environment>[a-zA-Z,]+)['|"] do/.match(line)
|
60
|
+
commented = /^[\s]*#/.match(line)
|
60
61
|
end
|
61
62
|
|
62
63
|
# Remove files
|
@@ -97,6 +98,14 @@ module DittoCode
|
|
97
98
|
|
98
99
|
end
|
99
100
|
|
101
|
+
# Commented
|
102
|
+
elsif !@isView && commented
|
103
|
+
|
104
|
+
if !actions[:atack] || DittoCode::Environments.isIncluded?(actions[:env])
|
105
|
+
# Write on the file
|
106
|
+
check_with_indent(out_file, line)
|
107
|
+
end
|
108
|
+
|
100
109
|
# Block conditionals
|
101
110
|
elsif m
|
102
111
|
# A block as been detected
|
@@ -118,7 +127,7 @@ module DittoCode
|
|
118
127
|
# If is the last end, it's coincide with the end of the block
|
119
128
|
if actions[:ends] == 1
|
120
129
|
actions[:atack] = false
|
121
|
-
elsif actions[:env]
|
130
|
+
elsif DittoCode::Environments.isIncluded?(actions[:env])
|
122
131
|
# Only how if we must mantain it
|
123
132
|
check_with_indent(out_file, line)
|
124
133
|
end
|
@@ -129,7 +138,7 @@ module DittoCode
|
|
129
138
|
else
|
130
139
|
|
131
140
|
# prints of coincide with the environment
|
132
|
-
if actions[:env]
|
141
|
+
if DittoCode::Environments.isIncluded?(actions[:env])
|
133
142
|
check_with_indent(out_file, line)
|
134
143
|
end
|
135
144
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ditto_code
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Angel M Miguel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: indentation
|