console_buddy 0.1.10 → 0.1.11
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 +4 -4
- data/lib/console_buddy/augment.rb +1 -0
- data/lib/console_buddy/helpers.rb +1 -0
- data/lib/console_buddy/version.rb +1 -1
- data/lib/console_buddy.rb +28 -13
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f06e8299de73ca38c3034fe6b769da6e0abe43d5cd139495afcba9009408b1dc
|
|
4
|
+
data.tar.gz: 9ae2d7489bf7eecd165cfa24ed388dfaf32ef9fc0a85a4402c5c6f951c0f2ae7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5bf025aac5e410b334475f5dcaab699cb5ca0692e690c686038f971595844250d772245d0f87662ed0e20b423b2c9a7fba82f12868cb267c243dcc64c32023cd
|
|
7
|
+
data.tar.gz: ae5ff5b1c1d1fd00bfea0ae195f5d061a0c698f050c8d7530544f086114b23cac318e5250c3a243a5a95f796375bb75abcc61045e6cd9631493de064e5271b3d
|
data/lib/console_buddy.rb
CHANGED
|
@@ -2,16 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
require 'pathname'
|
|
4
4
|
|
|
5
|
-
#
|
|
6
|
-
|
|
7
|
-
console_buddy_path = Pathname.new(File.join(Dir.pwd, '.console_buddy'))
|
|
8
|
-
console_buddy_path.exist? && console_buddy_path.directory?
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
if !console_buddy_directory_exists?
|
|
12
|
-
return
|
|
13
|
-
end
|
|
14
|
-
|
|
5
|
+
# Always load the module; .console_buddy existence is checked in start! when Rails.root is set
|
|
6
|
+
# (Rails 7.2 / Spring can require gems before Rails.root is available)
|
|
15
7
|
require 'active_support'
|
|
16
8
|
require 'active_support/all'
|
|
17
9
|
|
|
@@ -68,6 +60,8 @@ module ConsoleBuddy
|
|
|
68
60
|
def start!
|
|
69
61
|
# Initialize the default values
|
|
70
62
|
set_config_defaults
|
|
63
|
+
# Require .console_buddy to exist (check here when Rails.root is set; avoids Rails 7.2 / Spring load-order issues)
|
|
64
|
+
return unless console_buddy_directory_exists?
|
|
71
65
|
# Check if there is a .console_buddy/config file
|
|
72
66
|
load_console_buddy_config
|
|
73
67
|
|
|
@@ -129,9 +123,22 @@ module ConsoleBuddy
|
|
|
129
123
|
ENV['RAILS_ENV'] || ENV['RACK_ENV']
|
|
130
124
|
end
|
|
131
125
|
|
|
126
|
+
# App root so .console_buddy is found under Rails (e.g. with Spring) or Dir.pwd
|
|
127
|
+
def console_buddy_root
|
|
128
|
+
if defined?(Rails) && Rails.respond_to?(:root) && Rails.root.present?
|
|
129
|
+
Pathname.new(Rails.root.to_s)
|
|
130
|
+
else
|
|
131
|
+
Pathname.new(Dir.pwd)
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def console_buddy_directory_exists?
|
|
136
|
+
console_buddy_root.join('.console_buddy').exist? && console_buddy_root.join('.console_buddy').directory?
|
|
137
|
+
end
|
|
138
|
+
|
|
132
139
|
# Loads the .console_buddy/config file if present
|
|
133
140
|
def load_console_buddy_config
|
|
134
|
-
config_path =
|
|
141
|
+
config_path = console_buddy_root.join('.console_buddy', 'config.rb')
|
|
135
142
|
if config_path.exist? && config_path.file?
|
|
136
143
|
require config_path.to_s
|
|
137
144
|
else
|
|
@@ -142,7 +149,7 @@ module ConsoleBuddy
|
|
|
142
149
|
# Loads all the files in the .console_buddy folder
|
|
143
150
|
# .console_buddy folder should be in the root of the project
|
|
144
151
|
def load_console_buddy_files
|
|
145
|
-
console_buddy_path =
|
|
152
|
+
console_buddy_path = console_buddy_root.join('.console_buddy')
|
|
146
153
|
if console_buddy_path.exist? && console_buddy_path.directory?
|
|
147
154
|
console_buddy_path.find do |path|
|
|
148
155
|
next unless path.file?
|
|
@@ -188,6 +195,8 @@ module ConsoleBuddy
|
|
|
188
195
|
end
|
|
189
196
|
end
|
|
190
197
|
|
|
198
|
+
public :augment_classes, :augment_console
|
|
199
|
+
|
|
191
200
|
# This will add the buddy methods to the IRB session
|
|
192
201
|
# So that they can be called without instantiating the `ConsoleBuddy::Base` class
|
|
193
202
|
def start_buddy_in_irb
|
|
@@ -204,6 +213,12 @@ module ConsoleBuddy
|
|
|
204
213
|
Rails::ConsoleMethods.include(ConsoleBuddy::IRB)
|
|
205
214
|
load_progress_bar
|
|
206
215
|
end
|
|
216
|
+
# Pry: ensure console methods are on the session's main object (before_session gets output, binding, pry)
|
|
217
|
+
if defined?(Pry)
|
|
218
|
+
Pry.config.hooks.add_hook(:before_session, :console_buddy) do |_output, binding, _pry|
|
|
219
|
+
binding.receiver.extend(ConsoleBuddy::IRB)
|
|
220
|
+
end
|
|
221
|
+
end
|
|
207
222
|
end
|
|
208
223
|
|
|
209
224
|
def load_progress_bar
|
|
@@ -247,4 +262,4 @@ require_relative "console_buddy/initializers/rails"
|
|
|
247
262
|
|
|
248
263
|
if rspec_present
|
|
249
264
|
require_relative "console_buddy/initializers/rspec"
|
|
250
|
-
end
|
|
265
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: console_buddy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Micah Bowie
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-
|
|
12
|
+
date: 2026-03-09 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|
|
@@ -208,8 +208,8 @@ homepage:
|
|
|
208
208
|
licenses: []
|
|
209
209
|
metadata:
|
|
210
210
|
bug_tracker_uri: https://github.com/GoodForNothingTech/console_buddy/issues
|
|
211
|
-
changelog_uri: https://github.com/GoodForNothingTech/console_buddy/CHANGELOG.md
|
|
212
|
-
documentation_uri: https://github.com/GoodForNothingTech/console_buddy
|
|
211
|
+
changelog_uri: https://github.com/GoodForNothingTech/console_buddy/blob/main/CHANGELOG.md
|
|
212
|
+
documentation_uri: https://github.com/GoodForNothingTech/console_buddy/blob/main/README.md
|
|
213
213
|
source_code_uri: https://github.com/GoodForNothingTech/console_buddy
|
|
214
214
|
post_install_message:
|
|
215
215
|
rdoc_options: []
|
|
@@ -226,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
226
226
|
- !ruby/object:Gem::Version
|
|
227
227
|
version: '0'
|
|
228
228
|
requirements: []
|
|
229
|
-
rubygems_version: 3.4.
|
|
229
|
+
rubygems_version: 3.4.19
|
|
230
230
|
signing_key:
|
|
231
231
|
specification_version: 4
|
|
232
232
|
summary: Have you ever had debugging tricks, aliases, or shortcuts that don't make
|