peekdb 0.2.1 → 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.
- data/bin/peekdb +1 -7
- data/lib/peekdb.rb +16 -30
- data/lib/peekdb/database.rb +4 -4
- data/peekdb.gemspec +1 -1
- metadata +2 -2
data/bin/peekdb
CHANGED
data/lib/peekdb.rb
CHANGED
@@ -12,11 +12,12 @@ require_relative 'peekdb/database_sqlite'
|
|
12
12
|
class PeekDB
|
13
13
|
|
14
14
|
def initialize(argv)
|
15
|
-
puts "PeekDB:"
|
16
15
|
begin
|
16
|
+
puts "PeekDB:"
|
17
17
|
parse_options(argv)
|
18
18
|
rescue Exception => e
|
19
19
|
puts "... Error FATAL: #{e}"
|
20
|
+
puts usage
|
20
21
|
exit(1)
|
21
22
|
end
|
22
23
|
end
|
@@ -56,41 +57,26 @@ class PeekDB
|
|
56
57
|
db = DatabaseSQLite.new @options.name
|
57
58
|
else
|
58
59
|
puts "... Error FATAL: Unknown database type #{@options.type}"
|
60
|
+
puts usage
|
59
61
|
exit(1)
|
60
62
|
end
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
64
|
+
begin
|
65
|
+
graph = Graph.new
|
66
|
+
graph.build(db.name, db.tables, db.relations)
|
67
|
+
graph.output(db.name, @options.format)
|
68
|
+
rescue
|
69
|
+
puts '... Error FATAL: missing arguments'
|
70
|
+
puts usage
|
71
|
+
exit(1)
|
72
|
+
else
|
73
|
+
exit(0)
|
74
|
+
end
|
68
75
|
end
|
69
76
|
end
|
70
77
|
|
71
|
-
def
|
72
|
-
|
73
|
-
Usage: rails COMMAND [ARGS]
|
74
|
-
|
75
|
-
The most common rails commands are:
|
76
|
-
generate Generate new code (short-cut alias: "g")
|
77
|
-
console Start the Rails console (short-cut alias: "c")
|
78
|
-
server Start the Rails server (short-cut alias: "s")
|
79
|
-
dbconsole Start a console for the database specified in config/database.yml
|
80
|
-
(short-cut alias: "db")
|
81
|
-
new Create a new Rails application. "rails new my_app" creates a
|
82
|
-
new application called MyApp in "./my_app"
|
83
|
-
|
84
|
-
In addition to those, there are:
|
85
|
-
application Generate the Rails application code
|
86
|
-
destroy Undo code generated with "generate" (short-cut alias: "d")
|
87
|
-
benchmarker See how fast a piece of code runs
|
88
|
-
profiler Get profile information from a piece of code
|
89
|
-
plugin new Generates skeleton for developing a Rails plugin
|
90
|
-
runner Run a piece of code in the application environment (short-cut alias: "r")
|
91
|
-
|
92
|
-
All commands can be run with -h (or --help) for more information.
|
93
|
-
EOT
|
78
|
+
def usage
|
79
|
+
"Usage: peekdb -n DATABASE-NAME -t DATABASE-TYPE [psql | mysql | sqlite] -f FORMAT [pdf | dot]"
|
94
80
|
end
|
95
81
|
|
96
82
|
end
|
data/lib/peekdb/database.rb
CHANGED
@@ -15,7 +15,7 @@ class Database
|
|
15
15
|
find_relations
|
16
16
|
puts "... Found #{@relations.size} relations"
|
17
17
|
rescue Exception => e
|
18
|
-
puts "... Error #{e}"
|
18
|
+
puts "... Error FATAL: #{e}"
|
19
19
|
exit(1)
|
20
20
|
end
|
21
21
|
end
|
@@ -23,14 +23,14 @@ class Database
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def open_connection(database_name)
|
26
|
-
raise NotImplementedError
|
26
|
+
raise NotImplementedError.new("Feature Not Yet Implemented")
|
27
27
|
end
|
28
28
|
|
29
29
|
def find_tables
|
30
|
-
raise NotImplementedError
|
30
|
+
raise NotImplementedError.new("Feature Not Yet Implemented")
|
31
31
|
end
|
32
32
|
|
33
33
|
def find_relations
|
34
|
-
raise NotImplementedError
|
34
|
+
raise NotImplementedError.new("Feature Not Yet Implemented")
|
35
35
|
end
|
36
36
|
end
|
data/peekdb.gemspec
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: peekdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.3.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Adrian Smith
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-04-
|
13
|
+
date: 2012-04-30 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: ruby-graphviz
|