Class: Crusoe::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/crusoe/configuration.rb

Constant Summary collapse

DEFAULT_DIRECTORY =
File.join(Dir.home, ".crusoe")
ENTRIES_DIRECTORY_NAME =
"entries".freeze
CONFIGURATION_FILE_NAME =
"config.yml".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_directory_path = DEFAULT_DIRECTORY) ⇒ Configuration

Returns a new instance of Configuration.



12
13
14
15
16
17
18
# File 'lib/crusoe/configuration.rb', line 12

def initialize(base_directory_path = DEFAULT_DIRECTORY)
  configuration_file_path = File.join(base_directory_path, CONFIGURATION_FILE_NAME)
  configs = YAML.load_file(configuration_file_path)
  @directory = configs["directory"] || DEFAULT_DIRECTORY
  @git_repo = configs["git_repo"]
  @entries_directory_path = File.join(base_directory_path, ENTRIES_DIRECTORY_NAME)
end

Instance Attribute Details

#entries_directory_pathObject (readonly)

Returns the value of attribute entries_directory_path.



10
11
12
# File 'lib/crusoe/configuration.rb', line 10

def entries_directory_path
  @entries_directory_path
end

#git_repoObject (readonly)

Returns the value of attribute git_repo.



9
10
11
# File 'lib/crusoe/configuration.rb', line 9

def git_repo
  @git_repo
end