ronin-db 0.1.0.beta1-java → 0.1.0.beta3-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -0
- data/.yardopts +1 -1
- data/Gemfile +1 -6
- data/README.md +4 -2
- data/gemspec.yml +9 -2
- data/lib/ronin/db/cli/command.rb +1 -1
- data/lib/ronin/db/cli/commands/add.rb +1 -1
- data/lib/ronin/db/cli/commands/asn.rb +3 -3
- data/lib/ronin/db/cli/commands/creds.rb +1 -1
- data/lib/ronin/db/cli/commands/edit.rb +1 -1
- data/lib/ronin/db/cli/commands/emails.rb +1 -1
- data/lib/ronin/db/cli/commands/hosts.rb +1 -1
- data/lib/ronin/db/cli/commands/ips.rb +4 -2
- data/lib/ronin/db/cli/commands/irb.rb +1 -1
- data/lib/ronin/db/cli/commands/list.rb +1 -1
- data/lib/ronin/db/cli/commands/migrate.rb +1 -1
- data/lib/ronin/db/cli/commands/remove.rb +1 -1
- data/lib/ronin/db/cli/commands/urls.rb +1 -1
- data/lib/ronin/db/cli/database_command.rb +1 -1
- data/lib/ronin/db/cli/model_command.rb +1 -1
- data/lib/ronin/db/cli/modifiable.rb +2 -2
- data/lib/ronin/db/cli/resources_command.rb +1 -1
- data/lib/ronin/db/cli/ruby_shell.rb +1 -1
- data/lib/ronin/db/cli/uri_methods.rb +1 -1
- data/lib/ronin/db/cli.rb +6 -1
- data/lib/ronin/db/config_file.rb +1 -1
- data/lib/ronin/db/exceptions.rb +1 -1
- data/lib/ronin/db/home.rb +1 -1
- data/lib/ronin/db/root.rb +1 -1
- data/lib/ronin/db/version.rb +2 -2
- data/lib/ronin/db.rb +3 -3
- data/man/ronin-db-asn.1 +1 -1
- data/man/ronin-db-asn.1.md +1 -1
- data/ronin-db.gemspec +2 -1
- metadata +11 -21
- data/spec/cli/commands/add_spec.rb +0 -220
- data/spec/cli/commands/edit_spec.rb +0 -12
- data/spec/cli/commands/irb_spec.rb +0 -26
- data/spec/cli/database_command_spec.rb +0 -53
- data/spec/cli/model_command_spec.rb +0 -237
- data/spec/cli/ruby_shell_spec.rb +0 -14
- data/spec/cli/uri_methods_spec.rb +0 -190
- data/spec/spec_helper.rb +0 -15
@@ -1,190 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'ronin/db/cli/uri_methods'
|
3
|
-
|
4
|
-
describe Ronin::DB::CLI::URIMethods do
|
5
|
-
subject do
|
6
|
-
obj = Object.new
|
7
|
-
obj.extend described_class
|
8
|
-
obj
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "#normalize_adapter" do
|
12
|
-
context "when given 'sqlite'" do
|
13
|
-
it "must return 'sqlite3'" do
|
14
|
-
expect(subject.normalize_adapter('sqlite')).to eq('sqlite3')
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
context "when given 'sqlite3'" do
|
19
|
-
it "must return 'sqlite3'" do
|
20
|
-
expect(subject.normalize_adapter('sqlite3')).to eq('sqlite3')
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
context "when given 'mysql'" do
|
25
|
-
it "must return 'mysql2'" do
|
26
|
-
expect(subject.normalize_adapter('mysql')).to eq('mysql2')
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context "when given 'mysql2'" do
|
31
|
-
it "must return 'mysql2'" do
|
32
|
-
expect(subject.normalize_adapter('mysql2')).to eq('mysql2')
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
context "when given 'postgresql'" do
|
37
|
-
it "must return 'postgresql'" do
|
38
|
-
expect(subject.normalize_adapter('postgresql')).to eq('postgresql')
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
context "when given 'postgres'" do
|
43
|
-
it "must return 'postgresql'" do
|
44
|
-
expect(subject.normalize_adapter('postgres')).to eq('postgresql')
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
context "when given 'psql'" do
|
49
|
-
it "must return 'postgresql'" do
|
50
|
-
expect(subject.normalize_adapter('psql')).to eq('postgresql')
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
context "when given 'pg'" do
|
55
|
-
it "must return 'postgresql'" do
|
56
|
-
expect(subject.normalize_adapter('pg')).to eq('postgresql')
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
describe "#normalize_sqlite3_path" do
|
62
|
-
context "when given a relative path" do
|
63
|
-
let(:path) { 'file.sqlite3' }
|
64
|
-
|
65
|
-
it "must return an absolute path" do
|
66
|
-
expect(subject.normalize_sqlite3_path(path)).to eq(
|
67
|
-
File.expand_path(path)
|
68
|
-
)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
context "when given an absolute path" do
|
73
|
-
let(:path) { '/path/to/file.sqlite3' }
|
74
|
-
|
75
|
-
it "must return the absolute path" do
|
76
|
-
expect(subject.normalize_sqlite3_path(path)).to eq(path)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
context "when given ':memory:'" do
|
81
|
-
let(:path) { ':memory:' }
|
82
|
-
|
83
|
-
it "must return ':memory:'" do
|
84
|
-
expect(subject.normalize_sqlite3_path(path)).to eq(path)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
describe "#parse_uri" do
|
90
|
-
[:sqlite3, :sqlite].each do |adapter|
|
91
|
-
let(:adapter) { adapter }
|
92
|
-
|
93
|
-
context "when given '#{adapter}:path'" do
|
94
|
-
let(:path) { "db.sqlite3" }
|
95
|
-
let(:uri) { "#{adapter}:#{path}" }
|
96
|
-
|
97
|
-
it "must return {adapter: 'sqlite3', database: absolute_path}" do
|
98
|
-
expect(subject.parse_uri(uri)).to eq(
|
99
|
-
{
|
100
|
-
adapter: 'sqlite3',
|
101
|
-
database: File.expand_path(path)
|
102
|
-
}
|
103
|
-
)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
context "when given '#{adapter}:/path'" do
|
108
|
-
let(:path) { "/db.sqlite3" }
|
109
|
-
let(:uri) { "#{adapter}:#{path}" }
|
110
|
-
|
111
|
-
it "must return {adapter: 'sqlite3', database: '/path'}" do
|
112
|
-
expect(subject.parse_uri(uri)).to eq(
|
113
|
-
{
|
114
|
-
adapter: 'sqlite3',
|
115
|
-
database: path
|
116
|
-
}
|
117
|
-
)
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
context "when given '#{adapter}::memory:'" do
|
122
|
-
let(:path) { ":memory:" }
|
123
|
-
let(:uri) { "#{adapter}:#{path}" }
|
124
|
-
|
125
|
-
it "must return {adapter: 'sqlite3', database: ':memory:'}" do
|
126
|
-
expect(subject.parse_uri(uri)).to eq(
|
127
|
-
{
|
128
|
-
adapter: 'sqlite3',
|
129
|
-
database: path
|
130
|
-
}
|
131
|
-
)
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
[:mysql2, :mysql].each do |adapter|
|
137
|
-
context "when given '#{adapter}://user:password@host:port/database'" do
|
138
|
-
let(:adapter) { adapter }
|
139
|
-
let(:user) { 'foo' }
|
140
|
-
let(:password) { 'secret' }
|
141
|
-
let(:host) { 'example.com' }
|
142
|
-
let(:port) { 1234 }
|
143
|
-
let(:database) { 'test' }
|
144
|
-
let(:uri) do
|
145
|
-
"#{adapter}://#{user}:#{password}@#{host}:#{port}/#{database}"
|
146
|
-
end
|
147
|
-
|
148
|
-
it "must return {adapter: 'mysql2', username: '...', password: '...', host: '...', port: ..., database: 'database'}" do
|
149
|
-
expect(subject.parse_uri(uri)).to eq(
|
150
|
-
{
|
151
|
-
adapter: 'mysql2',
|
152
|
-
username: user,
|
153
|
-
password: password,
|
154
|
-
host: host,
|
155
|
-
port: port,
|
156
|
-
database: database
|
157
|
-
}
|
158
|
-
)
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
[:postgresql, :postgres, :psql, :pg].each do |adapter|
|
164
|
-
context "when given '#{adapter}://user:password@host:port/database'" do
|
165
|
-
let(:adapter) { adapter }
|
166
|
-
let(:user) { 'foo' }
|
167
|
-
let(:password) { 'secret' }
|
168
|
-
let(:host) { 'example.com' }
|
169
|
-
let(:port) { 1234 }
|
170
|
-
let(:database) { 'test' }
|
171
|
-
let(:uri) do
|
172
|
-
"#{adapter}://#{user}:#{password}@#{host}:#{port}/#{database}"
|
173
|
-
end
|
174
|
-
|
175
|
-
it "must return {adapter: 'postgresql', username: '...', password: '...', host: '...', port: ..., database: 'database'}" do
|
176
|
-
expect(subject.parse_uri(uri)).to eq(
|
177
|
-
{
|
178
|
-
adapter: 'postgresql',
|
179
|
-
username: user,
|
180
|
-
password: password,
|
181
|
-
host: host,
|
182
|
-
port: port,
|
183
|
-
database: database
|
184
|
-
}
|
185
|
-
)
|
186
|
-
end
|
187
|
-
end
|
188
|
-
end
|
189
|
-
end
|
190
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'simplecov'
|
3
|
-
SimpleCov.start
|
4
|
-
|
5
|
-
require 'active_record'
|
6
|
-
ActiveRecord::Base.establish_connection(
|
7
|
-
adapter: 'sqlite3', database: ':memory:'
|
8
|
-
)
|
9
|
-
|
10
|
-
RSpec.configure do |specs|
|
11
|
-
specs.before(:suite) do
|
12
|
-
require 'ronin/db/migrations'
|
13
|
-
Ronin::DB::Migrations.migrate
|
14
|
-
end
|
15
|
-
end
|