Class: CoffeeLint::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/coffeelint/config.rb

Class Method Summary collapse

Class Method Details

.locateObject

Looks for existing config files and returns the first match.



6
7
8
9
10
11
12
13
14
# File 'lib/coffeelint/config.rb', line 6

def self.locate
  locations = default_locations

  # handle environment variables
  locations.push(ENV['COFFEELINT_CONFIG']) if ENV['COFFEELINT_CONFIG']
  locations.concat(config_files_in_path(ENV['HOME'])) if ENV['HOME']

  locations.compact.detect { |file| File.exists?(file) }
end

.parse(file_name) ⇒ Object

Parses a given JSON file to a Hash.



17
18
19
# File 'lib/coffeelint/config.rb', line 17

def self.parse(file_name)
  JSON.parse(File.read(file_name))
end