Class: Dok::Config
- Inherits:
-
Object
- Object
- Dok::Config
- Defined in:
- lib/dok/config.rb
Constant Summary collapse
- CONFIG_DIRECTORY =
'.dok'
- CONFIG_FILE =
'config.rb'
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #base_directory_exists? ⇒ Boolean
- #create_directories(environments = ['development', 'production']) ⇒ Object
-
#initialize(path) ⇒ Config
constructor
A new instance of Config.
- #touch ⇒ Object
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
#path ⇒ Object (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
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 |
#touch ⇒ Object
24 25 26 |
# File 'lib/dok/config.rb', line 24 def touch FileUtils.touch(File.join(@path, CONFIG_FILE)) end |