hephaestus 0.8.12 → 0.8.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +1 -1
  4. data/bin/hephaestus +27 -37
  5. data/lib/hephaestus/engine.rb +2 -1
  6. data/lib/hephaestus/generators/app_generator.rb +181 -90
  7. data/lib/hephaestus/generators/base.rb +0 -9
  8. data/lib/hephaestus/version.rb +1 -1
  9. data/lib/hephaestus.rb +2 -10
  10. data/templates/bin/bundle +1 -1
  11. data/templates/hephaestus_github/dependabot.yml +27 -0
  12. data/templates/hephaestus_github/workflows/automerge.yml +14 -0
  13. data/templates/hephaestus_github/workflows/deploy.yml +30 -0
  14. data/templates/hephaestus_github/workflows/licenses.yml +17 -0
  15. data/templates/hephaestus_github/workflows/lint.yml +17 -0
  16. data/templates/hephaestus_github/workflows/security.yml +19 -0
  17. data/templates/hephaestus_github/workflows/sorbet.yml +19 -0
  18. data/templates/hephaestus_github/workflows/test.yml.tt +21 -0
  19. data/templates/hephaestus_github/workflows/updater.yml +18 -0
  20. data/templates/hephaestus_vscode/extensions.json +9 -0
  21. data/templates/hephaestus_vscode/launch.json +13 -0
  22. data/templates/hephaestus_vscode/settings.json +58 -0
  23. data/templates/{Gemfile → root/Gemfile} +0 -4
  24. data/templates/root/compose.yml +5 -0
  25. data/templates/root/hephaestus_dockerignore +43 -0
  26. data/templates/root/hephaestus_env.sample +12 -0
  27. data/templates/root/hephaestus_gitattributes +5 -0
  28. data/templates/root/hephaestus_licensed.yml +56 -0
  29. data/templates/root/hephaestus_rubocop.yml +5 -0
  30. data/templates/root/hephaestus_ruby-version +1 -0
  31. metadata +27 -19
  32. data/lib/hephaestus/app_builder.rb +0 -79
  33. data/lib/hephaestus/exit_on_failure.rb +0 -22
  34. data/lib/hephaestus/generators/config_generator.rb +0 -18
  35. data/lib/hephaestus/generators/core_generator.rb +0 -38
  36. data/lib/hephaestus/generators/db_generator.rb +0 -12
  37. data/lib/hephaestus/generators/deployment_generator.rb +0 -25
  38. data/lib/hephaestus/generators/lib_generator.rb +0 -12
  39. data/lib/hephaestus/generators/license_generator.rb +0 -19
  40. data/lib/hephaestus/generators/rubocop_generator.rb +0 -18
  41. data/lib/hephaestus/generators/sorbet_generator.rb +0 -17
  42. data/lib/version.rb +0 -6
  43. /data/templates/{Dockerfile → root/Dockerfile} +0 -0
  44. /data/templates/{Procfile → root/Procfile} +0 -0
  45. /data/templates/{README.md.erb → root/README.md.tt} +0 -0
  46. /data/templates/{config.ru → root/config.ru} +0 -0
  47. /data/templates/{hephaestus_gitignore → root/hephaestus_gitignore} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '06528561509ef978d2df34dc6ae67b75a91d26a67fda79fa97fbdd4dde886ab4'
4
- data.tar.gz: eb3559c45d3a7bf42221d346a344baaabbe44880dd755c87da5ff8109da11e93
3
+ metadata.gz: 946513d5bfb959191872e0404f6eb0c95c4a6d4ded918425926ba0ca24f09dce
4
+ data.tar.gz: 0524cf36eb6e3717eb1c1b7fab0de51438cbce348b0882a77e50422d5c25747a
5
5
  SHA512:
6
- metadata.gz: 56d6a0b8f9f823cc930230c9d2462d6f0fec6f801487acdbae3add9a63d7508100cf862c48c836e18bdfdcd30f7b261b77726469be194db352cb55ba90fdb119
7
- data.tar.gz: 1ea2bffff5ee8de27ae0de2a4657775bbad4bdddb82f369787e09ebb3fc9ec541316564e69609eb3fa70e708c9970667816e6f7e57a596fd50f567071c514a3a
6
+ metadata.gz: 15f88a25cfea5f83d2fb5ac629d163ab2d8b1205bc3b5a99cf38282b8628cac6da86a31f68c99e4e9eb0511e6a5f270ce562aada76e76db9eebf31a2f25073aa
7
+ data.tar.gz: 4271659d3c4302dcfa5cb991b8b9c01f20a8d2e8d13b3b554cfea8a79417117ee86ee2228188984bc1a78b7f42e5a81325386ebade0714c32dd14a7d8a5168c0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # [v0.8.12.2] - 17-12-2024
2
+ ## What's Changed
3
+ * Fixups by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/97
4
+
5
+
6
+ **Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.8.12.1...v0.8.12.2
7
+ # [v0.8.12.1] - 16-12-2024
8
+ ## What's Changed
9
+ * general updates by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/95
10
+
11
+
12
+ **Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.8.12...v0.8.12.1
1
13
  # [v0.8.12] - 16-12-2024
2
14
  ## What's Changed
3
15
  * Update template generator by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/93
data/README.md CHANGED
@@ -26,7 +26,7 @@ Where `app` represents the name of the platform you'd like to interact with, lik
26
26
  If you're working on updating/testing this gem locally, you may also try:
27
27
 
28
28
  ```
29
- rm -rf plug-app && DEBUG=1 bundle exec bin/hephaestus plug-app
29
+ rm -rf plug-app && DEBUG=1 bundle exec hephaestus/bin/hephaestus plug-app
30
30
  ```
31
31
 
32
32
  This way you can wipe the dir and quickly iterate on new changes.
data/bin/hephaestus CHANGED
@@ -34,6 +34,16 @@ if (str = ARGV.first)
34
34
  end
35
35
  end
36
36
 
37
+ if ARGV.empty?
38
+ puts "Please provide a path for the new application"
39
+ puts
40
+ puts "See --help for more info"
41
+ exit 0
42
+ elsif ["-v", "--version"].include?(ARGV[0])
43
+ puts Hephaestus::VERSION
44
+ exit 0
45
+ end
46
+
37
47
  if ENV.fetch("HEPHAESTUS_NO_EXTERNAL", "0") == "1"
38
48
  puts Rainbow("Skipping Hephaestus check...").yellow
39
49
  else
@@ -57,54 +67,34 @@ if ENV.fetch("HEPHAESTUS_NO_EXTERNAL", "0") != "1"
57
67
  end
58
68
  end
59
69
 
60
- puts Rainbow("Looking good! Proceeding...").blue
61
-
62
- if ARGV.empty?
63
- puts "Please provide a path for the new application"
64
- puts
65
- puts "See --help for more info"
66
- exit 0
67
- elsif ["-v", "--version"].include?(ARGV[0])
68
- puts Hephaestus::VERSION
69
- exit 0
70
- end
71
-
72
- path = ARGV.first
73
- if File.exist?(path)
74
- puts Rainbow("\nError: The directory #{path} already exists.").red
75
- exit 1
76
- end
77
-
78
- unless path.start_with?("plug-")
79
- puts Rainbow("\nError: The directory name must start with 'plug-'").red
80
- exit 1
81
- end
82
-
83
- if path.split("-").length < 2
84
- puts Rainbow("\nError: The directory name must start with 'plug-'").red
85
- exit 1
86
- end
70
+ puts Rainbow("You're on the latest version of Hephaestus! Proceeding...").blue
87
71
 
88
72
  ENGINE_ROOT = File.expand_path("..", __dir__)
89
73
  ENGINE_PATH = File.expand_path("../lib/hephaestus/engine", __dir__)
90
74
  APP_PATH = File.expand_path("../test/dummy/config/application", __dir__)
91
75
 
92
76
  # Set up gems listed in the Gemfile.
93
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
94
- require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
77
+ # ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
78
+ # require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
95
79
 
96
80
  require "rails/all"
97
81
  require "hephaestus"
98
82
 
99
83
  templates_root = File.expand_path(File.join("..", "templates"), File.dirname(__FILE__))
100
84
  Hephaestus::AppGenerator.source_root(templates_root)
