inline_forms_installer 8.1.75 → 8.1.76

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: 2e43613e52e90a18a8c5db155ffebabec24d39772c27ff1451ea4221ae42f6ba
4
- data.tar.gz: 2eea66bbc2be06e3979dbbfbe15d49f86ad9e0060bc7083b83647598d733a18c
3
+ metadata.gz: af146ae829ba88451ef3e2146d791aa9cc33517901065b35c9ee1c3e1edda1ab
4
+ data.tar.gz: 0eb65c0eaa3f499b52bd397c6fcfc4172fc16adb843d4ce5a4185266d49cbbee
5
5
  SHA512:
6
- metadata.gz: df499ecd653d1c141e011134d5c3a14509ff6b7b4801bd339abd2bdffeeb273c07c333c0bff7d577f6efdf882f830ef73e0a4e9be60a577659c1793a0ad37edd
7
- data.tar.gz: 73401f5b7f272a47166caed31686ac66e1def9d69af4a070bfe6ccc6ef00664a9131ca6c774a2138d79f2fe5bd7d48d9591dbe50ce8354df342e2b25d715d3bd
6
+ metadata.gz: 2552745f02d7b4e902290f458d136f87487518ba55c97ec74e9a7f585daf44420d4db324989a1135595d8a70b3ba236dbe36b14fc8de939d75c59ec99aeca87b
7
+ data.tar.gz: fa181a09bb442c9f5432a3b5878be779fffc51bd4a86cfa1fd159af355b6842b01b6d4e089d9dd58c81514e86aca05f56f19f3dfeb635dec4273b5ff531b38cf
@@ -110,7 +110,11 @@ module InlineFormsInstaller
110
110
  exit 1
111
111
  end
112
112
 
113
- target_ruby = InlineFormsInstaller::TARGET_RUBY_VERSION
113
+ target_ruby = InlineFormsInstaller.ruby_for_app(rvm_path: rvm_active? ? (ENV["rvm_path"] || RVM.path) : nil)
114
+ if InlineFormsInstaller.older_than_target_ruby?(target_ruby)
115
+ say "Ruby #{InlineFormsInstaller::TARGET_RUBY_VERSION} not found: the app gets Ruby #{target_ruby}. " \
116
+ "Older Rubies have known vulnerabilities; install the newer one and change .ruby-version.", :yellow
117
+ end
114
118
  if rvm_active?
115
119
  say "Installing inline_forms with RVM", :green
116
120
  else
@@ -163,7 +167,7 @@ module InlineFormsInstaller
163
167
 
164
168
  shell_cmd = [
165
169
  rails_invocation, "new", app_name, "-m", app_template_file,
166
- "--skip-bundle", "--skip-bootsnap", "--skip-javascript"
170
+ "--skip-bundle", "--skip-bootsnap", "--skip-javascript", "--skip-ci"
167
171
  ].join(" ")
168
172
 
169
173
  ok, log_path = InlineFormsInstaller::CreateLog.tee_rails_new(app_name, shell_cmd, started_at: started_at)
@@ -184,9 +184,10 @@ gem_group :test do
184
184
  end
185
185
 
186
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
187
+ # `rails new` writes and bin/ci runs. Not in the test group, where Rails itself
188
+ # also puts them: the generated Dockerfile leaves out only development, so they
189
+ # would end up in the production image.
190
+ gem_group :development do
190
191
  gem 'brakeman', require: false
191
192
  gem 'bundler-audit', require: false
192
193
  gem 'rubocop-rails-omakase', require: false
@@ -890,8 +891,14 @@ if ENV['install_schema_edit'] == 'true'
890
891
  run "bundle exec rake db:migrate" if ENV['using_sqlite'] == 'true'
891
892
  end
892
893
 
894
+ # --ensure-latest makes Brakeman fail as soon as a newer one is released than the
895
+ # one in Gemfile.lock: bin/ci would go red with no change in the app, and it
896
+ # needs the network.
897
+ say "- bin/brakeman without --ensure-latest..."
898
+ gsub_file "bin/brakeman", /^ARGV\.unshift\("--ensure-latest"\)\n\n?/, ""
899
+
893
900
  # 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'
901
+ # (the full gate runs bin/ci on the example app). These come from other gems'
895
902
  # generators.
896
903
  say "- Correcting the style of Devise's and PaperTrail's files (bin/rubocop)..."
897
904
  foreign_files = [ "config/initializers/devise.rb" ] +
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "inline_forms_installer/version"
4
+
5
+ module InlineFormsInstaller
6
+ # The Ruby a generated app pins in `.ruby-version`: TARGET_RUBY_VERSION when
7
+ # it is there, else the Ruby that runs the installer, so that the app can
8
+ # always find its Ruby. +rvm_path+ is nil without RVM; other version managers
9
+ # cannot be asked reliably.
10
+ def self.ruby_for_app(running: RUBY_VERSION, rvm_path: nil)
11
+ return TARGET_RUBY_VERSION if running == TARGET_RUBY_VERSION
12
+ return TARGET_RUBY_VERSION if rvm_path && File.directory?(File.join(rvm_path, "rubies", "ruby-#{TARGET_RUBY_VERSION}"))
13
+
14
+ running
15
+ end
16
+
17
+ def self.older_than_target_ruby?(version)
18
+ Gem::Version.new(version) < Gem::Version.new(TARGET_RUBY_VERSION)
19
+ end
20
+ end
@@ -1,9 +1,10 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  module InlineFormsInstaller
4
- VERSION = "8.1.75"
4
+ VERSION = "8.1.76"
5
5
 
6
- # Canonical bare Ruby version (must match gemspec `required_ruby_version`).
6
+ # Canonical bare Ruby version (the gemspecs accept any Ruby >= 4.0.0; an app
7
+ # gets the running Ruby when this one is not there, see ruby_for_app).
7
8
  # Written verbatim into generated apps' `.ruby-version` for rbenv/chruby/asdf/
8
9
  # mise (which need the bare `X.Y.Z` form). For RVM installs the Creator writes
9
10
  # the `ruby-X.Y.Z` form instead, because RVM's `.ruby-version` reader rejects a
@@ -1,6 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  require "inline_forms_installer/version"
4
+ require "inline_forms_installer/target_ruby"
4
5
 
5
6
  module InlineFormsInstaller
6
7
  def self.gem_root
@@ -5,9 +5,6 @@ set :bundle_binstubs, nil
5
5
  # Default deploy_to directory is /var/www/my_app_name
6
6
  set :deploy_to, ENV["DEPLOY_DIRECTORY"]
7
7
 
8
- # Default value for :linked_files is []
9
- set :linked_files, fetch(:linked_files, [])
10
- .push("config/application.yml")
11
8
  # Default value for linked_dirs is []
12
9
  set :linked_dirs, fetch(:linked_dirs, [])
13
10
  .push("log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/system", "vendor/bundle")
@@ -21,7 +18,6 @@ after "rvm1:install:ruby", "rvm1:install_bundler"
21
18
  before "deploy", "rvm1:install:rvm" # install/update RVM
22
19
  before "deploy", "rvm1:install:ruby" # install/update Ruby
23
20
 
24
- before "deploy:check", "figaro:upload"
25
21
  after "deploy:publishing", "deploy:restart"
26
22
 
27
23
  # Restart unicorn
@@ -31,16 +27,6 @@ namespace :deploy do
31
27
  end
32
28
  end
33
29
 
34
- # Uploads secrets.yml, database.yml and application.yml files
35
- namespace :figaro do
36
- task :upload do
37
- on roles(:all) do
38
- execute "mkdir -p #{shared_path}/config"
39
- upload! "config/application.yml", "#{shared_path}/config/application.yml"
40
- end
41
- end
42
- end
43
-
44
30
  namespace :app do
45
31
  task :update_rvm_key do
46
32
  roles(:all) do
@@ -4,10 +4,10 @@ require "open3"
4
4
  require_relative "../example_app/example_integration_test_case"
5
5
 
6
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.
7
+ # Only whether they start is checked here. bundler-audit needs the network
8
+ # (advisory database), and what Brakeman and RuboCop report depends on the newest
9
+ # version: a style rule must not make `inline_forms create --example`
10
+ # fail. The full gate runs bin/ci, with all three.
11
11
  class ExampleAppSecurityToolsTest < ExampleAppIntegrationTestCase
12
12
  test "bin/brakeman starts" do
13
13
  assert_tool_starts "bin/brakeman", "--version"
@@ -17,8 +17,31 @@ class ExampleAppSecurityToolsTest < ExampleAppIntegrationTestCase
17
17
  assert_tool_starts "bin/bundler-audit", "version"
18
18
  end
19
19
 
20
- test "bin/rubocop finds no offenses" do
21
- assert_tool_starts "bin/rubocop", "--format", "simple"
20
+ test "bin/rubocop starts" do
21
+ assert_tool_starts "bin/rubocop", "--version"
22
+ end
23
+
24
+ # They are for development; the production image must not get them (8.1.76).
25
+ test "the tools are in the development group only" do
26
+ gemfile = File.read(Rails.root.join("Gemfile"))
27
+ development = gemfile.scan(/^group :development do\n(.*?)^end/m).join
28
+
29
+ %w[brakeman bundler-audit rubocop-rails-omakase].each do |gem_name|
30
+ assert_match(/gem "#{gem_name}"/, development)
31
+ assert_equal 1, gemfile.scan(/gem "#{gem_name}"/).size, gem_name
32
+ end
33
+ end
34
+
35
+ # bin/ci would go red whenever a newer Brakeman is released (8.1.76).
36
+ test "bin/brakeman does not insist on the latest Brakeman" do
37
+ assert_no_match(/ensure-latest/, File.read(Rails.root.join("bin/brakeman")))
38
+ end
39
+
40
+ # GitHub runs nothing; bin/ci is for the developer and for any other CI (8.1.76).
41
+ test "no GitHub workflows or Dependabot, but bin/ci" do
42
+ assert_not File.exist?(Rails.root.join(".github"))
43
+ assert File.executable?(Rails.root.join("bin/ci"))
44
+ assert File.exist?(Rails.root.join("config/ci.rb"))
22
45
  end
23
46
 
24
47
  # It would download npm packages into the app; nothing needs it (8.1.75).
@@ -1,9 +1,6 @@
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__))
4
- Figaro.load
5
-
6
- app_path = "#{ENV['DEPLOY_DIRECTORY']}/current"
1
+ # DEPLOY_DIRECTORY (see config/deploy.rb) has to be in the environment Unicorn
2
+ # starts in.
3
+ app_path = "#{ENV.fetch("DEPLOY_DIRECTORY")}/current"
7
4
  working_directory app_path
8
5
 
9
6
  pid "#{app_path}/tmp/pids/unicorn.pid"
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.75
4
+ version: 8.1.76
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares
@@ -61,6 +61,7 @@ files:
61
61
  - lib/inline_forms_installer/create_log.rb
62
62
  - lib/inline_forms_installer/creator.rb
63
63
  - lib/inline_forms_installer/installer_core.rb
64
+ - lib/inline_forms_installer/target_ruby.rb
64
65
  - lib/inline_forms_installer/user_model_config.rb
65
66
  - lib/inline_forms_installer/version.rb
66
67
  - lib/installer_templates/capistrano/Capfile