tokenr 0.1.2 → 0.1.3
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.
- data/lib/tokenr/tokens.rb +7 -3
- data/lib/tokenr/tokens_checker.rb +7 -7
- metadata +3 -3
data/lib/tokenr/tokens.rb
CHANGED
@@ -19,15 +19,18 @@ class Tokens
|
|
19
19
|
puts
|
20
20
|
|
21
21
|
find_master_files_in(path).each do |file|
|
22
|
+
# Read global variables
|
22
23
|
read_tokens(@globals_file)
|
23
24
|
@globals = @environments.dup
|
24
25
|
|
26
|
+
# Read file variables
|
25
27
|
read_tokens(file.gsub('.master' + File.extname(file), '.tokens.rb'))
|
26
28
|
only_use_environments_defined_in_tokens_rb
|
27
29
|
|
28
|
-
@checker.check(@environments)
|
29
|
-
|
30
30
|
puts "Environments found - #{@environments.keys.join(', ')}"
|
31
|
+
|
32
|
+
# Check for duplicates
|
33
|
+
@checker.check(@environments)
|
31
34
|
|
32
35
|
if !@environments.has_key?(default_environment)
|
33
36
|
puts "Unable to find default environment #{default_environment}"
|
@@ -35,12 +38,13 @@ class Tokens
|
|
35
38
|
default_environment = @environments.keys.first
|
36
39
|
end
|
37
40
|
|
41
|
+
# Write out a file for each environment
|
38
42
|
@environments.each_pair do |environment, values|
|
39
43
|
values[:Environment] = environment # Add the environment as a token
|
40
44
|
@writer.write_for(environment, file, values, @globals[environment], true)
|
41
45
|
end
|
42
46
|
|
43
|
-
# Write out
|
47
|
+
# Write out a file for the default environment
|
44
48
|
@writer.write_for('', file, @environments[default_environment], @globals[default_environment])
|
45
49
|
end
|
46
50
|
end
|
@@ -1,17 +1,17 @@
|
|
1
1
|
|
2
2
|
class TokensChecker
|
3
3
|
|
4
|
-
def check(
|
5
|
-
|
4
|
+
def check(environments)
|
5
|
+
first_hash = environments[environments.keys.first]
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
first_hash.each_pair do |key, value|
|
8
|
+
environments.keys.each do |environment|
|
9
9
|
# Skip if what we're comparing is actually the first environment
|
10
|
-
next if environment ==
|
10
|
+
next if environment == environments.keys.first
|
11
11
|
|
12
|
-
break if
|
12
|
+
break if environments[environment][key] != value
|
13
13
|
|
14
|
-
if(environment ==
|
14
|
+
if(environment == environments.keys.last)
|
15
15
|
puts "Unrequired token - all environments have the same value '#{value}' for key '#{key}'"
|
16
16
|
end
|
17
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tokenr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-12-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -185,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
185
|
version: '0'
|
186
186
|
segments:
|
187
187
|
- 0
|
188
|
-
hash: -
|
188
|
+
hash: -2872688510888981153
|
189
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
190
|
none: false
|
191
191
|
requirements:
|