inline_forms_installer 8.1.17 → 8.1.18
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 +4 -4
- data/inline_forms_installer.gemspec +7 -1
- data/lib/inline_forms_installer/creator.rb +26 -6
- data/lib/inline_forms_installer/installer_core.rb +40 -4
- data/lib/inline_forms_installer/version.rb +7 -3
- data/lib/installer_templates/example_app_tests/test/models/example_app_paper_trail_changeset_test.rb +43 -0
- metadata +1 -21
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8f04e2b37e58d0c6658da6ab3cc13ae2a44e22bb898fac9e8980960fd5d61378
|
|
4
|
+
data.tar.gz: c6fe8cc0545e99c3671824b7858136ab6f36c696602c3db9ac5f0ea91c686c96
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2ec0b4161bf92dcaf7de326218c891dafaaf490c5a16f4850211bbc52672b75e96ab6f55291bdc79fae8a980c4c1cb6d93c036a07384c96e3a48801cd45167dc
|
|
7
|
+
data.tar.gz: 83c865c2688e60ec6b06a0c811d7bccea25a9d252e1d2a70bf7328443dd869c438463a689f3127957c7563bc426f5434871993ea9eef8c53b46df3fbc3740456
|
|
@@ -20,6 +20,12 @@ Gem::Specification.new do |s|
|
|
|
20
20
|
s.require_paths = ["lib"]
|
|
21
21
|
|
|
22
22
|
s.add_dependency("inline_forms", "~> 8")
|
|
23
|
-
s.add_dependency("rvm", ">= 1.11", "< 2.0")
|
|
24
23
|
s.add_dependency("thor", ">= 1.0", "< 2.0")
|
|
24
|
+
|
|
25
|
+
# RVM is optional. When the `rvm` gem is present AND the shell is inside an
|
|
26
|
+
# RVM environment, `inline_forms create` auto-creates a per-app gemset;
|
|
27
|
+
# otherwise it installs without RVM (any version manager, or none, works —
|
|
28
|
+
# Bundler isolates deps per app via Gemfile.lock). Install `gem install rvm`
|
|
29
|
+
# to opt in to gemset integration, or pass `--no-rvm` to skip it explicitly.
|
|
30
|
+
|
|
25
31
|
end
|
|
@@ -109,8 +109,7 @@ module InlineFormsInstaller
|
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
target_ruby = InlineFormsInstaller::TARGET_RUBY_VERSION
|
|
112
|
-
|
|
113
|
-
if RVM.current && !options[:skiprvm]
|
|
112
|
+
if rvm_active?
|
|
114
113
|
say "Installing inline_forms with RVM", :green
|
|
115
114
|
else
|
|
116
115
|
say "Installing inline_forms without RVM", :green
|
|
@@ -125,8 +124,13 @@ module InlineFormsInstaller
|
|
|
125
124
|
ENV["using_sqlite"] = using_sqlite?.to_s
|
|
126
125
|
ENV["database"] = database
|
|
127
126
|
ENV["install_example"] = install_example?.to_s
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
# Match the generated `.ruby-version` to the version manager actually in
|
|
128
|
+
# use. RVM's `.ruby-version` reader needs the `ruby-X.Y.Z` form — a bare
|
|
129
|
+
# `X.Y.Z` makes `rvm use .` bail with "do not know how to handle" and skip
|
|
130
|
+
# the per-app gemset. rbenv/chruby/asdf/mise instead need the *bare*
|
|
131
|
+
# `X.Y.Z`. So: prefixed for RVM installs, bare for everyone else.
|
|
132
|
+
ENV["ruby_version"] = rvm_active? ? "ruby-#{target_ruby}" : target_ruby
|
|
133
|
+
ENV["inline_forms_rvm_gemset"] = app_name if rvm_active?
|
|
130
134
|
ENV["inline_forms_version"] = inline_forms_version
|
|
131
135
|
ENV["inline_forms_installer_version"] = InlineFormsInstaller::VERSION
|
|
132
136
|
ENV["INLINE_FORMS_INSTALLER_ROOT"] = InlineFormsInstaller.gem_root
|
|
@@ -178,12 +182,28 @@ module InlineFormsInstaller
|
|
|
178
182
|
"(see install log — no Minitest summary line)"
|
|
179
183
|
end
|
|
180
184
|
|
|
185
|
+
# RVM is optional. Returns true only when the user did not pass `--no-rvm`,
|
|
186
|
+
# the `rvm` gem is installed (the installer no longer hard-depends on it),
|
|
187
|
+
# AND the shell is currently inside an RVM environment. Memoized because it
|
|
188
|
+
# is consulted in several places across the create flow.
|
|
189
|
+
def rvm_active?
|
|
190
|
+
return false if options[:skiprvm]
|
|
191
|
+
return @rvm_active if defined?(@rvm_active)
|
|
192
|
+
|
|
193
|
+
@rvm_active =
|
|
194
|
+
begin
|
|
195
|
+
require "rvm"
|
|
196
|
+
!!RVM.current
|
|
197
|
+
rescue LoadError
|
|
198
|
+
false
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
|
|
181
202
|
def bundle_check_ok?(app_name)
|
|
182
203
|
app_dir = File.expand_path(app_name)
|
|
183
204
|
return false unless File.directory?(app_dir)
|
|
184
205
|
|
|
185
|
-
if
|
|
186
|
-
require "rvm"
|
|
206
|
+
if rvm_active?
|
|
187
207
|
RVM.chdir(app_dir) do
|
|
188
208
|
RVM.use_from_path! "."
|
|
189
209
|
system("bundle", "check", out: File::NULL, err: File::NULL)
|
|
@@ -77,7 +77,12 @@ end
|
|
|
77
77
|
|
|
78
78
|
# Pin Ruby for the generated app (after `rails new`; do not write these files in
|
|
79
79
|
# Creator before `rails new` — Rails also emits `.ruby-version` and prompts).
|
|
80
|
-
|
|
80
|
+
# `rails new` writes its own `.ruby-version` (under RVM it picks up the ambient
|
|
81
|
+
# `ruby-X.Y.Z` string). We always overwrite it with our bare, version-manager-
|
|
82
|
+
# agnostic `X.Y.Z` form; `force: true` avoids Thor's interactive overwrite
|
|
83
|
+
# prompt when Rails' value differs (it always does, now that we drop the
|
|
84
|
+
# RVM-only `ruby-` prefix).
|
|
85
|
+
create_file ".ruby-version", "#{ENV.fetch('ruby_version', '4.0.4')}\n", force: true
|
|
81
86
|
if (gemset = ENV["inline_forms_rvm_gemset"]).to_s != ""
|
|
82
87
|
create_file ".ruby-gemset", "#{gemset}\n"
|
|
83
88
|
end
|
|
@@ -136,7 +141,10 @@ gem 'rails-i18n', '~> 8.1'
|
|
|
136
141
|
gem 'rails-jquery-autocomplete'
|
|
137
142
|
gem 'rails', '~> 8.1'
|
|
138
143
|
gem 'rake'
|
|
139
|
-
gem
|
|
144
|
+
# NOTE: the `rvm` gem is intentionally NOT a runtime dependency of generated
|
|
145
|
+
# apps — RVM is optional and nothing in the app needs the RVM Ruby API at
|
|
146
|
+
# runtime. (The RVM-based Capistrano deploy helpers live in the :development
|
|
147
|
+
# group below and are only used if you deploy with the shipped config/deploy.rb.)
|
|
140
148
|
gem 'dartsass-rails'
|
|
141
149
|
# Rails 7 no longer adds sprockets-rails to the default Gemfile; declare it
|
|
142
150
|
# explicitly because the gem's own assets (foundation, jquery, etc.) live in
|
|
@@ -549,12 +557,19 @@ say "- Configure ActiveRecord YAML permitted classes for PaperTrail changesets..
|
|
|
549
557
|
# `version.changeset`; PaperTrail rescues that and returns `{}`, which is why
|
|
550
558
|
# the inline_forms versions list rendered every changeset as `empty`. Permit
|
|
551
559
|
# the classes PT actually emits so `version.changeset` round-trips.
|
|
560
|
+
#
|
|
561
|
+
# date/time `_select` columns (e.g. FormElementShowcase#meeting_time, a
|
|
562
|
+
# `:time_select` backed by a :time column) serialize their changeset value as
|
|
563
|
+
# an `ActiveRecord::Type::Time::Value` (and the Date/DateTime siblings for
|
|
564
|
+
# `:date_select` / datetime columns). Those wrapper classes must also be
|
|
565
|
+
# permitted or `version.changeset` raises `Psych::DisallowedClass: Tried to
|
|
566
|
+
# load unspecified class: ActiveRecord::Type::Time::Value` on the revert /
|
|
567
|
+
# versions-panel path.
|
|
552
568
|
create_file 'config/initializers/paper_trail_yaml_safe_load.rb', <<-PT_YAML.strip_heredoc
|
|
553
569
|
# Generated by inline_forms.
|
|
554
570
|
# See https://github.com/paper-trail-gem/paper_trail and
|
|
555
571
|
# ActiveRecord::Coders::YAMLColumn safe-loading rules.
|
|
556
|
-
|
|
557
|
-
Rails.application.config.active_record.yaml_column_permitted_classes |= [
|
|
572
|
+
permitted = [
|
|
558
573
|
Symbol,
|
|
559
574
|
Date,
|
|
560
575
|
Time,
|
|
@@ -563,6 +578,27 @@ create_file 'config/initializers/paper_trail_yaml_safe_load.rb', <<-PT_YAML.stri
|
|
|
563
578
|
ActiveSupport::TimeZone,
|
|
564
579
|
ActiveSupport::HashWithIndifferentAccess
|
|
565
580
|
]
|
|
581
|
+
|
|
582
|
+
# date/time `_select` columns serialize their PaperTrail changeset/object
|
|
583
|
+
# value under a type-specific wrapper class — e.g. a `:time_select` helper
|
|
584
|
+
# maps to a `:time` column whose cast value is an
|
|
585
|
+
# `ActiveRecord::Type::Time::Value` (a Time subclass). Psych matches the
|
|
586
|
+
# *exact* stored class name, so permitting `Time`/`Date` is not enough: the
|
|
587
|
+
# wrapper must be listed too, or `revert` (`version.reify`) and the versions
|
|
588
|
+
# panel (`version.changeset`) raise/swallow Psych::DisallowedClass. Resolve
|
|
589
|
+
# by name and skip any this Rails version does not define (only Time::Value
|
|
590
|
+
# exists today; Date/DateTime are listed defensively for forward-compat).
|
|
591
|
+
%w[
|
|
592
|
+
ActiveRecord::Type::Time::Value
|
|
593
|
+
ActiveRecord::Type::Date::Value
|
|
594
|
+
ActiveRecord::Type::DateTime::Value
|
|
595
|
+
].each do |const_name|
|
|
596
|
+
klass = const_name.safe_constantize
|
|
597
|
+
permitted << klass if klass
|
|
598
|
+
end
|
|
599
|
+
|
|
600
|
+
Rails.application.config.active_record.yaml_column_permitted_classes ||= []
|
|
601
|
+
Rails.application.config.active_record.yaml_column_permitted_classes |= permitted
|
|
566
602
|
ActiveRecord.yaml_column_permitted_classes |= Rails.application.config.active_record.yaml_column_permitted_classes
|
|
567
603
|
PT_YAML
|
|
568
604
|
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
|
2
2
|
module InlineFormsInstaller
|
|
3
|
-
VERSION = "8.1.
|
|
3
|
+
VERSION = "8.1.18"
|
|
4
4
|
|
|
5
|
-
#
|
|
6
|
-
|
|
5
|
+
# Canonical bare Ruby version (must match gemspec `required_ruby_version`).
|
|
6
|
+
# Written verbatim into generated apps' `.ruby-version` for rbenv/chruby/asdf/
|
|
7
|
+
# mise (which need the bare `X.Y.Z` form). For RVM installs the Creator writes
|
|
8
|
+
# the `ruby-X.Y.Z` form instead, because RVM's `.ruby-version` reader rejects a
|
|
9
|
+
# bare version. See Creator#create (ENV["ruby_version"]).
|
|
10
|
+
TARGET_RUBY_VERSION = "4.0.4"
|
|
7
11
|
|
|
8
12
|
# Kept in sync with inline_forms gem releases from the same repo tag.
|
|
9
13
|
INLINE_FORMS_VERSION = VERSION
|
data/lib/installer_templates/example_app_tests/test/models/example_app_paper_trail_changeset_test.rb
CHANGED
|
@@ -35,6 +35,49 @@ class ExampleAppPaperTrailChangesetTest < ActiveSupport::TestCase
|
|
|
35
35
|
assert_equal ["Old Title", "New Title"], changeset["title"]
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
+
# Regression for `Psych::DisallowedClass: Tried to load unspecified class:
|
|
39
|
+
# ActiveRecord::Type::Time::Value` in FormElementShowcasesController#revert.
|
|
40
|
+
#
|
|
41
|
+
# A `:time` column (FormElementShowcase#meeting_time, a `:time_select`
|
|
42
|
+
# helper) stores its value as an `ActiveRecord::Type::Time::Value` — a Time
|
|
43
|
+
# subclass. PaperTrail serializes that value under its real class name, so
|
|
44
|
+
# `YAML.safe_load` rejects it unless the wrapper class is on the permitted
|
|
45
|
+
# list. `version.changeset` rescues the DisallowedClass into `{}` (the
|
|
46
|
+
# versions panel then renders empty), but `version.reify` — the path
|
|
47
|
+
# `revert` takes — does NOT rescue and raised before the date/time wrapper
|
|
48
|
+
# classes were added to config/initializers/paper_trail_yaml_safe_load.rb.
|
|
49
|
+
test "time_select (meeting_time) version reifies and changeset round-trips" do
|
|
50
|
+
PaperTrail.request.whodunnit = "test"
|
|
51
|
+
|
|
52
|
+
showcase = FormElementShowcase.create!(
|
|
53
|
+
title: "PT time demo",
|
|
54
|
+
meeting_time: Time.utc(2000, 1, 1, 9, 15)
|
|
55
|
+
)
|
|
56
|
+
showcase.update!(meeting_time: Time.utc(2000, 1, 1, 14, 30))
|
|
57
|
+
|
|
58
|
+
version = showcase.versions.last
|
|
59
|
+
assert_equal "update", version.event,
|
|
60
|
+
"expected an update version to be recorded by paper_trail"
|
|
61
|
+
|
|
62
|
+
# The revert path: reify must not raise Psych::DisallowedClass.
|
|
63
|
+
reified = assert_nothing_raised do
|
|
64
|
+
version.reify
|
|
65
|
+
end
|
|
66
|
+
assert_equal 9, reified.meeting_time.hour
|
|
67
|
+
assert_equal 15, reified.meeting_time.min
|
|
68
|
+
|
|
69
|
+
# The versions-panel read path: changeset must round-trip the time value
|
|
70
|
+
# (non-empty + present) rather than being rescued to {}.
|
|
71
|
+
changeset = version.changeset
|
|
72
|
+
assert_kind_of Hash, changeset
|
|
73
|
+
refute_empty changeset,
|
|
74
|
+
"version.changeset is empty; PaperTrail's YAML.safe_load probably hit a " \
|
|
75
|
+
"DisallowedClass (ActiveRecord::Type::Time::Value) and returned {}. Check " \
|
|
76
|
+
"config/initializers/paper_trail_yaml_safe_load.rb."
|
|
77
|
+
assert changeset.key?("meeting_time"),
|
|
78
|
+
"expected meeting_time in the changeset; got #{changeset.keys.inspect}"
|
|
79
|
+
end
|
|
80
|
+
|
|
38
81
|
# `has_rich_text :description` lives in the `action_text_rich_texts` table,
|
|
39
82
|
# so `has_paper_trail` on Apartment cannot see body edits. The installer adds
|
|
40
83
|
# `config/initializers/rich_text_paper_trail.rb` (which declares
|
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.1.
|
|
4
|
+
version: 8.1.18
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ace Suares
|
|
@@ -25,26 +25,6 @@ dependencies:
|
|
|
25
25
|
- - "~>"
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
27
|
version: '8'
|
|
28
|
-
- !ruby/object:Gem::Dependency
|
|
29
|
-
name: rvm
|
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
|
31
|
-
requirements:
|
|
32
|
-
- - ">="
|
|
33
|
-
- !ruby/object:Gem::Version
|
|
34
|
-
version: '1.11'
|
|
35
|
-
- - "<"
|
|
36
|
-
- !ruby/object:Gem::Version
|
|
37
|
-
version: '2.0'
|
|
38
|
-
type: :runtime
|
|
39
|
-
prerelease: false
|
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
-
requirements:
|
|
42
|
-
- - ">="
|
|
43
|
-
- !ruby/object:Gem::Version
|
|
44
|
-
version: '1.11'
|
|
45
|
-
- - "<"
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '2.0'
|
|
48
28
|
- !ruby/object:Gem::Dependency
|
|
49
29
|
name: thor
|
|
50
30
|
requirement: !ruby/object:Gem::Requirement
|