Class: DockerRailsConfigReader

Inherits:
Object
  • Object
show all
Defined in:
lib/support/docker_rails_config_reader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDockerRailsConfigReader

Returns a new instance of DockerRailsConfigReader.



5
6
7
8
9
10
11
12
13
# File 'lib/support/docker_rails_config_reader.rb', line 5

def initialize
  @definitions = nil
  config_file = "#{FileUtils.pwd}/docker/docker-rails.json"
  raise "Could not find your project config at: #{config_file} .  Did you run: 'rake docker:install' ?" if (!File.exist?(config_file))
  File.open(config_file, "r") do |file|
    str = file.read
    @definitions = JSON.parse(str)
  end
end

Instance Attribute Details

#definitionsObject

Returns the value of attribute definitions.



3
4
5
# File 'lib/support/docker_rails_config_reader.rb', line 3

def definitions
  @definitions
end

Instance Method Details

#rails_app_configurationObject



15
16
17
18
19
20
21
22
23
# File 'lib/support/docker_rails_config_reader.rb', line 15

def rails_app_configuration
  @definitions.each do |definition|
    name = definition.keys.first
    if (name == "rails_app")
      return definition
    end
  end
  return nil
end