Class: UpdateConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/commands/update-config.rb

Instance Method Summary collapse

Instance Method Details

#do(role, solution, gitRoot) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/commands/update-config.rb', line 5

def do (role, solution, gitRoot)

    steps = {}

    if File.directory? "#{gitRoot}"
        # write to configure the registration of the service
        if (File.exists?("#{gitRoot}/configure.json"))
            steps = JSON.parse(File.read("#{gitRoot}/configure.json"))
        else
            steps["steps"] = []
        end

        conf = {
            :role => role,
            :solution => solution
        }
        steps["steps"].push(conf)

        File.open("#{gitRoot}/configure.json", 'w') { |file| file.puts(JSON.generate(steps)) }
    end
end