inline_forms_installer 8.1.70 → 8.1.75

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: a76760c3472f54ae4118cbc75a0a651c2c898742ef0ed5369c9278cb2a220772
4
- data.tar.gz: 6801b1b3425f0167c246221a7ea95b86fe55bebbcefd5587d67acad9cc2733a1
3
+ metadata.gz: 2e43613e52e90a18a8c5db155ffebabec24d39772c27ff1451ea4221ae42f6ba
4
+ data.tar.gz: 2eea66bbc2be06e3979dbbfbe15d49f86ad9e0060bc7083b83647598d733a18c
5
5
  SHA512:
6
- metadata.gz: bc729a5297f2491e0236235eeb9e249c386d38eb3efd15c4401e4dbcc0a2f461fe18bfda459a17fb8550ef1303ed837eb3bb2aba131f87eb141ff218429a05d8
7
- data.tar.gz: e942c5ad03e09a0bd905eca34817e9056004d4d54ee748e827be96b333b766280e7308032d15d20ac50432e4d74dae3de2c3b408b6aa21896ebd1229613fd229
6
+ metadata.gz: df499ecd653d1c141e011134d5c3a14509ff6b7b4801bd339abd2bdffeeb273c07c333c0bff7d577f6efdf882f830ef73e0a4e9be60a577659c1793a0ad37edd
7
+ data.tar.gz: 73401f5b7f272a47166caed31686ac66e1def9d69af4a070bfe6ccc6ef00664a9131ca6c774a2138d79f2fe5bd7d48d9591dbe50ce8354df342e2b25d715d3bd
@@ -163,7 +163,7 @@ module InlineFormsInstaller
163
163
 
164
164
  shell_cmd = [
165
165
  rails_invocation, "new", app_name, "-m", app_template_file,
166
- "--skip-bundle", "--skip-bootsnap", "--javascript=importmap"
166
+ "--skip-bundle", "--skip-bootsnap", "--skip-javascript"
167
167
  ].join(" ")
168
168
 
169
169
  ok, log_path = InlineFormsInstaller::CreateLog.tee_rails_new(app_name, shell_cmd, started_at: started_at)
@@ -166,8 +166,8 @@ gem 'dartsass-rails'
166
166
  # explicitly because the gem's own assets (foundation, jquery, etc.) live in
167
167
  # app/assets and rely on the Sprockets pipeline.
168
168
  gem 'sprockets-rails'
169
- # Rails 7 default JavaScript tooling: importmap-rails replaces Webpacker.
170
- gem 'importmap-rails'
169
+ # No importmap-rails: JavaScript comes from gems through Sprockets, and
170
+ # `bin/importmap pin` would download npm packages into the app.
171
171
  # Hotwire/Turbo. Loaded from layouts as `<script type="module">`; inline flows
172
172
  # use `<turbo-frame>` + HTML responses (see docs/ujs-to-turbo.md). Registers the
173
173
  # `turbo_stream` MIME type for optional stream responses.
@@ -183,6 +183,15 @@ gem_group :test do
183
183
  gem 'minitest', '~> 5.25'
184
184
  end
185
185
 
186
+ # The gems behind bin/brakeman, bin/bundler-audit and bin/rubocop, which
187
+ # `rails new` writes and bin/ci runs. In both groups, as in the Gemfile Rails
188
+ # itself generates.
189
+ gem_group :development, :test do
190
+ gem 'brakeman', require: false
191
+ gem 'bundler-audit', require: false
192
+ gem 'rubocop-rails-omakase', require: false
193
+ end
194
+
186
195
  gem_group :development do
187
196
  gem 'capistrano-bundler', require: false
188
197
  gem 'capistrano-rails', require: false
