Class: Groundwork::RecipeUnpacker

Inherits:
Recipe
  • Object
show all
Defined in:
lib/recipe_unpacker.rb

Instance Method Summary collapse

Methods inherited from Recipe

compile, compile_file, generate, #initialize, #options, required_files, run, #tar=, unpack

Constructor Details

This class inherits a constructor from Groundwork::Recipe

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object



20
# File 'lib/recipe_unpacker.rb', line 20

def method_missing *args ; end

Instance Method Details

#directory(*args, &block) ⇒ Object



3
4
5
# File 'lib/recipe_unpacker.rb', line 3

def directory *args, &block
    yield if block_given?
end

#file(name, opts = nil) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/recipe_unpacker.rb', line 7

def file name, opts = nil
    if opts.is_a? Hash
        if filename = (opts[:from] || opts[:from_erb])
            FileUtils.mkdir_p File.dirname(filename)
            File.open(filename,"w"){|f| f.print read_file(filename) }
        end
    end
end

#possible(filename) ⇒ Object



16
17
18
# File 'lib/recipe_unpacker.rb', line 16

def possible filename
    File.open(filename,"w"){|f| f.print read_file(filename) }
end