pry-better_rails 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,5 +5,49 @@ require 'better_errors/rails'
5
5
 
6
6
  BetterErrors.use_pry!
7
7
 
8
+ Pry.hooks.add_hook :when_started, :preload_for_speedy_show_models do
9
+ Thread.start do
10
+ Rails.application.eager_load!
11
+ save_pos = "\e[s"
12
+ goto_top_left = "\e[0;0H"
13
+ restore_pos = "\e[u"
14
+ periwinkle = "\e[38;5;67m"
15
+ brightblue = "\e[38;5;51m"
16
+ color_off = "\e[0m"
17
+ print [
18
+ save_pos, goto_top_left,
19
+ '[',
20
+ periwinkle, 'pry-better_rails finished background eager_load!, ',
21
+ brightblue, 'show-models',
22
+ periwinkle, ' now loaded',
23
+ color_off,
24
+ ']',
25
+ restore_pos
26
+ ].join
27
+ end
28
+ end
29
+
30
+ # TODO
31
+ # FactoryGirl.reload
32
+
8
33
  module PryBetterRails
34
+ class DbQuietLog < Pry::ClassCommand
35
+ match 'db-quiet-log'
36
+ group 'Rails'
37
+ description 'Silence ActiveRecord logs'
38
+ def process
39
+ ActiveRecord::Base.logger = nil
40
+ end
41
+ end
42
+ Pry::Commands.add_command DbQuietLog
43
+
44
+ class DbLoudLog < Pry::ClassCommand
45
+ match 'db-loud-log'
46
+ group 'Rails'
47
+ description 'Verbosify ActiveRecord logs'
48
+ def process
49
+ ActiveRecord::Base.logger = Logger.new $stderr
50
+ end
51
+ end
52
+ Pry::Commands.add_command DbLoudLog
9
53
  end
@@ -1,3 +1,3 @@
1
1
  module PryBetterRails
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-better_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: