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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +1 -1
- data/bin/hephaestus +27 -37
- data/lib/hephaestus/engine.rb +2 -1
- data/lib/hephaestus/generators/app_generator.rb +181 -90
- data/lib/hephaestus/generators/base.rb +0 -9
- data/lib/hephaestus/version.rb +1 -1
- data/lib/hephaestus.rb +2 -10
- data/templates/bin/bundle +1 -1
- data/templates/hephaestus_github/dependabot.yml +27 -0
- data/templates/hephaestus_github/workflows/automerge.yml +14 -0
- data/templates/hephaestus_github/workflows/deploy.yml +30 -0
- data/templates/hephaestus_github/workflows/licenses.yml +17 -0
- data/templates/hephaestus_github/workflows/lint.yml +17 -0
- data/templates/hephaestus_github/workflows/security.yml +19 -0
- data/templates/hephaestus_github/workflows/sorbet.yml +19 -0
- data/templates/hephaestus_github/workflows/test.yml.tt +21 -0
- data/templates/hephaestus_github/workflows/updater.yml +18 -0
- data/templates/hephaestus_vscode/extensions.json +9 -0
- data/templates/hephaestus_vscode/launch.json +13 -0
- data/templates/hephaestus_vscode/settings.json +58 -0
- data/templates/{Gemfile → root/Gemfile} +0 -4
- data/templates/root/compose.yml +5 -0
- data/templates/root/hephaestus_dockerignore +43 -0
- data/templates/root/hephaestus_env.sample +12 -0
- data/templates/root/hephaestus_gitattributes +5 -0
- data/templates/root/hephaestus_licensed.yml +56 -0
- data/templates/root/hephaestus_rubocop.yml +5 -0
- data/templates/root/hephaestus_ruby-version +1 -0
- metadata +27 -19
- data/lib/hephaestus/app_builder.rb +0 -79
- data/lib/hephaestus/exit_on_failure.rb +0 -22
- data/lib/hephaestus/generators/config_generator.rb +0 -18
- data/lib/hephaestus/generators/core_generator.rb +0 -38
- data/lib/hephaestus/generators/db_generator.rb +0 -12
- data/lib/hephaestus/generators/deployment_generator.rb +0 -25
- data/lib/hephaestus/generators/lib_generator.rb +0 -12
- data/lib/hephaestus/generators/license_generator.rb +0 -19
- data/lib/hephaestus/generators/rubocop_generator.rb +0 -18
- data/lib/hephaestus/generators/sorbet_generator.rb +0 -17
- data/lib/version.rb +0 -6
- /data/templates/{Dockerfile → root/Dockerfile} +0 -0
- /data/templates/{Procfile → root/Procfile} +0 -0
- /data/templates/{README.md.erb → root/README.md.tt} +0 -0
- /data/templates/{config.ru → root/config.ru} +0 -0
- /data/templates/{hephaestus_gitignore → root/hephaestus_gitignore} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 946513d5bfb959191872e0404f6eb0c95c4a6d4ded918425926ba0ca24f09dce
|
4
|
+
data.tar.gz: 0524cf36eb6e3717eb1c1b7fab0de51438cbce348b0882a77e50422d5c25747a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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("
|
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
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
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
|
data/lib/hephaestus/engine.rb
CHANGED
@@ -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
|
-
|
29
|
-
|
30
|
-
|
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
|
-
|
37
|
-
|
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(:
|
65
|
+
invoke(:finalize)
|
66
|
+
invoke(:first_commit)
|
67
|
+
invoke(:outro)
|
49
68
|
end
|
50
69
|
|
51
|
-
def
|
52
|
-
|
53
|
-
|
54
|
-
end
|
70
|
+
def copy_basics
|
71
|
+
capture_stdout do
|
72
|
+
directory("root", ".")
|
55
73
|
|
56
|
-
|
57
|
-
|
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(
|
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(
|
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
|
-
|
100
|
+
|
87
101
|
capture_stdout do
|
88
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
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
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
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
|
-
|
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
|
-
|
143
|
-
generate("hephaestus:core")
|
159
|
+
directory("db", "db")
|
144
160
|
|
145
|
-
|
146
|
-
|
147
|
-
|
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
|
-
|
168
|
+
directory("config", "config", force: true, exclude_pattern: /blank.rb/)
|
151
169
|
end
|
152
170
|
end
|
153
171
|
|
154
|
-
#
|
155
|
-
#
|
156
|
-
#
|
157
|
-
|
158
|
-
|
159
|
-
|
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
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
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
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
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
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
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
|
-
|
177
|
-
|
178
|
-
|
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
|
185
|
-
|
186
|
-
|
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
|
-
|
244
|
-
|
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
|
-
|
247
|
-
|
248
|
-
|
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)
|
data/lib/hephaestus/version.rb
CHANGED
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
@@ -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,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 }}
|