Class: Pliny::Commands::Creator
- Inherits:
-
Object
- Object
- Pliny::Commands::Creator
- Defined in:
- lib/pliny/commands/creator.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#opts ⇒ Object
Returns the value of attribute opts.
-
#stream ⇒ Object
Returns the value of attribute stream.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args = {}, opts = {}, stream = $stdout) ⇒ Creator
constructor
A new instance of Creator.
- #run! ⇒ Object
Constructor Details
#initialize(args = {}, opts = {}, stream = $stdout) ⇒ Creator
Returns a new instance of Creator.
14 15 16 17 18 |
# File 'lib/pliny/commands/creator.rb', line 14 def initialize(args = {}, opts = {}, stream = $stdout) @args = args @opts = opts @stream = stream end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
8 9 10 |
# File 'lib/pliny/commands/creator.rb', line 8 def args @args end |
#opts ⇒ Object
Returns the value of attribute opts.
8 9 10 |
# File 'lib/pliny/commands/creator.rb', line 8 def opts @opts end |
#stream ⇒ Object
Returns the value of attribute stream.
8 9 10 |
# File 'lib/pliny/commands/creator.rb', line 8 def stream @stream end |
Class Method Details
.run(args, opts = {}, stream = $stdout) ⇒ Object
10 11 12 |
# File 'lib/pliny/commands/creator.rb', line 10 def self.run(args, opts = {}, stream = $stdout) new(args, opts, stream).run! end |
Instance Method Details
#run! ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/pliny/commands/creator.rb', line 20 def run! abort("#{name} already exists") if File.exist?(app_dir) FileUtils.copy_entry template_dir, app_dir FileUtils.rm_rf("#{app_dir}/.git") setup_database_urls display 'Pliny app created. To start, run:' display "cd #{app_dir} && bin/setup" end |