@@ -221,7 +230,7 @@ copy_file File.join(INSTALLER_ROOT, "lib/installer_templates/dartsass/inline_for
221
230
  copy_file File.join(INSTALLER_ROOT, "lib/installer_templates/dartsass/devise_main.scss"),
222
231
  "app/assets/stylesheets/inline_forms_install/devise_main.scss"
223
232
 
224
- say "- Sprockets: app/assets/config/manifest.js (Rails 8 importmap default omits it)..."
233
+ say "- Sprockets: app/assets/config/manifest.js (rails new omits it)..."
225
234
  empty_directory "app/assets/config"
226
235
  create_file "app/assets/config/manifest.js", <<~MANIFEST unless File.exist?("app/assets/config/manifest.js")
227
236
  //= link_tree ../images
@@ -326,8 +335,8 @@ say "- Create Devise route and add path_prefix..."
326
335
  route <<-ROUTE.strip_heredoc
327
336
  #{user_cfg.devise_route_line}
328
337
  resources :#{user_cfg.plural_route} do
329
- post 'revert', :on => :member
330
- get 'list_versions', :on => :member
338
+ post "revert", on: :member
339
+ get "list_versions", on: :member
331
340
  end
332
341
  ROUTE
333
342
 
@@ -339,7 +348,6 @@ create_file "db/migrate/" +
339
348
  "_" +
340
349
  "#{user_cfg.devise_migration_basename}.rb", <<-DEVISE_MIGRATION.strip_heredoc
341
350
  class #{user_cfg.devise_migration_class} < ActiveRecord::Migration[8.1]
342
-
343
351
  def change
344
352
  create_table(:#{user_cfg.table_name}) do |t|
345
353
  ## Database authenticatable
@@ -402,7 +410,6 @@ USERS_CONTROLLER
402
410
  say "- Create #{user_cfg.class_name} model..."
403
411
  create_file user_cfg.model_path, <<-USER_MODEL.strip_heredoc
404
412
  class #{user_cfg.class_name} < ApplicationRecord
405
-
406
413
  # devise options
407
414
  devise :database_authenticatable
408
415
  # devise :registerable # uncomment this if you want people to be able to register
@@ -416,13 +423,13 @@ create_file user_cfg.model_path, <<-USER_MODEL.strip_heredoc
416
423
  # devise :timeoutable
417
424
  # devise :omniauthable
418
425
 
419
- #attr_accessible :email, :password, :locale, :remember_me
426
+ # attr_accessible :email, :password, :locale, :remember_me
420
427
 
421
428
  belongs_to :locale
422
429
  has_and_belongs_to_many :roles
423
430
 
424
431
  # validations
425
- validates :name, :presence => true
432
+ validates :name, presence: true
426
433
  # Theming Pattern 2 color overrides; the color_field element only ever
427
434
  # submits "#rrggbb" or nil, but validate anyway (console edits, imports).
428
435
  validates :primary_color, format: { with: /\\A#\\h{6}\\z/i }, allow_blank: true
@@ -439,24 +446,24 @@ create_file user_cfg.model_path, <<-USER_MODEL.strip_heredoc
439
446
  end
440
447
 
441
448
  def role?(role)
442
- return !!self.roles.find_by_name(role)
449
+ !!self.roles.find_by_name(role)
443
450
  end
444
451
 
445
452
  # Preset UI themes (inline_forms Pattern 1 theming). The integer `theme`
446
453
  # column maps to a body class `theme-<name>`; the palettes ship in the
447
454
  # inline_forms engine (_theme.scss). The engine layout calls
448
455
  # #inline_forms_theme on current_user when the method exists.
449
- INLINE_FORMS_THEMES = { 0 => 'default', 1 => 'dark', 2 => 'sepia', 3 => 'high-contrast' }.freeze
456
+ INLINE_FORMS_THEMES = { 0 => "default", 1 => "dark", 2 => "sepia", 3 => "high-contrast" }.freeze
450
457
 
451
458
  def inline_forms_theme
452
- INLINE_FORMS_THEMES.fetch(theme.to_i, 'default')
459
+ INLINE_FORMS_THEMES.fetch(theme.to_i, "default")
453
460
  end
454
461
 
455
462
  # Theming Pattern 2: --if-color-* overrides for this user, rendered as an
456
463
  # inline <style> by the engine layout (inline_forms_user_color_overrides_style).
457
464
  # Keys are --if-color- suffixes; values must be "#rrggbb".
458
465
  def inline_forms_color_overrides
459
- { 'primary' => primary_color, 'accent' => accent_color }.compact
466
+ { "primary" => primary_color, "accent" => accent_color }.compact
460
467
  end
461
468
 
462
469
  def inline_forms_attribute_list
@@ -465,7 +472,7 @@ create_file user_cfg.model_path, <<-USER_MODEL.strip_heredoc
465
472
  [ :name, :text_field ],
466
473
  [ :email, :text_field ],
467
474
  [ :locale, :dropdown ],
468
- [ :theme, :dropdown_with_values, { 0 => 'default', 1 => 'dark', 2 => 'sepia', 3 => 'high contrast' } ],
475
+ [ :theme, :dropdown_with_values, { 0 => "default", 1 => "dark", 2 => "sepia", 3 => "high contrast" } ],
469
476
  [ :primary_color, :color_field ],
470
477
  [ :accent_color, :color_field ],
471
478
  [ :password, :devise_password_field ],
@@ -482,10 +489,9 @@ create_file user_cfg.model_path, <<-USER_MODEL.strip_heredoc
482
489
  [ :current_sign_in_ip, :info ],
483
490
  [ :last_sign_in_ip, :info ],
484
491
  [ :created_at, :info ],
485
- [ :updated_at, :info ],
492
+ [ :updated_at, :info ]
486
493
  ]
487
494
  end
488
-
489
495
  end
490
496
  USER_MODEL
491
497
 
@@ -497,7 +503,7 @@ USER_MODEL
497
503
  say "- Creating inline_forms initializer (MODEL_TABS seeded with #{user_cfg.plural_route})"
498
504
  create_file "config/initializers/inline_forms.rb", <<-END_INITIALIZER.strip_heredoc
499
505
  Rails.application.reloader.to_prepare do
500
- MODEL_TABS = %w(#{user_cfg.plural_route} )
506
+ MODEL_TABS = %w[#{user_cfg.plural_route} ]
501
507
  end
502
508
  END_INITIALIZER
503
509
 
@@ -533,7 +539,7 @@ create_file "db/migrate/" +
533
539
  "#{user_cfg.join_migration_basename}.rb", <<-ROLES_MIGRATION.strip_heredoc
534
540
  class #{user_cfg.join_migration_class} < ActiveRecord::Migration[8.1]
535
541
  def self.up
536
- create_table :#{user_cfg.join_table}, :id => false, :force => true do |t|
542
+ create_table :#{user_cfg.join_table}, id: false, force: true do |t|
537
543
  t.integer :role_id
538
544
  t.integer :#{user_cfg.foreign_key}
539
545
  end
@@ -541,7 +547,7 @@ create_file "db/migrate/" +
541
547
  end
542
548
 
543
549
  def self.down
544
- drop_table #{user_cfg.join_table}
550
+ drop_table :#{user_cfg.join_table}
545
551
  end
546
552
  end
547
553
  ROLES_MIGRATION
@@ -601,7 +607,7 @@ create_file 'config/initializers/rich_text_paper_trail.rb', <<-PT_RICH_TEXT.stri
601
607
  # `touch: true` pointing at it, the parent versions panel must not surface
602
608
  # touch-only "empty" rich-text rows whose Restore link reifies a no-op.
603
609
  ActiveSupport.on_load(:action_text_rich_text) do
604
- has_paper_trail on: [:create, :update, :destroy]
610
+ has_paper_trail on: [ :create, :update, :destroy ]
605
611
  end
606
612
  PT_RICH_TEXT
607
613
 
@@ -678,10 +684,10 @@ remove_file "app/helpers/application_helper.rb" # the one that 'rails new' creat
678
684
  create_file "app/helpers/application_helper.rb", <<-END_APPHELPER.strip_heredoc
679
685
  module ApplicationHelper
680
686
  def application_name
681
- '#{app_name}'
687
+ "#{app_name}"
682
688
  end
683
689
  def application_title
684
- '#{app_name}'
690
+ "#{app_name}"
685
691
  end
686
692
  end
687
693
  END_APPHELPER
@@ -701,9 +707,9 @@ create_file "app/controllers/application_controller.rb", <<-END_APPCONTROLLER.st
701
707
 
702
708
  rescue_from CanCan::AccessDenied do |exception|
703
709
  respond_to do |format|
704
- format.json { head :forbidden, content_type: 'text/html' }
710
+ format.json { head :forbidden, content_type: "text/html" }
705
711
  format.html { redirect_to main_app.root_url, notice: exception.message }
706
- format.js { head :forbidden, content_type: 'text/html' }
712
+ format.js { head :forbidden, content_type: "text/html" }
707
713
  end
708
714
  end
709
715
  # Comment previous lines if you don't want Devise authentication
@@ -790,18 +796,17 @@ JS_COMPRESSOR
790
796
  # devise mailer stuff
791
797
  say "- Injecting devise mailer stuff in environments/production.rb..."
792
798
  # strip_heredoc_with_indent(2) became strip_heredoc(2), but only in rails 4... :-(
793
- insert_into_file "config/environments/production.rb", <<-DEVISE_MAILER_PROD_STUFF.strip_heredoc, :before => "end\n"
799
+ insert_into_file "config/environments/production.rb", <<-DEVISE_MAILER_PROD_STUFF.strip_heredoc.indent(2), before: /^end\n/
794
800
 
795
801
  # for devise
796
- config.action_mailer.default_url_options = { protocol: 'https', host: Rails.application.credentials[:smtp_app_host] }
802
+ config.action_mailer.default_url_options = { protocol: "https", host: Rails.application.credentials[:smtp_app_host] }
797
803
  config.action_mailer.delivery_method = :smtp
798
804
  config.action_mailer.smtp_settings = {
799
805
  address: Rails.application.credentials[:smtp_host],
800
806
  enable_starttls_auto: true,
801
- password: Rails.application.credentials[:smtp_password] ,
807
+ password: Rails.application.credentials[:smtp_password],
802
808
  user_name: Rails.application.credentials[:smtp_username]
803
809
  }
804
-
805
810
  DEVISE_MAILER_PROD_STUFF
806
811
 
807
812
  say "Setting production smtp settings in credentials"
@@ -821,17 +826,17 @@ remove_file 'temp_production_smtp_credentials'
821
826
 
822
827
  say "- Injecting devise mailer stuff in environments/development.rb..."
823
828
  # strip_heredoc_with_indent(2) became strip_heredoc(2), but only in rails 4... :-(
824
- insert_into_file "config/environments/development.rb", <<-DEVISE_MAILER_DEV_STUFF.strip_heredoc, :before => "\nend\n"
829
+ insert_into_file "config/environments/development.rb", <<-DEVISE_MAILER_DEV_STUFF.strip_heredoc.indent(2), before: /^end\n/
830
+
825
831
  # for devise
826
- config.action_mailer.default_url_options = { protocol: 'http', host: 'localhost', port: 3000 }
832
+ config.action_mailer.default_url_options = { protocol: "http", host: "localhost", port: 3000 }
827
833
  config.action_mailer.delivery_method = :smtp
828
834
  config.action_mailer.smtp_settings = {
829
835
  address: Rails.application.credentials[:smtp_host],
830
836
  enable_starttls_auto: true,
831
- password: Rails.application.credentials[:smtp_password] ,
837
+ password: Rails.application.credentials[:smtp_password],
832
838
  user_name: Rails.application.credentials[:smtp_username]
833
839
  }
834
-
835
840
  DEVISE_MAILER_DEV_STUFF
836
841
 
837
842
  say "Setting development smtp settings in credentials"
@@ -885,6 +890,15 @@ if ENV['install_schema_edit'] == 'true'
885
890
  run "bundle exec rake db:migrate" if ENV['using_sqlite'] == 'true'
886
891
  end
887
892
 
893
+ # Style: what inline_forms writes follows the app's RuboCop config by itself
894
+ # (the example app's test suite checks that). These come from other gems'
895
+ # generators.
896
+ say "- Correcting the style of Devise's and PaperTrail's files (bin/rubocop)..."
897
+ foreign_files = [ "config/initializers/devise.rb" ] +
898
+ Dir.glob("db/migrate/*_create_versions.rb") +
899
+ Dir.glob("db/migrate/*_add_object_changes_to_versions.rb")
900
+ run "bin/rubocop -a #{foreign_files.join(' ')}"
901
+
888
902
  # Git
889
903
  say "- adding and committing to git..."
890
904
 
@@ -908,7 +922,7 @@ if ENV['install_example'] == 'true'
908
922
 
909
923
  say "- Apartment name is required..."
910
924
  inject_into_file "app/models/apartment.rb",
911
- "\n validates :name, presence: true\n",
925
+ " validates :name, presence: true\n\n",
912
926
  after: "class Apartment < ApplicationRecord\n"
913
927
 
914
928
  # CarrierWave + PaperTrail history.
@@ -935,7 +949,7 @@ if ENV['install_example'] == 'true'
935
949
 
936
950
  inject_into_file "app/uploaders/image_uploader.rb",
937
951
  after: "class ImageUploader < CarrierWave::Uploader::Base\n" do
938
- <<-RUBY.strip_heredoc.gsub(/^/, " ")
952
+ <<-RUBY.strip_heredoc.indent(2)
939
953
  # PaperTrail history support. CarrierWave's default behaviour wipes the
940
954
  # previous file on update and reuses the same filename; PaperTrail only
941
955
  # stores the column scalar, so a plain `version.reify; save!` restores a
@@ -1025,7 +1039,7 @@ if ENV['install_example'] == 'true'
1025
1039
 
1026
1040
  say "- Owner name is required..."
1027
1041
  inject_into_file "app/models/owner.rb",
1028
- "\n validates :name, presence: true\n",
1042
+ " validates :name, presence: true\n\n",
1029
1043
  after: "class Owner < ApplicationRecord\n"
1030
1044
 
1031
1045
  say "- Adding owner_id to apartments + belongs_to :owner..."
@@ -1047,7 +1061,7 @@ if ENV['install_example'] == 'true'
1047
1061
  # so it appears above :name in the inline panel.
1048
1062
  gsub_file "app/models/apartment.rb",
1049
1063
  /@inline_forms_attribute_list \|\|= \[\n/,
1050
- "@inline_forms_attribute_list ||= [\n [ :owner, :dropdown ], \n"
1064
+ "@inline_forms_attribute_list ||= [\n [ :owner, :dropdown ],\n"
1051
1065
 
1052
1066
  # Owner -> apartments: render as a check_list of EXISTING apartments
1053
1067
  # (not the default :associated panel that only lets you create new
@@ -1070,7 +1084,7 @@ if ENV['install_example'] == 'true'
1070
1084
  OWNER_TABS = %w[naw apartments].freeze
1071
1085
  OWNER_TAB_FIELDS = {
1072
1086
  "naw" => %i[name birthdate address city country],
1073
- "apartments" => %i[name apartments],
1087
+ "apartments" => %i[name apartments]
1074
1088
  }.freeze
1075
1089
 
1076
1090
  def show
@@ -1129,8 +1143,8 @@ if ENV['install_example'] == 'true'
1129
1143
 
1130
1144
  # The :phase dropdown row goes right below :owner.
1131
1145
  gsub_file "app/models/apartment.rb",
1132
- / \[ :owner, :dropdown \], \n/,
1133
- " [ :owner, :dropdown ], \n [ :phase, :dropdown ], \n"
1146
+ / \[ :owner, :dropdown \],\n/,
1147
+ " [ :owner, :dropdown ],\n [ :phase, :dropdown ],\n"
1134
1148
 
1135
1149
  # Seed the example app with 3 apartments + 3 owners and assign photos
1136
1150
  # from db/seed_images. Runs as a regular migration so `bundle exec rake
@@ -1153,7 +1167,7 @@ if ENV['install_example'] == 'true'
1153
1167
  APARTMENTS = [
1154
1168
  { name: "Apt 1", title: "Casa Aurora", opening_date: Date.new(2026, 1, 10) },
1155
1169
  { name: "Apt 2", title: "Villa Marina", opening_date: Date.new(2026, 2, 14) },
1156
- { name: "Apt 3", title: "Loft del Sol", opening_date: Date.new(2026, 3, 21) },
1170
+ { name: "Apt 3", title: "Loft del Sol", opening_date: Date.new(2026, 3, 21) }
1157
1171
  ].freeze
1158
1172
 
1159
1173
  # ---------------------------------------------------------------
@@ -1169,19 +1183,19 @@ if ENV['install_example'] == 'true'
1169
1183
  address: "Calle del Sol 42",
1170
1184
  city: "Willemstad",
1171
1185
  country: "Curacao",
1172
- apartments: ["Apt 1", "Apt 2"] },
1186
+ apartments: [ "Apt 1", "Apt 2" ] },
1173
1187
  { name: "Jean-Pierre Dupont",
1174
1188
  birthdate: Date.new(1972, 3, 4),
1175
1189
  address: "Rue des Lilas 7",
1176
1190
  city: "Lyon",
1177
1191
  country: "France",
1178
- apartments: ["Apt 3"] },
1192
+ apartments: [ "Apt 3" ] },
1179
1193
  { name: "Akira Tanaka",
1180
1194
  birthdate: Date.new(1990, 11, 23),
1181
1195
  address: "1-2-3 Sakura",
1182
1196
  city: "Kyoto",
1183
1197
  country: "Japan",
1184
- apartments: [] },
1198
+ apartments: [] }
1185
1199
  ].freeze
