Class: Trackablaze::Command

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/trackablaze/command.rb

Instance Method Summary collapse

Instance Method Details

#track(file) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/trackablaze/command.rb', line 10

def track(file)      
  Trackablaze::Tracker.load_trackers
  config = YAML::load( File.open( file ) )
  
  tracker_items = []
  config.each do |c|
    tracker_items << Trackablaze::TrackerItem.new(c)
  end
  
  results = Trackablaze::TrackerItem.run(tracker_items)
  
  tracker_items.each do |tracker_item|
    puts "[ #{tracker_item.title} ]".center(75,'-')
    puts "Key: #{tracker_item.key2}"
    puts "params: #{tracker_item.params}"
    puts "results: #{results[tracker_item.key]}"
  end
end