libraries/cerner_tomcat.rb
# Rewire our cerner_tomcat sub-resources so they dont require the cerner_tomcat_ prefix
Rewire our cerner_tomcat sub-resources so they dont require the cerner_tomcat_ prefix
Rewire our cerner_tomcat sub - resources so they dont require the cerner_tomcat_ prefix
def _rewire_sub_resources!
          rewire_map = {
            'remote_file' => 'cerner_tomcat_remote_file',
            'template' => 'cerner_tomcat_template',
            'cookbook_file' => 'cerner_tomcat_cookbook_file',
            'web_app' => 'cerner_tomcat_web_app'
          }
          rewire_map.each do |new_name, old_name|
            define_singleton_method(new_name) do |name=nil, *args, &block|
              created_at = caller[0]
              public_send(old_name, name, *args) do
                self.declared_type = self.class.resource_name
                self.source_line = created_at
                instance_exec(&block) if block
              end
            end
          end
        end
def _rewire_sub_resources! rewire_map = { 'remote_file' => 'cerner_tomcat_remote_file' , 'template' => 'cerner_tomcat_template' , 'cookbook_file' => 'cerner_tomcat_cookbook_file' , 'web_app' => 'cerner_tomcat_web_app' } rewire_map . each do | new_name , old_name | define_singleton_method ( new_name ) do | name = nil , * args , & block | created_at = caller [ 0 ] public_send ( old_name , name , * args ) do self . declared_type = self . class . resource_name self . source_line = created_at instance_exec ( & block ) if block end end end end
Rewire our cerner_tomcat sub-resources so they dont require the cerner_tomcat_ prefix
Rewire our cerner_tomcat sub - resources so they dont require the cerner_tomcat_ prefix
# Generate stub methods for all the rewiring. # This is defined as a singleton method on self so it looks like # the DSL but is scoped to just this context. # Store the caller to correct the source_line. # Set the declared type to be the native name. # Fix the source location. for chef 12.4 we could do this with the # declared_at parameter on the initial send. # Run the original block.