101
- Hephaestus::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root
102
-
103
- ARGV.push("--minimal")
104
- ARGV.push("--no-skip-active-job")
105
- ARGV.push("--skip-asset-pipeline")
106
- ARGV.push("--skip-active-record")
107
- ARGV.push("--skip-docker")
108
- ARGV.push("--skip_bundle")
85
+
86
+ # Since we're hijacking Rails' generation process,
87
+ # we *do not* want any of Rails' generators to interfere.
88
+ # Rails provides its own list of generators,
89
+ # and then attaches Hephaestus' generators to that list;
90
+ # so, we'll remove any generators that come before Hephaestus' generators.
91
+ config = Hephaestus::AppGenerator.all_commands
92
+
93
+ delete_keys = true
94
+ config.keys.each do |key|
95
+ break if key == "hephaestus_generator"
96
+
97
+ config.delete(key) if delete_keys
98
+ end
109
99
 
110
100
  Hephaestus::AppGenerator.start
@@ -16,7 +16,8 @@ module Hephaestus
16
16
  when "production", "staging"
17
17
  ENV["GIT_SHA"] || ""
18
18
  when "development"
19
- %x(git rev-parse HEAD)
19
+ result = %x(git rev-parse HEAD 2>&1)
20
+ $CHILD_STATUS == 0 ? result : "deadbeef" # check if the child process exited cleanly.
20
21
  when "test"
21
22
  "deadbeef"
22
23
  end.chomp
@@ -4,12 +4,16 @@
4
4
  require "rails/generators"
5
5
  require "rails/generators/rails/app/app_generator"
6
6
  require "tempfile"
7
+ require "bundler"
7
8
 
9
+ require "hephaestus/actions"
8
10
  require "hephaestus/app_name"
9
11
  module Hephaestus
10
12
  class AppGenerator < Rails::Generators::AppGenerator
11
- include ExitOnFailure
12
13
  include Hephaestus::AppName
14
+ include Hephaestus::Actions
15
+
16
+ attr_reader :result_dir
13
17
 
14
18
  hide!
15
19
 
@@ -25,16 +29,29 @@ module Hephaestus
25
29
  group: :hephaestus,
26
30
  desc: "Show this help message and quit"
27
31
 
28
- def finish_template
29
- invoke(:hephaestus_initialize)
30
- # super
31
- end
32
-
33
- def hephaestus_initialize
32
+ # This method name is important as everything before it is added by
33
+ # Rails::Generators::AppGenerator; this is our true entrypoint.
34
+ def hephaestus_generator
34
35
  say(set_color("Invoking Hephaestus customizations...", :cyan))
35
36
 
36
- invoke(:init_git)
37
- invoke(:customize_gemfile)
37
+ path = ARGV.first
38
+ if File.exist?(path)
39
+ raise(Rainbow("\nError: The directory #{path} already exists.").red.to_s)
40
+ end
41
+
42
+ unless path.start_with?("plug-")
43
+ raise(Rainbow("\nError: The directory name must start with 'plug-'").red.to_s)
44
+ end
45
+
46
+ if path.split("-").length < 2
47
+ raise(Rainbow("\nError: The directory name must start with 'plug-'").red.to_s)
48
+ end
49
+
50
+ @destination_stack << @app_path
51
+
52
+ @result_dir = @destination_stack.join(File::SEPARATOR)
53
+
54
+ invoke(:copy_basics)
38
55
 
39
56
  invoke(:copy_github_actions)
40
57
  invoke(:copy_vscode_settings)
@@ -45,23 +62,20 @@ module Hephaestus
45
62
  invoke(:setup_test_environment)
46
63
 
47
64
  invoke(:configure_app)
48
- invoke(:leftovers)
65
+ invoke(:finalize)
66
+ invoke(:first_commit)
67
+ invoke(:outro)
49
68
  end
50
69
 
51
- def init_git
52
- run("git remote add origin https://github.com/yettoapp/#{app_name}.git")
53
- run("git branch -m production")
54
- end
70
+ def copy_basics
71
+ capture_stdout do
72
+ directory("root", ".")
55
73
 
56
- def customize_gemfile
57
- say(set_color("Customizing Gemfile...", :cyan))
58
- build(:replace_gemfile)
59
- unless ENV.fetch("HEPHAESTUS_NO_EXTERNAL", "0") == "1"
60
- capture_stdout do
61
- bundle_command("install")
62
- bundle_command("update")
63
- bundle_command("lock --add-platform x86_64-linux")
74
+ Dir.glob(File.join(destination_root, "hephaestus_*")).each do |file|
75
+ File.rename(file, file.gsub("hephaestus_", "."))
64
76
  end
