Class: Nrb::Commands::Script
- Includes:
- ScriptGenerator
- Defined in:
- lib/nrb/commands/script.rb
Overview
This command generates a new script scaffold.
Instance Method Summary collapse
- #boot ⇒ Object
- #bundle_install ⇒ Object
- #config_nrb ⇒ Object
- #db_config ⇒ Object
- #gemfile ⇒ Object
- #gitignore ⇒ Object
- #initialize_repo ⇒ Object
- #rakefile ⇒ Object
- #readme ⇒ Object
- #resources ⇒ Object
- #script_file ⇒ Object
Methods inherited from Base
Instance Method Details
#boot ⇒ Object
40 41 42 |
# File 'lib/nrb/commands/script.rb', line 40 def boot template 'templates/config/boot.rb.tt', target('config/boot.rb'), opts end |
#bundle_install ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/nrb/commands/script.rb', line 61 def bundle_install return unless [:bundle_install] inside target, opts do Bundler.with_clean_env do try_loud_command('bundle install') end end end |
#config_nrb ⇒ Object
29 30 31 32 |
# File 'lib/nrb/commands/script.rb', line 29 def config_nrb template 'templates/config/nrb.rb.tt', target('config/nrb.rb'), opts.merge(resources: Nrb.resources) end |
#db_config ⇒ Object
44 45 46 47 |
# File 'lib/nrb/commands/script.rb', line 44 def db_config template 'templates/db/config.yml.tt', target('db/config.yml'), opts.merge(db: name) end |
#gemfile ⇒ Object
20 21 22 23 |
# File 'lib/nrb/commands/script.rb', line 20 def gemfile template 'templates/Gemfile.tt', target('Gemfile'), opts.merge(nrb_gem: nrb_gem) end |
#gitignore ⇒ Object
11 12 13 |
# File 'lib/nrb/commands/script.rb', line 11 def gitignore template 'templates/.gitignore.tt', target('.gitignore'), opts end |
#initialize_repo ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/nrb/commands/script.rb', line 53 def initialize_repo return unless [:init_repo] inside target, opts do try_loud_command('git init') end end |
#rakefile ⇒ Object
25 26 27 |
# File 'lib/nrb/commands/script.rb', line 25 def rakefile template 'templates/Rakefile.tt', target('Rakefile'), opts end |
#readme ⇒ Object
15 16 17 18 |
# File 'lib/nrb/commands/script.rb', line 15 def readme template 'templates/README.md.tt', target('README.md'), opts.merge(title: name, version: Nrb::VERSION) end |
#resources ⇒ Object
34 35 36 37 38 |
# File 'lib/nrb/commands/script.rb', line 34 def resources Nrb.resources.each do |dir| create_file target("#{dir}/.keep"), opts end end |
#script_file ⇒ Object
49 50 51 |
# File 'lib/nrb/commands/script.rb', line 49 def script_file template 'templates/script.rb.tt', "#{target(name)}.rb", opts end |