1186
1200
 
1187
1201
  # Phases, created in neither name nor dropdown order: the apartment
@@ -1191,7 +1205,7 @@ if ENV['install_example'] == 'true'
1191
1205
  { name: "decision", dropdown_order: 20 },
1192
1206
  { name: "admittance", dropdown_order: 30 },
1193
1207
  { name: "---", dropdown_order: 0 },
1194
- { name: "helprequest", dropdown_order: 10 },
1208
+ { name: "helprequest", dropdown_order: 10 }
1195
1209
  ].freeze
1196
1210
  APARTMENT_PHASES = { "Apt 1" => "helprequest", "Apt 2" => "decision", "Apt 3" => "---" }.freeze
1197
1211
 
@@ -1199,7 +1213,7 @@ if ENV['install_example'] == 'true'
1199
1213
  # Photo -> Comment: the second nesting level).
1200
1214
  COMMENTS = [
1201
1215
  "Lovely light in this room!",
1202
- "Could use a fresh coat of paint.",
1216
+ "Could use a fresh coat of paint."
1203
1217
  ].freeze
1204
1218
 
1205
1219
  def up
@@ -1369,13 +1383,13 @@ if ENV['install_example'] == 'true'
1369
1383
  # A `def` body is parsed but only resolved at call time, side-stepping
