summaryrefslogtreecommitdiff
path: root/lib/oxidized/output/file.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized/output/file.rb')
-rw-r--r--lib/oxidized/output/file.rb15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/oxidized/output/file.rb b/lib/oxidized/output/file.rb
index ee8a9a6..f3443b4 100644
--- a/lib/oxidized/output/file.rb
+++ b/lib/oxidized/output/file.rb
@@ -3,20 +3,19 @@ class OxFile < Output
require 'fileutils'
def initialize
- @cfg = CFG.output[:file]
+ @cfg = CFG.output.file
end
def setup
- if not @cfg
- CFG.output[:file] = {
- :directory => File.join(Config::Root, 'configs')
- }
- CFG.save
+ if @cfg.empty?
+ CFGS.user.output.file.directory = File.join(Config::Root, 'configs')
+ CFGS.save :user
+ raise NoConfig, 'no output file config, edit ~/.config/oxidized/config'
end
end
def store node, data, opt={}
- file = @cfg[:directory]
+ file = @cfg.directory
if opt[:group]
file = File.join File.dirname(file), opt[:group]
end
@@ -26,7 +25,7 @@ class OxFile < Output
end
def fetch node, group
- cfg_dir = @cfg[:directory]
+ cfg_dir = @cfg.directory
if group # group is explicitly defined by user
IO.readlines File.join(cfg_dir, group, node)
else