safer_rails_console 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: fa6dfe54a684681be959fb96f6e22373e0776945
4
- data.tar.gz: ac0286cc4a62e5d99e7b10b8332a75a76e6eabbb
3
+ metadata.gz: 59ffd68473fc4c5bbf2dfb186a84cab00ae3299c
4
+ data.tar.gz: 0e3c5eb6bdc2a068b0bfe308af666f3d2cc21e87
5
5
  SHA512:
6
- metadata.gz: b15d749d96006900aaeef79633164e7ddc340da7eeb6e4bf91fa208479e30064fc50595c8cf598e00c44030b468435840880941635efb3225b7bb4686ae934ed
7
- data.tar.gz: 06b467a28054545c9b22426b6c5a1161651f87b87f9cc8caefd2c0bff40ba4eeca981489edda5c2a2133735b3f3ff1a506bc044ff179d99f013c4b97c26a92c3
6
+ metadata.gz: e1c92aab76465e922c072953628fe44e67b99a098be13d24a5d0540d5fc5618e4beb19615dc1ac0b602709aed0a3b7ed4c99931b641b0a4383acc6d2edba89e3
7
+ data.tar.gz: 19c8070a11dc6fcf31938cc77c1be220644318f4eca463f6acfb617da9b11634e701d4f6ba0bf552c278f154d871c82485d97307b27ed7c4fccadad4be361a55
data/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ # Change Log
2
+
3
+ ## [v0.1.1](https://github.com/salsify/safer_rails_console/tree/v0.1.1) (2017-07-07)
4
+ [Full Changelog](https://github.com/salsify/safer_rails_console/compare/v0.1.0...v0.1.1)
5
+
6
+ **Fixed bugs:**
7
+
8
+ - Nothing happens when Spring is running [\#6](https://github.com/salsify/safer_rails_console/issues/6)
9
+
10
+ **Merged pull requests:**
11
+
12
+ - Add support for Spring [\#8](https://github.com/salsify/safer_rails_console/pull/8) ([timothysu](https://github.com/timothysu))
13
+
14
+ ## [v0.1.0](https://github.com/salsify/safer_rails_console/tree/v0.1.0) (2017-06-26)
15
+ **Merged pull requests:**
16
+
17
+ - Initial Implementation [\#2](https://github.com/salsify/safer_rails_console/pull/2) ([timothysu](https://github.com/timothysu))
18
+
19
+
20
+
21
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
@@ -11,7 +11,13 @@ module SaferRailsConsole
11
11
  puts color_text(SaferRailsConsole.config.warn_text, SaferRailsConsole.prompt_color) # rubocop:disable Rails/Output
12
12
  end
13
13
 
14
- def sandbox_prompt_user_input
14
+ def load_config
15
+ gem = Gem::Specification.find_by_name('safer_rails_console') # rubocop:disable Rails/DynamicFindBy
16
+ gem_root = gem.gem_dir
17
+ ARGV.push '-r', File.join(gem_root, 'lib', 'safer_rails_console', 'consoles', "#{SaferRailsConsole.config.console}.rb")
18
+ end
19
+
20
+ def sandbox_user_prompt
15
21
  puts "Defaulting the console into sandbox mode.\nType 'disable' to disable. Anything else will begin a sandboxed session:" # rubocop:disable Rails/Output
16
22
  input = gets.strip
17
23
  input != 'disable'
@@ -11,10 +11,7 @@ module SaferRailsConsole
11
11
  options = args.last
12
12
 
13
13
  options[:sandbox] = SaferRailsConsole.sandbox_environment? if options[:sandbox].nil?
14
- options[:sandbox] = SaferRailsConsole::Console.sandbox_prompt_user_input if SaferRailsConsole.sandbox_environment? && SaferRailsConsole.config.sandbox_prompt
15
-
16
- SaferRailsConsole::Console.initialize_sandbox if options[:sandbox]
17
- SaferRailsConsole::Console.print_warning if SaferRailsConsole.warn_environment?
14
+ options[:sandbox] = SaferRailsConsole::Console.sandbox_user_prompt if SaferRailsConsole.sandbox_environment? && SaferRailsConsole.config.sandbox_prompt
18
15
 
19
16
  super *args
20
17
  end
@@ -25,6 +22,12 @@ module SaferRailsConsole
25
22
  end
26
23
 
27
24
  if SaferRailsConsole::RailsVersion.supported?
25
+ if SaferRailsConsole::RailsVersion.five_one?
26
+ require 'rails/commands/console/console_command'
27
+ else
28
+ require 'rails/commands/console'
29
+ end
30
+
28
31
  ::Rails::Console.singleton_class.prepend(SaferRailsConsole::Patches::Sandbox::Rails::Console)
29
32
  else
30
33
  raise "No sandbox patch for rails version '#{::Rails.version}' exists. "\
@@ -12,7 +12,13 @@ module SaferRailsConsole
12
12
  end
13
13
 
14
14
  config.after_initialize do
15
- require 'safer_rails_console/patches/railtie' if defined?(::Rails::Console)
15
+ require 'safer_rails_console/patches/railtie'
16
+ end
17
+
18
+ console do
19
+ SaferRailsConsole::Console.initialize_sandbox if ::Rails.application.sandbox
20
+ SaferRailsConsole::Console.print_warning if SaferRailsConsole.warn_environment?
21
+ SaferRailsConsole::Console.load_config
16
22
  end
17
23
  end
18
24
  end
@@ -1,3 +1,3 @@
1
1
  module SaferRailsConsole
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.1'.freeze
3
3
  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.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salsify, Inc
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-26 00:00:00.000000000 Z
11
+ date: 2017-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal
@@ -171,6 +171,7 @@ files:
171
171
  - ".rubocop.yml"
172
172
  - ".travis.yml"
173
173
  - Appraisals
174
+ - CHANGELOG.md
174
175
  - Gemfile
175
176
  - LICENSE.txt
176
177
  - README.md
@@ -188,7 +189,6 @@ files:
188
189
  - lib/safer_rails_console/patches/boot.rb
189
190
  - lib/safer_rails_console/patches/boot/sandbox_flag.rb
190
191
  - lib/safer_rails_console/patches/railtie.rb
191
- - lib/safer_rails_console/patches/railtie/console.rb
192
192
  - lib/safer_rails_console/patches/railtie/sandbox.rb
193
193
  - lib/safer_rails_console/patches/sandbox.rb
194
194
  - lib/safer_rails_console/patches/sandbox/auto_rollback.rb
@@ -1,7 +0,0 @@
1
- ::Rails::Application.class_eval do
2
- console do
3
- gem = Gem::Specification.find_by_name('safer_rails_console') # rubocop:disable Rails/DynamicFindBy
4
- gem_root = gem.gem_dir
5
- ARGV.push '-r', File.join(gem_root, 'lib', 'safer_rails_console', 'consoles', "#{SaferRailsConsole.config.console}.rb")
6
- end
7
- end