1370
1384
  # the ordering hazard.
1371
1385
  inject_into_file "app/models/form_element_showcase.rb",
1372
- "\n validates :count, numericality: { only_integer: true }, allow_blank: true\n" \
1386
+ " validates :count, numericality: { only_integer: true }, allow_blank: true\n" \
1373
1387
  " validates :price, numericality: true, allow_blank: true\n" \
1374
1388
  " validates :latitude, numericality: { greater_than_or_equal_to: -90, less_than_or_equal_to: 90 }, allow_blank: true\n" \
1375
1389
  " validates :longitude, numericality: { greater_than_or_equal_to: -180, less_than_or_equal_to: 180 }, allow_blank: true\n" \
1376
1390
  " mount_uploader :attachment, AttachmentUploader\n" \
1377
1391
  " serialize :gallery, coder: JSON\n mount_uploaders :gallery, ImageUploader\n" \
1378
- " monetize :amount_cents\n\n def locales_display\n locales\n end\n",
1392
+ " monetize :amount_cents\n\n def locales_display\n locales\n end\n\n",
1379
1393
  after: "class FormElementShowcase < ApplicationRecord\n"
1380
1394
 
1381
1395
  # Value-bearing rows for every form_element that needs a values hash
@@ -1383,14 +1397,14 @@ if ENV['install_example'] == 'true'
1383
1397
  # for bare rows, [:attr, :form_element, values, options_disabled] for
