safer_rails_console 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a72dc87254b563b3550b58ad3ca7e579d747febbf46b9aac3aeba9386686c552
4
- data.tar.gz: 6a152d59202737f419716eb1246e4059dc5446642a0b9d2672720a6685f4b54e
3
+ metadata.gz: ec564183ae00b04c696c1a114ca102cf21e939a64efa9877658b3928e33c164b
4
+ data.tar.gz: 726b923163ba0ee2319609533565a7011e8067653a84194141c7306ecc95dc5f
5
5
  SHA512:
6
- metadata.gz: fa8eb4f6f403c5fc50eb079b762232dc5e797edaa80aec15714f33fbe2f5af724efe874e30f5c0bd0286186c62e1516fb90583e14a8d5ebbeeb3de6f61465959
7
- data.tar.gz: 0f3446376ef66b7b6a6bcaa8d6c51e94973e3888bda683ea44bced0885cd7895a9ac70ef348f51459ab5b0c22a31db1cc26a6726010fbab8805cfd8986b1af8a
6
+ metadata.gz: 06417d2590224e02b198e4602e7e88662a43dfadd88df1c6e62a75a02e0f933ab08ee5d6ca064fc4532ce052a84ab13d22108a5668e577cd1e96a92313e8b58d
7
+ data.tar.gz: 21e40876d56b75c4fb91491e62c1fda88933621983ce6a78e21e925adbe5ee28abe3c3b870aaa576d4559a63ad1221d19f84aad7d67d597a2b5c366cf29aa2fe
data/.circleci/config.yml CHANGED
@@ -2,14 +2,14 @@ version: 2.1
2
2
  jobs:
3
3
  lint:
4
4
  docker:
5
- - image: salsify/ruby_ci:2.5.8
5
+ - image: salsify/ruby_ci:2.7.6
6
6
  working_directory: ~/safer_rails_console
7
7
  steps:
8
8
  - checkout
9
9
  - restore_cache:
10
10
  keys:
11
- - v2-gems-ruby-2.5.8-{{ checksum "safer_rails_console.gemspec" }}-{{ checksum "Gemfile" }}
12
- - v2-gems-ruby-2.5.8-
11
+ - v2-gems-ruby-2.7.6-{{ checksum "safer_rails_console.gemspec" }}-{{ checksum "Gemfile" }}
12
+ - v2-gems-ruby-2.7.6-
13
13
  - run:
14
14
  name: Install Gems
15
15
  command: |
@@ -18,7 +18,7 @@ jobs:
18
18
  bundle clean
19
19
  fi
20
20
  - save_cache:
21
- key: v2-gems-ruby-2.5.8-{{ checksum "safer_rails_console.gemspec" }}-{{ checksum "Gemfile" }}
21
+ key: v2-gems-ruby-2.7.6-{{ checksum "safer_rails_console.gemspec" }}-{{ checksum "Gemfile" }}
22
22
  paths:
23
23
  - "vendor/bundle"
24
24
  - "gemfiles/vendor/bundle"
@@ -36,7 +36,7 @@ jobs:
36
36
  environment:
37
37
  CIRCLE_TEST_REPORTS: "test-results"
38
38
  BUNDLE_GEMFILE: "/home/circleci/safer_rails_console/<< parameters.gemfile >>"
39
- - image: circleci/postgres:9.6
39
+ - image: cimg/postgres:12.9
40
40
  environment:
41
41
  POSTGRES_USER: "circleci"
42
42
  POSTGRES_DB: "safer_rails_console_test"
@@ -71,16 +71,16 @@ workflows:
71
71
  jobs:
72
72
  - lint
73
73
  - test:
74
- ruby_version: "2.5.8"
75
74
  matrix:
76
75
  parameters:
76
+ ruby_version:
77
+ - "2.7.6"
78
+ - "3.0.4"
79
+ - "3.1.2"
77
80
  gemfile:
78
- - "gemfiles/5.0.gemfile"
79
- - "gemfiles/5.1.gemfile"
80
- - "gemfiles/5.2.gemfile"
81
81
  - "gemfiles/6.0.gemfile"
82
82
  - "gemfiles/6.1.gemfile"
