module P::Actions

Public Instance Methods

directory(path) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/p/actions.rb, line 6
def touch(path)
  say "Touching file `#{path}`" do
    FileUtils.touch(destination_file(path))
  end
end