inline_forms_installer 8.0.0 → 8.0.3

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: dd3c5925a09649543ee457a7150ce972a9369172b2b458c32997fe6e8bcb2c2f
4
- data.tar.gz: e518a25462d7003a2b40415dbdd60782f87f6fb8b7e26068a4ae223c7ef75131
3
+ metadata.gz: 91d4fdc2c47dbae9f0fb05f32157e77326029df28eae8c529655779d417d791a
4
+ data.tar.gz: d21272dbbdd19be64fd742f267054fca738afc40cffbda9cbfe74dfb1bf2982a
5
5
  SHA512:
6
- metadata.gz: b2679daccabc402e75e1651946d55f9c04101460d80c881336c618f4d1a4662e38a840c2a397f2da5dbb19f126159a101d40f7bf67e070c3dc8a53e52e36c9ca
7
- data.tar.gz: ef9c2b32d0d7df9370feece3b35e97bcb842013e5d89a4da83a4cacb950e295d7d513ebd165f9cf25c6d4b2b9af9dbe4f2b5e11efb05acbed5a46e9776eee074
6
+ metadata.gz: 51085fde767560341594f9d3c3da50b8a6085b06bfef3a3ba4826e63a21de5f5278d43fdee437b1e6c45f44738bb81b3fc7e3cde5bd471dee6fe5581a7bb0bcf
7
+ data.tar.gz: 1f4f9a714507ac6ba8658418a0586d1f006591f3ea9ffe6a0f655390211e7ea090a74c35f5f18cf8bbf61bbbd5b2a4fa0f52cf4f17ba223aba0b6c6f6bb8ba60
@@ -61,7 +61,7 @@ module InlineFormsInstaller
61
61
 
62
62
  inline_forms_version = InlineFormsInstaller.inline_forms_version
63
63
  # The Gemfile pins `gem "inline_forms", "~> 8"`, so Bundler resolves the
64
- # highest 7.x available on RubyGems at install time. The
64
+ # highest 8.x available on RubyGems at install time. The
65
65
  # `inline_forms_version` value above is just whatever happens to be in
66
66
  # the Creator's own gemset and may differ from what lands in the app;
67
67
  # report the constraint instead of a misleading exact version, and let
@@ -103,6 +103,7 @@ module InlineFormsInstaller
103
103
  ENV["inline_forms_installer_version"] = InlineFormsInstaller::VERSION
104
104
  ENV["INLINE_FORMS_INSTALLER_ROOT"] = InlineFormsInstaller.gem_root
105
105
  ENV["INLINE_FORMS_ROOT"] = InlineFormsInstaller.inline_forms_gem_root
106
+ InlineFormsInstaller.discover_prerelease_env!
106
107
 
107
108
  app_template_file = File.join(__dir__, "app_template.rb")
108
109
 
@@ -112,7 +113,7 @@ module InlineFormsInstaller
112
113
  Gem::Specification
113
114
  .find_all_by_name("rails")
114
115
  .map(&:version)
115
- .select { |v| v >= Gem::Version.new("7.2") && v < Gem::Version.new("7.3") }
116
+ .select { |v| v >= Gem::Version.new("8.0") && v < Gem::Version.new("8.1") }
116
117
  .max
117
118
  rescue StandardError
118
119
  nil
@@ -31,6 +31,31 @@ def bundle_install!
31
31
  end
32
32
  end
33
33
 
