Method: Cuboid::OptionGroups::Paths#initialize

Defined in:
lib/cuboid/option_groups/paths.rb

#initializePaths

Returns a new instance of Paths.



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/cuboid/option_groups/paths.rb', line 75

def initialize
    @root = self.root_path
    FileUtils.mkdir_p home_path

    @snapshots = self.config['snapshots'] || home_path + 'snapshots/'
    FileUtils.mkdir_p @snapshots

    @reports = self.config['reports'] || home_path + 'reports/'
    FileUtils.mkdir_p @reports

    if ENV['CUBOID_LOGDIR'].to_s != ''
        @logs = "#{ENV['CUBOID_LOGDIR']}/"
    elsif self.config['logs']
        @logs = self.config['logs']
    else
        @logs = "#{home_path}logs/"
        FileUtils.mkdir_p @logs
    end

    @lib         = @root    + 'lib/cuboid/'
    @executables = @lib     + 'processes/executables/'
    @support     = @lib     + 'support/'
    @mixins      = @support + 'mixins/'

    instance_variables.each do |iv|
        defaults[iv.to_s.sub( '@', '' ).to_sym] = instance_variable_get( iv )
    end

    tmpdir
end