83
- - test:
84
- name: 'ruby-3.0.0'
85
- ruby_version: "3.0.0"
86
- gemfile: "gemfiles/6.1.gemfile"
83
+ - "gemfiles/7.0.gemfile"
84
+ exclude:
85
+ - ruby_version: "3.1.2"
86
+ gemfile: "gemfiles/6.0.gemfile"
@@ -0,0 +1 @@
1
+ * @jturkel @will89 @mattsmith0308
data/.rubocop.yml CHANGED
@@ -2,10 +2,8 @@ inherit_gem:
2
2
  salsify_rubocop: conf/rubocop_rails.yml
3
3
 
4
4
  AllCops:
5
- TargetRubyVersion: 2.4
5
+ TargetRubyVersion: 2.7
6
6
  Exclude:
7
7
  - 'vendor/**/*'
8
- - 'gemfiles/vendor/**/*'
9
-
10
- Style/FrozenStringLiteralComment:
11
- Enabled: true
8
+ - 'gemfiles/**/*'
9
+ - 'spec/internal/**/*'
data/Appraisals CHANGED
@@ -1,17 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- appraise '5.0' do
4
- gem 'rails', '~> 5.0.0'
5
- end
6
-
7
- appraise '5.1' do
8
- gem 'rails', '~> 5.1.0'
9
- end
10
-
11
- appraise '5.2' do
12
- gem 'rails', '~> 5.2.0'
13
- end
14
-
15
3
  appraise '6.0' do
16
4
  gem 'rails', '~> 6.0.0'
17
5
  end
@@ -19,3 +7,7 @@ end
19
7
  appraise '6.1' do
20
8
  gem 'rails', '~> 6.1.0'
21
9
  end
10
+
11
+ appraise '7.0' do
12
+ gem 'rails', '~> 7.0.0'
13
+ end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.6.0
4
+ - Drop support for Ruby < 2.7 and Rails < 6.0.
5
+ - Add support for Ruby 3.1.
6
+ - Add support for Rails 7.0.
7
+
3
8
  ## [v0.5.1](https://github.com/salsify/safer_rails_console/tree/v0.5.0) (2020-01-29)
4
9
 
5
10
  [Full Changelog](https://github.com/salsify/safer_rails_console/compare/v0.5.0...v0.5.1)
@@ -121,7 +126,3 @@
121
126
  **Merged pull requests:**
122
127
 
123
128
  - Initial Implementation [\#2](https://github.com/salsify/safer_rails_console/pull/2) ([timothysu](https://github.com/timothysu))
124
-
125
-
126
-
127
- \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "~> 5.0.0"
5
+ gem "rails", "~> 7.0.0"
6
6
 
7
7
  gemspec path: "../"
@@ -2,6 +2,8 @@
2
2
 
3
3
  module SaferRailsConsole
4
4
  module Colors
5
+ extend self
6
+
5
7
  NONE = 0
6
8
  BLACK = 30
7
9
  RED = 31
@@ -14,13 +14,17 @@ module SaferRailsConsole
14
14
  end
15
15
 
16
16
  def load_config
17
- gem = Gem::Specification.find_by_name('safer_rails_console') # rubocop:disable Rails/DynamicFindBy
17
+ gem = Gem::Specification.find_by_name('safer_rails_console')
18
18
  gem_root = gem.gem_dir
19
- ARGV.push '-r', File.join(gem_root, 'lib', 'safer_rails_console', 'consoles', "#{SaferRailsConsole.config.console}.rb")
19
+ ARGV.push(
20
+ '-r',
21
+ File.join(gem_root, 'lib', 'safer_rails_console', 'consoles', "#{SaferRailsConsole.config.console}.rb")
22
+ )
20
23
  end
21
24
 
22
25
  def sandbox_user_prompt
23
- puts "Defaulting the console into sandbox mode.\nType 'disable' to disable. Anything else will begin a sandboxed session:" # rubocop:disable Rails/Output
26
+ puts 'Defaulting the console into sandbox mode.' # rubocop:disable Rails/Output
27
+ puts "Type 'disable' to disable. Anything else will begin a sandboxed session:" # rubocop:disable Rails/Output
24
28
  input = gets.strip
25
29
  input != 'disable'
26
30
  end
@@ -1,12 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- include SaferRailsConsole::Colors
4
-
5
- app_name = if SaferRailsConsole::RailsVersion.six_or_above?
6
- ::Rails.application.class.module_parent.to_s.underscore.dasherize
7
- else
8
- ::Rails.application.class.parent.to_s.underscore.dasherize
9
- end
3
+ app_name = ::Rails.application.class.module_parent.to_s.underscore.dasherize
10
4
  env_name = SaferRailsConsole.environment_name
11
5
  status = ::Rails.application.sandbox ? 'read-only' : 'writable'
12
6
  color = SaferRailsConsole.prompt_color
@@ -14,11 +8,11 @@ color = SaferRailsConsole.prompt_color
14
8
  prompt = "#{app_name}(#{env_name})(#{status}):%03n:%i"
15
9
 
16
10
  IRB.conf[:PROMPT][:RAILS_ENV] = {
17
- PROMPT_I: color_text("#{prompt}> ", color),
18
- PROMPT_N: color_text("#{prompt}> ", color),
19
- PROMPT_S: color_text("#{prompt}%l ", color),
20
- PROMPT_C: color_text("#{prompt}* ", color),
21
- RETURN: "#{color_text('=> ', color)}%s\n"
11
+ PROMPT_I: SaferRailsConsole::Colors.color_text("#{prompt}> ", color),
12
+ PROMPT_N: SaferRailsConsole::Colors.color_text("#{prompt}> ", color),
13
+ PROMPT_S: SaferRailsConsole::Colors.color_text("#{prompt}%l ", color),
14
+ PROMPT_C: SaferRailsConsole::Colors.color_text("#{prompt}* ", color),
15
+ RETURN: "#{SaferRailsConsole::Colors.color_text('=> ', color)}%s\n"
22
16
  }
23
17
 
24
18
  IRB.conf[:PROMPT_MODE] = :RAILS_ENV
@@ -2,54 +2,11 @@
2
2
 
3
3
  require 'safer_rails_console/rails_version'
4
4
 
5
- module SaferRailsConsole
6
- module Patches
7
- module Boot
8
- module SandboxFlag
9
- def self.console_options(opt, options = {})
10
- opt.banner = 'Usage: rails console [environment] [options]'
11
- opt.on('-s', '--[no-]sandbox', 'Explicitly enable/disable sandbox mode.') { |v| options[:sandbox] = v }
12
- opt.on('-w', '--writable', 'Alias for --no-sandbox.') { |v| options[:writable] = v }
13
- opt.on('-r', '--read-only', 'Alias for --sandbox.') { |v| options[:'read-only'] = v }
14
- opt.on('-e', '--environment=name', String,
15
- 'Specifies the environment to run this console under (test/development/production).',
16
- 'Default: development') { |v| options[:environment] = v.strip }
17
- end
18
-
19
- module Rails
20
- module CommandsTasks50
21
- def console
22
- require_command!('console')
23
- ::Rails::Console.singleton_class.prepend(::SaferRailsConsole::Patches::Boot::SandboxFlag::Rails::Console50)
24
- super
25
- end
26
- end
27
-
28
- module Console50
29
- def parse_arguments(arguments)
30
- options = {}
31
-
32
- OptionParser.new do |opt|
33
- ::SaferRailsConsole::Patches::Boot::SandboxFlag.console_options(opt, options)
34
- opt.parse!(arguments)
35
- end
36
-
37
- set_options_env(arguments, options)
38
- end
39
- end
40
- end
41
- end
42
- end
43
- end
44
- end
45
-
46
- if SaferRailsConsole::RailsVersion.five_zero?
47
- require 'rails/commands/commands_tasks'
48
- ::Rails::CommandsTasks.prepend(SaferRailsConsole::Patches::Boot::SandboxFlag::Rails::CommandsTasks50)
49
- elsif SaferRailsConsole::RailsVersion.five_one_or_above?
5
+ if SaferRailsConsole::RailsVersion.supported?
50
6
  require 'rails/command'
51
7
  require 'rails/commands/console/console_command'
52
- # Rails 5.1 and 5.2 defaults `sandbox` to `false`, but we need it to NOT have a default value and be `nil` when it is not user-specified
8
+ # Rails defaults `sandbox` to `false`, but we need it to NOT have a default value and
9
+ # be `nil` when it is not user-specified
53
10
  ::Rails::Command::ConsoleCommand.class_eval do
54
11
  remove_class_option :sandbox
55
12
  class_option :sandbox, aliases: '-s', type: :boolean, desc: 'Explicitly enable/disable sandbox mode.'
@@ -57,9 +14,7 @@ elsif SaferRailsConsole::RailsVersion.five_one_or_above?
57
14
  class_option :'read-only', aliases: '-r', type: :boolean, desc: 'Alias for --sandbox.'
58
15
  end
59
16
  else
60
- unless SaferRailsConsole::RailsVersion.supported?
61
- raise "No boot/sandbox_flag patch for rails version '#{::Rails.version}' exists. "\
62
- 'Please disable safer_rails_console, use a supported version of rails, '\
63
- "or remove \"require 'safer_rails_console/patches/boot'\" from your application's 'config/boot.rb'."
64
- end
17
+ raise "No boot/sandbox_flag patch for rails version '#{::Rails.version}' exists. "\
18
+ 'Please disable safer_rails_console, use a supported version of rails, '\
19
+ "or remove \"require 'safer_rails_console/patches/boot'\" from your application's 'config/boot.rb'."
65
20
  end
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Dir[File.join(__dir__, 'boot', '*.rb')].each { |file| require file }
3
+ Dir[File.join(__dir__, 'boot', '*.rb')].sort.each { |file| require file }
@@ -13,8 +13,11 @@ module SaferRailsConsole
13
13
  true
14
14
  elsif options[:writable]
15
15
  false
16
+ elsif SaferRailsConsole.sandbox_environment? &&
17
+ SaferRailsConsole.config.sandbox_prompt
18
+ SaferRailsConsole::Console.sandbox_user_prompt
16
19
  else
17
- SaferRailsConsole.sandbox_environment? && SaferRailsConsole.config.sandbox_prompt ? SaferRailsConsole::Console.sandbox_user_prompt : SaferRailsConsole.sandbox_environment?
20
+ SaferRailsConsole.sandbox_environment?
18
21
  end
19
22
  end
20
23
 
@@ -27,14 +30,10 @@ module SaferRailsConsole
27
30
  end
28
31
 
29
32
  if SaferRailsConsole::RailsVersion.supported?
30
- if SaferRailsConsole::RailsVersion.five_one_or_above?
31
- require 'rails/commands/console/console_command'
32
- else
33
- require 'rails/commands/console'
34
- end
33
+ require 'rails/commands/console/console_command'
35
34
 
36
35
  ::Rails::Console.singleton_class.prepend(SaferRailsConsole::Patches::Sandbox::Rails::Console)
37
36
  else
38
- raise "No sandbox patch for rails version '#{::Rails.version}' exists. "\
39
- 'Please disable safer_rails_console, use a supported version of rails, or disable SaferRailsConsole.config.sandbox_environments.'
37
+ raise "No sandbox patch for rails version '#{::Rails.version}' exists. Please disable safer_rails_console, "\
38
+ 'use a supported version of rails, or disable SaferRailsConsole.config.sandbox_environments.'
40
39
  end
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Dir[File.join(__dir__, 'railtie', '*.rb')].each { |file| require file }
3
+ Dir[File.join(__dir__, 'railtie', '*.rb')].sort.each { |file| require file }
@@ -4,7 +4,6 @@ module SaferRailsConsole
4
4
  module Patches
5
5
  module Sandbox
6
6
  module AutoRollback
7
- extend SaferRailsConsole::Colors
8
7
 
9
8
  def self.rollback_and_begin_new_transaction
10
9
  connection = ::ActiveRecord::Base.connection
@@ -12,32 +11,31 @@ module SaferRailsConsole
12
11
  connection.begin_db_transaction
13
12
  end
14
13
 
15
- def self.handle_and_reraise_exception(e)
16
- if e.message.include?('PG::ReadOnlySqlTransaction')
17
- puts color_text('An operation could not be completed due to read-only mode.', RED) # rubocop:disable Rails/Output
14
+ def self.handle_and_reraise_exception(error)
15
+ if error.message.include?('PG::ReadOnlySqlTransaction')
16
+ puts SaferRailsConsole::Colors.color_text( # rubocop:disable Rails/Output
17
+ 'An operation could not be completed due to read-only mode.',
18
+ SaferRailsConsole::Colors::RED
19
+ )
18
20
  else
19
21
  rollback_and_begin_new_transaction
20
22
  end
21
23
 
22
- raise e
24
+ raise error
23
25
  end
24
26
 
25
- module ActiveRecord
26
- module ConnectionAdapters
27
- module PostgreSQLAdapter5
28
- def execute_and_clear(sql, name, binds, prepare: false)
29
- super
30
- rescue => e
31
- SaferRailsConsole::Patches::Sandbox::AutoRollback.handle_and_reraise_exception(e)
32
- end
33
- end
27
+ module PostgreSQLAdapterPatch
28
+ def execute_and_clear(...)
29
+ super
30
+ rescue StandardError => e
31
+ SaferRailsConsole::Patches::Sandbox::AutoRollback.handle_and_reraise_exception(e)
34
32
  end
35
33
  end
34
+
35
+ if defined?(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
36
+ ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(PostgreSQLAdapterPatch)
37
+ end
36
38
  end
37
39
  end
38
40
  end
39
41
  end
40
-
41
- if defined?(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
42
- ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(SaferRailsConsole::Patches::Sandbox::AutoRollback::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter5)
43
- end
@@ -4,25 +4,21 @@ module SaferRailsConsole
4
4
  module Patches
5
5
  module Sandbox
6
6
  module TransactionReadOnly
7
- module ActiveRecord
8
- module ConnectionAdapters
9
- module PostgreSQLAdapter
10
- def begin_db_transaction
11
- super
12
- execute 'SET TRANSACTION READ ONLY'
13
- end
14
- end
7
+ module PostgreSQLAdapterPatch
8
+ def begin_db_transaction
9
+ super
10
+ execute 'SET TRANSACTION READ ONLY'
15
11
  end
16
12
  end
13
+
14
+ if defined?(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
15
+ ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(PostgreSQLAdapterPatch)
16
+
17
+ # Ensure transaction is read-only if it was began before this patch was loaded
18
+ connection = ::ActiveRecord::Base.connection
19
+ connection.execute 'SET TRANSACTION READ ONLY' if connection.open_transactions > 0
20
+ end
17
21
  end
18
22
  end
19
23
  end
20
24
  end
21
-
22
- if defined?(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
23
- ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(SaferRailsConsole::Patches::Sandbox::TransactionReadOnly::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
24
-
25
- # Ensure transaction is read-only if it was began before this patch was loaded
26
- connection = ::ActiveRecord::Base.connection
27
- connection.execute 'SET TRANSACTION READ ONLY' if connection.open_transactions > 0
28
- end
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Dir[File.join(__dir__, 'sandbox', '*.rb')].each { |file| require file }
3
+ Dir[File.join(__dir__, 'sandbox', '*.rb')].sort.each { |file| require file }
@@ -8,37 +8,13 @@ module SaferRailsConsole
8
8
 
9
9
  class << self
10
10
  def supported?
11
- five_zero? || five_one? || five_two? || six_or_above?
12
- end
13
-
14
- def five_zero?
15
- @is_five_zero = Gem::Requirement.new('~> 5.0.0').satisfied_by?(SaferRailsConsole::RailsVersion::RAILS_VERSION) if @is_five_zero.nil?
16
- @is_five_zero
17
- end
18
-
19
- def five_one?
20
- @is_five_one = Gem::Requirement.new('~> 5.1.0').satisfied_by?(SaferRailsConsole::RailsVersion::RAILS_VERSION) if @is_five_one.nil?
21
- @is_five_one
22
- end
23
-
24
- def five_one_or_above?
25
- @is_five_one_or_above = SaferRailsConsole::RailsVersion::RAILS_VERSION >= ::Gem::Version.new('5.1.0') if @is_five_one_or_above.nil?
26
- @is_five_one_or_above
27
- end
28
-
29
- def five_two?
30
- @is_five_two = Gem::Requirement.new('~> 5.2.0').satisfied_by?(SaferRailsConsole::RailsVersion::RAILS_VERSION) if @is_five_two.nil?
31
- @is_five_two
32
- end
33
-
34
- def six_zero?
35
- @is_six_zero = Gem::Requirement.new('~> 6.0.0').satisfied_by?(SaferRailsConsole::RailsVersion::RAILS_VERSION) if @is_six_zero.nil?
36
- @is_six_zero
11
+ six_or_above?
37
12
  end
38
13
 
39
14
  def six_or_above?
40
- @is_six_or_above = SaferRailsConsole::RailsVersion::RAILS_VERSION >= ::Gem::Version.new('6.0.0') if @is_six_or_above.nil?
41
- @is_six_or_above
15
+ return @six_or_above if defined?(@six_or_above)
16
+
17
+ @six_or_above = SaferRailsConsole::RailsVersion::RAILS_VERSION >= ::Gem::Version.new('6.0.0')
42
18
  end
43
19
  end
44
20
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SaferRailsConsole
4
- VERSION = '0.5.1'
4
+ VERSION = '0.6.0'
5
5
  end
@@ -12,16 +12,20 @@ module SaferRailsConsole
12
12
  def environment_name
13
13
  if ENV.key?('SAFER_RAILS_CONSOLE_ENVIRONMENT_NAME')
14
14
  ENV['SAFER_RAILS_CONSOLE_ENVIRONMENT_NAME']
15
+ elsif config.environment_names.key?(::Rails.env.downcase)
16
+ config.environment_names[::Rails.env.downcase]
15
17
  else
16
- config.environment_names.key?(::Rails.env.downcase) ? config.environment_names[::Rails.env.downcase] : 'unknown env'
18
+ 'unknown env'
17
19
  end
18
20
  end
19
21
 
20
22
  def prompt_color
21
23
  if ENV.key?('SAFER_RAILS_CONSOLE_PROMPT_COLOR')
22
24
  SaferRailsConsole::Colors.const_get(ENV['SAFER_RAILS_CONSOLE_PROMPT_COLOR'].upcase)
25
+ elsif config.environment_prompt_colors.key?(::Rails.env.downcase)
26
+ config.environment_prompt_colors[::Rails.env.downcase]
23
27
  else
24
- config.environment_prompt_colors.key?(::Rails.env.downcase) ? config.environment_prompt_colors[::Rails.env.downcase] : SaferRailsConsole::Colors::NONE
28
+ SaferRailsConsole::Colors::NONE
25
29
  end
26
30
  end
27
31
 
@@ -69,9 +73,9 @@ module SaferRailsConsole
69
73
  'staging' => SaferRailsConsole::Colors::YELLOW,
70
74
  'production' => SaferRailsConsole::Colors::RED
71
75
  },
72
- sandbox_environments: %w{production},
76
+ sandbox_environments: ['production'],
73
77
  sandbox_prompt: false,
74
- warn_environments: %w{production},
78
+ warn_environments: ['production'],
75
79
  warn_text: "WARNING: YOU ARE USING RAILS CONSOLE IN PRODUCTION!\n" \
76
80
  'Changing data can cause serious data loss. ' \
77
81
  'Make sure you know what you\'re doing.'
@@ -1,7 +1,6 @@
1
- # coding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
5
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
5
  require 'safer_rails_console/version'
7
6
 
@@ -12,7 +11,9 @@ Gem::Specification.new do |spec|
12
11
  spec.email = ['engineering@salsify.com']
13
12
 
14
13
  spec.summary = 'Make rails console less dangerous!'
15
- spec.description = 'This gem makes Rails console sessions less dangerous in specified environments by warning, color-coding, auto-sandboxing, and allowing read-only external connections (disables job queueing, non-GET requests, etc.)'
14
+ spec.description = 'This gem makes Rails console sessions less dangerous in specified environments by warning, ' \
15
+ 'color-coding, auto-sandboxing, and allowing read-only external connections ' \
16
+ '(disables job queueing, non-GET requests, etc.)'
16
17
  spec.homepage = 'https://github.com/salsify/safer_rails_console'
17
18
  spec.license = 'MIT'
18
19
 
@@ -20,6 +21,7 @@ Gem::Specification.new do |spec|
20
21
  # to allow pushing to a single host or delete this section to allow pushing to any host.
21
22
  if spec.respond_to?(:metadata)
22
23
  spec.metadata['allowed_push_host'] = 'https://rubygems.org'
24
+ spec.metadata['rubygems_mfa_required'] = 'true'
23
25
  else
24
26
  raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
25
27
  end
@@ -31,6 +33,8 @@ Gem::Specification.new do |spec|
31
33
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
34
  spec.require_paths = ['lib']
33
35
 
36
+ spec.required_ruby_version = '>= 2.7'
37
+
34
38
  spec.add_development_dependency 'appraisal', '~> 2.2'
35
39
  spec.add_development_dependency 'bundler', '~> 2.0'
36
40
  spec.add_development_dependency 'climate_control', '~> 0.2.0'
@@ -40,7 +44,7 @@ Gem::Specification.new do |spec|
40
44
  spec.add_development_dependency 'rake', '~> 12.0'
41
45
  spec.add_development_dependency 'rspec', '~> 3.6'
42
46
  spec.add_development_dependency 'rspec_junit_formatter'
43
- spec.add_development_dependency 'salsify_rubocop', '~> 0.48.0'
47
+ spec.add_development_dependency 'salsify_rubocop', '~> 1.27.0'
44
48
 
45
- spec.add_runtime_dependency 'rails', '>= 5.0', '< 6.2'
49
+ spec.add_runtime_dependency 'rails', '>= 6.0', '< 7.1'
46
50
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safer_rails_console
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salsify, Inc
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-29 00:00:00.000000000 Z
11
+ date: 2022-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal
@@ -142,34 +142,34 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 0.48.0
145
+ version: 1.27.0
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 0.48.0
152
+ version: 1.27.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rails
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: '5.0'
159
+ version: '6.0'
160
160
  - - "<"
161
161
  - !ruby/object:Gem::Version
162
- version: '6.2'
162
+ version: '7.1'
163
163
  type: :runtime
164
164
  prerelease: false
165
165
  version_requirements: !ruby/object:Gem::Requirement
166
166
  requirements:
167
167
  - - ">="
168
168
  - !ruby/object:Gem::Version
169
- version: '5.0'
169
+ version: '6.0'
170
170
  - - "<"
171
171
  - !ruby/object:Gem::Version
172
- version: '6.2'
172
+ version: '7.1'
173
173
  description: This gem makes Rails console sessions less dangerous in specified environments
174
174
  by warning, color-coding, auto-sandboxing, and allowing read-only external connections
175
175
  (disables job queueing, non-GET requests, etc.)
@@ -180,6 +180,7 @@ extensions: []
180
180
  extra_rdoc_files: []
181
181
  files:
182
182
  - ".circleci/config.yml"
183
+ - ".github/CODEOWNERS"
183
184
  - ".gitignore"
184
185
  - ".overcommit.yml"
185
186
  - ".rspec"
@@ -192,11 +193,9 @@ files:
192
193
  - Rakefile
193
194
  - bin/console
194
195
  - bin/setup
195
- - gemfiles/5.0.gemfile
196
- - gemfiles/5.1.gemfile
197
- - gemfiles/5.2.gemfile
198
196
  - gemfiles/6.0.gemfile
199
197
  - gemfiles/6.1.gemfile
198
+ - gemfiles/7.0.gemfile
200
199
  - lib/safer_rails_console.rb
201
200
  - lib/safer_rails_console/colors.rb
202
201
  - lib/safer_rails_console/console.rb
@@ -217,6 +216,7 @@ licenses:
217
216
  - MIT
218
217
  metadata:
219
218
  allowed_push_host: https://rubygems.org
219
+ rubygems_mfa_required: 'true'
220
220
  post_install_message:
221
221
  rdoc_options: []
222
222
  require_paths:
@@ -225,14 +225,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
225
225
  requirements:
226
226
  - - ">="
227
227
  - !ruby/object:Gem::Version
228
- version: '0'
228
+ version: '2.7'
229
229
  required_rubygems_version: !ruby/object:Gem::Requirement
230
230
  requirements:
231
231
  - - ">="
232
232
  - !ruby/object:Gem::Version
233
233
  version: '0'
234
234
  requirements: []
235
- rubygems_version: 3.1.2
235
+ rubygems_version: 3.2.33
236
236
  signing_key:
237
237
  specification_version: 4
238
238
  summary: Make rails console less dangerous!
data/gemfiles/5.1.gemfile DELETED
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 5.1.0"
6
-
7
- gemspec path: "../"
data/gemfiles/5.2.gemfile DELETED
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 5.2.0"
6
-
7
- gemspec path: "../"