1384
1398
  # choice rows.
1385
1399
  showcase_value_rows = {
1386
- "[ :is_active, :check_box ]" => "[ :is_active, :check_box, { 0 => 'no', 1 => 'yes' } ]",
1387
- "[ :gender, :radio_button ]" => "[ :gender, :radio_button, { 1 => 'male', 2 => 'female' } ]",
1388
- "[ :rating_int, :dropdown_with_integers ]" => "[ :rating_int, :dropdown_with_integers, { 1 => 'one', 2 => 'two', 3 => 'three' } ]",
1389
- "[ :priority, :dropdown_with_values ]" => "[ :priority, :dropdown_with_values, { 1 => 'low', 2 => 'mid', 3 => 'high' } ]",
1390
- "[ :priority2, :dropdown_with_values ]" => "[ :priority2, :dropdown_with_values, { 1 => 'low', 2 => 'mid', 3 => 'high' }, [ 2 ] ]",
1391
- "[ :stars, :dropdown_with_values_with_stars ]" => "[ :stars, :dropdown_with_values_with_stars, { 1 => '1stars', 2 => '2stars', 3 => '3stars', 4 => '4stars', 5 => '5stars' } ]",
1392
- "[ :scale_int, :scale_with_integers ]" => "[ :scale_int, :scale_with_integers, { 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five' } ]",
1393
- "[ :scale_val, :scale_with_values ]" => "[ :scale_val, :scale_with_values, { 1 => 'red', 2 => 'green', 3 => 'blue' } ]",
1400
+ "[ :is_active, :check_box ]" => '[ :is_active, :check_box, { 0 => "no", 1 => "yes" } ]',
1401
+ "[ :gender, :radio_button ]" => '[ :gender, :radio_button, { 1 => "male", 2 => "female" } ]',
1402
+ "[ :rating_int, :dropdown_with_integers ]" => '[ :rating_int, :dropdown_with_integers, { 1 => "one", 2 => "two", 3 => "three" } ]',
1403
+ "[ :priority, :dropdown_with_values ]" => '[ :priority, :dropdown_with_values, { 1 => "low", 2 => "mid", 3 => "high" } ]',
1404
+ "[ :priority2, :dropdown_with_values ]" => '[ :priority2, :dropdown_with_values, { 1 => "low", 2 => "mid", 3 => "high" }, [ 2 ] ]',
1405
+ "[ :stars, :dropdown_with_values_with_stars ]" => '[ :stars, :dropdown_with_values_with_stars, { 1 => "1stars", 2 => "2stars", 3 => "3stars", 4 => "4stars", 5 => "5stars" } ]',
1406
+ "[ :scale_int, :scale_with_integers ]" => '[ :scale_int, :scale_with_integers, { 1 => "one", 2 => "two", 3 => "three", 4 => "four", 5 => "five" } ]',
1407
+ "[ :scale_val, :scale_with_values ]" => '[ :scale_val, :scale_with_values, { 1 => "red", 2 => "green", 3 => "blue" } ]',
1394
1408
  }
1395
1409
  showcase_value_rows.each do |from, to|
1396
1410
  gsub_file "app/models/form_element_showcase.rb", from, to
@@ -1401,12 +1415,12 @@ if ENV['install_example'] == 'true'
1401
1415
  # attribute_list row; we hand-insert it as `:info_list` (read-only
1402
1416
  # checklist of role _presentation strings).
1403
1417
  showcase_header_inserts = {
1404
- "[ :title, :text_field ]," => "[ :header_basics, :header ], \n [ :title, :text_field ],",
1405
- "[ :count, :integer_field ]," => "[ :header_numbers, :header ], \n [ :count, :integer_field ],",
1406
- "[ :meeting_date, :date_select ]," => "[ :header_dates, :header ], \n [ :meeting_date, :date_select ],",
1407
- "[ :is_active, :check_box, { 0 => 'no'" => "[ :header_choices, :header ], \n [ :is_active, :check_box, { 0 => 'no'",
1408
- "[ :attachment, :file_field ]," => "[ :header_files, :header ], \n [ :attachment, :file_field ],",
1409
- "[ :description, :rich_text ]," => "[ :header_rich, :header ], \n [ :description, :rich_text ],",
1418
+ "[ :title, :text_field ]," => "[ :header_basics, :header ],\n [ :title, :text_field ],",
1419
+ "[ :count, :integer_field ]," => "[ :header_numbers, :header ],\n [ :count, :integer_field ],",
1420
+ "[ :meeting_date, :date_select ]," => "[ :header_dates, :header ],\n [ :meeting_date, :date_select ],",
1421
+ "[ :is_active, :check_box, {" => "[ :header_choices, :header ],\n [ :is_active, :check_box, {",
1422
+ "[ :attachment, :file_field ]," => "[ :header_files, :header ],\n [ :attachment, :file_field ],",
1423
+ "[ :description, :rich_text ]" => "[ :header_rich, :header ],\n [ :description, :rich_text ]",
1410
1424
  }
1411
1425
  showcase_header_inserts.each do |from, to|
1412
1426
  gsub_file "app/models/form_element_showcase.rb", from, to
@@ -1422,14 +1436,14 @@ if ENV['install_example'] == 'true'
1422
1436
  # Locale already has a `_presentation` returning `title`, which is
1423
1437
  # exactly what `info_list_show` renders per row.
1424
1438
  gsub_file "app/models/form_element_showcase.rb",
