class Nrb::Commands::Script

This command generates a new script scaffold.

Public Instance Methods

boot() click to toggle source
# File lib/nrb/commands/script.rb, line 40
def boot
  template 'templates/config/boot.rb.tt', target('config/boot.rb'), opts
end
bundle_install() click to toggle source
# File lib/nrb/commands/script.rb, line 61
def bundle_install
  return unless options[:bundle_install]

  inside target, opts do
    Bundler.with_clean_env do
      try_loud_command('bundle install')
    end
  end
end
config_nrb() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# File lib/nrb/commands/script.rb, line 20
def gemfile
  template 'templates/Gemfile.tt', target('Gemfile'),
    opts.merge(nrb_gem: nrb_gem)
end
gitignore() click to toggle source
# File lib/nrb/commands/script.rb, line 11
def gitignore
  template 'templates/.gitignore.tt', target('.gitignore'), opts
end
initialize_repo() click to toggle source
# File lib/nrb/commands/script.rb, line 53
def initialize_repo
  return unless options[:init_repo]

  inside target, opts do
    try_loud_command('git init')
  end
end
rakefile() click to toggle source
# File lib/nrb/commands/script.rb, line 25
def rakefile
  template 'templates/Rakefile.tt', target('Rakefile'), opts
end
readme() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# File lib/nrb/commands/script.rb, line 49
def script_file
  template 'templates/script.rb.tt', "#{target(name)}.rb", opts
end