Class: Hephaestus::CoreGenerator

Inherits:
Generators::Base show all
Defined in:
lib/hephaestus/generators/core_generator.rb

Instance Method Summary collapse

Methods inherited from Generators::Base

default_source_root, inherited

Methods included from ExitOnFailure

#bundle_command

Methods included from Actions

#action_mailer_asset_host, #action_mailer_host, #configure_environment, #expand_json, #gem, #replace_in_file, #replace_in_files

Instance Method Details

#controllersObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/hephaestus/generators/core_generator.rb', line 8

def controllers
  remove_file("app/controllers/application_controller.rb")
  copy_file("app/controllers/application_controller.rb", "app/controllers/application_controller.rb")

  copy_file("app/controllers/root_controller.rb", "app/controllers/root_controller.rb")
  copy_file("app/controllers/settings_controller.rb", "app/controllers/settings_controller.rb")
  copy_file("app/controllers/staff_controller.rb", "app/controllers/staff_controller.rb")
  copy_file("app/controllers/yetto_controller.rb", "app/controllers/yetto_controller.rb")
  copy_file("app/controllers/app_controller.rb", "app/controllers/#{short_app_name}_controller.rb")

  copy_file("app/controllers/concerns/authable.rb", "app/controllers/concerns/authable.rb")
end

#jobsObject



21
22
23
24
# File 'lib/hephaestus/generators/core_generator.rb', line 21

def jobs
  copy_file("app/jobs/application_job.rb", "app/jobs/application_job.rb", force: true)
  copy_file("app/jobs/update_yetto_job.rb", "app/jobs/update_yetto_job.rb")
end

#libsObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/hephaestus/generators/core_generator.rb', line 26

def libs
  copy_file("app/lib/body_parameter/yetto_parameters.rb", "app/lib/body_parameter/yetto_parameters.rb")
  copy_file("app/lib/constants/app.rb", "app/lib/constants/plug_#{short_app_name}.rb")
  copy_file("app/lib/headers/yetto.rb", "app/lib/headers/yetto.rb")

  path_parameters_content = <<~CONTENT
    # typed: false
    # frozen_string_literal: true

    module PathParameter
      module AppParameters
        extend T::Sig
      end
    end
  CONTENT

  create_file("app/lib/path_parameter/#{short_app_name}_parameters.rb", path_parameters_content)

  body_parameters_content = <<~CONTENT
    # typed: false
    # frozen_string_literal: true

    module BodyParameter
      module AppParameters
        extend T::Sig
      end
    end
  CONTENT

  create_file("app/lib/body_parameter/#{short_app_name}_parameters.rb", body_parameters_content)

  copy_file("app/lib/path_parameter/settings_parameters.rb", "app/lib/path_parameter/settings_parameters.rb")
  copy_file("app/lib/path_parameter/yetto_parameters.rb", "app/lib/path_parameter/yetto_parameters.rb")
  directory("app/lib/plug_app", "app/lib/#{app_name.underscore}")

  copy_file("app/lib/body_parameter.rb", "app/lib/body_parameter.rb")
  copy_file("app/lib/headers.rb", "app/lib/headers.rb")
  copy_file("app/lib/path_parameter.rb", "app/lib/path_parameter.rb")
end

#serializersObject



66
67
68
# File 'lib/hephaestus/generators/core_generator.rb', line 66

def serializers
  copy_file("app/serializers/error_serializer.rb", "app/serializers/error_serializer.rb")
end

#servicesObject



70
71
72
# File 'lib/hephaestus/generators/core_generator.rb', line 70

def services
  copy_file("app/services/yetto_service.rb", "app/services/yetto_service.rb")
end

#viewsObject



74
75
76
# File 'lib/hephaestus/generators/core_generator.rb', line 74

def views
  copy_file("app/views/settings/new.json.jbuilder", "app/views/settings/new.json.jbuilder")
end