huqua 2.0.1 → 3.2
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 +4 -4
- data/lib/display_detail.rb +1 -1
- data/lib/display_overview.rb +3 -0
- data/lib/display_structure.rb +1 -1
- data/lib/huqua.rb +16 -23
- metadata +6 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 84a65b9780a39a35f877ecc3fd8c86f270647571f8635d1ed0d8fb1c820096de
|
|
4
|
+
data.tar.gz: aecf6b7b992b1c23cdf5961cc36bbb74ccac1f1a142ee922ac08ee5e3a65c689
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d87f9750243b3bef96c5dcd6fe99e28a0f20c50dd1733e4ee6a00682cf1541ec997bc6d5d78f0a4064832a084c783971ae202aded2c959c9682d5857d18308e4
|
|
7
|
+
data.tar.gz: 6d23cac58d63c4087de2f782aa4b838314d8a4efb1df47cc85aa27eb29c266d8dbd18c49e63306766bd0de240061f250345abab5c50310fa5a2daa7dd0db6487
|
data/lib/display_detail.rb
CHANGED
data/lib/display_overview.rb
CHANGED
data/lib/display_structure.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module DisplayStructure
|
|
2
2
|
def self.show(tables, tmp_arg)
|
|
3
3
|
if(['-v', '--v', '-version', '--version', 'version'].include?(tmp_arg[0]))
|
|
4
|
-
puts "Your current version is: 2
|
|
4
|
+
puts "Your current version is: 3.2"
|
|
5
5
|
else
|
|
6
6
|
if(['-h', '--h', '-help', '--help', 'help'].include?(tmp_arg[0]))
|
|
7
7
|
DisplayStructure.show_help
|
data/lib/huqua.rb
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
3
|
-
require_relative
|
|
4
|
-
require_relative
|
|
5
|
-
require_relative
|
|
6
|
-
require_relative
|
|
7
|
-
require_relative
|
|
1
|
+
require "pg"
|
|
2
|
+
require "yaml"
|
|
3
|
+
require_relative "string"
|
|
4
|
+
require_relative "read_schema"
|
|
5
|
+
require_relative "display_overview"
|
|
6
|
+
require_relative "display_structure"
|
|
7
|
+
require_relative "display_detail"
|
|
8
8
|
|
|
9
9
|
# Read database.yml
|
|
10
10
|
begin
|
|
11
|
-
config_info = YAML.load_file(
|
|
11
|
+
config_info = YAML.load_file("config/database.yml")
|
|
12
12
|
|
|
13
|
-
$username = config_info["development"]["username"]
|
|
14
|
-
$password = config_info["development"]["password"]
|
|
13
|
+
$username = config_info["development"]["username"]
|
|
14
|
+
$password = config_info["development"]["password"]
|
|
15
15
|
$database = config_info["development"]["database"]
|
|
16
16
|
rescue StandardError => e
|
|
17
17
|
puts "Missing database.yml or config in this file is wrong".red
|
|
@@ -19,15 +19,12 @@ end
|
|
|
19
19
|
|
|
20
20
|
# Connect to database
|
|
21
21
|
begin
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
:dbname
|
|
25
|
-
:user => $username,
|
|
26
|
-
:password => $password
|
|
27
|
-
)
|
|
22
|
+
configs = Rails.configuration.database_configuration[Rails.env].with_indifferent_access
|
|
23
|
+
$conn =
|
|
24
|
+
PG::Connection.connect(hostaddr: (configs[:port] || "127.0.0.1"), port: (configs[:port] || 5432), dbname: configs[:database], user: configs[:username], password: configs[:password] || "")
|
|
28
25
|
puts "Congrats, you have good connection to database!\n".green
|
|
29
26
|
rescue StandardError => e
|
|
30
|
-
puts "Can not connect to database
|
|
27
|
+
puts "Can not connect to database...: #{e.message}\n".red
|
|
31
28
|
end
|
|
32
29
|
|
|
33
30
|
# Main Class
|
|
@@ -42,12 +39,8 @@ class Huqua
|
|
|
42
39
|
ARGV.size.times { |item| tmp_arg.push(ARGV[item]) }
|
|
43
40
|
|
|
44
41
|
if ARGV.size <= 2
|
|
45
|
-
if(ARGV.size == 1)
|
|
46
|
-
|
|
47
|
-
end
|
|
48
|
-
if(ARGV.size == 2)
|
|
49
|
-
DisplayDetail.show(tables, tmp_arg)
|
|
50
|
-
end
|
|
42
|
+
DisplayStructure.show(tables, tmp_arg) if (ARGV.size == 1)
|
|
43
|
+
DisplayDetail.show(tables, tmp_arg) if (ARGV.size == 2)
|
|
51
44
|
else
|
|
52
45
|
puts "The number of arguments went wrong".red
|
|
53
46
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: huqua
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2
|
|
4
|
+
version: '3.2'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Duy Chinh
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-08-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A simple tool for checking postgresql database in development without
|
|
14
14
|
access to rails console
|
|
@@ -29,7 +29,7 @@ homepage: https://github.com/hdchinh/huqua
|
|
|
29
29
|
licenses:
|
|
30
30
|
- MIT
|
|
31
31
|
metadata: {}
|
|
32
|
-
post_install_message:
|
|
32
|
+
post_install_message:
|
|
33
33
|
rdoc_options: []
|
|
34
34
|
require_paths:
|
|
35
35
|
- lib
|
|
@@ -44,9 +44,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
45
|
version: '0'
|
|
46
46
|
requirements: []
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
signing_key:
|
|
47
|
+
rubygems_version: 3.2.33
|
|
48
|
+
signing_key:
|
|
50
49
|
specification_version: 4
|
|
51
50
|
summary: A simple tool for checking postgresql database in development without access
|
|
52
51
|
to rails console
|