Class: Sumcli::Commands::New
- Inherits:
-
Sumcli::Command
- Object
- Sumcli::Command
- Sumcli::Commands::New
- Defined in:
- lib/sumcli/commands/new.rb
Instance Method Summary collapse
- #execute(input: $stdin, output: $stdout) ⇒ Object
-
#initialize(name, options) ⇒ New
constructor
A new instance of New.
Methods inherited from Sumcli::Command
#command, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which
Constructor Details
#initialize(name, options) ⇒ New
Returns a new instance of New.
8 9 10 11 |
# File 'lib/sumcli/commands/new.rb', line 8 def initialize(name, ) @name = name @options = end |
Instance Method Details
#execute(input: $stdin, output: $stdout) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sumcli/commands/new.rb', line 13 def execute(input: $stdin, output: $stdout) output.puts "OK" unless @name.nil? or File.directory?(@name) directory = File.('../../templates/new/app', __FILE__) return generator.copy_directory(directory, @name) end output.puts "Directory #{@name} already exists." end |