77
+
78
+ copy_file("root/hephaestus_env.sample", ".env")
65
79
  end
66
80
  end
67
81
 
@@ -69,7 +83,7 @@ module Hephaestus
69
83
  say(set_color("Copying GitHub Actions...", :cyan))
70
84
 
71
85
  capture_stdout do
72
- directory(Hephaestus.source_path(".github"), ".github", force: true)
86
+ directory("hephaestus_github", ".github", force: true)
73
87
  end
74
88
  end
75
89
 
@@ -77,113 +91,157 @@ module Hephaestus
77
91
  say(set_color("Copying .vscode/...", :cyan))
78
92
 
79
93
  capture_stdout do
80
- directory(Hephaestus.source_path(".vscode"), ".vscode")
94
+ directory("hephaestus_vscode", ".vscode")
81
95
  end
82
96
  end
83
97
 
84
98
  def setup_development_environment
85
99
  say(set_color("Setting up the development environment...", :cyan))
86
- build(:setup_dev_environment)
100
+
87
101
  capture_stdout do
88
- build(:copy_setup_scripts)
102
+ copy_file("config/environments/blank.rb", "config/environments/development.rb", force: true)
103
+
104
+ directory(Hephaestus.source_path("script"), "script")
105
+
106
+ chmod_dir("script")
89
107
  end
90
108
  end
91
109
 
92
110
  def setup_staging_environment
93
111
  say(set_color("Setting up the staging environment...", :cyan))
94
- build(:setup_staging_environment)
112
+
95
113
  capture_stdout do
114
+ copy_file("config/environments/blank.rb", "config/environments/staging.rb", force: true)
96
115
  end
97
116
  end
98
117
 
99
118
  def setup_production_environment
100
119
  say(set_color("Setting up the production environment...", :cyan))
101
- build(:setup_production_environment)
120
+
102
121
  capture_stdout do
122
+ copy_file("config/environments/blank.rb", "config/environments/production.rb", force: true)
103
123
  end
104
124
  end
105
125
 
106
126
  def setup_test_environment
107
127
  say(set_color("Setting up the test environment...", :cyan))
108
- build(:setup_test_environment)
128
+
129
+ capture_stdout do
130
+ copy_file("config/environments/blank.rb", "config/environments/test.rb", force: true)
131
+ end
109
132
  end
110
133
 
111
134
  def configure_app
112
135
  say(set_color("Configuring app...", :cyan))
113
136
 
114
137
  capture_stdout do
115
- remove_dir("bin")
116
- remove_dir("app/helpers")
117
- remove_dir("app/models")
118
- remove_dir("app/views/layouts")
119
- remove_dir("lib/assets")
120
- remove_file("lib/tasks/.keep")
121
- end
122
-
123
- # This must be here, rather than a generator, because generators are run in a Rails environment,
124
- # and the bootup process requires the fake PEM key file to be present.
125
- # we do this to specify the template source, otherwise the generator wants to use its own `test` dir
126
- source = File.join(Hephaestus::AppGenerator.source_root, "test")
127
- directory(source, "test", force: true)
128
-
129
- # This must be here, rather than a generator, because generators are run in a Rails environment,
130
- # and the OpenAPI middleware, which is loaded when the app boots, requires the schema files to be present.
131
- capture_stdout do
138
+ # This must be here, rather than a generator, because generators are run in a Rails environment,
139
+ # and the bootup process requires the fake PEM key file to be present.
140
+ # we do this to specify the template source, otherwise the generator wants to use its own `test` dir
141
+ source = File.join(Hephaestus::AppGenerator.source_root, "test")
142
+ directory(source, "test", force: true)
143
+
144
+ # This must be here, rather than a generator, because generators are run in a Rails environment,
145
+ # and the OpenAPI middleware, which is loaded when the app boots, requires the schema files to be present.
132
146
  directory("lib/schemas/api/2023-03-06", "lib/schemas/api/2023-03-06")
133
- end
134
147
 
