File tree 8 files changed +40
-17
lines changed
8 files changed +40
-17
lines changed Original file line number Diff line number Diff line change 11
11
remote: .
12
12
specs:
13
13
console1984 (0.1.31 )
14
+ irb (~> 1.13 )
14
15
parser
15
16
rails (>= 7.0 )
16
17
rainbow
98
99
activesupport (>= 6.1 )
99
100
i18n (1.14.1 )
100
101
concurrent-ruby (~> 1.0 )
102
+ io-console (0.7.2 )
103
+ irb (1.13.1 )
104
+ rdoc (>= 4.0.0 )
105
+ reline (>= 0.4.2 )
101
106
json (2.6.3 )
102
107
language_server-protocol (3.17.0.3 )
103
108
loofah (2.22.0 )
135
140
ast (~> 2.4.1 )
136
141
racc
137
142
pg (1.5.3 )
143
+ psych (5.1.2 )
144
+ stringio
138
145
racc (1.7.1 )
139
146
rack (2.2.7 )
140
147
rack-test (2.1.0 )
169
176
zeitwerk (~> 2.5 )
170
177
rainbow (3.1.1 )
171
178
rake (13.1.0 )
179
+ rdoc (6.6.3.1 )
180
+ psych (>= 4.0.0 )
172
181
regexp_parser (2.8.1 )
182
+ reline (0.5.7 )
183
+ io-console (~> 0.5 )
173
184
rexml (3.2.5 )
174
185
rubocop (1.54.1 )
175
186
json (~> 2.3 )
200
211
rubyzip (2.3.2 )
201
212
sqlite3 (1.6.3 )
202
213
mini_portile2 (~> 2.8.0 )
214
+ stringio (3.1.0 )
203
215
thor (1.3.1 )
204
216
timeout (0.4.1 )
205
217
tzinfo (2.0.6 )
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
28
28
spec . add_dependency 'rainbow'
29
29
spec . add_dependency 'parser'
30
30
spec . add_dependency 'rails' , '>= 7.0'
31
+ spec . add_dependency 'irb' , '~> 1.13'
31
32
32
33
spec . add_development_dependency 'benchmark-ips'
33
34
spec . add_development_dependency 'mocha'
Original file line number Diff line number Diff line change 1
- # Naming class with dot so that it doesn't get loaded eagerly by Zeitwork . We want to load
1
+ # Naming class with dot so that it doesn't get loaded eagerly by Zeitwerk . We want to load
2
2
# only when a console session is started, when +parser+ is loaded.
3
3
#
4
4
# See +Console1984::Supervisor#require_dependencies+
Original file line number Diff line number Diff line change
1
+ module Console1984 ::Commands
2
+ class Decrypt < IRB ::Command ::Base
3
+ include Console1984 ::Ext ::Irb ::Commands
4
+
5
+ category "Console1984"
6
+ description "go back to protected mode, without access to encrypted information"
7
+
8
+ def execute ( *)
9
+ decrypt!
10
+ end
11
+ end
12
+ end
Original file line number Diff line number Diff line change
1
+ module Console1984 ::Commands
2
+ class Encrypt < IRB ::Command ::Base
3
+ include Console1984 ::Ext ::Irb ::Commands
4
+
5
+ category "Console1984"
6
+ description "go back to protected mode, without access to encrypted information"
7
+
8
+ def execute ( *)
9
+ encrypt!
10
+ end
11
+ end
12
+ end
Original file line number Diff line number Diff line change @@ -13,13 +13,4 @@ def decrypt!
13
13
def encrypt!
14
14
shield . enable_protected_mode
15
15
end
16
-
17
- # This returns the last error that prevented a command execution in the console
18
- # or nil if there isn't any.
19
- #
20
- # This is meant for internal usage when debugging legit commands that are wrongly
21
- # prevented.
22
- def _console_last_suspicious_command_error
23
- Console1984 . command_executor . last_suspicious_command_error
24
- end
25
16
end
Original file line number Diff line number Diff line change @@ -34,7 +34,8 @@ def extend_protected_systems
34
34
35
35
def extend_irb
36
36
IRB ::Context . prepend ( Console1984 ::Ext ::Irb ::Context )
37
- Rails ::ConsoleMethods . include ( Console1984 ::Ext ::Irb ::Commands )
37
+ IRB ::Command . register :decrypt! , Console1984 ::Commands ::Decrypt
38
+ IRB ::Command . register :encrypt! , Console1984 ::Commands ::Encrypt
38
39
end
39
40
40
41
def extend_core_ruby
Original file line number Diff line number Diff line change 1
1
require "active_support/all"
2
2
3
- if Rails . version >= "8"
4
- require "rails/console/methods"
5
- else
6
- require "rails/console/app"
7
- end
8
-
9
3
# Entry point to the system. In charge of installing everything
10
4
# and starting and stopping sessions.
11
5
class Console1984 ::Supervisor
You can’t perform that action at this time.
0 commit comments