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



245
246
247
# File 'lib/rage/cli.rb', line 245

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

Instance Method Details

#copy_filesObject



257
258
259
# File 'lib/rage/cli.rb', line 257

def copy_files
  inject_templates
end

#create_directoryObject



253
254
255
# File 'lib/rage/cli.rb', line 253

def create_directory
  empty_directory(path)
end

#install_databaseObject



261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/rage/cli.rb', line 261

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



249
250
251
# File 'lib/rage/cli.rb', line 249

def setup
  @use_database = !database.nil?
end