135
- # This is h
136
- # we do this to specify the template source, otherwise the generator wants to use Rails own `bin` dir
137
- source = File.join(Hephaestus::Engine.root, "templates", "bin")
138
- directory(source, "bin", force: true)
148
+ # we do this to specify the template source, otherwise the generator wants to use Rails own `bin` dir
149
+ source = File.join(Hephaestus::Engine.root, "templates", "bin")
150
+ directory(source, "bin", force: true)
151
+ chmod_dir("bin")
139
152
 
140
- say(set_color("\n*** All these upcoming `HEAD` errors are okay to ignore! ***\n", :cyan))
153
+ # we do this to specify the template source, otherwise the generator wants to use Rails' own dir
154
+ ["controllers", "jobs", "services", "views"].each do |dir|
155
+ source = File.join(Hephaestus::Engine.root, "templates", "app", dir)
156
+ directory(source, "app/#{dir}", force: true)
157
+ end
141
158
 
142
- capture_stdout do
143
- generate("hephaestus:core")
159
+ directory("db", "db")
144
160
 
145
- generate("hephaestus:db")
146
- generate("hephaestus:deployment")
147
- generate("hephaestus:lib")
161
+ directory("vendor/fly", "vendor/fly")
162
+
163
+ directory("lib/tasks", "lib/tasks")
164
+
165
+ remove_file("config/credentials.yml.enc")
148
166
 
149
167
  # keep this at the end
150
- generate("hephaestus:config")
168
+ directory("config", "config", force: true, exclude_pattern: /blank.rb/)
151
169
  end
152
170
  end
153
171
 
154
- # NOTE: this function name is important as it matches
155
- # a Rails function of the same name (that performs work
156
- # that we don't want to do). Think of this as the final step in the process
157
- # started by `finish_template`.
158
- def leftovers
159
- build(:replace_generic_variables)
172
+ # Think of this as the final step in the process
173
+ # started by `hephaestus_generator`. All the relevant commands are run in the context of the
174
+ # new app directory.
175
+ def finalize
176
+ File.rename(File.join(destination_root, "app", "controllers", "app_controller.rb"), File.join(destination_root, "app", "controllers", "#{plug_name}_controller.rb"))
177
+ File.rename(File.join(destination_root, "app", "services", "app_service.rb"), File.join(destination_root, "app", "services", "#{plug_name}_service.rb"))
178
+ File.rename(File.join(destination_root, "test", "controllers", "app_controller_test.rb"), File.join(destination_root, "test", "controllers", "#{plug_name}_controller_test.rb"))
179
+ File.rename(File.join(destination_root, "test", "support", "webmocks", "app_webmock.rb"), File.join(destination_root, "test", "support", "webmocks", "#{plug_name}_webmock.rb"))
180
+
181
+ replace_in_file(File.join("lib", "schemas", "api", "2023-03-06", "openapi.json"), %r{paths/app.json}, "paths/#{plug_name}.json")
182
+ File.rename(File.join(destination_root, "lib", "schemas", "api", "2023-03-06", "paths", "app.json"), File.join(destination_root, "lib", "schemas", "api", "2023-03-06", "paths", "#{plug_name}.json"))
183
+
184
+ Dir.chdir(shell.base.result_dir) do
185
+ unless ENV.fetch("HEPHAESTUS_NO_EXTERNAL", "0") == "1"
186
+ say(set_color("Installing gems...", :cyan))
187
+ capture_stdout do
188
+ run("bundle install", abort_on_failure: false)
189
+ run("bundle update")
190
+ run("bundle lock --add-platform x86_64-linux")
191
+ end
192
+ end
160
193
 
161
- say(set_color("Generating `hephaestus:license`...", :cyan))
162
- capture_stdout do
163
- generate("hephaestus:license")
164
- end
194
+ result = nil
195
+ say(set_color("Generating `hephaestus:license`...", :cyan))
196
+ Bundler.with_unbundled_env do
197
+ capture_stdout do
198
+ capture_stderr do
199
+ result = run("script/licenses --update", quiet: true, abort_on_failure: false)
200
+ end
201
+ end
202
+ end
165
203
 
166
- say(set_color("Generating `hephaestus:rubocop`...", :cyan))
167
- capture_stdout do
168
- generate("hephaestus:rubocop")
169
- end
204
+ unless result
205
+ say(set_color("Error generating licenses. When Hephaestus finishes executing, run `script/licenses --update`.", :red))
206
+ sleep(3)
207
+ end
170
208
 
