inline_forms_installer 7.13.13 → 7.13.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dc53f7edb26ebffb66e3d3aa0e018ba33b54795c2716c99ca02eef0ef1cdfe56
|
|
4
|
+
data.tar.gz: e8d5cc3f8f2ffd62cbce5cc54db7fd99dacc039450741305f4afa453ab7d8b61
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f9ea09854370bc3df76b4edbeb9a1c54ddb4579f327d76fa884821ab8f76b6e0f0266f99a066caff03c11784476701ea51aa05e85aaf910cc077f97eab98d3c7
|
|
7
|
+
data.tar.gz: acb61c2ef500a94995f15dbaabae511a3f05e3a87839f6ac2a59bf26314ec4226f92e5297d1d97343c67a5af0b248757ee6d0be46a1c5c19b37ab2766e2786e5
|
|
@@ -14,15 +14,45 @@ module InlineFormsInstaller
|
|
|
14
14
|
File.expand_path(File.join(app_name, "log", basename_for(started_at)))
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
def write_header(path, started_at: Time.now, display_path: nil)
|
|
18
|
+
FileUtils.mkdir_p(File.dirname(path))
|
|
19
|
+
shown = display_path || path
|
|
20
|
+
File.open(path, "w") do |f|
|
|
21
|
+
f.puts "=== inline_forms create install log ==="
|
|
22
|
+
f.puts "started: #{started_at.iso8601}"
|
|
23
|
+
f.puts "Install log: #{shown}"
|
|
24
|
+
f.puts ""
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def append_summary(path, started_at:, duration_s:, inline_forms_version:, installer_version:, bundle_ok:, test_summary:)
|
|
29
|
+
append_section(
|
|
30
|
+
path,
|
|
31
|
+
"install summary",
|
|
32
|
+
<<~TEXT
|
|
33
|
+
finished: #{Time.now.iso8601}
|
|
34
|
+
duration: #{duration_s}s
|
|
35
|
+
inline_forms: #{inline_forms_version}
|
|
36
|
+
inline_forms_installer: #{installer_version}
|
|
37
|
+
bundle check: #{bundle_ok ? "ok" : "FAILED"}
|
|
38
|
+
tests: #{test_summary}
|
|
39
|
+
Install log: #{path}
|
|
40
|
+
TEXT
|
|
41
|
+
)
|
|
42
|
+
end
|
|
43
|
+
|
|
17
44
|
def tee_rails_new(app_name, shell_command, started_at: Time.now)
|
|
18
45
|
final = final_path(app_name, started_at)
|
|
19
46
|
tmp = File.expand_path(basename_for(started_at))
|
|
20
|
-
ENV["INLINE_FORMS_INSTALLER_LOG"] =
|
|
47
|
+
ENV["INLINE_FORMS_INSTALLER_LOG"] = tmp
|
|
48
|
+
ENV["INLINE_FORMS_INSTALLER_LOG_DISPLAY"] = final
|
|
21
49
|
ENV["INLINE_FORMS_CREATE_STARTED_AT"] = started_at.iso8601
|
|
22
50
|
|
|
51
|
+
write_header(tmp, started_at: started_at, display_path: final)
|
|
52
|
+
|
|
23
53
|
ok = system(
|
|
24
54
|
"bash", "-c",
|
|
25
|
-
"#{shell_command} 2>&1 | tee #{Shellwords.escape(tmp)}; exit ${PIPESTATUS[0]}"
|
|
55
|
+
"#{shell_command} 2>&1 | tee -a #{Shellwords.escape(tmp)}; exit ${PIPESTATUS[0]}"
|
|
26
56
|
)
|
|
27
57
|
|
|
28
58
|
if ok && File.directory?(app_name)
|
|
@@ -129,27 +129,49 @@ module InlineFormsInstaller
|
|
|
129
129
|
exit 1
|
|
130
130
|
end
|
|
131
131
|
|
|
132
|
-
print_create_summary(app_name, log_path, started_at)
|
|
132
|
+
print_create_summary(app_name, log_path, started_at, install_example?)
|
|
133
133
|
end
|
|
134
134
|
|
|
135
|
-
def
|
|
135
|
+
def test_summary_from_log(log_path, ran_example)
|
|
136
|
+
return "(not run — create without --example)" unless ran_example
|
|
137
|
+
return "(install log missing)" unless log_path.to_s != "" && File.file?(log_path)
|
|
138
|
+
|
|
139
|
+
summary = File.read(log_path).lines.reverse.find { |l| l =~ /\d+ runs,/ }
|
|
140
|
+
return summary.strip if summary
|
|
141
|
+
|
|
142
|
+
"(see install log — no Minitest summary line)"
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def print_create_summary(app_name, log_path, started_at, ran_example)
|
|
136
146
|
duration = (Time.now - started_at).round(1)
|
|
137
147
|
bundle_ok = false
|
|
138
148
|
Dir.chdir(app_name) do
|
|
139
149
|
bundle_ok = system("bundle", "check", out: File::NULL, err: File::NULL)
|
|
140
150
|
end
|
|
141
151
|
|
|
142
|
-
test_summary =
|
|
143
|
-
|
|
152
|
+
test_summary = test_summary_from_log(log_path, ran_example)
|
|
153
|
+
|
|
154
|
+
if_ver = InlineFormsInstaller.inline_forms_version
|
|
155
|
+
inst_ver = InlineFormsInstaller::VERSION
|
|
156
|
+
|
|
157
|
+
InlineFormsInstaller::CreateLog.append_summary(
|
|
158
|
+
log_path,
|
|
159
|
+
started_at: started_at,
|
|
160
|
+
duration_s: duration,
|
|
161
|
+
inline_forms_version: if_ver,
|
|
162
|
+
installer_version: inst_ver,
|
|
163
|
+
bundle_ok: bundle_ok,
|
|
164
|
+
test_summary: test_summary
|
|
165
|
+
)
|
|
144
166
|
|
|
145
167
|
say ""
|
|
146
168
|
say "Install complete (#{duration}s)", :green
|
|
147
|
-
say " inline_forms #{
|
|
169
|
+
say " inline_forms #{if_ver} / inline_forms_installer #{inst_ver}", :green
|
|
148
170
|
say " bundle check: #{bundle_ok ? 'ok' : 'FAILED'}", bundle_ok ? :green : :red
|
|
149
171
|
say " tests: #{test_summary}", :green
|
|
150
172
|
say "Install log: #{log_path}", :green
|
|
151
173
|
end
|
|
152
|
-
private :print_create_summary
|
|
174
|
+
private :print_create_summary, :test_summary_from_log
|
|
153
175
|
end
|
|
154
176
|
end
|
|
155
177
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require "
|
|
1
|
+
require "shellwords"
|
|
2
2
|
|
|
3
3
|
INSTALLER_ROOT = File.expand_path(ENV.fetch("INLINE_FORMS_INSTALLER_ROOT", File.expand_path("..", __dir__)))
|
|
4
4
|
INLINE_FORMS_ROOT = File.expand_path(ENV.fetch("INLINE_FORMS_ROOT", INSTALLER_ROOT))
|
|
@@ -24,7 +24,7 @@ end
|
|
|
24
24
|
# Rails 7 dropped --skip-gemfile, so `rails new` always writes its own Gemfile.
|
|
25
25
|
# Remove it so our `create_file` below does not prompt for overwrite.
|
|
26
26
|
remove_file 'Gemfile' if File.exist?('Gemfile')
|
|
27
|
-
create_file 'Gemfile', "# created by
|
|
27
|
+
create_file 'Gemfile', "# created by inline_forms_installer #{ENV['inline_forms_installer_version']} on #{Date.today}\n"
|
|
28
28
|
|
|
29
29
|
# `rails new` is invoked with whatever the system `rails` binary points at
|
|
30
30
|
# (often Rails 8.x), so the generated `config/application.rb` may carry
|
|
@@ -1056,18 +1056,21 @@ if ENV['install_example'] == 'true'
|
|
|
1056
1056
|
end
|
|
1057
1057
|
|
|
1058
1058
|
say "- Running example regression tests (bundle exec rails test)..."
|
|
1059
|
-
|
|
1060
|
-
if
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1059
|
+
log_path = ENV["INLINE_FORMS_INSTALLER_LOG"].to_s
|
|
1060
|
+
test_cmd = if log_path != ""
|
|
1061
|
+
"bundle exec rails test 2>&1 | tee -a #{Shellwords.escape(log_path)}"
|
|
1062
|
+
else
|
|
1063
|
+
"bundle exec rails test 2>&1"
|
|
1064
|
+
end
|
|
1065
|
+
test_ok = system("bash", "-c", "#{test_cmd}; exit ${PIPESTATUS[0]}")
|
|
1066
|
+
abort "ERROR: bundle exec rails test failed during --example install. See #{log_path}" unless test_ok
|
|
1066
1067
|
|
|
1067
1068
|
say "\nDone! Example app (Photo + Apartment + Owner) is ready.", :yellow
|
|
1068
1069
|
say " cd #{File.basename(Dir.pwd)} && rvm use . && bundle exec rails s", :yellow
|
|
1069
1070
|
say " http://localhost:3000/apartments — #{ENV["email"]} / #{ENV["password"]}", :yellow
|
|
1070
|
-
|
|
1071
|
+
log_path = ENV["INLINE_FORMS_INSTALLER_LOG_DISPLAY"].to_s
|
|
1072
|
+
log_path = ENV["INLINE_FORMS_INSTALLER_LOG"].to_s if log_path.empty?
|
|
1073
|
+
if log_path != ""
|
|
1071
1074
|
say " Install log: #{log_path}", :yellow
|
|
1072
1075
|
end
|
|
1073
1076
|
end
|