diff options
-rw-r--r-- | tapelibrary.rb | 22 | ||||
-rw-r--r-- | ystv.rb | 13 |
2 files changed, 30 insertions, 5 deletions
diff --git a/tapelibrary.rb b/tapelibrary.rb index daf0e2e..ee57dbc 100644 --- a/tapelibrary.rb +++ b/tapelibrary.rb @@ -35,8 +35,8 @@ class RobotBuilder @name = name @libraries = Hash.new end - def uselibrary name, library - @libraries[name] = library + def uselibrary library + @libraries[library.name] = library end def build Robot.new @name, @libraries @@ -46,3 +46,21 @@ end def robot name, &block Docile.dsl_eval(RobotBuilder.new(name), &block).build end + +Backup = Struct.new(:name, :robot, :backups) + +class BackupBuilder + def initialize name, robot + @name = name + @robot = robot + end + def backup bkp = {} + bkp.each do |dir, lib| + puts "Backup #{@name}: Backing up #{dir} to library #{lib} on robot #{@robot.name}" + end + end +end + +def backups name, robot, &block + Docile.dsl_eval(BackupBuilder.new(name, robot), &block) +end @@ -24,7 +24,14 @@ urylib = library "ury" do tape "ury010", :slot => 20 end -tapebackup = robot "tapebackup" do - uselibrary "ystv", ystvlib - uselibrary "ury", urylib +wallyrobot = robot "wally" do + uselibrary ystvlib + uselibrary urylib +end + +backups "backuptotape", wallyrobot do + backup( + "/data/backups/" => "ystv", + "/mnt/urybackup/" => "ury" + ) end |