arql 0.1.9 → 0.1.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc368945ff1a7d43a518b4e43007756ec037011fb18493f706ab83d27dcb037a
4
- data.tar.gz: 07f259ca53861ea57a9e5f6a49fbf6fdfc69eed96dcadf4240757c6303c7fe5f
3
+ metadata.gz: 17878b43fdb37376072a9ce87b9455cf42303a2a2eeacb0a382ee8b761e837cf
4
+ data.tar.gz: 12054ff4ed638edef1b8fa8a37c014bd6933f499add79367032c7eb4b4087a9b
5
5
  SHA512:
6
- metadata.gz: 814a25787c74a23d44f3a812066924b521978047109944d574f4b7b5a13f7f3a916d02de0b09387e319937bb93f2801e3c8836cbc8650445168b4976c8265684
7
- data.tar.gz: 886230ca5cbdb0f8aaf340b701a097063bf584f33d8b5bd14e956d859034439d54fa33dcdf567e04d4f22c54c923a042dd00260bdba5aef56f402ba295262ff6
6
+ metadata.gz: b66b11751c5d0dda49dd3e3b46643a954a9e2d33e7c94bab718703393cf35a1e8fb71b22d20c8a51e857eabf45ed481f5472cab18dc0a4959d20fdc418a4a4bf
7
+ data.tar.gz: fb72779d24b99ed46b22e105f43f4abe9ad973a780e66c0d11f2325b89923004db5811dbc90a74c7d8b786ed7c575938675cdc865f8e8d95c4a41d5f654ab383
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- arql (0.1.9)
4
+ arql (0.1.10)
5
5
  activerecord (~> 6.0.3)
6
6
  activesupport (~> 6.0.3)
7
7
  mysql2 (~> 0.5.3)
data/lib/arql/app.rb CHANGED
@@ -64,8 +64,10 @@ module Arql
64
64
  eval(effective_config[:code])
65
65
  elsif effective_config[:args].present?
66
66
  effective_config[:args].each { |rb| load(rb) }
67
- else
67
+ elsif STDIN.isatty
68
68
  run_repl!
69
+ else
70
+ eval(STDIN.read)
69
71
  end
70
72
  end
71
73
 
@@ -3,13 +3,13 @@ module Arql
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  def t
6
- puts Terminal::Table.new { |t|
6
+ Terminal::Table.new { |t|
7
7
  t << ['Attribute Name', 'Attribute Value', 'SQL Type', 'Comment']
8
8
  t << :separator
9
9
  self.class.connection.columns(self.class.table_name).each do |column|
10
10
  t << [column.name, read_attribute(column.name), column.sql_type, column.comment || '']
11
11
  end
12
- }
12
+ }.to_s
13
13
  end
14
14
 
15
15
  def to_insert_sql
@@ -23,9 +23,7 @@ module Arql
23
23
  class_methods do
24
24
  def t
25
25
  table_name = Commands::Table::get_table_name(name)
26
- puts
27
- puts "Table: #{table_name}"
28
- puts Commands::Table::table_info(table_name)
26
+ "\nTable: #{table_name}\n" + Commands::Table::table_info(table_name).to_s
29
27
  end
30
28
  def to_insert_sql(records, batch_size=1)
31
29
  to_sql(records, :skip, batch_size)
@@ -1,10 +1,10 @@
1
1
  class Object
2
2
 
3
3
  def j
4
- puts to_json
4
+ to_json
5
5
  end
6
6
 
7
7
  def jj
8
- puts JSON.pretty_generate(JSON.parse(to_json))
8
+ JSON.pretty_generate(JSON.parse(to_json))
9
9
  end
10
10
  end
@@ -0,0 +1,5 @@
1
+ class String
2
+ def p
3
+ puts self
4
+ end
5
+ end
data/lib/arql/ext.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  require 'arql/ext/object'
2
2
  require 'arql/ext/array'
3
3
  require 'arql/ext/time'
4
+ require 'arql/ext/string'
data/lib/arql/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Arql
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
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.1.9
4
+ version: 0.1.10
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-05-09 00:00:00.000000000 Z
11
+ date: 2020-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mysql2
@@ -181,6 +181,7 @@ files:
181
181
  - lib/arql/ext.rb
182
182
  - lib/arql/ext/array.rb
183
183
  - lib/arql/ext/object.rb
184
+ - lib/arql/ext/string.rb
184
185
  - lib/arql/ext/time.rb
185
186
  - lib/arql/id.rb
186
187
  - lib/arql/multi_io.rb