hephaestus 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +13 -0
- data/LICENSE.txt +9 -0
- data/README.md +19 -0
- data/bin/hephaestus +55 -0
- data/lib/hephaestus/actions/strip_comments_action.rb +263 -0
- data/lib/hephaestus/actions.rb +116 -0
- data/lib/hephaestus/app_builder.rb +168 -0
- data/lib/hephaestus/exit_on_failure.rb +22 -0
- data/lib/hephaestus/generators/app_generator.rb +158 -0
- data/lib/hephaestus/generators/base.rb +65 -0
- data/lib/hephaestus/generators/config_generator.rb +102 -0
- data/lib/hephaestus/generators/core_generator.rb +50 -0
- data/lib/hephaestus/generators/deployment_generator.rb +18 -0
- data/lib/hephaestus/generators/lib_generator.rb +16 -0
- data/lib/hephaestus/generators/license_generator.rb +16 -0
- data/lib/hephaestus/generators/rubocop_generator.rb +18 -0
- data/lib/hephaestus/generators/sorbet_generator.rb +16 -0
- data/lib/hephaestus/version.rb +11 -0
- data/lib/hephaestus.rb +21 -0
- data/templates/Gemfile.erb +121 -0
- data/templates/Procfile.debug +2 -0
- data/templates/Procfile.dev +2 -0
- data/templates/README.md.erb +1 -0
- data/templates/app/controllers/application_controller.rb +107 -0
- data/templates/app/controllers/concerns/authable.rb +32 -0
- data/templates/app/controllers/root_controller.rb +11 -0
- data/templates/app/controllers/settings_controller.rb +7 -0
- data/templates/app/controllers/staff_controller.rb +15 -0
- data/templates/app/controllers/yetto_controller.rb +30 -0
- data/templates/app/jobs/application_job.rb +10 -0
- data/templates/app/jobs/update_yetto_job.rb +27 -0
- data/templates/app/lib/body_parameter/yetto_parameters.rb +8 -0
- data/templates/app/lib/body_parameter.rb +6 -0
- data/templates/app/lib/constants/app.rb +8 -0
- data/templates/app/lib/headers/yetto.rb +17 -0
- data/templates/app/lib/headers.rb +5 -0
- data/templates/app/lib/path_parameter/yetto_parameters.rb +25 -0
- data/templates/app/lib/path_parameter.rb +8 -0
- data/templates/app/lib/plug_app/http.rb +34 -0
- data/templates/app/lib/plug_app/middleware/malformed_request.rb +110 -0
- data/templates/app/lib/plug_app/middleware/not_found.rb +41 -0
- data/templates/app/lib/plug_app/middleware/openapi_validation.rb +54 -0
- data/templates/app/lib/plug_app/middleware/tracing_attributes.rb +42 -0
- data/templates/app/lib/query_parameter.rb +6 -0
- data/templates/app/serializers/error_serializer.rb +16 -0
- data/templates/app/services/yetto_service.rb +61 -0
- data/templates/app/views/settings/index.json.jbuilder +15 -0
- data/templates/config/initializers/cors.rb +18 -0
- data/templates/config/initializers/environment.rb +30 -0
- data/templates/config/initializers/filter_parameter_logging.rb +22 -0
- data/templates/config/initializers/inflections.rb +20 -0
- data/templates/config/initializers/lograge.rb +25 -0
- data/templates/config/initializers/open_telemetry.rb +27 -0
- data/templates/config/initializers/sidekiq.rb +11 -0
- data/templates/config/initializers/slack_webhook_logger.rb +17 -0
- data/templates/config/sidekiq.yml +18 -0
- data/templates/hephaestus_gitignore +296 -0
- data/templates/lib/plug_app/schemas/api/2023-03-06/components/parameters/headers/yetto.json +42 -0
- data/templates/lib/plug_app/schemas/api/2023-03-06/components/parameters/plugInstallation.json +12 -0
- data/templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/plug.json +9 -0
- data/templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/responses.json +64 -0
- data/templates/lib/plug_app/schemas/api/2023-03-06/components/schemas/yetto.json +1 -0
- data/templates/lib/plug_app/schemas/api/2023-03-06/openapi.json +27 -0
- data/templates/lib/plug_app/schemas/api/2023-03-06/paths/plug.json +91 -0
- data/templates/lib/plug_app/schemas/api/2023-03-06/paths/yetto/after_create_message.json +41 -0
- data/templates/lib/plug_app/schemas/api/2023-03-06/paths/yetto/after_create_plug_installation.json +41 -0
- data/templates/lib/tasks/test_tasks.rake +10 -0
- data/templates/script/ci +7 -0
- data/templates/script/hmac_text +22 -0
- data/templates/script/licenses +51 -0
- data/templates/script/ngrok +5 -0
- data/templates/script/security_checks/brakeman +5 -0
- data/templates/script/security_checks/bundle-audit +5 -0
- data/templates/script/server +5 -0
- data/templates/script/server-debug +5 -0
- data/templates/script/test +5 -0
- data/templates/script/typecheck +42 -0
- data/templates/sorbet/custom.rbi +14 -0
- data/templates/test/controllers/root_controller_test.rb +12 -0
- data/templates/test/controllers/settings_controller_test.rb +27 -0
- data/templates/test/controllers/yetto_controller_test.rb +130 -0
- data/templates/test/jobs/update_yetto_job_test.rb +41 -0
- data/templates/test/support/api.rb +74 -0
- data/templates/test/support/rails.rb +39 -0
- data/templates/test/support/webmocks/slack_webmock.rb +24 -0
- data/templates/test/support/webmocks/yetto.rb +94 -0
- data/templates/test/support/webmocks.rb +5 -0
- data/templates/test/test_helper.rb +24 -0
- metadata +209 -0
@@ -0,0 +1,158 @@
|
|
1
|
+
# typed: false
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "rails/generators"
|
5
|
+
require "rails/generators/rails/app/app_generator"
|
6
|
+
|
7
|
+
module Hephaestus
|
8
|
+
class AppGenerator < Rails::Generators::AppGenerator
|
9
|
+
include ExitOnFailure
|
10
|
+
|
11
|
+
hide!
|
12
|
+
|
13
|
+
class_option :version,
|
14
|
+
type: :boolean,
|
15
|
+
aliases: "-v",
|
16
|
+
group: :hephaestus,
|
17
|
+
desc: "Show Hephaestus version number and quit"
|
18
|
+
|
19
|
+
class_option :help,
|
20
|
+
type: :boolean,
|
21
|
+
aliases: "-h",
|
22
|
+
group: :hephaestus,
|
23
|
+
desc: "Show this help message and quit"
|
24
|
+
|
25
|
+
def finish_template
|
26
|
+
say("Invoking Hephaestus customization")
|
27
|
+
invoke(:hephaestus_customization)
|
28
|
+
super
|
29
|
+
end
|
30
|
+
|
31
|
+
def leftovers
|
32
|
+
build(:replace_generic_variables)
|
33
|
+
generate("hephaestus:license")
|
34
|
+
generate("hephaestus:rubocop")
|
35
|
+
|
36
|
+
generate("hephaestus:sorbet")
|
37
|
+
invoke(:commit)
|
38
|
+
invoke(:outro)
|
39
|
+
end
|
40
|
+
|
41
|
+
def hephaestus_customization
|
42
|
+
invoke(:customize_gemfile)
|
43
|
+
invoke(:copy_github_actions)
|
44
|
+
invoke(:setup_development_environment)
|
45
|
+
invoke(:setup_staging_environment)
|
46
|
+
invoke(:setup_production_environment)
|
47
|
+
invoke(:setup_test_environment)
|
48
|
+
invoke(:configure_app)
|
49
|
+
invoke(:purge_unneeded_files)
|
50
|
+
invoke(:copy_vscode_settings)
|
51
|
+
invoke(:generate_default)
|
52
|
+
invoke(:create_github_repo)
|
53
|
+
end
|
54
|
+
|
55
|
+
def customize_gemfile
|
56
|
+
build(:replace_gemfile)
|
57
|
+
bundle_command("install")
|
58
|
+
bundle_command("lock --add-platform x86_64-linux")
|
59
|
+
end
|
60
|
+
|
61
|
+
def copy_github_actions
|
62
|
+
source = File.join(Hephaestus::AppGenerator.source_root, ".github")
|
63
|
+
directory(source, ".github")
|
64
|
+
end
|
65
|
+
|
66
|
+
def setup_development_environment
|
67
|
+
say("Setting up the development environment")
|
68
|
+
build(:configure_local_mail)
|
69
|
+
build(:raise_on_delivery_errors)
|
70
|
+
build(:configure_dev_hosting)
|
71
|
+
build(:copy_setup_scripts)
|
72
|
+
end
|
73
|
+
|
74
|
+
def copy_vscode_settings
|
75
|
+
source = File.join(Hephaestus::AppGenerator.source_root, ".vscode")
|
76
|
+
directory(source, ".vscode")
|
77
|
+
end
|
78
|
+
|
79
|
+
def purge_unneeded_files
|
80
|
+
remove_dir("app/assets")
|
81
|
+
remove_file("app/controllers/concerns/.keep")
|
82
|
+
remove_dir("app/helpers")
|
83
|
+
remove_dir("app/models")
|
84
|
+
remove_dir("app/views/layouts")
|
85
|
+
remove_dir("lib/assets")
|
86
|
+
remove_dir("lib/tasks/.keep")
|
87
|
+
remove_dir("test/helpers")
|
88
|
+
remove_dir("test/channels")
|
89
|
+
remove_dir("test/models")
|
90
|
+
end
|
91
|
+
|
92
|
+
def setup_staging_environment
|
93
|
+
build(:setup_staging_environment)
|
94
|
+
end
|
95
|
+
|
96
|
+
def setup_production_environment
|
97
|
+
say("Setting up the production environment")
|
98
|
+
build(:setup_asset_host)
|
99
|
+
build(:setup_background_worker)
|
100
|
+
build(:setup_slack_logger)
|
101
|
+
end
|
102
|
+
|
103
|
+
def setup_test_environment
|
104
|
+
say("Setting up the production environment")
|
105
|
+
build(:setup_test_environment)
|
106
|
+
end
|
107
|
+
|
108
|
+
def configure_app
|
109
|
+
say("Configuring app")
|
110
|
+
build(:configure_time_formats)
|
111
|
+
end
|
112
|
+
|
113
|
+
def create_github_repo
|
114
|
+
if !options[:skip_git] && options[:github]
|
115
|
+
say("Creating Github repo")
|
116
|
+
build(:create_github_repo, options[:github])
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def generate_default
|
121
|
+
run("spring stop > /dev/null 2>&1 || true")
|
122
|
+
|
123
|
+
generate("hephaestus:core")
|
124
|
+
generate("hephaestus:deployment")
|
125
|
+
generate("hephaestus:lib")
|
126
|
+
|
127
|
+
# keep this at the end
|
128
|
+
generate("hephaestus:config")
|
129
|
+
end
|
130
|
+
|
131
|
+
def commit
|
132
|
+
run("git add .")
|
133
|
+
run("git commit -m 'Initial commit'")
|
134
|
+
end
|
135
|
+
|
136
|
+
def outro
|
137
|
+
say("\nCongratulations! You just made a plug.")
|
138
|
+
say("\nTry running `rails c` to ensure that everything was set up correctly.")
|
139
|
+
say("\nRunning `rake test` is also a good idea.")
|
140
|
+
end
|
141
|
+
|
142
|
+
class << self
|
143
|
+
def banner
|
144
|
+
"hephaestus #{arguments.map(&:usage).join(" ")} [options]"
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
protected
|
149
|
+
|
150
|
+
def get_builder_class # rubocop:disable Naming/AccessorMethodName
|
151
|
+
Hephaestus::AppBuilder
|
152
|
+
end
|
153
|
+
|
154
|
+
def using_active_record?
|
155
|
+
!options[:skip_active_record]
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# typed: false
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "rails/generators"
|
5
|
+
require_relative "../actions"
|
6
|
+
|
7
|
+
module Hephaestus
|
8
|
+
module Generators
|
9
|
+
class Base < Rails::Generators::Base
|
10
|
+
include Hephaestus::Actions
|
11
|
+
include ExitOnFailure
|
12
|
+
|
13
|
+
class << self
|
14
|
+
def default_source_root
|
15
|
+
File.expand_path(File.join("..", "..", "..", "templates"), __dir__)
|
16
|
+
end
|
17
|
+
|
18
|
+
def inherited(subclass)
|
19
|
+
super
|
20
|
+
|
21
|
+
description_file = File.expand_path(
|
22
|
+
File.join(
|
23
|
+
default_source_root,
|
24
|
+
"descriptions",
|
25
|
+
"#{subclass.generator_name}.md",
|
26
|
+
),
|
27
|
+
)
|
28
|
+
|
29
|
+
subclass.desc(File.read(description_file))
|
30
|
+
rescue Errno::ENOENT # rubocop:disable Lint/SuppressedException
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def app_name
|
37
|
+
Rails.app_class.module_parent_name.demodulize.underscore.dasherize
|
38
|
+
end
|
39
|
+
|
40
|
+
def empty_directory_with_keep_file(destination)
|
41
|
+
empty_directory(destination, {})
|
42
|
+
keep_file(destination)
|
43
|
+
end
|
44
|
+
|
45
|
+
def keep_file(destination)
|
46
|
+
create_file(File.join(destination, ".keep"))
|
47
|
+
end
|
48
|
+
|
49
|
+
def append_template_to_file(destination, source, *args)
|
50
|
+
partial = File.expand_path(find_in_source_paths(source))
|
51
|
+
append_to_file(destination, File.read(partial, *args))
|
52
|
+
end
|
53
|
+
|
54
|
+
def prepend_template_to_file(destination, source, *args)
|
55
|
+
partial = File.expand_path(find_in_source_paths(source))
|
56
|
+
prepend_to_file(destination, File.read(partial, *args))
|
57
|
+
end
|
58
|
+
|
59
|
+
def inject_template_into_file(destination, source, *args)
|
60
|
+
partial = File.expand_path(find_in_source_paths(source))
|
61
|
+
inject_into_file(destination, File.read(partial), *args)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# typed: false
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "base"
|
5
|
+
|
6
|
+
module Hephaestus
|
7
|
+
class ConfigGenerator < Generators::Base
|
8
|
+
def application
|
9
|
+
config = <<~CONFIG
|
10
|
+
|
11
|
+
|
12
|
+
if ENV.fetch("DEBUG", false) && defined?(Rails::Server) && Rails.env.development?
|
13
|
+
require "debug/open_nonstop"
|
14
|
+
end
|
15
|
+
|
16
|
+
CONFIG
|
17
|
+
|
18
|
+
inject_into_file(
|
19
|
+
"config/application.rb",
|
20
|
+
config,
|
21
|
+
after: "require \"rails/test_unit/railtie\"",
|
22
|
+
)
|
23
|
+
inject_into_file(
|
24
|
+
"config/application.rb",
|
25
|
+
"\n CURRENT_VERSION = \"2023-03-06\"\n\n",
|
26
|
+
before: "class Application < Rails::Application",
|
27
|
+
)
|
28
|
+
|
29
|
+
config = <<~CONFIG
|
30
|
+
|
31
|
+
# Only loads a smaller set of middleware suitable for API only apps.
|
32
|
+
# Middleware like session, flash, cookies can be added back manually.
|
33
|
+
# Skip views, helpers and assets when generating a new resource.
|
34
|
+
config.api_only = true
|
35
|
+
|
36
|
+
Rails.root.glob("app/lib/#{app_name.underscore}/middleware/*.{rb}").each { |file| require_relative file }
|
37
|
+
|
38
|
+
config.middleware.insert(0, PlugEmail::Middleware::TracingAttributes)
|
39
|
+
config.middleware.insert(0, PlugEmail::Middleware::MalformedRequest)
|
40
|
+
|
41
|
+
config.middleware.use(PlugEmail::Middleware::OpenapiValidation)
|
42
|
+
|
43
|
+
GIT_SHA = %x(git rev-parse HEAD).chomp
|
44
|
+
CONFIG
|
45
|
+
|
46
|
+
inject_into_file(
|
47
|
+
"config/application.rb",
|
48
|
+
config,
|
49
|
+
before: "\n end",
|
50
|
+
)
|
51
|
+
|
52
|
+
replace_in_file(
|
53
|
+
"config/application.rb",
|
54
|
+
"require \"rails\"\n",
|
55
|
+
"",
|
56
|
+
)
|
57
|
+
|
58
|
+
comment_lines("config/application.rb", "require \"active_model/railtie\"")
|
59
|
+
uncomment_lines("config/application.rb", "require \"active_job/railtie\"")
|
60
|
+
end
|
61
|
+
|
62
|
+
def boot
|
63
|
+
boot = "require \"bootsnap/setup\" # Speed up boot time by caching expensive operations."
|
64
|
+
inject_into_file(
|
65
|
+
"config/boot.rb",
|
66
|
+
boot,
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
def initializers
|
71
|
+
remove_dir("config/initializers")
|
72
|
+
directory("config/initializers", "config/initializers")
|
73
|
+
end
|
74
|
+
|
75
|
+
def configure_routes
|
76
|
+
routes = <<~ROUTES
|
77
|
+
root "root#index"
|
78
|
+
|
79
|
+
# events into the plug, usually from yetto
|
80
|
+
get "/api/2023-03-06/settings", to: "settings#index"
|
81
|
+
post "/api/2023-03-06/:event/:record_type", to: "yetto#event"
|
82
|
+
|
83
|
+
# Staff pages
|
84
|
+
get "staff", to: "staff#index"
|
85
|
+
require "sidekiq/web"
|
86
|
+
constraints ->(request) { StaffController.staff_request?(request) } do
|
87
|
+
mount Sidekiq::Web => "staff/sidekiq"
|
88
|
+
end
|
89
|
+
ROUTES
|
90
|
+
|
91
|
+
replace_in_file(
|
92
|
+
"config/routes.rb",
|
93
|
+
"# root \"articles#index\"",
|
94
|
+
routes,
|
95
|
+
)
|
96
|
+
end
|
97
|
+
|
98
|
+
def sidekiq
|
99
|
+
copy_file("config/sidekiq.yml", "config/sidekiq.yml")
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# typed: false
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "base"
|
5
|
+
|
6
|
+
module Hephaestus
|
7
|
+
class CoreGenerator < Generators::Base
|
8
|
+
def controllers
|
9
|
+
remove_file("app/controllers/application_controller.rb")
|
10
|
+
copy_file("app/controllers/application_controller.rb", "app/controllers/application_controller.rb")
|
11
|
+
|
12
|
+
copy_file("app/controllers/root_controller.rb", "app/controllers/root_controller.rb")
|
13
|
+
copy_file("app/controllers/settings_controller.rb", "app/controllers/settings_controller.rb")
|
14
|
+
copy_file("app/controllers/staff_controller.rb", "app/controllers/staff_controller.rb")
|
15
|
+
copy_file("app/controllers/yetto_controller.rb", "app/controllers/yetto_controller.rb")
|
16
|
+
|
17
|
+
copy_file("app/controllers/concerns/authable.rb", "app/controllers/concerns/authable.rb")
|
18
|
+
end
|
19
|
+
|
20
|
+
def jobs
|
21
|
+
copy_file("app/jobs/application_job.rb", "app/jobs/application_job.rb")
|
22
|
+
copy_file("app/jobs/update_yetto_job.rb", "app/jobs/update_yetto_job.rb")
|
23
|
+
end
|
24
|
+
|
25
|
+
def libs
|
26
|
+
bare_app_name = app_name.split("-").last
|
27
|
+
copy_file("app/lib/body_parameter/yetto_parameters.rb", "app/lib/body_parameter/yetto_parameters.rb")
|
28
|
+
copy_file("app/lib/constants/app.rb", "app/lib/constants/#{bare_app_name}.rb")
|
29
|
+
copy_file("app/lib/headers/yetto.rb", "app/lib/headers/yetto.rb")
|
30
|
+
copy_file("app/lib/path_parameter/yetto_parameters.rb", "app/lib/path_parameter/yetto_parameters.rb")
|
31
|
+
directory("app/lib/plug_app", "app/lib/#{app_name.underscore}")
|
32
|
+
|
33
|
+
copy_file("app/lib/body_parameter.rb", "app/lib/body_parameter.rb")
|
34
|
+
copy_file("app/lib/headers.rb", "app/lib/headers.rb")
|
35
|
+
copy_file("app/lib/path_parameter.rb", "app/lib/path_parameter.rb")
|
36
|
+
end
|
37
|
+
|
38
|
+
def serializers
|
39
|
+
copy_file("app/serializers/error_serializer.rb", "app/serializers/error_serializer.rb")
|
40
|
+
end
|
41
|
+
|
42
|
+
def services
|
43
|
+
copy_file("app/services/yetto_service.rb", "app/services/yetto_service.rb")
|
44
|
+
end
|
45
|
+
|
46
|
+
def views
|
47
|
+
copy_file("app/views/settings/index.json.jbuilder", "app/views/settings/index.json.jbuilder")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# typed: false
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "base"
|
5
|
+
|
6
|
+
module Hephaestus
|
7
|
+
class DeploymentGenerator < Generators::Base
|
8
|
+
def procfile
|
9
|
+
copy_file("Procfile.dev", "Procfile.dev")
|
10
|
+
copy_file("Procfile.debug", "Procfile.debug")
|
11
|
+
end
|
12
|
+
|
13
|
+
def sample_env
|
14
|
+
copy_file(".env.test", ".env.test")
|
15
|
+
copy_file(".env.test", ".env")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# typed: false
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "base"
|
5
|
+
|
6
|
+
module Hephaestus
|
7
|
+
class LibGenerator < Generators::Base
|
8
|
+
def lib_plug
|
9
|
+
directory("lib/plug_app", "lib/#{app_name.underscore}")
|
10
|
+
end
|
11
|
+
|
12
|
+
def lib_tasks
|
13
|
+
directory("lib/tasks", "lib/tasks")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# typed: false
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "base"
|
5
|
+
|
6
|
+
module Hephaestus
|
7
|
+
class LicenseGenerator < Generators::Base
|
8
|
+
def licensed
|
9
|
+
copy_file(".licensed.yml", ".licensed.yml")
|
10
|
+
end
|
11
|
+
|
12
|
+
def generate_licenses
|
13
|
+
run("script/licenses --update")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# typed: false
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "base"
|
5
|
+
|
6
|
+
module Hephaestus
|
7
|
+
class RubocopGenerator < Generators::Base
|
8
|
+
def rubocop
|
9
|
+
copy_file(".rubocop.yml", ".rubocop.yml")
|
10
|
+
end
|
11
|
+
|
12
|
+
def lint
|
13
|
+
Bundler.with_unbundled_env do
|
14
|
+
run("bundle exec rubocop -A", abort_on_failure: false)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# typed: false
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require_relative "base"
|
5
|
+
|
6
|
+
module Hephaestus
|
7
|
+
class SorbetGenerator < Generators::Base
|
8
|
+
def sorbet
|
9
|
+
copy_file("sorbet/custom.rbi", "sorbet/custom.rbi")
|
10
|
+
Bundler.with_unbundled_env do
|
11
|
+
run("bundle exec tapioca init")
|
12
|
+
run("script/typecheck --update")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/hephaestus.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# typed: false
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
DEBUG = ENV.fetch("DEBUG", false)
|
5
|
+
|
6
|
+
def debugging?
|
7
|
+
DEBUG
|
8
|
+
end
|
9
|
+
|
10
|
+
require "debug" if debugging?
|
11
|
+
|
12
|
+
require "hephaestus/version"
|
13
|
+
require "hephaestus/exit_on_failure"
|
14
|
+
require "hephaestus/generators/app_generator"
|
15
|
+
Dir.glob(File.join(__dir__, "hephaestus", "generators", "*.rb")).each do |file|
|
16
|
+
require file
|
17
|
+
end
|
18
|
+
|
19
|
+
require "hephaestus/actions"
|
20
|
+
require "hephaestus/actions/strip_comments_action"
|
21
|
+
require "hephaestus/app_builder"
|
@@ -0,0 +1,121 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
git_source(:github) do |repo_name|
|
4
|
+
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
|
5
|
+
"https://github.com/#{repo_name}.git"
|
6
|
+
end
|
7
|
+
|
8
|
+
ruby "<%= Hephaestus::RUBY_VERSION %>"
|
9
|
+
|
10
|
+
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
11
|
+
gem "rails", "~> 7.0"
|
12
|
+
|
13
|
+
# Use the Puma web server [https://github.com/puma/puma]
|
14
|
+
gem "puma", "~> 6.1"
|
15
|
+
|
16
|
+
# for making kick-ass http queries
|
17
|
+
gem "httpx", "~> 0.22"
|
18
|
+
|
19
|
+
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
|
20
|
+
gem "jbuilder", "~> 2.11"
|
21
|
+
|
22
|
+
# Use Redis adapter to run Action Cable in production
|
23
|
+
gem "redis", "~> 5.0"
|
24
|
+
|
25
|
+
# Use hiredis to get better performance than the "redis" gem
|
26
|
+
gem "hiredis", "~> 0.6"
|
27
|
+
|
28
|
+
# better loggin'
|
29
|
+
gem "lograge", "~> 0.12"
|
30
|
+
|
31
|
+
# provides middleware to make OpenAPI parsing simpler
|
32
|
+
gem "openapi_first", "~> 0.20"
|
33
|
+
|
34
|
+
# For Honeycomb.io
|
35
|
+
gem "opentelemetry-sdk", "~> 1.1"
|
36
|
+
gem "opentelemetry-exporter-otlp", "~> 0.23"
|
37
|
+
gem "opentelemetry-semantic_conventions", "~> 1.1"
|
38
|
+
|
39
|
+
gem "opentelemetry-instrumentation-rack", "~> 0.22"
|
40
|
+
gem "opentelemetry-instrumentation-rails", "~> 0.24"
|
41
|
+
gem "opentelemetry-instrumentation-concurrent_ruby", "~> 0.20"
|
42
|
+
|
43
|
+
gem "opentelemetry-instrumentation-net_http", "~> 0.21"
|
44
|
+
|
45
|
+
gem "opentelemetry-instrumentation-active_job", "~> 0.4"
|
46
|
+
gem "opentelemetry-instrumentation-redis", "~> 0.24"
|
47
|
+
gem "opentelemetry-instrumentation-sidekiq", "~> 0.23"
|
48
|
+
|
49
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
50
|
+
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
51
|
+
|
52
|
+
# Reduces boot times through caching; required in config/boot.rb
|
53
|
+
gem "bootsnap", require: false
|
54
|
+
|
55
|
+
gem "safety_dance", "~> 1.0"
|
56
|
+
|
57
|
+
# Use Sidekiq for the jobs queue
|
58
|
+
gem "sidekiq", "~> 7.0"
|
59
|
+
|
60
|
+
# sends logs to Slack
|
61
|
+
gem "slack_webhook_logger", "~> 0.1"
|
62
|
+
|
63
|
+
group :development, :test do
|
64
|
+
# better debug output with `ap`
|
65
|
+
gem "amazing_print"
|
66
|
+
|
67
|
+
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
68
|
+
gem "debug", platforms: [:mri, :mingw, :x64_mingw], require: false
|
69
|
+
|
70
|
+
gem "faker", "~> 2.20"
|
71
|
+
gem "rubocop", require: false
|
72
|
+
gem "rubocop-standard", require: false
|
73
|
+
end
|
74
|
+
|
75
|
+
group :development do
|
76
|
+
gem "dotenv-rails"
|
77
|
+
|
78
|
+
gem "foreman", "~> 0.87"
|
79
|
+
|
80
|
+
gem "licensed", "~> 4.0"
|
81
|
+
|
82
|
+
gem "ruby-lsp", "~> 0.3", require: false
|
83
|
+
|
84
|
+
gem "spoom"
|
85
|
+
gem "sorbet"
|
86
|
+
gem "tapioca", require: false
|
87
|
+
end
|
88
|
+
gem "sorbet-runtime"
|
89
|
+
|
90
|
+
group :test do
|
91
|
+
# Adds support for Capybara system testing and selenium driver
|
92
|
+
gem "capybara", "~> 3.26"
|
93
|
+
|
94
|
+
# track down flakey tests
|
95
|
+
gem "minitest-bisect"
|
96
|
+
|
97
|
+
# mocking lib
|
98
|
+
gem "mocha"
|
99
|
+
|
100
|
+
# allow easier middleware testing
|
101
|
+
gem "rack-test", "~> 2.0"
|
102
|
+
|
103
|
+
# navigate website
|
104
|
+
gem "selenium-webdriver"
|
105
|
+
|
106
|
+
# jump around through time
|
107
|
+
gem "timecop", "~> 0.9"
|
108
|
+
|
109
|
+
# Easy installation and use of web drivers to run system tests with browsers
|
110
|
+
gem "webdrivers", "~> 5.0", require: false
|
111
|
+
|
112
|
+
# prevents real http requests
|
113
|
+
gem "webmock", "~> 3.8"
|
114
|
+
end
|
115
|
+
|
116
|
+
group :ci do
|
117
|
+
gem "brakeman", "~> 5.3"
|
118
|
+
gem "bundle-audit", "~> 0.1"
|
119
|
+
end
|
120
|
+
|
121
|
+
gem "hephaestus", group: [:development, :test]
|
@@ -0,0 +1 @@
|
|
1
|
+
# <%= app_name.titlecase %>
|