34
+ # Pre-install built .gem files into the app RVM gemset so Bundler can resolve
35
+ # inline_forms ~> 8 before those releases exist on RubyGems. Set
36
+ # INLINE_FORMS_RELEASE_ROOT and/or VALIDATION_HINTS_ROOT (creator sets the latter
37
+ # when a sibling validation_hints checkout exists).
38
+ def install_prerelease_gems_from_roots!
39
+ roots = []
40
+ %w[INLINE_FORMS_RELEASE_ROOT VALIDATION_HINTS_ROOT].each do |key|
41
+ root = ENV[key].to_s
42
+ roots << File.expand_path(root) if root != "" && File.directory?(root)
43
+ end
44
+ roots.uniq!
45
+ return if roots.empty?
46
+
47
+ %w[validation_hints inline_forms inline_forms_installer].each do |name|
48
+ gem_file = roots.filter_map { |root|
49
+ files = Dir[File.join(root, "#{name}-*.gem")]
50
+ files.sort.last if files.any?
51
+ }.max
52
+ next unless gem_file && File.file?(gem_file)
53
+
54
+ say "- Installing #{File.basename(gem_file)} into app gemset..."
55
+ run "gem install #{Shellwords.escape(gem_file)} --no-document"
56
+ end
57
+ end
58
+
34
59
  # Pin Ruby for the generated app (after `rails new`; do not write these files in
35
60
  # Creator before `rails new` — Rails also emits `.ruby-version` and prompts).
36
61
  create_file ".ruby-version", "#{ENV.fetch('ruby_version', 'ruby-4.0.4')}\n"
@@ -44,15 +69,12 @@ use_app_rvm_gemset!
44
69
  remove_file 'Gemfile' if File.exist?('Gemfile')
45
70
  create_file 'Gemfile', "# created by inline_forms_installer #{ENV['inline_forms_installer_version']} on #{Date.today}\n"
46
71
 
47
- # `rails new` is invoked with whatever the system `rails` binary points at
48
- # (often Rails 8.x), so the generated `config/application.rb` may carry
49
- # `load_defaults 8.0` and other 8.x-only settings. The Gemfile below pins
50
- # `rails ~> 7.2.3`; normalize application.rb so the first `bundle exec rails`
51
- # boot matches that pin.
72
+ # Creator invokes `rails _8.0.x_ new`, which emits `load_defaults 8.0` and removes
73
+ # `new_framework_defaults_8_0.rb`. Normalize anyway when an older generator left another minor.
52
74
  if File.exist?('config/application.rb')
53
75
  gsub_file 'config/application.rb',
54
76
  /config\.load_defaults\s+\d+\.\d+/,
55
- 'config.load_defaults 7.2'
77
+ 'config.load_defaults 8.0'
56
78
  end
57
79
 
58
80
  add_source 'https://rubygems.org'
@@ -65,8 +87,8 @@ gem 'autoprefixer-rails'
65
87
  # foundation-rails 6.7+ uses Dart Sass (`sass:math`); sass-rails/sassc removed.
66
88
  # Visually tuned against foundation-rails ~> 6.6.2; current pin ~> 6.9 (6.9.0.x).
67
89
  gem 'foundation-rails', '~> 6.9'
68
- # Pin inline_forms and validation_hints on the 7.x line; Bundler resolves the
69
- # highest 7.x that satisfies all deps. Set INLINE_FORMS_GEMFILE_PATH for
90
+ # Pin inline_forms and validation_hints on the 8.x line; Bundler resolves the
91
+ # highest 8.x that satisfies all deps. Set INLINE_FORMS_GEMFILE_PATH for
70
92
  # maintainer local-path overrides only.
71
93
  if ENV["INLINE_FORMS_GEMFILE_PATH"] && File.directory?(ENV["INLINE_FORMS_GEMFILE_PATH"])
72
94
  gem "inline_forms", path: ENV["INLINE_FORMS_GEMFILE_PATH"]
@@ -84,9 +106,9 @@ gem 'jquery-ui-rails', '4.0.3'
84
106
  gem 'mini_magick'
85
107
  gem 'mysql2'
86
108
  gem 'paper_trail', '~> 16.0'
87
- gem 'rails-i18n', '~> 7.0'
109
+ gem 'rails-i18n', '~> 8.0'
88
110
  gem 'rails-jquery-autocomplete'
89
- gem 'rails', '~> 7.2.3'
111
+ gem 'rails', '~> 8.0'
90
112
  gem 'rake'
91
113
  gem 'rvm'
92
114
  gem 'dartsass-rails'
@@ -121,8 +143,8 @@ gem_group :development do
121
143
  gem 'rvm-capistrano', :require => false
122
144
  gem 'rvm1-capistrano3', require: false
