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.
18 19 20 21 22 |
# File 'lib/pliny/commands/creator.rb', line 18 def initialize(args = {}, opts = {}, stream = $stdout) @args = args @opts = opts @stream = stream end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
12 13 14 |
# File 'lib/pliny/commands/creator.rb', line 12 def args @args end |
#opts ⇒ Object
Returns the value of attribute opts.
12 13 14 |
# File 'lib/pliny/commands/creator.rb', line 12 def opts @opts end |
#stream ⇒ Object
Returns the value of attribute stream.
12 13 14 |
# File 'lib/pliny/commands/creator.rb', line 12 def stream @stream end |
Class Method Details
.run(args, opts = {}, stream = $stdout) ⇒ Object
14 15 16 |
# File 'lib/pliny/commands/creator.rb', line 14 def self.run(args, opts = {}, stream = $stdout) new(args, opts, stream).run! end |
Instance Method Details
#run! ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/pliny/commands/creator.rb', line 24 def run! abort("#{name} already exists") if File.exist?(app_dir) FileUtils.copy_entry template_dir, app_dir FileUtils.rm_rf("#{app_dir}/.git") FileUtils.mv("#{app_dir}/.rubocop_template.yml", "#{app_dir}/.rubocop.yml") parse_erb_files display "Pliny app created. To start, run:" display "cd #{app_dir} && bin/setup" end |