# File lib/rudy/routines/base.rb, line 32
32:     def initialize(name=nil, option={}, argv=[], *args)
33:       name ||= (self.class.to_s.split(/::/)).last.downcase
34:       option = OpenStruct.new(option) if option.is_a? Hash
35:       @name, @option, @argv = name.to_sym, option, argv
36:       a, s, r = @@global.accesskey, @@global.secretkey, @@global.region
37:       @@sdb ||= Rudy::AWS::SDB.new(a, s, r)
38:       
39:       # Grab the routines configuration for this routine name
40:       # e.g. startup, sysupdate, installdeps
41:       @routine = fetch_routine_config @name rescue {}
42:       
43:       ld "Routine: #{@routine.inspect}"
44:       
45:       if @routine
46:         # Removes the dependencies from the routines hash. 
47:         # We run these separately from the other actions.
48:         @before, @after = @routine.delete(:before), @routine.delete(:after)
49:       end
50:       
51:       # Share one Rye::Box instance for localhost across all routines
52:       unless defined?(@@lbox)
53:         host, opts = @@global.localhost, { :user => Rudy.sysinfo.user }
54:         @@lbox = Rudy::Routines::Handlers::RyeTools.create_box host, opts
55:       end
56:       
57:       disable_run if @@global.testrun
58:       
59:       # We create these frozen globals for the benefit of 
60:       # the local and remote routine blocks. 
61:       $global = @@global.dup.freeze unless $global
62:       $option = option.dup.freeze unless $option
63:       
64:       ## TODO: get the machine config for just the current machine group. This
65:       ## probably requires Caesars to be aware of which nodes are structural.  
66:       ##$config = fetch_machine_config unless $config
67:       
68:       init(*args) if respond_to? :init
69:     end