Method: Longbow.json_object_from_directory

Defined in:
lib/longbow/json.rb

.json_object_from_directory(directory) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/longbow/json.rb', line 8

def self.json_object_from_directory directory
  return nil unless directory

  # Check for longbow.json
  @json_path = directory + '/longbow.json'
  unless File.exists?(@json_path)
    Longbow::red "\n  Couldn't find longbow.json at #{@json_path}\n"
    puts "  Run this command to install the correct files:\n  longbow install\n"
    return nil
  end

  # Create hash from longbow.json
  json_contents = File.open(@json_path).read
  return json_object_from_string json_contents
end