1425
- "[ :description, :rich_text ], \n",
1426
- "[ :description, :rich_text ], \n [ :locales, :check_list ], \n [ :locales_display, :info_list ], \n [ :header_meta, :header ], \n [ :created_at, :info ], \n [ :updated_at, :info ], \n"
1439
+ "[ :description, :rich_text ]\n",
1440
+ "[ :description, :rich_text ],\n [ :locales, :check_list ],\n [ :locales_display, :info_list ],\n [ :header_meta, :header ],\n [ :created_at, :info ],\n [ :updated_at, :info ]\n"
1427
1441
 
1428
1442
  # pdf_link links to /report/:id and /report/:id.pdf and leaves both routes
1429
1443
  # to the app. There is no column and no model method.
1430
1444
  gsub_file "app/models/form_element_showcase.rb",
1431
- "[ :manual, :simple_file_field ], \n",
1432
- "[ :manual, :simple_file_field ], \n [ :report, :pdf_link ], \n"
1445
+ "[ :manual, :simple_file_field ],\n",
1446
+ "[ :manual, :simple_file_field ],\n [ :report, :pdf_link ],\n"
1433
1447
  create_file "app/controllers/showcase_reports_controller.rb", <<-'SHOWCASE_REPORTS'.strip_heredoc
1434
1448
  # The two routes behind FormElementShowcase's :report pdf_link row.
1435
1449
  class ShowcaseReportsController < ApplicationController
@@ -1593,7 +1607,7 @@ if ENV['install_example'] == 'true'
1593
1607
  {
1594
1608
  attachment: seed_uploads.join("sample.txt"),
1595
1609
  jingle: seed_uploads.join("sample.wav"),
1596
- cover: seed_uploads.join("sample_cover.png"),
1610
+ cover: seed_uploads.join("sample_cover.png")
1597
1611
  }.each do |attr, path|
1598
1612
  next unless path.file?
1599
1613
  next if full.public_send(attr).present?
@@ -1604,7 +1618,7 @@ if ENV['install_example'] == 'true'
1604
1618
  # mount_uploaders. One file is enough to exercise the array path.
1605
1619
  gallery_src = seed_uploads.join("sample_cover.png")
1606
1620
  if full.respond_to?(:gallery) && gallery_src.file? && full.gallery.blank?
1607
- File.open(gallery_src, "rb") { |io| full.gallery = [io] }
1621
+ File.open(gallery_src, "rb") { |io| full.gallery = [ io ] }
1608
1622
  end
1609
1623
  full.save! if full.changed?
1610
1624
 
@@ -1626,7 +1640,7 @@ if ENV['install_example'] == 'true'
1626
1640
 
1627
1641
  def down
1628
1642
  return unless defined?(FormElementShowcase)
1629
- FormElementShowcase.where(title: ["Full demo", "Empty demo"]).destroy_all
1643
+ FormElementShowcase.where(title: [ "Full demo", "Empty demo" ]).destroy_all
1630
1644
  end
1631
1645
  end
1632
1646
  SHOWCASE_SEED
@@ -1653,7 +1667,7 @@ if ENV['install_example'] == 'true'
1653
1667
 
1654
1668
  route 'get "apartments/name_list", to: "apartments#name_list", as: :apartment_name_list'
1655
1669
 
1656
- route "root :to => 'apartments#index'"
1670
+ route 'root to: "apartments#index"'
1657
1671
 
1658
1672
  example_tests_root = File.join(INSTALLER_ROOT, "lib/installer_templates/example_app_tests")
1659
1673
  example_user_cfg = InlineFormsInstaller::UserModelConfig.from_env
@@ -85,9 +85,9 @@ module InlineFormsInstaller
85
85
 
86
86
  def devise_route_line
87
87
  if default?
88
- "devise_for :users, :path_prefix => 'auth'"
88
+ "devise_for :users, path_prefix: \"auth\""
89
89
  else
90
- "devise_for :users, class_name: \"#{class_name}\", path: \"#{plural_route}\", path_prefix: 'auth'"
90
+ "devise_for :users, class_name: \"#{class_name}\", path: \"#{plural_route}\", path_prefix: \"auth\""
91
91
  end
92
92
  end
93
93
 
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  module InlineFormsInstaller
4
- VERSION = "8.1.70"
4
+ VERSION = "8.1.75"
5
5
 
6
6
  # Canonical bare Ruby version (must match gemspec `required_ruby_version`).
7
7
  # Written verbatim into generated apps' `.ruby-version` for rbenv/chruby/asdf/
@@ -1,9 +1,9 @@
1
- set :application, ENV['DEPLOY_APPLICATION']
2
- set :repo_url, ENV['DEPLOY_REPO_URL']
1
+ set :application, ENV["DEPLOY_APPLICATION"]
2
+ set :repo_url, ENV["DEPLOY_REPO_URL"]
3
3
  set :bundle_binstubs, nil
4
4
 
5
5
  # Default deploy_to directory is /var/www/my_app_name
6
- set :deploy_to, ENV['DEPLOY_DIRECTORY']
6
+ set :deploy_to, ENV["DEPLOY_DIRECTORY"]
7
7
 
8
8
  # Default value for :linked_files is []
9
9
  set :linked_files, fetch(:linked_files, [])
@@ -15,14 +15,14 @@ set :linked_dirs, fetch(:linked_dirs, [])
15
15
  # Default value for keep_releases is 5
16
16
  set :keep_releases, 5
17
17
 
18
- before 'rvm1:install:rvm', 'app:update_rvm_key'
19
- after 'rvm1:install:ruby', 'rvm1:install_bundler'
18
+ before "rvm1:install:rvm", "app:update_rvm_key"
19
+ after "rvm1:install:ruby", "rvm1:install_bundler"
20
20
 
21
- before 'deploy', 'rvm1:install:rvm' # install/update RVM
22
- before 'deploy', 'rvm1:install:ruby' # install/update Ruby
21
+ before "deploy", "rvm1:install:rvm" # install/update RVM
22
+ before "deploy", "rvm1:install:ruby" # install/update Ruby
23
23
 
