slyce 1.2.4 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/bin/slyce +22 -3
  3. data/bin/slyced +2 -2
  4. data/slyce.gemspec +1 -1
  5. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e976689780c3b732b1254c1291868415a7d7e31c1c5144c93d9786df80697b8
4
- data.tar.gz: 39f1fba4a6a32436bf407af6d4b52e71f7447390ed2eb8532338399b34175268
3
+ metadata.gz: fec75a29f832be5cce086420a326344089addb6804c8c881b0608560797f8f5c
4
+ data.tar.gz: 2f24983ed709549e1ef18f10e80a5417e8bd7c890f43e725abbcbe18c656232e
5
5
  SHA512:
6
- metadata.gz: 55cbbb017e93530759ea9d9239a8c18df4426c185e8c8d8f080816355124307189f7c2fe4c26bfbf86fac252679584ad078708186eaf023e664a57c6e52521a6
7
- data.tar.gz: 52a9fafe8e978bc3614548e29ecdfd9afb48c121526e5f928a5463cca66128f17564706bb9645fe51e8ad5a03b18d562f5d35eec34edd31d8e4832bfd3086b5f
6
+ metadata.gz: c746ea7eeb63859b7318f9245028f530b973b997ca1de1220a2346d363307756e8ca6d879f4155719da49dd2420220e54ef34bdf225ea39dade507a49030400d
7
+ data.tar.gz: 213560784f729604ce2cea20dc57b51c45775cfc8c9be273842cb0818448f9792764516dcb2ff00fc435c2de9b8f0ceccfd9153bcd7899a8043969dc21c689bb
data/bin/slyce CHANGED
@@ -11,7 +11,7 @@ dbas = nil
11
11
  tabl = nil
12
12
 
13
13
  OptionParser.new.instance_eval do
14
- @version = "1.2.4"
14
+ @version = "1.2.7"
15
15
  @banner = "usage: #{program_name} [options] <database> <table>"
16
16
 
17
17
  on "--csv" , "Output comma separated values"
@@ -75,10 +75,29 @@ end
75
75
 
76
76
  # ==[ Let 'er rip! ]==
77
77
 
78
- conn = Mysql2::Client.new(database: dbas, as: :array)
78
+ if dbas.include?("/")
79
+ dbas = $' if dbas =~ %r|^mysql://| # drop mysql:// prefix, if present
80
+ auth, dbas = dbas.split("/", 2)
81
+ if auth =~ /^(?:(\w+)(?::([^@]+))?@)?(?:([^:]+)?(?::(\d+))?)$/
82
+ user, pass, host, port = $1, $2, $3, $4 # user:pass@host:port
83
+ conf = {
84
+ database: dbas,
85
+ username: $1,
86
+ password: $2,
87
+ host: $3,
88
+ port: $4,
89
+ }.compact
90
+ else
91
+ abort "invalid database value #{dbas.inspect}"
92
+ end
93
+ else
94
+ conf = { database: dbas }
95
+ end
96
+
97
+ conn = Mysql2::Client.new(**conf, as: :array)
79
98
  resu = conn.query("select * from `#{tabl}` limit 0")
80
99
  cols = resu.fields
81
- want = want.empty? ? cols : want & cols
100
+ want = want.empty? ? cols : want.select {|e| cols.include?(e) }
82
101
 
83
102
  if opts[:columns]
84
103
  puts cols
data/bin/slyced CHANGED
@@ -11,7 +11,7 @@ dbas = nil
11
11
  tabl = nil
12
12
 
13
13
  OptionParser.new.instance_eval do
14
- @version = "1.2.4"
14
+ @version = "1.2.7"
15
15
  @banner = "usage: #{program_name} [options] <database> <table>"
16
16
 
17
17
  on "--csv" , "Output comma separated values"
@@ -83,7 +83,7 @@ resu = conn.query(<<~end)
83
83
  order by ordinal_position
84
84
  end
85
85
  cols = resu.to_a.flatten
86
- want = want.empty? ? cols : want & cols
86
+ want = want.empty? ? cols : want.select {|e| cols.include?(e) }
87
87
 
88
88
  if opts[:columns]
89
89
  puts cols
data/slyce.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.files = `git ls-files`.split("\n") - %w[.gitignore]
13
13
  s.executables = `cd bin && git ls-files .`.split("\n")
14
14
  s.add_runtime_dependency "any_ascii", "~> 0.3.2"
15
- s.add_runtime_dependency "censive", "~> 1.0.2"
15
+ s.add_runtime_dependency "censive", "~> 1.0.3"
16
16
  s.add_runtime_dependency "duckdb", "~> 0.8.0"
17
17
  s.add_runtime_dependency "extralite-bundle", "~> 1.25"
18
18
  s.add_runtime_dependency "mysql2", "~> 0.5"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slyce
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Shreeve
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.0.2
33
+ version: 1.0.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.0.2
40
+ version: 1.0.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: duckdb
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
117
  requirements: []
118
- rubygems_version: 3.2.33
118
+ rubygems_version: 3.4.14
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: Ruby utility to show data statistics for MySQL databases