ronin 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +11 -0
- data/.github/workflows/ruby.yml +32 -0
- data/.gitignore +7 -7
- data/.ruby-version +1 -0
- data/COPYING.txt +3 -3
- data/ChangeLog.md +25 -11
- data/Gemfile +21 -20
- data/README.md +102 -81
- data/Rakefile +4 -5
- data/bin/ronin +7 -12
- data/bin/ronin-campaigns +7 -12
- data/bin/ronin-console +7 -12
- data/bin/ronin-creds +7 -12
- data/bin/ronin-database +7 -12
- data/bin/ronin-emails +7 -12
- data/bin/ronin-exec +7 -12
- data/bin/ronin-fuzzer +7 -12
- data/bin/ronin-help +7 -12
- data/bin/ronin-hosts +7 -12
- data/bin/ronin-install +7 -12
- data/bin/ronin-ips +7 -12
- data/bin/ronin-net-proxy +7 -12
- data/bin/ronin-repos +7 -12
- data/bin/ronin-uninstall +7 -12
- data/bin/ronin-update +7 -12
- data/bin/ronin-urls +7 -12
- data/bin/ronin-wordlist +7 -12
- data/gemspec.yml +8 -8
- data/lib/bond/completions/ronin.rb +23 -23
- data/lib/ronin.rb +3 -3
- data/lib/ronin/address.rb +6 -7
- data/lib/ronin/arch.rb +3 -3
- data/lib/ronin/author.rb +5 -7
- data/lib/ronin/auto_load.rb +5 -5
- data/lib/ronin/bootstrap.rb +3 -3
- data/lib/ronin/campaign.rb +3 -3
- data/lib/ronin/config.rb +5 -7
- data/lib/ronin/credential.rb +3 -3
- data/lib/ronin/database.rb +3 -3
- data/lib/ronin/database/database.rb +8 -12
- data/lib/ronin/database/exceptions.rb +3 -3
- data/lib/ronin/database/exceptions/invalid_config.rb +3 -3
- data/lib/ronin/database/exceptions/unknown_repository.rb +3 -3
- data/lib/ronin/database/migrations.rb +3 -3
- data/lib/ronin/database/migrations/1.0.0.rb +3 -3
- data/lib/ronin/database/migrations/1.1.0.rb +3 -3
- data/lib/ronin/database/migrations/exceptions.rb +3 -3
- data/lib/ronin/database/migrations/exceptions/duplicate_migration.rb +3 -3
- data/lib/ronin/database/migrations/exceptions/unknown_migration.rb +3 -3
- data/lib/ronin/database/migrations/graph.rb +3 -3
- data/lib/ronin/database/migrations/migration.rb +3 -3
- data/lib/ronin/database/migrations/migrations.rb +3 -3
- data/lib/ronin/email_address.rb +5 -7
- data/lib/ronin/environment.rb +3 -3
- data/lib/ronin/exceptions.rb +3 -3
- data/lib/ronin/exceptions/duplicate_repository.rb +3 -3
- data/lib/ronin/exceptions/repository_not_found.rb +3 -3
- data/lib/ronin/host_name.rb +3 -3
- data/lib/ronin/host_name_ip_address.rb +3 -3
- data/lib/ronin/installation.rb +5 -7
- data/lib/ronin/ip_address.rb +6 -8
- data/lib/ronin/ip_address_mac_address.rb +3 -3
- data/lib/ronin/license.rb +6 -6
- data/lib/ronin/mac_address.rb +3 -3
- data/lib/ronin/model.rb +3 -3
- data/lib/ronin/model/has_authors.rb +3 -3
- data/lib/ronin/model/has_description.rb +3 -3
- data/lib/ronin/model/has_license.rb +3 -3
- data/lib/ronin/model/has_name.rb +3 -3
- data/lib/ronin/model/has_title.rb +3 -3
- data/lib/ronin/model/has_unique_name.rb +5 -7
- data/lib/ronin/model/has_version.rb +3 -3
- data/lib/ronin/model/importable.rb +3 -3
- data/lib/ronin/model/model.rb +7 -8
- data/lib/ronin/model/types.rb +3 -3
- data/lib/ronin/model/types/description.rb +9 -12
- data/lib/ronin/open_port.rb +5 -7
- data/lib/ronin/organization.rb +3 -3
- data/lib/ronin/os.rb +5 -7
- data/lib/ronin/os_guess.rb +3 -3
- data/lib/ronin/password.rb +3 -3
- data/lib/ronin/port.rb +3 -3
- data/lib/ronin/repositories.rb +3 -3
- data/lib/ronin/repository.rb +3 -3
- data/lib/ronin/ronin.rb +3 -3
- data/lib/ronin/script.rb +3 -3
- data/lib/ronin/script/buildable.rb +3 -3
- data/lib/ronin/script/deployable.rb +3 -3
- data/lib/ronin/script/exceptions.rb +3 -3
- data/lib/ronin/script/exceptions/build_failed.rb +3 -3
- data/lib/ronin/script/exceptions/deploy_failed.rb +3 -3
- data/lib/ronin/script/exceptions/exception.rb +3 -3
- data/lib/ronin/script/exceptions/not_built.rb +3 -3
- data/lib/ronin/script/exceptions/test_failed.rb +3 -3
- data/lib/ronin/script/path.rb +3 -3
- data/lib/ronin/script/script.rb +3 -3
- data/lib/ronin/script/testable.rb +3 -3
- data/lib/ronin/service.rb +3 -3
- data/lib/ronin/service_credential.rb +3 -3
- data/lib/ronin/software.rb +3 -3
- data/lib/ronin/spec/database.rb +27 -21
- data/lib/ronin/target.rb +3 -3
- data/lib/ronin/tcp_port.rb +3 -3
- data/lib/ronin/udp_port.rb +3 -3
- data/lib/ronin/ui.rb +3 -3
- data/lib/ronin/ui/cli.rb +3 -3
- data/lib/ronin/ui/cli/class_command.rb +14 -7
- data/lib/ronin/ui/cli/cli.rb +5 -5
- data/lib/ronin/ui/cli/command.rb +5 -7
- data/lib/ronin/ui/cli/commands.rb +3 -3
- data/lib/ronin/ui/cli/commands/campaigns.rb +5 -7
- data/lib/ronin/ui/cli/commands/console.rb +3 -3
- data/lib/ronin/ui/cli/commands/creds.rb +3 -3
- data/lib/ronin/ui/cli/commands/database.rb +3 -3
- data/lib/ronin/ui/cli/commands/emails.rb +3 -3
- data/lib/ronin/ui/cli/commands/exec.rb +3 -3
- data/lib/ronin/ui/cli/commands/fuzzer.rb +16 -16
- data/lib/ronin/ui/cli/commands/help.rb +3 -3
- data/lib/ronin/ui/cli/commands/hosts.rb +5 -7
- data/lib/ronin/ui/cli/commands/install.rb +7 -11
- data/lib/ronin/ui/cli/commands/ips.rb +5 -7
- data/lib/ronin/ui/cli/commands/net/proxy.rb +19 -12
- data/lib/ronin/ui/cli/commands/repos.rb +3 -3
- data/lib/ronin/ui/cli/commands/uninstall.rb +3 -3
- data/lib/ronin/ui/cli/commands/update.rb +3 -3
- data/lib/ronin/ui/cli/commands/urls.rb +3 -3
- data/lib/ronin/ui/cli/commands/wordlist.rb +3 -3
- data/lib/ronin/ui/cli/exceptions.rb +3 -3
- data/lib/ronin/ui/cli/exceptions/unknown_command.rb +3 -3
- data/lib/ronin/ui/cli/model_command.rb +6 -9
- data/lib/ronin/ui/cli/printing.rb +3 -3
- data/lib/ronin/ui/cli/resources_command.rb +7 -11
- data/lib/ronin/ui/cli/script_command.rb +5 -10
- data/lib/ronin/ui/console.rb +3 -3
- data/lib/ronin/ui/console/commands.rb +3 -3
- data/lib/ronin/ui/console/console.rb +3 -3
- data/lib/ronin/ui/console/context.rb +3 -3
- data/lib/ronin/ui/console/shell.rb +3 -3
- data/lib/ronin/url.rb +5 -7
- data/lib/ronin/url_query_param.rb +3 -3
- data/lib/ronin/url_query_param_name.rb +6 -6
- data/lib/ronin/url_scheme.rb +4 -4
- data/lib/ronin/user_name.rb +3 -3
- data/lib/ronin/vendor.rb +3 -3
- data/lib/ronin/version.rb +5 -5
- data/lib/ronin/web_credential.rb +5 -7
- data/man/ronin-campaigns.1.md +20 -20
- data/man/ronin-console.1.md +17 -17
- data/man/ronin-creds.1.md +16 -16
- data/man/ronin-database.1.md +23 -23
- data/man/ronin-emails.1.md +18 -18
- data/man/ronin-exec.1.md +11 -11
- data/man/ronin-fuzzer.1.md +23 -23
- data/man/ronin-help.1.md +5 -5
- data/man/ronin-hosts.1.md +20 -20
- data/man/ronin-install.1.md +18 -18
- data/man/ronin-ips.1.md +21 -21
- data/man/ronin-net-proxy.1.md +24 -24
- data/man/ronin-repos.1.md +18 -18
- data/man/ronin-uninstall.1.md +14 -14
- data/man/ronin-update.1.md +14 -14
- data/man/ronin-urls.1.md +22 -22
- data/man/ronin-wordlist.1.md +14 -13
- data/man/ronin.1.md +1 -1
- data/spec/arch_spec.rb +59 -46
- data/spec/author_spec.rb +14 -14
- data/spec/campaign_spec.rb +8 -0
- data/spec/credential_spec.rb +11 -8
- data/spec/database_spec.rb +6 -6
- data/spec/email_address_spec.rb +23 -20
- data/spec/host_name_spec.rb +24 -22
- data/spec/installation_spec.rb +6 -6
- data/spec/ip_address_spec.rb +31 -26
- data/spec/license_spec.rb +15 -9
- data/spec/mac_address_spec.rb +17 -8
- data/spec/model/has_authors_spec.rb +56 -37
- data/spec/model/has_description_spec.rb +36 -23
- data/spec/model/has_license_spec.rb +38 -28
- data/spec/model/has_name_spec.rb +36 -19
- data/spec/model/has_title_spec.rb +27 -14
- data/spec/model/has_version_spec.rb +64 -35
- data/spec/model/model_spec.rb +57 -33
- data/spec/model/models/{basic_model.rb → base_model.rb} +1 -1
- data/spec/model/models/{custom_model.rb → inherited_model.rb} +2 -3
- data/spec/os_spec.rb +24 -20
- data/spec/password_spec.rb +17 -9
- data/spec/port_spec.rb +30 -22
- data/spec/repository_spec.rb +59 -60
- data/spec/ronin_spec.rb +4 -4
- data/spec/script/buildable_spec.rb +8 -8
- data/spec/script/deployable_spec.rb +7 -7
- data/spec/script/path_spec.rb +42 -40
- data/spec/script/script_spec.rb +23 -23
- data/spec/script/testable_spec.rb +20 -20
- data/spec/service_spec.rb +14 -8
- data/spec/software_spec.rb +30 -17
- data/spec/spec_helper.rb +4 -4
- data/spec/ui/cli/classes/test_command.rb +2 -4
- data/spec/ui/cli/cli_spec.rb +5 -5
- data/spec/ui/cli/command_spec.rb +34 -30
- data/spec/url_query_param_spec.rb +23 -14
- data/spec/url_scheme_spec.rb +12 -9
- data/spec/url_spec.rb +64 -61
- data/spec/vendor_spec.rb +15 -8
- metadata +122 -150
- data/.gemtest +0 -0
data/spec/port_spec.rb
CHANGED
@@ -1,43 +1,51 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
|
2
3
|
require 'ronin/port'
|
3
4
|
|
4
5
|
describe Port do
|
5
6
|
let(:protocol) { 'tcp' }
|
6
|
-
let(:number)
|
7
|
+
let(:number) { 80 }
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
subject do
|
10
|
+
described_class.new(:protocol => protocol, :number => number)
|
10
11
|
end
|
11
12
|
|
12
|
-
|
13
|
-
port = Port.new(:number => 1111)
|
13
|
+
before { subject.save }
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
describe "validations" do
|
16
|
+
it "should require a protocol" do
|
17
|
+
port = described_class.new(:number => port)
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
expect(port).not_to be_valid
|
20
|
+
end
|
20
21
|
|
21
|
-
port
|
22
|
-
|
22
|
+
it "should require a port number" do
|
23
|
+
port = described_class.new(:protocol => protocol)
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
expect(port).not_to be_valid
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
-
|
28
|
+
it "should only allow 'tcp' and 'udp' as protocols" do
|
29
|
+
port = described_class.new(:protocol => 'foo', :number => port)
|
29
30
|
|
30
|
-
|
31
|
-
|
31
|
+
expect(port).not_to be_valid
|
32
|
+
end
|
32
33
|
|
33
|
-
port
|
34
|
+
it "should require unique protocol/port-number combinations" do
|
35
|
+
port = described_class.new(:protocol => protocol, :number => number)
|
36
|
+
expect(port).not_to be_valid
|
37
|
+
end
|
34
38
|
end
|
35
39
|
|
36
|
-
|
37
|
-
|
40
|
+
describe "#to_i" do
|
41
|
+
it "should be convertable to an Integer" do
|
42
|
+
expect(subject.to_i).to eq(number)
|
43
|
+
end
|
38
44
|
end
|
39
45
|
|
40
|
-
|
41
|
-
|
46
|
+
describe "#to_s" do
|
47
|
+
it "should include the number and protocol" do
|
48
|
+
expect(subject.to_s).to eq("#{number}/#{protocol}")
|
49
|
+
end
|
42
50
|
end
|
43
51
|
end
|
data/spec/repository_spec.rb
CHANGED
@@ -12,72 +12,72 @@ describe Repository do
|
|
12
12
|
it "should be able to retrieve an Repository by name" do
|
13
13
|
repo = subject.find('local')
|
14
14
|
|
15
|
-
repo.name.
|
15
|
+
expect(repo.name).to eq('local')
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should be able to retrieve an Repository by name and domain" do
|
19
19
|
repo = subject.find('installed@github.com')
|
20
20
|
|
21
|
-
repo.name.
|
22
|
-
repo.domain.
|
21
|
+
expect(repo.name).to eq('installed')
|
22
|
+
expect(repo.domain).to eq('github.com')
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should raise RepositoryNotFound for unknown Repository names" do
|
26
|
-
|
26
|
+
expect {
|
27
27
|
subject.find('bla')
|
28
|
-
}.
|
28
|
+
}.to raise_error(RepositoryNotFound)
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should raise RepositoryNotFound for unknown Repository names or domains" do
|
32
|
-
|
32
|
+
expect {
|
33
33
|
subject.find('bla/bla')
|
34
|
-
}.
|
34
|
+
}.to raise_error(RepositoryNotFound)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
describe "add" do
|
39
39
|
it "should not add Repositorys without a path property" do
|
40
|
-
|
40
|
+
expect {
|
41
41
|
subject.add
|
42
|
-
}.
|
42
|
+
}.to raise_error(ArgumentError)
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should not add Repositorys that do not point to a directory" do
|
46
|
-
|
46
|
+
expect {
|
47
47
|
subject.add(:path => 'path/to/nowhere')
|
48
|
-
}.
|
48
|
+
}.to raise_error(RepositoryNotFound)
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should not allow adding an Repository from the same path twice" do
|
52
|
-
|
52
|
+
expect {
|
53
53
|
subject.add(:path => repository('local').path)
|
54
|
-
}.
|
54
|
+
}.to raise_error(DuplicateRepository)
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should not allow adding an Repository that was already installed" do
|
58
|
-
|
58
|
+
expect {
|
59
59
|
subject.add(:path => repository('installed').path)
|
60
|
-
}.
|
60
|
+
}.to raise_error(DuplicateRepository)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
64
|
describe "install" do
|
65
65
|
it "should not allow installing an Repository with no URI" do
|
66
|
-
|
66
|
+
expect {
|
67
67
|
subject.install
|
68
|
-
}.
|
68
|
+
}.to raise_error(ArgumentError)
|
69
69
|
end
|
70
70
|
|
71
71
|
it "should not allow installing an Repository that was already added" do
|
72
|
-
|
72
|
+
expect {
|
73
73
|
subject.install(:uri => repository('remote').uri)
|
74
|
-
}.
|
74
|
+
}.to raise_error(DuplicateRepository)
|
75
75
|
end
|
76
76
|
|
77
77
|
it "should not allow installing an Repository from the same URI twice" do
|
78
|
-
|
78
|
+
expect {
|
79
79
|
subject.install(:uri => repository('installed').uri)
|
80
|
-
}.
|
80
|
+
}.to raise_error(DuplicateRepository)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
@@ -85,15 +85,15 @@ describe Repository do
|
|
85
85
|
it "should be considered local for 'localhost' domains" do
|
86
86
|
repo = repository('local')
|
87
87
|
|
88
|
-
repo.
|
89
|
-
repo.
|
88
|
+
expect(repo).to be_local
|
89
|
+
expect(repo).not_to be_remote
|
90
90
|
end
|
91
91
|
|
92
92
|
it "should be considered remote for non 'localhost' domains" do
|
93
93
|
repo = repository('installed')
|
94
94
|
|
95
|
-
repo.
|
96
|
-
repo.
|
95
|
+
expect(repo).to be_remote
|
96
|
+
expect(repo).not_to be_local
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
@@ -103,7 +103,7 @@ describe Repository do
|
|
103
103
|
:path => File.join(Helpers::Repositories::DIR,'local')
|
104
104
|
)
|
105
105
|
|
106
|
-
repo.name.
|
106
|
+
expect(repo.name).to eq('local')
|
107
107
|
end
|
108
108
|
|
109
109
|
it "should default the 'installed' property to false" do
|
@@ -112,7 +112,7 @@ describe Repository do
|
|
112
112
|
:uri => 'git://github.com/path/to/local.git'
|
113
113
|
)
|
114
114
|
|
115
|
-
repo.installed.
|
115
|
+
expect(repo.installed).to be(false)
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
@@ -120,18 +120,18 @@ describe Repository do
|
|
120
120
|
subject { repository('installed') }
|
121
121
|
|
122
122
|
it "should load the title" do
|
123
|
-
subject.title.
|
123
|
+
expect(subject.title).to eq('Installed Repo')
|
124
124
|
end
|
125
125
|
|
126
126
|
it "should load the website" do
|
127
127
|
website = Addressable::URI.parse('http://ronin.rubyforge.org/')
|
128
128
|
|
129
|
-
subject.website.
|
129
|
+
expect(subject.website).to eq(website)
|
130
130
|
end
|
131
131
|
|
132
132
|
it "should load the license" do
|
133
|
-
subject.license.
|
134
|
-
subject.license.name.
|
133
|
+
expect(subject.license).not_to be_nil
|
134
|
+
expect(subject.license.name).to eq('GPL-2')
|
135
135
|
end
|
136
136
|
|
137
137
|
it "should load the maintainers" do
|
@@ -140,41 +140,42 @@ describe Repository do
|
|
140
140
|
author.email == 'postmodern.mod3@gmail.com'
|
141
141
|
}
|
142
142
|
|
143
|
-
author.
|
143
|
+
expect(author).not_to be_nil
|
144
144
|
end
|
145
145
|
|
146
146
|
it "should load the description" do
|
147
|
-
subject.description.
|
147
|
+
expect(subject.description).to eq(%{This is a test repo used in Ronin's specs.})
|
148
148
|
end
|
149
149
|
end
|
150
150
|
|
151
151
|
describe "#activate!" do
|
152
152
|
subject { repository('local') }
|
153
153
|
|
154
|
-
before
|
155
|
-
subject.activate!
|
156
|
-
end
|
154
|
+
before { subject.activate! }
|
157
155
|
|
158
156
|
it "should load the init.rb file if present" do
|
159
|
-
$local_repo_loaded.
|
157
|
+
expect($local_repo_loaded).to be(true)
|
160
158
|
end
|
161
159
|
|
162
160
|
it "should make the lib directory accessible to Kernel#require" do
|
163
|
-
require('stuff/test').
|
161
|
+
expect(require('stuff/test')).to be(true)
|
164
162
|
end
|
163
|
+
|
164
|
+
after { subject.deactivate! }
|
165
165
|
end
|
166
166
|
|
167
167
|
describe "#deactivate!" do
|
168
168
|
subject { repository('local') }
|
169
169
|
|
170
|
-
before
|
170
|
+
before do
|
171
|
+
subject.activate!
|
171
172
|
subject.deactivate!
|
172
173
|
end
|
173
174
|
|
174
175
|
it "should make the lib directory unaccessible to Kernel#require" do
|
175
|
-
|
176
|
+
expect {
|
176
177
|
require 'stuff/another_test'
|
177
|
-
}.
|
178
|
+
}.to raise_error(LoadError)
|
178
179
|
end
|
179
180
|
end
|
180
181
|
|
@@ -182,13 +183,13 @@ describe Repository do
|
|
182
183
|
subject { repository('scripts') }
|
183
184
|
|
184
185
|
it "should list the contents of the 'cache/' directory" do
|
185
|
-
subject.each_script.to_a.
|
186
|
+
expect(subject.each_script.to_a).not_to be_empty
|
186
187
|
end
|
187
188
|
|
188
189
|
it "should only list '.rb' files" do
|
189
|
-
subject.each_script.map { |path|
|
190
|
+
expect(subject.each_script.map { |path|
|
190
191
|
path.extname
|
191
|
-
}.uniq.
|
192
|
+
}.uniq).to eq(['.rb'])
|
192
193
|
end
|
193
194
|
end
|
194
195
|
|
@@ -196,44 +197,44 @@ describe Repository do
|
|
196
197
|
subject { repository('scripts') }
|
197
198
|
|
198
199
|
describe "#cache_scripts!" do
|
199
|
-
before
|
200
|
+
before { subject.cache_scripts! }
|
200
201
|
|
201
202
|
it "should be populated script_paths" do
|
202
|
-
subject.script_paths.
|
203
|
+
expect(subject.script_paths).not_to be_empty
|
203
204
|
end
|
204
205
|
|
205
206
|
it "should recover from files that contain syntax errors" do
|
206
|
-
subject.find_script('failures/syntax_errors.rb').
|
207
|
+
expect(subject.find_script('failures/syntax_errors.rb')).not_to be_nil
|
207
208
|
end
|
208
209
|
|
209
210
|
it "should recover from files that raised exceptions" do
|
210
|
-
subject.find_script('failures/exceptions.rb').
|
211
|
+
expect(subject.find_script('failures/exceptions.rb')).not_to be_nil
|
211
212
|
end
|
212
213
|
|
213
214
|
it "should recover from files that raise NoMethodError" do
|
214
|
-
subject.find_script('failures/no_method_errors.rb').
|
215
|
+
expect(subject.find_script('failures/no_method_errors.rb')).not_to be_nil
|
215
216
|
end
|
216
217
|
|
217
218
|
it "should recover from files that have validation errors" do
|
218
|
-
subject.find_script('failures/validation_errors.rb').
|
219
|
+
expect(subject.find_script('failures/validation_errors.rb')).not_to be_nil
|
219
220
|
end
|
220
221
|
|
221
222
|
it "should clear script_paths before re-populate them" do
|
222
223
|
paths = subject.script_paths.length
|
223
224
|
subject.cache_scripts!
|
224
225
|
|
225
|
-
subject.script_paths.length.
|
226
|
+
expect(subject.script_paths.length).to eq(paths)
|
226
227
|
end
|
227
228
|
|
228
229
|
it "should be populated using the paths in the 'cache/' directory" do
|
229
|
-
subject.script_paths.map { |file|
|
230
|
+
expect(subject.script_paths.map { |file|
|
230
231
|
file.path
|
231
|
-
}.
|
232
|
+
}).to eq(subject.each_script.to_a)
|
232
233
|
end
|
233
234
|
end
|
234
235
|
|
235
236
|
describe "#sync_scripts!" do
|
236
|
-
before
|
237
|
+
before do
|
237
238
|
subject.cache_scripts!
|
238
239
|
|
239
240
|
script_path = subject.find_script('cached/modified.rb')
|
@@ -250,21 +251,19 @@ describe Repository do
|
|
250
251
|
it "should update stale cached files" do
|
251
252
|
script_path = subject.find_script('cached/modified.rb')
|
252
253
|
|
253
|
-
script_path.timestamp.
|
254
|
+
expect(script_path.timestamp).to eq(File.mtime(script_path.path))
|
254
255
|
end
|
255
256
|
|
256
257
|
it "should cache new files" do
|
257
|
-
subject.find_script('cached/cached.rb').
|
258
|
+
expect(subject.find_script('cached/cached.rb')).not_to be_nil
|
258
259
|
end
|
259
260
|
end
|
260
261
|
|
261
262
|
describe "#clean_scripts!" do
|
262
|
-
before
|
263
|
-
subject.clean_scripts!
|
264
|
-
end
|
263
|
+
before { subject.clean_scripts! }
|
265
264
|
|
266
265
|
it "should clear the script_paths" do
|
267
|
-
subject.script_paths.
|
266
|
+
expect(subject.script_paths).to be_empty
|
268
267
|
end
|
269
268
|
end
|
270
269
|
end
|
data/spec/ronin_spec.rb
CHANGED
@@ -6,12 +6,12 @@ describe Ronin do
|
|
6
6
|
it "should have a version" do
|
7
7
|
version = subject.const_get('VERSION')
|
8
8
|
|
9
|
-
version.
|
10
|
-
version.
|
9
|
+
expect(version).not_to be_nil
|
10
|
+
expect(version).not_to be_empty
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should include AutoLoad" do
|
14
|
-
subject.
|
14
|
+
expect(subject).to include(AutoLoad)
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should add a const_missing method when included" do
|
@@ -20,6 +20,6 @@ describe Ronin do
|
|
20
20
|
|
21
21
|
subject.const_set('SOME_CONSTANT',1)
|
22
22
|
|
23
|
-
base_class.const_get('SOME_CONSTANT').
|
23
|
+
expect(base_class.const_get('SOME_CONSTANT')).to eq(1)
|
24
24
|
end
|
25
25
|
end
|
@@ -13,39 +13,39 @@ describe Script::Buildable do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should not be built by default" do
|
16
|
-
subject.
|
16
|
+
expect(subject).not_to be_built
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should include Testable" do
|
20
|
-
subject.class.included_modules.
|
20
|
+
expect(subject.class.included_modules).to include(Script::Testable)
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "#build!" do
|
24
24
|
it "should call the build block" do
|
25
25
|
subject.build!
|
26
26
|
|
27
|
-
subject.output.
|
27
|
+
expect(subject.output).to eq("hello world")
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should mark the script as built" do
|
31
31
|
subject.build!
|
32
32
|
|
33
|
-
subject.
|
33
|
+
expect(subject).to be_built
|
34
34
|
end
|
35
35
|
|
36
36
|
it "should accept parameters as options" do
|
37
37
|
subject.build!(:var => 'dave')
|
38
38
|
|
39
|
-
subject.output.
|
40
|
-
subject.var.
|
39
|
+
expect(subject.output).to eq("hello dave")
|
40
|
+
expect(subject.var).to eq('dave')
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
describe "#verify!" do
|
45
45
|
it "should raise a NotBuilt exception when verifying unbuilt scripts" do
|
46
|
-
|
46
|
+
expect {
|
47
47
|
subject.test!
|
48
|
-
}.
|
48
|
+
}.to raise_error(Script::NotBuilt)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -16,32 +16,32 @@ describe Script::Deployable do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should include Testable" do
|
19
|
-
subject.class.included_modules.
|
19
|
+
expect(subject.class.included_modules).to include(Script::Testable)
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should not be deployed by default" do
|
23
|
-
subject.
|
23
|
+
expect(subject).not_to be_deployed
|
24
24
|
end
|
25
25
|
|
26
26
|
describe "#deploy!" do
|
27
27
|
it "should test! the script before deploying it" do
|
28
28
|
subject.var = -1
|
29
29
|
|
30
|
-
|
30
|
+
expect {
|
31
31
|
subject.deploy!
|
32
|
-
}.
|
32
|
+
}.to raise_error(RuntimeError)
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should mark the script deployed" do
|
36
36
|
subject.deploy!
|
37
37
|
|
38
|
-
subject.
|
38
|
+
expect(subject).to be_deployed
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should not mark the script as evacuated" do
|
42
42
|
subject.deploy!
|
43
43
|
|
44
|
-
subject.
|
44
|
+
expect(subject).not_to be_evacuated
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -49,7 +49,7 @@ describe Script::Deployable do
|
|
49
49
|
it "should mark the script as evacuated" do
|
50
50
|
subject.evacuate!
|
51
51
|
|
52
|
-
subject.
|
52
|
+
expect(subject).to be_evacuated
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|