tokenr 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE.txt CHANGED
File without changes
File without changes
File without changes
data/lib/tokenr/tokens.rb CHANGED
@@ -8,7 +8,6 @@ class Tokens
8
8
  @tokens_pattern = tokens_pattern
9
9
  @writer = writer
10
10
  @checker = checker
11
- @globals = {}
12
11
  end
13
12
 
14
13
  def replace(path, default_environment='local')
@@ -20,16 +19,16 @@ class Tokens
20
19
  puts
21
20
 
22
21
  find_master_files_in(path).each do |file|
23
- @environments = {}
24
-
25
- read_tokens(file.gsub('.master' + File.extname(file), '.tokens.rb'))
26
- master_environments = @environments.dup
27
-
28
22
  read_tokens(@globals_file)
29
- only_use_environments_in(master_environments)
23
+ @globals = @environments.dup
24
+
25
+ read_tokens(file.gsub('.master' + File.extname(file), '.tokens.rb'))
26
+ only_use_environments_defined_in_tokens_rb
30
27
 
31
28
  @checker.check(@environments)
32
29
 
30
+ puts "Environments found - #{@environments.keys.join(', ')}"
31
+
33
32
  if !@environments.has_key?(default_environment)
34
33
  puts "Unable to find default environment #{default_environment}"
35
34
  puts "Setting default environment to #{@environments.keys.first}"
@@ -38,11 +37,11 @@ class Tokens
38
37
 
39
38
  @environments.each_pair do |environment, values|
40
39
  values[:Environment] = environment # Add the environment as a token
41
- @writer.write_for(environment, file, values, @globals, true)
40
+ @writer.write_for(environment, file, values, @globals[environment], true)
42
41
  end
43
42
 
44
43
  # Write out an App.config, or Web.config file (ie without the environment in the name)
45
- @writer.write_for('', file, @environments[default_environment], @globals)
44
+ @writer.write_for('', file, @environments[default_environment], @globals[default_environment])
46
45
  end
47
46
  end
48
47
 
@@ -52,7 +51,9 @@ class Tokens
52
51
  return Dir.glob("#{path}/**/#{@tokens_pattern}", File::FNM_CASEFOLD)
53
52
  end
54
53
 
55
- def read_tokens(path)
54
+ def read_tokens(path)
55
+ @environments = Hash.new({})
56
+
56
57
  if(File.exist?(path))
57
58
  begin
58
59
  eval(File.read(path))
@@ -64,9 +65,9 @@ class Tokens
64
65
  end
65
66
  end
66
67
 
67
- def only_use_environments_in(master_environments)
68
- @environments.each_key do |key|
69
- @environments.delete(key) if !master_environments.has_key?(key)
68
+ def only_use_environments_defined_in_tokens_rb()
69
+ @globals.each_key do |key|
70
+ @globals.delete(key) if !@environments.has_key?(key)
70
71
  end
71
72
  end
72
73
  end
File without changes
File without changes
File without changes
data/lib/tokenr.rb CHANGED
File without changes
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.0
4
+ version: 0.1.1
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-04-02 00:00:00.000000000 Z
12
+ date: 2013-04-08 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: -1476521593813482787
188
+ hash: 3764011758071452566
189
189
  required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  none: false
191
191
  requirements: