Module: P::Actions

Included in:
Builder
Defined in:
lib/p/actions.rb,
lib/p/actions/template_file.rb

Defined Under Namespace

Classes: TemplateFile

Instance Method Summary collapse

Instance Method Details

#directory(path) ⇒ Object



23
24
25
26
27
# File 'lib/p/actions.rb', line 23

def directory(path)
  say "Creating directory `#{path}`" do
    FileUtils.mkdir(destination_file(path))
  end
end

#file(path, &block) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/p/actions.rb', line 12

def file(path, &block)
  say "Creating file `#{path}`" do
    source = source_file(path)
    destination = destination_file(path)

    file = P::Actions::TemplateFile.new(self, source, destination)
    file.instance_eval(&block) if block_given?
    file.run!
  end
end

#touch(path) ⇒ Object



6
7
8
9
10
# File 'lib/p/actions.rb', line 6

def touch(path)
  say "Touching file `#{path}`" do
    FileUtils.touch(destination_file(path))
  end
end