Class: DomainEngine::Generators::NewGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/domain_engine/new_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_filesObject



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/generators/domain_engine/new_generator.rb', line 47

def create_files
  template 'package.yml', "domains/#{file_name}/package.yml"
  template 'engine.rb', "domains/#{file_name}/lib/engine.rb"
  template 'routes.rb', "domains/#{file_name}/config/routes.rb"
  template 'application_controller.rb', "domains/#{file_name}/app/controllers/#{file_name}/application_controller.rb"
  template 'hellos_controller.rb', "domains/#{file_name}/app/controllers/#{file_name}/hellos_controller.rb"
  template 'package_helper.rb', "domains/#{file_name}/spec/package_helper.rb"
  template 'controller_extension.rb', "domains/#{file_name}/spec/support/controller_extension.rb"
  template 'hellos_controller_spec.rb',
           "domains/#{file_name}/spec/controllers/#{file_name}/hellos_controller_spec.rb"
end

#create_sub_directoriesObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/generators/domain_engine/new_generator.rb', line 20

def create_sub_directories
  empty_directory "domains/#{file_name}/app/controllers/#{file_name}"
  empty_directory "domains/#{file_name}/spec/controllers/#{file_name}"
  empty_directory "domains/#{file_name}/spec/support"

  empty_directory_with_keep_file "domains/#{file_name}/app/public"
  empty_directory_with_keep_file "domains/#{file_name}/app/blueprints/#{file_name}"
  empty_directory_with_keep_file "domains/#{file_name}/app/commands/#{file_name}"
  empty_directory_with_keep_file "domains/#{file_name}/app/domain/#{file_name}"
  empty_directory_with_keep_file "domains/#{file_name}/app/infrastructure/#{file_name}"
  empty_directory_with_keep_file "domains/#{file_name}/app/jobs/#{file_name}"
  empty_directory_with_keep_file "domains/#{file_name}/app/models/#{file_name}"
  empty_directory_with_keep_file "domains/#{file_name}/app/queries/#{file_name}"

  empty_directory_with_keep_file "domains/#{file_name}/lib/tasks"

  empty_directory_with_keep_file "domains/#{file_name}/spec/factories"
  empty_directory_with_keep_file "domains/#{file_name}/spec/fixtures"
  empty_directory_with_keep_file "domains/#{file_name}/spec/commands/#{file_name}"
  empty_directory_with_keep_file "domains/#{file_name}/spec/domain/#{file_name}"
  empty_directory_with_keep_file "domains/#{file_name}/spec/infrastructure/#{file_name}"
  empty_directory_with_keep_file "domains/#{file_name}/spec/jobs/#{file_name}"
  empty_directory_with_keep_file "domains/#{file_name}/spec/models/#{file_name}"
  empty_directory_with_keep_file "domains/#{file_name}/spec/queries/#{file_name}"
  empty_directory_with_keep_file "domains/#{file_name}/spec/requests/#{file_name}"
end

#create_top_level_directoriesObject



10
11
12
13
14
15
16
17
18
# File 'lib/generators/domain_engine/new_generator.rb', line 10

def create_top_level_directories
  empty_directory 'domains'
  empty_directory "domains/#{file_name}"
  empty_directory "domains/#{file_name}/app"
  empty_directory "domains/#{file_name}/config"
  empty_directory "domains/#{file_name}/lib"
  empty_directory "domains/#{file_name}/spec"
  empty_directory_with_keep_file "domains/#{file_name}/doc"
end