Skip to content

Commit

Permalink
Added output option to yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
Casper devboxmatsumoto.springer-sbm.com committed Nov 1, 2012
1 parent 9abe5b2 commit 00ea216
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions spec/statcollector_spec.rb
Expand Up @@ -9,6 +9,7 @@
max: 10
one_per_day: true
decending: true
output: csv
collect:
command1: "a command"
command2: another command
Expand All @@ -35,6 +36,7 @@
config.location.should eq("/a/location/for/myproject")
config.one_per_day.should eq(true)
config.decending.should eq(true)
config.output.should eq("csv")
end

it "should be able to be configured with sensible defaults" do
Expand All @@ -44,6 +46,7 @@
config.location.should eq("/a/location/for/myproject")
config.one_per_day.should eq(false)
config.decending.should eq(false)
config.output.should eq("graph")
end

it "should not be able to be configured without a location" do
Expand Down
4 changes: 2 additions & 2 deletions statcollector.rb
Expand Up @@ -60,7 +60,7 @@ def runCmd(conf,cmd)
end

class StatConfiguration
attr_accessor :max, :name, :location, :collect, :tmp_repo, :tmp_root, :one_per_day, :decending
attr_accessor :max, :name, :location, :collect, :tmp_repo, :tmp_root, :one_per_day, :decending, :output

def initialize(yaml)
raise "Configuration must include a location" if yaml["location"].nil?
Expand All @@ -72,7 +72,7 @@ def initialize(yaml)
@decending = yaml["decending"]||=false
@tmp_root = Dir.mktmpdir
@tmp_repo = @tmp_root + "/" + @name

@output = yaml["output"]||="graph"
end
end

0 comments on commit 00ea216

Please sign in to comment.