Class: QAT::CLI::Generator::Project
- Inherits:
-
Object
- Object
- QAT::CLI::Generator::Project
- Includes:
- FileUtils
- Defined in:
- lib/qat/cli/generator/project.rb
Overview
New project generator
Instance Method Summary collapse
-
#initialize(stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel) ⇒ Project
constructor
A new instance of Project.
-
#run!(name, opts = {}) ⇒ Object
Create a new project.
Constructor Details
#initialize(stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel) ⇒ Project
Returns a new instance of Project.
11 12 13 |
# File 'lib/qat/cli/generator/project.rb', line 11 def initialize stdin=STDIN, stdout=STDOUT, stderr=STDERR, kernel=Kernel @fileutils_output = stdout end |
Instance Method Details
#run!(name, opts = {}) ⇒ Object
Create a new project. Will create a new folder with the project’s name.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/qat/cli/generator/project.rb', line 17 def run! name, opts={} raise ArgumentError.new 'No project name given' unless name raise ArgumentError.new "The project '#{name}' already exists" if ::File.directory? name mkdir name, opts cp_r ::File.join(::File.dirname(__FILE__), '..', '..', 'project', '.'), name, opts cd name, opts do mkdir_p ::File.join('config', 'common'), opts mkdir_p 'lib', opts mkdir_p 'public', opts end end |