Class: Zerg::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/zerg/runner.rb

Class Method Summary collapse

Class Method Details

.clean(task, debug) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/zerg/runner.rb', line 68

def self.clean(task, debug)
    # load the hive first
    Zerg::Hive.instance.load

    puts "Loaded hive. Looking for task #{task}..."
    abort("ERROR: Task #{task} not found in current hive!") unless Zerg::Hive.instance.hive.has_key?(task) 

    begin
        pmgr = ZergGemPlugin::Manager.instance
        pmgr.load
        driver = pmgr.create("/driver/#{Zerg::Hive.instance.hive[task]["vm"]["driver"]["drivertype"]}")
        driver.clean Zerg::Hive.instance.load_path, task, Zerg::Hive.instance.hive[task], debug
    rescue ZergGemPlugin::PluginNotLoaded
        abort("ERROR: driver #{Zerg::Hive.instance.hive[task]["vm"]["driver"]["drivertype"]} not found. Did you install the plugin gem?")
    end
    puts("SUCCESS!")
end

.halt(task, debug) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/zerg/runner.rb', line 49

def self.halt(task, debug)
    # load the hive first
    Zerg::Hive.instance.load

    puts "Loaded hive. Looking for task #{task}..."
    abort("ERROR: Task #{task} not found in current hive!") unless Zerg::Hive.instance.hive.has_key?(task) 

    # halt!
    begin
        pmgr = ZergGemPlugin::Manager.instance
        pmgr.load
        driver = pmgr.create("/driver/#{Zerg::Hive.instance.hive[task]["vm"]["driver"]["drivertype"]}")
        driver.halt Zerg::Hive.instance.load_path, task, Zerg::Hive.instance.hive[task], debug
    rescue ZergGemPlugin::PluginNotLoaded
        abort("ERROR: driver #{Zerg::Hive.instance.hive[task]["vm"]["driver"]["drivertype"]} not found. Did you install the plugin gem?")
    end
    puts("SUCCESS!")
end

.rush(task, debug) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/zerg/runner.rb', line 29

def self.rush(task, debug)
    # load the hive first
    Zerg::Hive.instance.load

    puts "Loaded hive. Looking for task #{task}..."
    abort("ERROR: Task #{task} not found in current hive!") unless Zerg::Hive.instance.hive.has_key?(task) 

    # rush!
    begin
        pmgr = ZergGemPlugin::Manager.instance
        pmgr.load
        puts "/driver/#{Zerg::Hive.instance.hive[task]["vm"]["driver"]["drivertype"]}"
        driver = pmgr.create("/driver/#{Zerg::Hive.instance.hive[task]["vm"]["driver"]["drivertype"]}")
        driver.rush Zerg::Hive.instance.load_path, task, Zerg::Hive.instance.hive[task], debug
    rescue ZergGemPlugin::PluginNotLoaded
        abort("ERROR: driver #{Zerg::Hive.instance.hive[task]["vm"]["driver"]["drivertype"]} not found. Did you install the plugin gem?")
    end
    puts("SUCCESS!")
end

.snapshot(task, base) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/zerg/runner.rb', line 86

def self.snapshot(task, base)
    # load the hive first
    Zerg::Hive.instance.load

    puts "Loaded hive. Looking for task #{task}..."
    abort("ERROR: Task #{task} not found in current hive!") unless Zerg::Hive.instance.hive.has_key?(task) 

    begin
        pmgr = ZergGemPlugin::Manager.instance
        pmgr.load
        driver = pmgr.create("/driver/#{Zerg::Hive.instance.hive[task]["vm"]["driver"]["drivertype"]}")
        driver.snapshot Zerg::Hive.instance.load_path, task, Zerg::Hive.instance.hive[task], base
    rescue ZergGemPlugin::PluginNotLoaded
        abort("ERROR: driver #{Zerg::Hive.instance.hive[task]["vm"]["driver"]["drivertype"]} not found. Did you install the plugin gem?")
    end
    puts("SUCCESS!")
end