inline_forms_installer 7.13.11 → 7.13.13
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: 040522701135611fb98f42262dde130ed4abf544dbcab5d61cb4bac8c4cdb381
|
|
4
|
+
data.tar.gz: 59e927280fe2d3de6d027e8adcd6ae432174225d7cf619ff26fc4b4982520864
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 578ebcf29d67df3e127a0eff5049a8cb2799fd9abb503ac89c5487e36f11ae475d5a4cfbf37bbdd8efeb69ade61caa8d1267aa9d88ed3f74dcd008abc4d9d402
|
|
7
|
+
data.tar.gz: 95fa9bfad065ed0810f84093baa5b513a207ae2cc2fe3b5ac182b3e2baf46ae70a09a32eee095242f6f208ed3263e0fb00d38ae04d47bebd7129d2cac9b39092
|
|
@@ -0,0 +1,46 @@
|
|
|
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 tee_rails_new(app_name, shell_command, started_at: Time.now)
|
|
18
|
+
final = final_path(app_name, started_at)
|
|
19
|
+
tmp = File.expand_path(basename_for(started_at))
|
|
20
|
+
ENV["INLINE_FORMS_INSTALLER_LOG"] = final
|
|
21
|
+
ENV["INLINE_FORMS_CREATE_STARTED_AT"] = started_at.iso8601
|
|
22
|
+
|
|
23
|
+
ok = system(
|
|
24
|
+
"bash", "-c",
|
|
25
|
+
"#{shell_command} 2>&1 | tee #{Shellwords.escape(tmp)}; exit ${PIPESTATUS[0]}"
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
if ok && File.directory?(app_name)
|
|
29
|
+
FileUtils.mkdir_p(File.join(app_name, "log"))
|
|
30
|
+
FileUtils.mv(tmp, final) if File.exist?(tmp)
|
|
31
|
+
elsif File.exist?(tmp)
|
|
32
|
+
FileUtils.mkdir_p(File.dirname(final))
|
|
33
|
+
FileUtils.mv(tmp, final)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
[ok, final]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def append_section(path, title, body)
|
|
40
|
+
return if path.to_s.strip.empty?
|
|
41
|
+
|
|
42
|
+
FileUtils.mkdir_p(File.dirname(path))
|
|
43
|
+
File.open(path, "a") { |f| f.puts "\n=== #{title} ===\n#{body}" }
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
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,11 +113,43 @@ 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
|
|
131
|
+
|
|
132
|
+
print_create_summary(app_name, log_path, started_at)
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def print_create_summary(app_name, log_path, started_at)
|
|
136
|
+
duration = (Time.now - started_at).round(1)
|
|
137
|
+
bundle_ok = false
|
|
138
|
+
Dir.chdir(app_name) do
|
|
139
|
+
bundle_ok = system("bundle", "check", out: File::NULL, err: File::NULL)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
test_summary = ENV["INLINE_FORMS_CREATE_TEST_SUMMARY"].to_s
|
|
143
|
+
test_summary = "(not run — create without --example)" if test_summary.empty?
|
|
144
|
+
|
|
145
|
+
say ""
|
|
146
|
+
say "Install complete (#{duration}s)", :green
|
|
147
|
+
say " inline_forms #{InlineFormsInstaller.inline_forms_version} / inline_forms_installer #{InlineFormsInstaller::VERSION}", :green
|
|
148
|
+
say " bundle check: #{bundle_ok ? 'ok' : 'FAILED'}", bundle_ok ? :green : :red
|
|
149
|
+
say " tests: #{test_summary}", :green
|
|
150
|
+
say "Install log: #{log_path}", :green
|
|
124
151
|
end
|
|
152
|
+
private :print_create_summary
|
|
125
153
|
end
|
|
126
154
|
end
|
|
127
155
|
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
+
require "open3"
|
|
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")
|
|
6
|
+
|
|
7
|
+
def bundle_install!
|
|
8
|
+
say "- Running bundle install..."
|
|
9
|
+
unless system("bundle", "install")
|
|
10
|
+
abort "ERROR: bundle install failed in #{Dir.pwd}. From the app directory run: rvm use . && bundle install"
|
|
11
|
+
end
|
|
12
|
+
unless system("bundle", "check")
|
|
13
|
+
abort "ERROR: bundle check failed (gems missing). From the app directory run: rvm use . && bundle install"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
3
16
|
|
|
4
17
|
# Pin Ruby for the generated app (after `rails new`; do not write these files in
|
|
5
18
|
# Creator before `rails new` — Rails also emits `.ruby-version` and prompts).
|
|
@@ -85,6 +98,7 @@ gem_group :development do
|
|
|
85
98
|
gem 'capistrano', require: false
|
|
86
99
|
gem 'capistrano3-unicorn'
|
|
87
100
|
gem 'listen'
|
|
101
|
+
gem 'foreman'
|
|
88
102
|
gem 'puma', '>= 5.0'
|
|
89
103
|
gem 'rvm-capistrano', :require => false
|
|
90
104
|
gem 'rvm1-capistrano3', require: false
|
|
@@ -101,19 +115,15 @@ gem_group :production do
|
|
|
101
115
|
end
|
|
102
116
|
|
|
103
117
|
say "- Running bundle..."
|
|
104
|
-
run "gem install bundler"
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
File.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
vh_gem = vh_gem_dirs.flat_map { |dir| Dir[File.join(dir, "validation_hints-*.gem")] }.sort.last
|
|
112
|
-
if vh_gem && File.file?(vh_gem)
|
|
113
|
-
say "- Installing #{File.basename(vh_gem)} (local build; not on RubyGems yet)..."
|
|
114
|
-
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
|
|
115
125
|
end
|
|
116
|
-
|
|
126
|
+
bundle_install!
|
|
117
127
|
|
|
118
128
|
say "- Dart Sass: inline_forms stylesheet entrypoints + initializer..."
|
|
119
129
|
copy_file File.join(INSTALLER_ROOT, "lib/installer_templates/dartsass/inline_forms_dartsass_builds.rb"),
|
|
@@ -413,7 +423,7 @@ copy_file File.join(INLINE_FORMS_ROOT, 'lib/generators/templates/application_rec
|
|
|
413
423
|
say "- Install ActionText..."
|
|
414
424
|
run "bundle exec rails active_storage:install"
|
|
415
425
|
run "bundle exec rails action_text:install:migrations"
|
|
416
|
-
|
|
426
|
+
bundle_install!
|
|
417
427
|
|
|
418
428
|
say "- Paper_trail install..."
|
|
419
429
|
# Upstream paper_trail (>= 13) detects MySQL via the live ActiveRecord connection,
|
|
@@ -1039,19 +1049,27 @@ if ENV['install_example'] == 'true'
|
|
|
1039
1049
|
route 'get "apartments/name_list", to: "apartments#name_list", as: :apartment_name_list'
|
|
1040
1050
|
route "root :to => 'apartments#index'"
|
|
1041
1051
|
|
|
1042
|
-
say "- Adding example app regression tests (bundle exec rails test)..."
|
|
1043
1052
|
example_tests_root = File.join(INSTALLER_ROOT, "lib/installer_templates/example_app_tests")
|
|
1044
1053
|
Dir.glob(File.join(example_tests_root, "**", "*.rb")).sort.each do |abs|
|
|
1045
1054
|
rel = abs.delete_prefix(example_tests_root + File::SEPARATOR).tr("\\", "/")
|
|
1046
1055
|
create_file rel, File.read(abs)
|
|
1047
1056
|
end
|
|
1048
1057
|
|
|
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?
|
|
1066
|
+
|
|
1049
1067
|
say "\nDone! Example app (Photo + Apartment + Owner) is ready.", :yellow
|
|
1050
|
-
say " bundle exec rails
|
|
1051
|
-
say "
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1068
|
+
say " cd #{File.basename(Dir.pwd)} && rvm use . && bundle exec rails s", :yellow
|
|
1069
|
+
say " http://localhost:3000/apartments — #{ENV["email"]} / #{ENV["password"]}", :yellow
|
|
1070
|
+
if (log_path = ENV["INLINE_FORMS_INSTALLER_LOG"]).to_s != ""
|
|
1071
|
+
say " Install log: #{log_path}", :yellow
|
|
1072
|
+
end
|
|
1055
1073
|
end
|
|
1056
1074
|
# done!
|
|
1057
1075
|
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.13
|
|
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
|