Class: Dok::Config

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

Constant Summary collapse

CONFIG_DIRECTORY =
'.dok'
CONFIG_FILE =
'config.rb'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Config

Returns a new instance of Config.



11
12
13
# File 'lib/dok/config.rb', line 11

def initialize(path)
  @path = File.join(path, CONFIG_DIRECTORY)
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/dok/config.rb', line 9

def path
  @path
end

Instance Method Details

#base_directory_exists?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/dok/config.rb', line 15

def base_directory_exists?
  File.exists?(@path)
end

#create_directories(environments = ['development', 'production']) ⇒ Object



19
20
21
22
# File 'lib/dok/config.rb', line 19

def create_directories(environments = ['development', 'production'])
  Dir.mkdir(@path)
  environments.each { |env| Dir.mkdir(File.join(@path, env)) }
end

#touchObject



24
25
26
# File 'lib/dok/config.rb', line 24

def touch
  FileUtils.touch(File.join(@path, CONFIG_FILE))
end