171
- # say(set_color("Generating `hephaestus:sorbet`...", :cyan))
172
- # capture_stdout do
173
- # generate("hephaestus:sorbet")
174
- # end
209
+ # say(set_color("Generating `hephaestus:sorbet`...", :cyan))
210
+ # Bundler.with_unbundled_env do
211
+ # run("bundle exec tapioca init")
212
+ # run("bundle exec tapioca require")
213
+ # run("script/sorbet --update")
214
+ # end
215
+
216
+ say(set_color("Generating `hephaestus:rubocop`...", :cyan))
217
+ Bundler.with_unbundled_env do
218
+ capture_stdout do
219
+ capture_stderr do
220
+ result = run("bundle exec rubocop -A", abort_on_failure: false)
221
+ end
222
+ end
223
+ end
175
224
 
176
- say(set_color("Creating first commit...", :cyan))
177
- capture_stdout do
178
- invoke(:commit)
225
+ unless result
226
+ say(set_color("Could not run Rubocop. When Hephaestus finishes executing, run `bundle exec rubocop -A`.", :red))
227
+ sleep(3)
228
+ end
179
229
  end
180
-
181
- invoke(:outro)
182
230
  end
183
231
 
184
- def commit
185
- run("git add .")
186
- run("git commit -m 'Initial commit'", capture: true)
232
+ def first_commit
233
+ say(set_color("Creating first commit...", :cyan))
234
+
235
+ Dir.chdir(shell.base.result_dir) do
236
+ capture_stdout do
237
+ run("git init")
238
+ run("git remote add origin https://github.com/yettoapp/#{app_name}.git")
239
+ run("git branch -m production")
240
+
241
+ run("git add .")
242
+ run("git commit -m 'Initial commit'", capture: true)
243
+ end
244
+ end
187
245
  end
188
246
 
189
247
  def outro
@@ -239,13 +297,46 @@ module Hephaestus
239
297
  !options[:skip_active_record]
240
298
  end
241
299
 
242
- private def capture_stdout
243
- out = StringIO.new
244
- $stdout = out
300
+ private def capture_stdout(&block)
301
+ capture_stream("stdout", &block)
302
+ end
303
+
304
+ private def capture_stderr(&block)
305
+ capture_stream("stderr", &block)
306
+ end
307
+
308
+ private def capture_stream(stream)
309
+ captured_stream = Tempfile.new(stream)
310
+ stream_io = eval("$#{stream}", binding, __FILE__, __LINE__) # rubocop:disable Security/Eval
311
+ origin_stream = stream_io.dup
312
+ stream_io.reopen(captured_stream)
313
+
245
314
  yield
246
- out.string
247
- ensure
248
- $stdout = STDOUT
315
+
316
+ stream_io.rewind
317
+ captured_stream.read
318
+
319
+ unless captured_stream.nil?
320
+ captured_stream.close
321
+ captured_stream.unlink
322
+ end
323
+ stream_io.reopen(origin_stream) unless stream_io.nil?
324
+ end
325
+
326
+ private def chmod_dir(dir)
327
+ Dir.glob(File.join(destination_root, dir, "**", "*")).each do |file|
328
+ next if File.directory?(file)
329
+
330
+ # Rails adds this
331
+ if file == ".keep"
332
+ remove_file(file)
333
+ next
334
+ end
335
+
336
+ # this is because we might have *.tt templates, which aren't executable,
337
+ # so we gotta re-execute-em all
338
+ chmod(file, 0o755)
339
+ end
249
340
  end
250
341
  end
251
342
  end
@@ -8,7 +8,6 @@ module Hephaestus
8
8
  module Generators
9
9
  class Base < Rails::Generators::Base
10
10
  include Hephaestus::Actions
11
- include ExitOnFailure
12
11
 
13
12
  class << self
14
13
  def default_source_root
@@ -33,14 +32,6 @@ module Hephaestus
33
32
 
34
33
  private
35
34
 
36
- def app_name
37
- Rails.app_class.module_parent_name.demodulize.underscore.dasherize
38
- end
39
-
40
- def short_app_name
41
- app_name.sub(/plug-/i, "")
42
- end
43
-
44
35
  def empty_directory_with_keep_file(destination)
