Class: SuperCopyAppGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/super/test_support/generate_copy_app.rb

Instance Method Summary collapse

Instance Method Details

#copy_appObject



26
27
28
29
# File 'lib/super/test_support/generate_copy_app.rb', line 26

def copy_app
  directory "models", "app/models"
  directory "controllers", "app/controllers/admin"
end

#copy_configObject



36
37
38
# File 'lib/super/test_support/generate_copy_app.rb', line 36

def copy_config
  copy_file "routes.rb", "config/routes.rb"
end

#copy_dbObject



31
32
33
34
# File 'lib/super/test_support/generate_copy_app.rb', line 31

def copy_db
  directory "migrations", "db/migrate"
  copy_file "seeds.rb", "db/seeds.rb"
end

#ensure_reasonable_directoryObject



15
16
17
18
19
20
# File 'lib/super/test_support/generate_copy_app.rb', line 15

def ensure_reasonable_directory
  app_path = File.join(destination_root, "app")
  if !File.directory?(app_path)
    raise "Can't find dir: #{app_path}"
  end
end

#install_superObject



22
23
24
# File 'lib/super/test_support/generate_copy_app.rb', line 22

def install_super
  Super::InstallGenerator.start([], destination_root: destination_root)
end

#set_destination_rootObject



11
12
13
# File 'lib/super/test_support/generate_copy_app.rb', line 11

def set_destination_root
  self.destination_root = options[:destination]
end