Class: Nrb::Commands::Script
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Nrb::Commands::Script
- Includes:
- Thor::Actions
- Defined in:
- lib/nrb/commands/script.rb
Class Method Summary collapse
Instance Method Summary collapse
- #boot ⇒ Object
- #bundle_install ⇒ Object
- #config_nrb ⇒ Object
- #db_config ⇒ Object
- #directories ⇒ Object
- #gemfile ⇒ Object
- #gitignore ⇒ Object
- #initialize_repo ⇒ Object
- #rakefile ⇒ Object
- #readme ⇒ Object
- #script_file ⇒ Object
Class Method Details
.source_root ⇒ Object
18 19 20 |
# File 'lib/nrb/commands/script.rb', line 18 def self.source_root File.('..', __dir__) end |
Instance Method Details
#boot ⇒ Object
52 53 54 |
# File 'lib/nrb/commands/script.rb', line 52 def boot template 'templates/config/boot.rb.tt', target('config/boot.rb') end |
#bundle_install ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/nrb/commands/script.rb', line 73 def bundle_install return unless [:bundle] inside target, verbose: true do run 'bundle install' end end |
#config_nrb ⇒ Object
41 42 43 44 |
# File 'lib/nrb/commands/script.rb', line 41 def config_nrb template 'templates/config/nrb.rb.tt', target('config/nrb.rb'), directories: Nrb.config.directories end |
#db_config ⇒ Object
56 57 58 59 |
# File 'lib/nrb/commands/script.rb', line 56 def db_config template 'templates/db/config.yml.tt', target('db/config.yml'), db: name end |
#directories ⇒ Object
46 47 48 49 50 |
# File 'lib/nrb/commands/script.rb', line 46 def directories Nrb.config.directories.each do |dir| create_file target("#{dir}/.keep") end end |
#gemfile ⇒ Object
32 33 34 35 |
# File 'lib/nrb/commands/script.rb', line 32 def gemfile template 'templates/Gemfile.tt', target('Gemfile'), version: Nrb::VERSION end |
#gitignore ⇒ Object
22 23 24 |
# File 'lib/nrb/commands/script.rb', line 22 def gitignore template 'templates/.gitignore.tt', target('.gitignore') end |
#initialize_repo ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/nrb/commands/script.rb', line 65 def initialize_repo return unless [:repo] inside target, verbose: true do run 'git init' end end |
#rakefile ⇒ Object
37 38 39 |
# File 'lib/nrb/commands/script.rb', line 37 def rakefile template 'templates/Rakefile.tt', target('Rakefile') end |
#readme ⇒ Object
26 27 28 29 30 |
# File 'lib/nrb/commands/script.rb', line 26 def readme template 'templates/README.md.tt', target('README.md'), title: name, version: Nrb::VERSION end |
#script_file ⇒ Object
61 62 63 |
# File 'lib/nrb/commands/script.rb', line 61 def script_file template 'templates/script.rb.tt', "#{target(name)}.rb" end |