45
36
  empty_directory(destination, {})
46
37
  keep_file(destination)
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Hephaestus
5
- VERSION = "0.8.12"
5
+ VERSION = "0.8.12.2"
6
6
  RAILS_VERSION = ">= 8.0"
7
7
  RUBY_VERSION = File
8
8
  .read("#{File.dirname(__FILE__)}/../../.ruby-version")
data/lib/hephaestus.rb CHANGED
@@ -8,25 +8,17 @@ def debugging?
8
8
  end
9
9
 
10
10
  require "debug" if debugging?
11
+ require "amazing_print" if debugging?
11
12
 
12
13
  require "hephaestus/version"
13
14
  require "hephaestus/engine"
14
- require "hephaestus/exit_on_failure"
15
15
 
16
16
  require "hephaestus/generators/app_generator"
17
- require "hephaestus/generators/config_generator"
18
- require "hephaestus/generators/core_generator"
19
- require "hephaestus/generators/db_generator"
20
- require "hephaestus/generators/deployment_generator"
21
- require "hephaestus/generators/lib_generator"
22
- require "hephaestus/generators/license_generator"
23
- require "hephaestus/generators/rubocop_generator"
24
- require "hephaestus/generators/sorbet_generator"
25
17
 
26
18
  require "hephaestus/actions"
27
19
  require "hephaestus/app_name"
20
+
28
21
  require "hephaestus/actions/strip_comments_action"
29
- require "hephaestus/app_builder"
30
22
 
31
23
  module Hephaestus
32
24
  class << self
data/templates/bin/bundle CHANGED
@@ -41,7 +41,7 @@ m = Module.new do
41
41
 
42
42
  def gemfile
43
43
  gemfile = ENV["BUNDLE_GEMFILE"]
44
- return gemfile if gemfile.present?
44
+ return gemfile if gemfile && !gemfile.empty? # rubocop:disable Rails/Present
45
45
 
46
46
  File.expand_path("../Gemfile", __dir__)
47
47
  end
@@ -0,0 +1,27 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: weekly
7
+ day: monday
8
+ time: "09:00"
9
+ timezone: "Etc/UTC"
10
+ groups:
11
+ github-actions:
12
+ patterns:
13
+ - "*"
14
+ open-pull-requests-limit: 10
15
+
16
+ - package-ecosystem: bundler
17
+ directory: "/"
18
+ schedule:
19
+ interval: monthly
20
+ day: monday
21
+ time: "09:00"
22
+ timezone: "Etc/UTC"
23
+ open-pull-requests-limit: 10
24
+ groups:
25
+ bundler-dependencies:
26
+ patterns:
27
+ - "*"
@@ -0,0 +1,14 @@
1
+ name: PR auto-{approve,merge}
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ pull_request_target:
6
+
7
+ permissions:
8
+ pull-requests: write
9
+ contents: write
10
+
11
+ jobs:
12
+ bot-check:
13
+ uses: yettoapp/actions/.github/workflows/automerge.yml@main
14
+ secrets: inherit
@@ -0,0 +1,30 @@
1
+ name: Deployments
2
+ on:
3
+ push:
4
+ branches:
5
+ - production
6
+ workflow_dispatch:
7
+ inputs:
8
+ target:
9
+ required: true
10
+ type: choice
11
+ description: The name of the environment that you're deploying the application to
12
+ options:
13
+ - staging
14
+ - production
15
+ forced:
16
+ description: "Whether to perform the deploy regardless of test state."
17
+ required: false
18
+ type: boolean
19
+ default: false
20
+
21
+ jobs:
22
+ deployment:
23
+ name: Deploy app
24
+ uses: yettoapp/actions/.github/workflows/fly_deployment.yml@main
25
+ with:
26
+ target: ${{ github.event_name != 'workflow_dispatch' && 'production' || inputs.target }}
27
+ forced: ${{ github.event_name == 'workflow_dispatch' && inputs.forced || false }}
28
+ secrets:
29
+ gh_token: ${{ secrets.GH_DEPLOYMENTS_TOKEN }}
30
+ fly_token: ${{ inputs.target == 'staging' && secrets.FLY_STAGING_API_TOKEN || secrets.FLY_PRODUCTION_API_TOKEN }}