Class: DockerRailsConfigReader
- Inherits:
-
Object
- Object
- DockerRailsConfigReader
- Defined in:
- lib/support/docker_rails_config_reader.rb
Instance Attribute Summary collapse
-
#definitions ⇒ Object
Returns the value of attribute definitions.
Instance Method Summary collapse
-
#initialize ⇒ DockerRailsConfigReader
constructor
A new instance of DockerRailsConfigReader.
- #rails_app_configuration ⇒ Object
Constructor Details
#initialize ⇒ DockerRailsConfigReader
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
#definitions ⇒ Object
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_configuration ⇒ Object
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 |