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: 040522701135611fb98f42262dde130ed4abf544dbcab5d61cb4bac8c4cdb381
4
- data.tar.gz: 59e927280fe2d3de6d027e8adcd6ae432174225d7cf619ff26fc4b4982520864
3
+ metadata.gz: dc53f7edb26ebffb66e3d3aa0e018ba33b54795c2716c99ca02eef0ef1cdfe56
4
+ data.tar.gz: e8d5cc3f8f2ffd62cbce5cc54db7fd99dacc039450741305f4afa453ab7d8b61
5
5
  SHA512:
6
- metadata.gz: 578ebcf29d67df3e127a0eff5049a8cb2799fd9abb503ac89c5487e36f11ae475d5a4cfbf37bbdd8efeb69ade61caa8d1267aa9d88ed3f74dcd008abc4d9d402
7
- data.tar.gz: 95fa9bfad065ed0810f84093baa5b513a207ae2cc2fe3b5ac182b3e2baf46ae70a09a32eee095242f6f208ed3263e0fb00d38ae04d47bebd7129d2cac9b39092
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"] = final
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 print_create_summary(app_name, log_path, started_at)
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 = ENV["INLINE_FORMS_CREATE_TEST_SUMMARY"].to_s
143
- test_summary = "(not run — create without --example)" if test_summary.empty?
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 #{InlineFormsInstaller.inline_forms_version} / inline_forms_installer #{InlineFormsInstaller::VERSION}", :green
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 "open3"
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 inline_forms #{ENV['inline_forms_version']} on #{Date.today}\n"
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
- test_out, test_status = Open3.capture2e("bundle", "exec", "rails", "test")
1060
- if (log_path = ENV["INLINE_FORMS_INSTALLER_LOG"]).to_s != ""
1061
- InlineFormsInstaller::CreateLog.append_section(log_path, "bundle exec rails test", test_out)
1062
- end
1063
- summary_line = test_out.lines.reverse.find { |l| l =~ /\d+ runs,/ }
1064
- ENV["INLINE_FORMS_CREATE_TEST_SUMMARY"] = summary_line&.strip || "failed (no summary line)"
1065
- abort "ERROR: bundle exec rails test failed during --example install.\n#{test_out}" unless test_status.success?
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
- if (log_path = ENV["INLINE_FORMS_INSTALLER_LOG"]).to_s != ""
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
@@ -1,6 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineFormsInstaller
3
- VERSION = "7.13.13"
3
+ VERSION = "7.13.14"
4
4
 
5
5
  # Written into generated apps' `.ruby-version` (must match gemspec `required_ruby_version`).
6
6
  TARGET_RUBY_VERSION = "ruby-4.0.4"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inline_forms_installer
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.13.13
4
+ version: 7.13.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares