arql 0.2.10 → 0.3.0

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.
@@ -2,4 +2,12 @@ class String
2
2
  def p
3
3
  puts self
4
4
  end
5
+
6
+ def expa
7
+ File.expand_path(self)
8
+ end
9
+
10
+ def f
11
+ expa
12
+ end
5
13
  end
@@ -0,0 +1,44 @@
1
+ module Arql
2
+ class Mysqldump
3
+
4
+ def initialize(options = nil)
5
+ options ||= App.connect_options
6
+ @options = options
7
+ if options[:socket]
8
+ port_or_sock = "-S #{options[:socket]}"
9
+ else
10
+ port_or_sock = "-P #{options[:port] || 3306}"
11
+ end
12
+ @base_dump_cmd = "mysqldump -u %{user} -h %{host} %{port_or_sock} %{password} --skip-lock-tables " % {
13
+ user: options[:username],
14
+ host: options[:host],
15
+ password: options[:password].presence.try { |e| "-p#{e}" } || '',
16
+ port_or_sock: port_or_sock
17
+ }
18
+ end
19
+
20
+ def dump_table(filename, table_name, no_create_table = false)
21
+ system dump_table_cmd(table_name, no_create_table) + " > #{filename}"
22
+ end
23
+
24
+ def dump_database(filename, no_create_db = false)
25
+ system dump_database_cmd(no_create_db) + " > #{filename}"
26
+ end
27
+
28
+ def dump_table_cmd(table_name, no_create_table = false)
29
+ @base_dump_cmd + " " + if no_create_table
30
+ "--no-create-info #{@options[:database]} #{table_name}"
31
+ else
32
+ "--add-drop-table #{@options[:database]} #{table_name}"
33
+ end
34
+ end
35
+
36
+ def dump_database_cmd(no_create_db = false)
37
+ @base_dump_cmd + " " + if no_create_db
38
+ "--no-create-db --add-drop-database --databases #{@options[:database]}"
39
+ else
40
+ "--add-drop-database --add-drop-table --databases #{@options[:database]}"
41
+ end
42
+ end
43
+ end
44
+ end
@@ -1,3 +1,3 @@
1
1
  module Arql
2
- VERSION = "0.2.10"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.10
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liu Xiang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-18 00:00:00.000000000 Z
11
+ date: 2021-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mysql2
@@ -237,6 +237,9 @@ files:
237
237
  - lib/arql/commands/redefine.rb
238
238
  - lib/arql/commands/show_sql.rb
239
239
  - lib/arql/commands/table.rb
240
+ - lib/arql/concerns.rb
241
+ - lib/arql/concerns/global_data_definition.rb
242
+ - lib/arql/concerns/table_data_definition.rb
240
243
  - lib/arql/connection.rb
241
244
  - lib/arql/definition.rb
242
245
  - lib/arql/ext.rb
@@ -248,6 +251,7 @@ files:
248
251
  - lib/arql/ext/time.rb
249
252
  - lib/arql/id.rb
250
253
  - lib/arql/multi_io.rb
254
+ - lib/arql/mysqldump.rb
251
255
  - lib/arql/repl.rb
252
256
  - lib/arql/ssh_proxy.rb
253
257
  - lib/arql/ssh_proxy_patch.rb
@@ -264,14 +268,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
264
268
  requirements:
265
269
  - - ">="
266
270
  - !ruby/object:Gem::Version
267
- version: 2.3.0
271
+ version: 2.6.0
268
272
  required_rubygems_version: !ruby/object:Gem::Requirement
269
273
  requirements:
270
274
  - - ">="
271
275
  - !ruby/object:Gem::Version
272
276
  version: '0'
273
277
  requirements: []
274
- rubygems_version: 3.1.2
278
+ rubygems_version: 3.2.3
275
279
  signing_key:
276
280
  specification_version: 4
277
281
  summary: Rails ActiveRecord + Pry is the best SQL query editor