one_conf_compare 0.0.2 → 0.0.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.
Files changed (2) hide show
  1. data/lib/one_conf_compare.rb +10 -12
  2. metadata +3 -3
@@ -26,6 +26,9 @@ class DirectoryScan
26
26
  def setdir=( dir )
27
27
  @dir = dir
28
28
  end
29
+ def setfile=( file )
30
+ @file = file
31
+ end
29
32
  def get_files
30
33
  config_files = []
31
34
  Dir.glob(@dir + "/**/*.cfg") do |e|
@@ -34,38 +37,33 @@ class DirectoryScan
34
37
  end
35
38
  config_files
36
39
  end
37
- def examine_file=( filetocheck )
38
- @filetocheck = filetocheck
39
- if @filetocheck.match /[a-z0-9]+-[0-9]+-[prod|stg|test]+-[nydc1|ladc1|chidc1|test].[nydc1|ladc1|chidc1|test]/
40
+ def examine_file
41
+ @filetocheck = @file
42
+ if @filetocheck.match /[a-z0-9]+-[0-9]+-[prod|stg|test]+-[nydc1|ladc1|chidc1|test|nyc].[nydc1|ladc1|chidc1|test|nyc]/
40
43
  @dc = @filetocheck.split('.')
41
44
  @app = @filetocheck.split('-')
42
45
  if @app[2] == "test"
43
46
  @dc[1] = "nydc1"
44
47
  end
45
- if @dc[1] == "nyc"
46
- @dc[1] = "nydc1"
47
- end
48
+ if @dc[1] == "nyc"
49
+ return nil
50
+ end
48
51
  @directory = @dir + @dc[1] + "/" + @app[0]
49
- puts @directory
50
52
  if ! File.directory? @directory
51
53
  Dir.mkdir(@directory)
52
54
  end
53
55
  @fullpath = @directory + "/" + @filetocheck + ".cfg"
54
56
  end
55
57
  end
56
- def get_fullpath
57
- @fullpath
58
- end
59
58
  def create_file=( file_to_create )
60
59
  @file_to_create = file_to_create
61
- #puts @file_to_create
62
60
  File.new(@file_to_create, "w")
63
61
  @file_h = File.open(@file_to_create,"w")
64
62
  @file_h.puts("define host{")
65
63
  @file_h.puts(" use linux-server")
66
64
  @file_h.puts(" host_name " + @filetocheck)
67
65
  @file_h.puts(" alias " + @filetocheck)
68
- @file_h.puts(" hostgroups appnode,linux")
66
+ @file_h.puts(" hostgroups appnode")
69
67
  @file_h.puts("}")
70
68
  end
71
69
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ariel Moskovich
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-12-26 00:00:00 +02:00
17
+ date: 2013-01-15 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies: []
20
20