class Catalyst::Config

Constants

CATALYST_CONFIG_PATH
PACKAGE_PATH

Public Class Methods

new() click to toggle source
# File lib/catalyst/config.rb, line 21
    def initialize
      @values = if File.exists?(CATALYST_CONFIG_PATH)
        JSON.parse(File.read(CATALYST_CONFIG_PATH))
      elsif File.exists?(PACKAGE_PATH)
        JSON.parse(File.read(PACKAGE_PATH))['catalyst']
      else
        raise ::Catalyst::MissingConfig,
              "Missing 'catalyst.config.json' or 'package.json' file in: #{Dir.pwd}"
      end

      if @values.nil?
        raise ::Catalyst::MissingConfig, <<~MESSAGE
          Missing "catalyst" config in package.json file.
          Please follow the instructions here to set up Catalyst:
          https://github.com/friendsoftheweb/catalyst
        MESSAGE
      end
    end

Public Instance Methods

context_path() click to toggle source
# File lib/catalyst/config.rb, line 40
def context_path
  File.join(Dir.pwd, @values['contextPath'] || @values['rootPath'])
end