24
- before 'deploy:check', 'figaro:upload'
25
- after 'deploy:publishing', 'deploy:restart'
24
+ before "deploy:check", "figaro:upload"
25
+ after "deploy:publishing", "deploy:restart"
26
26
 
27
27
  # Restart unicorn
28
28
  namespace :deploy do
@@ -36,7 +36,7 @@ namespace :figaro do
36
36
  task :upload do
37
37
  on roles(:all) do
38
38
  execute "mkdir -p #{shared_path}/config"
39
- upload! 'config/application.yml', "#{shared_path}/config/application.yml"
39
+ upload! "config/application.yml", "#{shared_path}/config/application.yml"
40
40
  end
41
41
  end
42
42
  end
@@ -4,4 +4,4 @@ set :conditionally_migrate, true
4
4
  set :rails_env, "production"
5
5
 
6
6
  # Server IP
7
- server ENV["DEPLOY_HOST"], user: fetch(:user), port: fetch(:port), roles: %w(web app db)
7
+ server ENV["DEPLOY_HOST"], user: fetch(:user), port: fetch(:port), roles: %w[web app db]
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../example_app/example_integration_test_case"
4
+ require Dir[Rails.root.join("db/migrate/*_inline_forms_create_join_table_*_role.rb")].first
5
+
6
+ # Until 8.1.74 down said `drop_table roles_users`, without the colon, and raised.
7
+ class ExampleAppRolesJoinTableRollbackTest < ExampleAppIntegrationTestCase
8
+ test "the migration rolls back and runs again" do
9
+ table = User.reflect_on_association(:roles).join_table
10
+ migration = InlineFormsCreateJoinTableUserRole.new
11
+
12
+ migration.suppress_messages do
13
+ migration.down
14
+ assert_not migration.table_exists?(table)
15
+
16
+ migration.up
17
+ assert migration.table_exists?(table)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "open3"
4
+ require_relative "../example_app/example_integration_test_case"
5
+
6
+ # bin/ci runs these commands; the installer supplies their gems (8.1.71, 8.1.72).
7
+ # Only whether Brakeman and bundler-audit start is checked here: their scans need
8
+ # the network (latest Brakeman, advisory database), so those stay with bin/ci and
9
+ # the full gate. RuboCop needs neither, so it checks the whole app: what the
10
+ # generators write has to be clean.
11
+ class ExampleAppSecurityToolsTest < ExampleAppIntegrationTestCase
12
+ test "bin/brakeman starts" do
13
+ assert_tool_starts "bin/brakeman", "--version"
14
+ end
15
+
16
+ test "bin/bundler-audit starts" do
17
+ assert_tool_starts "bin/bundler-audit", "version"
18
+ end
19
+
20
+ test "bin/rubocop finds no offenses" do
21
+ assert_tool_starts "bin/rubocop", "--format", "simple"
22
+ end
23
+
24
+ # It would download npm packages into the app; nothing needs it (8.1.75).
25
+ test "importmap is not there" do
26
+ assert_not File.exist?(Rails.root.join("bin/importmap"))
27
+ assert_not File.exist?(Rails.root.join("config/importmap.rb"))
28
+ %w[Gemfile.lock config/ci.rb].each do |file|
29
+ assert_no_match(/importmap/i, File.read(Rails.root.join(file)), file)
30
+ end
31
+ end
32
+
33
+ private
34
+
35
+ def assert_tool_starts(*command)
36
+ output, status = Open3.capture2e(*command, chdir: Rails.root.to_s)
37
+
38
+ assert status.success?, "expected #{command.join(" ")} to run:\n#{output}"
39
+ end
40
+ end
@@ -148,5 +148,4 @@ class ExampleAppShowcaseChoiceScaleFieldsTest < ExampleAppIntegrationTestCase
148
148
  assert_response :success
149
149
  assert_equal 3, @showcase.reload.scale_val
150
150
  end
151
-
152
151
  end
@@ -10,7 +10,7 @@ class ExampleAppShowcaseGalleryTest < ExampleAppIntegrationTestCase
10
10
  @showcase = FormElementShowcase.find_or_create_by!(title: "Gallery demo")
11
11
  src = Rails.root.join("db", "seed_uploads", "sample_cover.png")
12
12
  if @showcase.gallery.blank? && src.file?
13
- File.open(src, "rb") { |io| @showcase.gallery = [io] }
13
+ File.open(src, "rb") { |io| @showcase.gallery = [ io ] }
14
14
  @showcase.save!
15
15
  end
16
16
  end
@@ -41,7 +41,7 @@ class ExampleAppShowcaseLocalesAssociationsTest < ExampleAppIntegrationTestCase
41
41
  ), params: { locales: { @en.id.to_s => 1, @de.id.to_s => 1 } }, headers: field_headers(:locales)
42
42
 
43
43
  assert_response :success
44
- assert_equal [@en.id, @de.id].sort, @showcase.reload.locale_ids.sort
44
+ assert_equal [ @en.id, @de.id ].sort, @showcase.reload.locale_ids.sort
45
45
 
46
46
  # PUT again with only one locale; the missing one is uncoupled.
47
47
  put form_element_showcase_path(
@@ -52,7 +52,7 @@ class ExampleAppShowcaseLocalesAssociationsTest < ExampleAppIntegrationTestCase
52
52
  ), params: { locales: { @nl.id.to_s => 1 } }, headers: field_headers(:locales)
53
53
 
54
54
  assert_response :success
55
- assert_equal [@nl.id], @showcase.reload.locale_ids
55
+ assert_equal [ @nl.id ], @showcase.reload.locale_ids
56
56
  end
57
57
 
58
58
  test "info_list locales_display mirrors the locales association read-only" do
@@ -112,8 +112,8 @@ class ExampleAppShowcaseNumericFieldsTest < ExampleAppIntegrationTestCase
112
112
  priority2: 1,
113
113
  stars: 1,
114
114
  scale_int: 1,
115
- scale_val: 1,
116
- },
115
+ scale_val: 1
116
+ }
117
117
  },
