Module: Ore::Actions

Included in:
Generator
Defined in:
lib/ore/actions.rb

Overview

Additional actions for the Generator.

Since:

  • 0.9.0

Instance Method Summary collapse

Instance Method Details

#generate_dir(dest) ⇒ String (protected)

Generates an empty directory.

Since:

  • 0.7.1



38
39
40
41
42
43
44
45
46
# File 'lib/ore/actions.rb', line 38

def generate_dir(dest)
  return if @generated_dirs.has_key?(dest)

  path = interpolate(dest)
  empty_directory path

  @generated_dirs[dest] = path
  return path
end

#generate_file(dest, file, options = {}) ⇒ String (protected)

Generates a file.

Options Hash (options):

  • :template (Boolean)

    Specifies that the file is a template, and should be rendered.

Since:

  • 0.7.1



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/ore/actions.rb', line 68

def generate_file(dest,file,options={})
  return if @generated_files.has_key?(dest)

  path = interpolate(dest)

  if options[:template]
    @current_template_dir = File.dirname(dest)
    template file, path
    @current_template_dir = nil
  else
    copy_file file, path
  end

  @generated_files[dest] = path
  return path
end

#run(command, config = {}) ⇒ Object (protected)

Runs a command.



23
24
25
# File 'lib/ore/actions.rb', line 23

def run(command,config={})
  super(command,config.merge(capture: true))
end