arql 0.3.3 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.solargraph.yml +10 -0
- data/Gemfile.lock +2 -2
- data/lib/arql/commands/sandbox.rb +33 -0
- data/lib/arql/commands.rb +1 -0
- data/lib/arql/multi_io.rb +8 -1
- data/lib/arql/repl.rb +6 -1
- data/lib/arql/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 754f0123178d350470df65a3b627f3ae3890a3de7668d8422429d661e1d271cf
|
4
|
+
data.tar.gz: 5d8241b6d7ba7fca92cd3a645138276fc2c3b0c8fb7658ba514f16794f63e26a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85e3b47d182b593b9a34055141192073844d257d96fbd2319e83eb3b0444c3f747fcc460819a1f8d7b51110487f00afa27c61f8ef280d49724390123c8d759f1
|
7
|
+
data.tar.gz: a5c8898c8384a7ed8685fe0ce758f797cbb530c627e116ad58610b854496d388063dfb0278a5c53586bd17a38740925d39ff9cc9942bda200436da597abaf644
|
data/.solargraph.yml
ADDED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
arql (0.3.
|
4
|
+
arql (0.3.5)
|
5
5
|
activerecord (>= 6.0.3, < 6.2.0)
|
6
6
|
activesupport (~> 6.0.3)
|
7
7
|
caxlsx (~> 3.0.2)
|
@@ -40,7 +40,7 @@ GEM
|
|
40
40
|
coderay (1.1.3)
|
41
41
|
composite_primary_keys (12.0.10)
|
42
42
|
activerecord (~> 6.0.0)
|
43
|
-
concurrent-ruby (1.1.
|
43
|
+
concurrent-ruby (1.1.10)
|
44
44
|
htmlentities (4.3.4)
|
45
45
|
i18n (1.8.11)
|
46
46
|
concurrent-ruby (~> 1.0)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Arql::Commands
|
2
|
+
module Sandbox
|
3
|
+
class << self
|
4
|
+
attr_accessor :enabled
|
5
|
+
|
6
|
+
@sandbox_callback = proc do
|
7
|
+
begin_transaction(joinable: false)
|
8
|
+
end
|
9
|
+
|
10
|
+
def enter
|
11
|
+
ActiveRecord::ConnectionAdapters::AbstractAdapter.set_callback(:checkout, :after, &@sandbox_callback)
|
12
|
+
ActiveRecord::Base.connection.begin_transaction(joinable: false)
|
13
|
+
@enabled = true
|
14
|
+
end
|
15
|
+
|
16
|
+
def quit
|
17
|
+
ActiveRecord::ConnectionAdapters::AbstractAdapter.skip_callback(:checkout, :after, &@sandbox_callback)
|
18
|
+
@enabled = false
|
19
|
+
|
20
|
+
puts "begin_transaction callbacks removed."
|
21
|
+
puts "You still have open %d transactions open, don't forget commit or rollback them." % ActiveRecord::Base.connection.open_transactions if ActiveRecord::Base.connection.open_transactions > 0
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
Pry.commands.block_command 'sandbox-enter' do
|
26
|
+
Sandbox.enter
|
27
|
+
end
|
28
|
+
|
29
|
+
Pry.commands.block_command 'sandbox-quit' do
|
30
|
+
Sandbox.quit
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/arql/commands.rb
CHANGED
data/lib/arql/multi_io.rb
CHANGED
data/lib/arql/repl.rb
CHANGED
@@ -35,7 +35,12 @@ module Arql
|
|
35
35
|
"(#{obj}:#{nest_level})"
|
36
36
|
end
|
37
37
|
end
|
38
|
-
|
38
|
+
if Arql::Commands::Sandbox.enabled
|
39
|
+
sandbox_indicator = ' [%s] ' % Rainbow('sandbox').green.bright
|
40
|
+
else
|
41
|
+
sandbox_indicator = ''
|
42
|
+
end
|
43
|
+
"%s#{Rainbow('@').green}%s%s#{nest_level_prompt} [%d] %s " % [Rainbow('ARQL').red, Rainbow(App.prompt).yellow, sandbox_indicator, pry_instance.input_ring.count, Rainbow('❯').green]
|
39
44
|
end]
|
40
45
|
end
|
41
46
|
end
|
data/lib/arql/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liu Xiang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mysql2
|
@@ -222,6 +222,7 @@ extensions: []
|
|
222
222
|
extra_rdoc_files: []
|
223
223
|
files:
|
224
224
|
- ".gitignore"
|
225
|
+
- ".solargraph.yml"
|
225
226
|
- CODE_OF_CONDUCT.md
|
226
227
|
- Gemfile
|
227
228
|
- Gemfile.lock
|
@@ -241,6 +242,7 @@ files:
|
|
241
242
|
- lib/arql/commands/models.rb
|
242
243
|
- lib/arql/commands/reconnect.rb
|
243
244
|
- lib/arql/commands/redefine.rb
|
245
|
+
- lib/arql/commands/sandbox.rb
|
244
246
|
- lib/arql/commands/show_sql.rb
|
245
247
|
- lib/arql/commands/table.rb
|
246
248
|
- lib/arql/concerns.rb
|