123
145
  gem 'seed_dump', '~> 0.5.3'
124
- # Rails 6.1 ActiveRecord's sqlite3 adapter requires sqlite3 ~> 1.4; 2.x activates first and breaks.
125
- gem 'sqlite3', '~> 1.4'
146
+ # Rails 8 sqlite3 adapter requires sqlite3 >= 2.1.
147
+ gem 'sqlite3', '>= 2.1'
126
148
  gem 'thin'
127
149
  gem 'yaml_db'
128
150
  end
@@ -134,13 +156,7 @@ end
134
156
 
135
157
  say "- Running bundle..."
136
158
  run "gem install bundler --no-document"
137
- if (vh_root = ENV["VALIDATION_HINTS_ROOT"]) && File.directory?(vh_root)
138
- vh_gem = Dir[File.join(vh_root, "validation_hints-*.gem")].sort.last
139
- if vh_gem && File.file?(vh_gem)
140
- say "- Installing #{File.basename(vh_gem)} from VALIDATION_HINTS_ROOT..."
141
- run "gem install #{vh_gem} --no-document"
142
- end
143
- end
159
+ install_prerelease_gems_from_roots!
144
160
  bundle_install!
145
161
 
146
162
  say "- Dart Sass: inline_forms stylesheet entrypoints + initializer..."
@@ -151,6 +167,13 @@ copy_file File.join(INSTALLER_ROOT, "lib/installer_templates/dartsass/inline_for
151
167
  copy_file File.join(INSTALLER_ROOT, "lib/installer_templates/dartsass/devise_main.scss"),
152
168
  "app/assets/stylesheets/inline_forms_install/devise_main.scss"
153
169
 
170
+ say "- Sprockets: app/assets/config/manifest.js (Rails 8 importmap default omits it)..."
171
+ empty_directory "app/assets/config"
172
+ create_file "app/assets/config/manifest.js", <<~MANIFEST unless File.exist?("app/assets/config/manifest.js")
173
+ //= link_tree ../images
174
+ //= link_tree ../builds
175
+ MANIFEST
176
+
154
177
  say "- Dart Sass: rails dartsass:install (builds/, manifest, Procfile.dev)..."
155
178
  run "bundle exec rails dartsass:install"
156
179
 
@@ -256,7 +279,7 @@ create_file "db/migrate/" +
256
279
  Time.now.utc.strftime("%Y%m%d%H%M%S") +
257
280
  "_" +
258
281
  "devise_create_users.rb", <<-DEVISE_MIGRATION.strip_heredoc
259
- class DeviseCreateUsers < ActiveRecord::Migration[7.2]
282
+ class DeviseCreateUsers < ActiveRecord::Migration[8.0]
260
283
 
261
284
  def change
262
285
  create_table(:users) do |t|
@@ -409,7 +432,7 @@ create_file "db/migrate/" +
409
432
  Time.now.utc.strftime("%Y%m%d%H%M%S") +
410
433
  "_" +
411
434
  "inline_forms_create_join_table_user_role.rb", <<-ROLES_MIGRATION.strip_heredoc
412
- class InlineFormsCreateJoinTableUserRole < ActiveRecord::Migration[7.2]
435
+ class InlineFormsCreateJoinTableUserRole < ActiveRecord::Migration[8.0]
413
436
  def self.up
414
437
  create_table :roles_users, :id => false, :force => true do |t|
415
438
  t.integer :role_id
@@ -837,7 +860,7 @@ if ENV['install_example'] == 'true'
837
860
  sleep 1
838
861
  add_owner_ts = Time.now.utc.strftime("%Y%m%d%H%M%S")
839
862
  create_file "db/migrate/#{add_owner_ts}_add_owner_to_apartments.rb", <<-ADD_OWNER.strip_heredoc
840
- class AddOwnerToApartments < ActiveRecord::Migration[7.2]
863
+ class AddOwnerToApartments < ActiveRecord::Migration[8.0]
841
864
  def change
842
865
  add_reference :apartments, :owner, null: true, foreign_key: true
843
866
  end
@@ -916,7 +939,7 @@ if ENV['install_example'] == 'true'
916
939
  sleep 1
917
940
  seed_ts = Time.now.utc.strftime("%Y%m%d%H%M%S")
918
941
  create_file "db/migrate/#{seed_ts}_seed_example_apartments_and_owners.rb", <<-SEED_MIGRATION.strip_heredoc
919
- class SeedExampleApartmentsAndOwners < ActiveRecord::Migration[7.2]
942
+ class SeedExampleApartmentsAndOwners < ActiveRecord::Migration[8.0]
920
943
  # ---------------------------------------------------------------
921
944
  # Apartment seed gallery
922
945
  # ---------------------------------------------------------------
@@ -1,6 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineFormsInstaller
3
- VERSION = "8.0.0"
3
+ VERSION = "8.0.3"
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"
@@ -29,6 +29,54 @@ module InlineFormsInstaller
29
29
  INLINE_FORMS_VERSION
30
30
  end
31
31
  end
32
+
33
+ # When developing unreleased 8.x gems, point env at checkouts that contain
34
+ # built *.gem files so the installer can gem-install them into the app gemset.
35
+ def self.discover_prerelease_env!
36
+ if ENV["INLINE_FORMS_RELEASE_ROOT"].to_s == "" || ENV["VALIDATION_HINTS_ROOT"].to_s == ""
37
+ dir = gem_root
38
+ 6.times do
39
+ if ENV["INLINE_FORMS_RELEASE_ROOT"].to_s == "" &&
40
+ File.file?(File.join(dir, "inline_forms.gemspec")) &&
41
+ Dir[File.join(dir, "inline_forms-*.gem")].any?
42
+ ENV["INLINE_FORMS_RELEASE_ROOT"] = dir
43
+ end
44
+ if ENV["VALIDATION_HINTS_ROOT"].to_s == "" &&
45
+ File.file?(File.join(dir, "validation_hints.gemspec")) &&
46
+ Dir[File.join(dir, "validation_hints-*.gem")].any?
47
+ ENV["VALIDATION_HINTS_ROOT"] = dir
48
+ end
49
+ parent = File.expand_path("..", dir)
50
+ break if parent == dir
51
+ dir = parent
52
+ end
53
+ end
54
+
55
+ if ENV["VALIDATION_HINTS_ROOT"].to_s == ""
56
+ sibling_vh = File.expand_path("../validation_hints", File.expand_path("..", gem_root))
57
+ ENV["VALIDATION_HINTS_ROOT"] = sibling_vh if File.directory?(sibling_vh)
58
+ end
59
+
60
+ {
61
+ "INLINE_FORMS_RELEASE_ROOT" => "inline_forms",
62
+ "VALIDATION_HINTS_ROOT" => "validation_hints"
63
+ }.each do |env_key, repo_name|
64
+ next if ENV[env_key].to_s != ""
65
+
66
+ checkout = dev_checkout_with_gems(repo_name)
67
+ ENV[env_key] = checkout if checkout
68
+ end
69
+ end
70
+
71
+ def self.dev_checkout_with_gems(repo_name)
72
+ [
73
+ File.expand_path("~/code/#{repo_name}"),
74
+ File.expand_path("~/#{repo_name}")
75
+ ].uniq.find do |checkout|
76
+ File.file?(File.join(checkout, "#{repo_name}.gemspec")) &&
77
+ Dir[File.join(checkout, "#{repo_name}-*.gem")].any?
78
+ end
79
+ end
32
80
  end
33
81
 
34
82
  require "inline_forms_installer/creator"
@@ -22,7 +22,7 @@ before_exec do |_|
22
22
  end
23
23
 
24
24
  before_fork do |server, worker|
25
- defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect!
25
+ defined?(ActiveRecord::Base) and ActiveRecord::Base.connection_pool.disconnect!
26
26
 
27
27
  old_pid = "#{app_path}/tmp/pids/unicorn.pid.oldbin"
28
28
 
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: 8.0.0
4
+ version: 8.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares