inline_forms_installer 7.13.12 → 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
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
require "fileutils"
|
|
3
|
+
require "shellwords"
|
|
4
|
+
|
|
5
|
+
module InlineFormsInstaller
|
|
6
|
+
module CreateLog
|
|
7
|
+
module_function
|
|
8
|
+
|
|
9
|
+
def basename_for(started_at = Time.now)
|
|
10
|
+
"inline_forms_create-#{started_at.strftime('%Y%m%d-%H%M%S')}.log"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def final_path(app_name, started_at = Time.now)
|
|
14
|
+
File.expand_path(File.join(app_name, "log", basename_for(started_at)))
|
|
15
|
+
end
|
|
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
|
+
|
|
44
|
+
def tee_rails_new(app_name, shell_command, started_at: Time.now)
|
|
45
|
+
final = final_path(app_name, started_at)
|
|
46
|
+
tmp = File.expand_path(basename_for(started_at))
|
|
47
|
+
ENV["INLINE_FORMS_INSTALLER_LOG"] = tmp
|
|
48
|
+
ENV["INLINE_FORMS_INSTALLER_LOG_DISPLAY"] = final
|
|
49
|
+
ENV["INLINE_FORMS_CREATE_STARTED_AT"] = started_at.iso8601
|
|
50
|
+
|
|
51
|
+
write_header(tmp, started_at: started_at, display_path: final)
|
|
52
|
+
|
|
53
|
+
ok = system(
|
|
54
|
+
"bash", "-c",
|
|
55
|
+
"#{shell_command} 2>&1 | tee -a #{Shellwords.escape(tmp)}; exit ${PIPESTATUS[0]}"
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
if ok && File.directory?(app_name)
|
|
59
|
+
FileUtils.mkdir_p(File.join(app_name, "log"))
|
|
60
|
+
FileUtils.mv(tmp, final) if File.exist?(tmp)
|
|
61
|
+
elsif File.exist?(tmp)
|
|
62
|
+
FileUtils.mkdir_p(File.dirname(final))
|
|
63
|
+
FileUtils.mv(tmp, final)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
[ok, final]
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def append_section(path, title, body)
|
|
70
|
+
return if path.to_s.strip.empty?
|
|
71
|
+
|
|
72
|
+
FileUtils.mkdir_p(File.dirname(path))
|
|
73
|
+
File.open(path, "a") { |f| f.puts "\n=== #{title} ===\n#{body}" }
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
|
2
2
|
require "securerandom"
|
|
3
3
|
require "thor"
|
|
4
|
+
require_relative "create_log"
|
|
4
5
|
|
|
5
6
|
module InlineFormsInstaller
|
|
6
7
|
class Creator < Thor
|
|
@@ -20,7 +21,6 @@ module InlineFormsInstaller
|
|
|
20
21
|
method_option :example, :type => :boolean, :desc => "install the example app. uses sqlite as development database"
|
|
21
22
|
method_option :email, :aliases => "-e", :default => "admin@example.com", :desc => "specify admin email"
|
|
22
23
|
method_option :password, :aliases => "-p", :default => "admin999", :desc => "specify admin password"
|
|
23
|
-
method_option :runtest, :aliases => "--run-test", :default => false, :desc => "run tests"
|
|
24
24
|
method_option :skiprvm, :aliases => "--no-rvm", :type => :boolean, :default => false, :desc => "install inline_forms without RVM"
|
|
25
25
|
|
|
26
26
|
def create(app_name)
|
|
@@ -28,10 +28,6 @@ module InlineFormsInstaller
|
|
|
28
28
|
options[:skiprvm]
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
def self.runtest
|
|
32
|
-
options[:runtest]
|
|
33
|
-
end
|
|
34
|
-
|
|
35
31
|
def self.install_example?
|
|
36
32
|
options[:example]
|
|
37
33
|
end
|
|
@@ -117,17 +113,65 @@ module InlineFormsInstaller
|
|
|
117
113
|
rails_invocation = compatible_rails ? "rails _#{compatible_rails}_" : "rails"
|
|
118
114
|
say "Generating app with: #{rails_invocation} new ...", :green
|
|
119
115
|
|
|
120
|
-
|
|
116
|
+
started_at = Time.now
|
|
117
|
+
log_path = InlineFormsInstaller::CreateLog.final_path(app_name, started_at)
|
|
118
|
+
say "Install log: #{log_path}", :green
|
|
119
|
+
|
|
120
|
+
shell_cmd = [
|
|
121
|
+
rails_invocation, "new", app_name, "-m", app_template_file,
|
|
122
|
+
"--skip-bundle", "--skip-bootsnap", "--javascript=importmap"
|
|
123
|
+
].join(" ")
|
|
124
|
+
|
|
125
|
+
ok, log_path = InlineFormsInstaller::CreateLog.tee_rails_new(app_name, shell_cmd, started_at: started_at)
|
|
126
|
+
unless ok
|
|
121
127
|
say "Rails could not create the app '#{app_name}', maybe because it is a reserved word...", :red
|
|
128
|
+
say "Install log: #{log_path}", :red
|
|
122
129
|
exit 1
|
|
123
130
|
end
|
|
124
131
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
132
|
+
print_create_summary(app_name, log_path, started_at, install_example?)
|
|
133
|
+
end
|
|
134
|
+
|
|
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)
|
|
146
|
+
duration = (Time.now - started_at).round(1)
|
|
147
|
+
bundle_ok = false
|
|
148
|
+
Dir.chdir(app_name) do
|
|
149
|
+
bundle_ok = system("bundle", "check", out: File::NULL, err: File::NULL)
|
|
150
|
+
end
|
|
151
|
+
|
|
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
|
+
)
|
|
166
|
+
|
|
167
|
+
say ""
|
|
168
|
+
say "Install complete (#{duration}s)", :green
|
|
169
|
+
say " inline_forms #{if_ver} / inline_forms_installer #{inst_ver}", :green
|
|
170
|
+
say " bundle check: #{bundle_ok ? 'ok' : 'FAILED'}", bundle_ok ? :green : :red
|
|
171
|
+
say " tests: #{test_summary}", :green
|
|
172
|
+
say "Install log: #{log_path}", :green
|
|
130
173
|
end
|
|
174
|
+
private :print_create_summary, :test_summary_from_log
|
|
131
175
|
end
|
|
132
176
|
end
|
|
133
177
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
require "shellwords"
|
|
2
|
+
|
|
1
3
|
INSTALLER_ROOT = File.expand_path(ENV.fetch("INLINE_FORMS_INSTALLER_ROOT", File.expand_path("..", __dir__)))
|
|
2
4
|
INLINE_FORMS_ROOT = File.expand_path(ENV.fetch("INLINE_FORMS_ROOT", INSTALLER_ROOT))
|
|
5
|
+
require File.join(INSTALLER_ROOT, "lib", "inline_forms_installer", "create_log")
|
|
3
6
|
|
|
4
7
|
def bundle_install!
|
|
5
8
|
say "- Running bundle install..."
|
|
@@ -21,7 +24,7 @@ end
|
|
|
21
24
|
# Rails 7 dropped --skip-gemfile, so `rails new` always writes its own Gemfile.
|
|
22
25
|
# Remove it so our `create_file` below does not prompt for overwrite.
|
|
23
26
|
remove_file 'Gemfile' if File.exist?('Gemfile')
|
|
24
|
-
create_file 'Gemfile', "# created by
|
|
27
|
+
create_file 'Gemfile', "# created by inline_forms_installer #{ENV['inline_forms_installer_version']} on #{Date.today}\n"
|
|
25
28
|
|
|
26
29
|
# `rails new` is invoked with whatever the system `rails` binary points at
|
|
27
30
|
# (often Rails 8.x), so the generated `config/application.rb` may carry
|
|
@@ -95,6 +98,7 @@ gem_group :development do
|
|
|
95
98
|
gem 'capistrano', require: false
|
|
96
99
|
gem 'capistrano3-unicorn'
|
|
97
100
|
gem 'listen'
|
|
101
|
+
gem 'foreman'
|
|
98
102
|
gem 'puma', '>= 5.0'
|
|
99
103
|
gem 'rvm-capistrano', :require => false
|
|
100
104
|
gem 'rvm1-capistrano3', require: false
|
|
@@ -111,17 +115,13 @@ gem_group :production do
|
|
|
111
115
|
end
|
|
112
116
|
|
|
113
117
|
say "- Running bundle..."
|
|
114
|
-
run "gem install bundler"
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
File.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
vh_gem = vh_gem_dirs.flat_map { |dir| Dir[File.join(dir, "validation_hints-*.gem")] }.sort.last
|
|
122
|
-
if vh_gem && File.file?(vh_gem)
|
|
123
|
-
say "- Installing #{File.basename(vh_gem)} (local build; not on RubyGems yet)..."
|
|
124
|
-
run "gem install #{vh_gem} --no-document"
|
|
118
|
+
run "gem install bundler --no-document"
|
|
119
|
+
if (vh_root = ENV["VALIDATION_HINTS_ROOT"]) && File.directory?(vh_root)
|
|
120
|
+
vh_gem = Dir[File.join(vh_root, "validation_hints-*.gem")].sort.last
|
|
121
|
+
if vh_gem && File.file?(vh_gem)
|
|
122
|
+
say "- Installing #{File.basename(vh_gem)} from VALIDATION_HINTS_ROOT..."
|
|
123
|
+
run "gem install #{vh_gem} --no-document"
|
|
124
|
+
end
|
|
125
125
|
end
|
|
126
126
|
bundle_install!
|
|
127
127
|
|
|
@@ -1049,19 +1049,30 @@ if ENV['install_example'] == 'true'
|
|
|
1049
1049
|
route 'get "apartments/name_list", to: "apartments#name_list", as: :apartment_name_list'
|
|
1050
1050
|
route "root :to => 'apartments#index'"
|
|
1051
1051
|
|
|
1052
|
-
say "- Adding example app regression tests (bundle exec rails test)..."
|
|
1053
1052
|
example_tests_root = File.join(INSTALLER_ROOT, "lib/installer_templates/example_app_tests")
|
|
1054
1053
|
Dir.glob(File.join(example_tests_root, "**", "*.rb")).sort.each do |abs|
|
|
1055
1054
|
rel = abs.delete_prefix(example_tests_root + File::SEPARATOR).tr("\\", "/")
|
|
1056
1055
|
create_file rel, File.read(abs)
|
|
1057
1056
|
end
|
|
1058
1057
|
|
|
1058
|
+
say "- Running example regression tests (bundle exec rails test)..."
|
|
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
|
|
1067
|
+
|
|
1059
1068
|
say "\nDone! Example app (Photo + Apartment + Owner) is ready.", :yellow
|
|
1060
|
-
say " bundle exec rails
|
|
1061
|
-
say "
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1069
|
+
say " cd #{File.basename(Dir.pwd)} && rvm use . && bundle exec rails s", :yellow
|
|
1070
|
+
say " http://localhost:3000/apartments — #{ENV["email"]} / #{ENV["password"]}", :yellow
|
|
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 != ""
|
|
1074
|
+
say " Install log: #{log_path}", :yellow
|
|
1075
|
+
end
|
|
1065
1076
|
end
|
|
1066
1077
|
# done!
|
|
1067
1078
|
say "\nDone! Now make your tables with 'bundle exec rails g inline_forms ...", :yellow
|
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.
|
|
4
|
+
version: 7.13.14
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ace Suares
|
|
@@ -78,6 +78,7 @@ files:
|
|
|
78
78
|
- inline_forms_installer.gemspec
|
|
79
79
|
- lib/inline_forms_installer.rb
|
|
80
80
|
- lib/inline_forms_installer/app_template.rb
|
|
81
|
+
- lib/inline_forms_installer/create_log.rb
|
|
81
82
|
- lib/inline_forms_installer/creator.rb
|
|
82
83
|
- lib/inline_forms_installer/installer_core.rb
|
|
83
84
|
- lib/inline_forms_installer/version.rb
|