Class: Rage::CLINewAppGenerator

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/rage/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



285
286
287
# File 'lib/rage/cli.rb', line 285

def self.source_root
  File.expand_path("templates", __dir__)
end

Instance Method Details

#copy_filesObject



297
298
299
# File 'lib/rage/cli.rb', line 297

def copy_files
  inject_templates
end

#create_directoryObject



293
294
295
# File 'lib/rage/cli.rb', line 293

def create_directory
  empty_directory(path)
end

#install_databaseObject



301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/rage/cli.rb', line 301

def install_database
  return unless @use_database

  @app_name = path.tr("-", "_").downcase
  append_to_file "#{path}/Gemfile", <<~RUBY

    gem "#{get_db_gem_name}"
    gem "activerecord"
    gem "standalone_migrations", require: false
  RUBY

  inject_templates("db-templates")
  inject_templates("db-templates/#{database}")
end

#setupObject



289
290
291
# File 'lib/rage/cli.rb', line 289

def setup
  @use_database = !database.nil?
end