118
118
  headers: @list_headers
119
119
  end
@@ -161,8 +161,8 @@ class ExampleAppShowcaseNumericFieldsTest < ExampleAppIntegrationTestCase
161
161
  priority2: 1,
162
162
  stars: 1,
163
163
  scale_int: 1,
164
- scale_val: 1,
165
- },
164
+ scale_val: 1
165
+ }
166
166
  },
167
167
  headers: @list_headers
168
168
  end
@@ -64,7 +64,7 @@ class ExampleAppFormElementShowcaseTest < ActiveSupport::TestCase
64
64
  assert_not_nil row, "expected a :priority2 row"
65
65
  assert_equal :dropdown_with_values, row[1]
66
66
  assert_kind_of Hash, row[2]
67
- assert_equal [2], row[3],
67
+ assert_equal [ 2 ], row[3],
68
68
  "expected options_disabled at index 3 (was the 8.1.5 row-shape shift)"
69
69
  end
70
70
 
@@ -99,7 +99,7 @@ class ExampleAppFormElementShowcaseTest < ActiveSupport::TestCase
99
99
  assert_equal :decimal, price_col.type,
100
100
  "expected :price to be a :decimal column, got #{price_col.type.inspect} (#{price_col.sql_type.inspect})"
101
101
  assert_equal 10, price_col.precision, "expected default precision: 10"
102
- assert_equal 2, price_col.scale, "expected default scale: 2"
102
+ assert_equal 2, price_col.scale, "expected default scale: 2"
103
103
  end
104
104
 
105
105
  test "decimal_field{p,s} CLI suffix sets precision and scale" do
@@ -107,9 +107,9 @@ class ExampleAppFormElementShowcaseTest < ActiveSupport::TestCase
107
107
  lon = FormElementShowcase.columns_hash["longitude"]
108
108
  assert_equal :decimal, lat.type
109
109
  assert_equal :decimal, lon.type
110
- assert_equal [9, 6], [lat.precision, lat.scale],
110
+ assert_equal [ 9, 6 ], [ lat.precision, lat.scale ],
111
111
  "expected latitude:decimal_field{9,6} -> decimal(9,6), got decimal(#{lat.precision},#{lat.scale})"
112
- assert_equal [10, 6], [lon.precision, lon.scale],
112
+ assert_equal [ 10, 6 ], [ lon.precision, lon.scale ],
113
113
  "expected longitude:decimal_field{10,6} -> decimal(10,6), got decimal(#{lon.precision},#{lon.scale})"
114
114
  end
115
115
 
@@ -31,8 +31,8 @@ class ExampleAppPaperTrailChangesetTest < ActiveSupport::TestCase
31
31
  "config/initializers/paper_trail_yaml_safe_load.rb and the Rails " \
32
32
  "ActiveRecord.yaml_column_permitted_classes setting."
33
33
 
34
- assert_equal ["Original", "Renamed"], changeset["name"]
35
- assert_equal ["Old Title", "New Title"], changeset["title"]
34
+ assert_equal [ "Original", "Renamed" ], changeset["name"]
35
+ assert_equal [ "Old Title", "New Title" ], changeset["title"]
36
36
  end
37
37
 
38
38
  # Regression for `Psych::DisallowedClass: Tried to load unspecified class:
@@ -14,7 +14,7 @@ class ExampleAppPlainTextRichTextEdgeCasesTest < ActiveSupport::TestCase
14
14
  test "plain_text mapped to actiontext-backed attribute raises configuration error" do
15
15
  with_temporary_inline_forms_attribute_list(
16
16
  Apartment,
17
- [[:description, :plain_text]]
17
+ [ [ :description, :plain_text ] ]
18
18
  ) do
19
19
  error = assert_raises(InlineForms::PlainTextColumnMissingError) do
20
20
  InlineForms.validate_plain_text_configuration_for!(Apartment)
@@ -38,7 +38,7 @@ class ExampleAppPlainTextRichTextEdgeCasesTest < ActiveSupport::TestCase
38
38
  test "switching text column field from plain_text to rich_text does not raise" do
39
39
  with_temporary_inline_forms_attribute_list(
40
40
  Role,
41
- [[:description, :rich_text]]
41
+ [ [ :description, :rich_text ] ]
42
42
  ) do
43
43
  InlineForms.validate_plain_text_configuration_for!(Role)
44
44
  end
@@ -1,6 +1,6 @@
1
1
  # Load ENV vars via Figaro
2
- require 'figaro'
3
- Figaro.application = Figaro::Application.new(environment: 'production', path: File.expand_path('../../../config/application.yml', __FILE__))
2
+ require "figaro"
3
+ Figaro.application = Figaro::Application.new(environment: "production", path: File.expand_path("../../../config/application.yml", __FILE__))
4
4
  Figaro.load
5
5
 
6
6
  app_path = "#{ENV['DEPLOY_DIRECTORY']}/current"
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.70
4
+ version: 8.1.75
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares
@@ -110,9 +110,11 @@ files:
110
110
  - lib/installer_templates/example_app_tests/test/integration/example_app_photos_test.rb
111
111
  - lib/installer_templates/example_app_tests/test/integration/example_app_production_js_compressor_test.rb
112
112
  - lib/installer_templates/example_app_tests/test/integration/example_app_production_ssl_test.rb
113
+ - lib/installer_templates/example_app_tests/test/integration/example_app_roles_join_table_rollback_test.rb
113
114
  - lib/installer_templates/example_app_tests/test/integration/example_app_routing_test.rb
114
115
  - lib/installer_templates/example_app_tests/test/integration/example_app_sass_deprecations_test.rb
115
116
  - lib/installer_templates/example_app_tests/test/integration/example_app_schema_edit_test.rb
117
+ - lib/installer_templates/example_app_tests/test/integration/example_app_security_tools_test.rb
116
118
  - lib/installer_templates/example_app_tests/test/integration/example_app_seed_rollback_test.rb
117
119
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_choice_scale_fields_test.rb
118
120
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_date_time_fields_test.rb