Module: Padrino::Generators::Runner
Overview
Responsible for executing plugin and template instructions including common actions for modifying a project or application.
Instance Method Summary collapse
-
#app(name) ⇒ Object
Executes App generator.
-
#generate(type, arguments = "") ⇒ Object
Executes generator command for specified type with given arguments.
-
#git(*args) ⇒ Object
Executes git commmands in project.
-
#project(options = {}) ⇒ Object
Generates project scaffold based on a given template file.
-
#rake(command) ⇒ Object
Executes rake command with given arguments.
Instance Method Details
#app(name) ⇒ Object
Executes App generator. Accepts an optional block allowing generation inside subapp.
74 75 76 77 78 79 80 81 82 |
# File 'padrino-gen/lib/padrino-gen/generators/runner.rb', line 74 def app(name) say "=> Executing: padrino-gen app #{name} -r=#{destination_root}", :magenta Padrino.bin_gen(:app, name.to_s, "-r=#{destination_root}") if block_given? @_app_name = name yield @_app_name = nil end end |
#generate(type, arguments = "") ⇒ Object
Executes generator command for specified type with given arguments.
40 41 42 43 44 45 |
# File 'padrino-gen/lib/padrino-gen/generators/runner.rb', line 40 def generate(type, arguments="") params = arguments.split(" ").push("-r=#{destination_root}") params.push("--app=#{@_app_name}") if @_app_name say "=> Executing: padrino-gen #{type} #{params.join(" ")}", :magenta Padrino.bin_gen(*params.unshift(type)) end |
#git(*args) ⇒ Object
Executes git commmands in project.
97 98 99 100 101 102 103 |
# File 'padrino-gen/lib/padrino-gen/generators/runner.rb', line 97 def git(*args) FileUtils.cd(destination_root) do cmd = "git %s" % args.join(' ') say cmd, :green system cmd end end |
#project(options = {}) ⇒ Object
Generates project scaffold based on a given template file.
20 21 22 23 24 25 |
# File 'padrino-gen/lib/padrino-gen/generators/runner.rb', line 20 def project(={}) components = .sort_by { |k, v| k.to_s }.map { |component, value| "--#{component}=#{value}" } params = [name, *components].push("-r=#{destination_root("../")}") say "=> Executing: padrino-gen project #{params.join(" ")}", :magenta Padrino.bin_gen(*params.unshift("project")) end |