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
41 42 43 |
# File 'lib/nrb/commands/script.rb', line 41 def boot template 'templates/config/boot.rb.tt', target('config/boot.rb'), opts end |
#bundle_install ⇒ Object
62 63 64 65 66 67 68 69 70 |
# File 'lib/nrb/commands/script.rb', line 62 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
30 31 32 33 |
# File 'lib/nrb/commands/script.rb', line 30 def config_nrb template 'templates/config/nrb.rb.tt', target('config/nrb.rb'), opts.merge(resources: Nrb.resources) end |
#db_config ⇒ Object
45 46 47 48 |
# File 'lib/nrb/commands/script.rb', line 45 def db_config template 'templates/db/config.yml.tt', target('db/config.yml'), opts.merge(db: name) end |
#gemfile ⇒ Object
21 22 23 24 |
# File 'lib/nrb/commands/script.rb', line 21 def gemfile template 'templates/Gemfile.tt', target('Gemfile'), opts.merge(nrb_gem: nrb_gem) end |
#gitignore ⇒ Object
12 13 14 |
# File 'lib/nrb/commands/script.rb', line 12 def gitignore template 'templates/.gitignore.tt', target('.gitignore'), opts end |
#initialize_repo ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/nrb/commands/script.rb', line 54 def initialize_repo return unless [:init_repo] inside target, opts do try_loud_command('git init') end end |
#rakefile ⇒ Object
26 27 28 |
# File 'lib/nrb/commands/script.rb', line 26 def rakefile template 'templates/Rakefile.tt', target('Rakefile'), opts end |
#readme ⇒ Object
16 17 18 19 |
# File 'lib/nrb/commands/script.rb', line 16 def readme template 'templates/README.md.tt', target('README.md'), opts.merge(title: name, version: Nrb::VERSION) end |
#resources ⇒ Object
35 36 37 38 39 |
# File 'lib/nrb/commands/script.rb', line 35 def resources Nrb.resources.each do |dir| create_file target("#{dir}/.keep"), opts end end |
#script_file ⇒ Object
50 51 52 |
# File 'lib/nrb/commands/script.rb', line 50 def script_file template 'templates/script.rb.tt', "#{target(name)}.rb", opts end |