ronin-core 0.1.0.beta1
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 +7 -0
- data/.document +5 -0
- data/.github/workflows/ruby.yml +41 -0
- data/.gitignore +12 -0
- data/.rspec +1 -0
- data/.rubocop.yml +160 -0
- data/.ruby-version +1 -0
- data/.yardopts +1 -0
- data/COPYING.txt +165 -0
- data/ChangeLog.md +11 -0
- data/Gemfile +30 -0
- data/README.md +299 -0
- data/Rakefile +34 -0
- data/examples/ruby_shell.rb +11 -0
- data/gemspec.yml +28 -0
- data/lib/ronin/core/class_registry.rb +246 -0
- data/lib/ronin/core/cli/command.rb +87 -0
- data/lib/ronin/core/cli/command_shell/command.rb +110 -0
- data/lib/ronin/core/cli/command_shell.rb +345 -0
- data/lib/ronin/core/cli/generator/options/author.rb +106 -0
- data/lib/ronin/core/cli/generator/options/description.rb +54 -0
- data/lib/ronin/core/cli/generator/options/reference.rb +60 -0
- data/lib/ronin/core/cli/generator/options/summary.rb +54 -0
- data/lib/ronin/core/cli/generator.rb +238 -0
- data/lib/ronin/core/cli/logging.rb +59 -0
- data/lib/ronin/core/cli/options/param.rb +68 -0
- data/lib/ronin/core/cli/options/values/arches.rb +45 -0
- data/lib/ronin/core/cli/options/values/oses.rb +32 -0
- data/lib/ronin/core/cli/printing/arch.rb +71 -0
- data/lib/ronin/core/cli/printing/metadata.rb +113 -0
- data/lib/ronin/core/cli/printing/os.rb +54 -0
- data/lib/ronin/core/cli/printing/params.rb +69 -0
- data/lib/ronin/core/cli/ruby_shell.rb +131 -0
- data/lib/ronin/core/cli/shell.rb +186 -0
- data/lib/ronin/core/git.rb +73 -0
- data/lib/ronin/core/home.rb +86 -0
- data/lib/ronin/core/metadata/authors/author.rb +241 -0
- data/lib/ronin/core/metadata/authors.rb +120 -0
- data/lib/ronin/core/metadata/description.rb +100 -0
- data/lib/ronin/core/metadata/id.rb +88 -0
- data/lib/ronin/core/metadata/references.rb +87 -0
- data/lib/ronin/core/metadata/summary.rb +78 -0
- data/lib/ronin/core/metadata/version.rb +74 -0
- data/lib/ronin/core/params/exceptions.rb +38 -0
- data/lib/ronin/core/params/mixin.rb +317 -0
- data/lib/ronin/core/params/param.rb +137 -0
- data/lib/ronin/core/params/types/boolean.rb +64 -0
- data/lib/ronin/core/params/types/enum.rb +107 -0
- data/lib/ronin/core/params/types/float.rb +68 -0
- data/lib/ronin/core/params/types/integer.rb +100 -0
- data/lib/ronin/core/params/types/numeric.rb +106 -0
- data/lib/ronin/core/params/types/regexp.rb +67 -0
- data/lib/ronin/core/params/types/string.rb +118 -0
- data/lib/ronin/core/params/types/type.rb +54 -0
- data/lib/ronin/core/params/types/uri.rb +72 -0
- data/lib/ronin/core/params/types.rb +62 -0
- data/lib/ronin/core/params.rb +19 -0
- data/lib/ronin/core/version.rb +24 -0
- data/ronin-core.gemspec +59 -0
- data/spec/class_registry_spec.rb +224 -0
- data/spec/cli/command_shell/command_spec.rb +113 -0
- data/spec/cli/command_shell_spec.rb +1114 -0
- data/spec/cli/command_spec.rb +16 -0
- data/spec/cli/fixtures/irb_command +8 -0
- data/spec/cli/fixtures/template/dir/file1.txt +1 -0
- data/spec/cli/fixtures/template/dir/file2.txt +1 -0
- data/spec/cli/fixtures/template/file.erb +1 -0
- data/spec/cli/fixtures/template/file.txt +1 -0
- data/spec/cli/generator/options/author_spec.rb +121 -0
- data/spec/cli/generator/options/description_spec.rb +45 -0
- data/spec/cli/generator/options/reference_spec.rb +53 -0
- data/spec/cli/generator/options/summary_spec.rb +45 -0
- data/spec/cli/generator_spec.rb +244 -0
- data/spec/cli/logging_spec.rb +95 -0
- data/spec/cli/options/param_spec.rb +67 -0
- data/spec/cli/options/values/arches_spec.rb +62 -0
- data/spec/cli/printing/arch_spec.rb +130 -0
- data/spec/cli/printing/metadata_spec.rb +211 -0
- data/spec/cli/printing/os_spec.rb +64 -0
- data/spec/cli/printing/params_spec.rb +63 -0
- data/spec/cli/ruby_shell.rb +99 -0
- data/spec/cli/shell_spec.rb +211 -0
- data/spec/fixtures/example_class_registry/base_class.rb +9 -0
- data/spec/fixtures/example_class_registry/classes/loaded_class.rb +9 -0
- data/spec/fixtures/example_class_registry/classes/name_mismatch.rb +9 -0
- data/spec/fixtures/example_class_registry/classes/no_module.rb +4 -0
- data/spec/fixtures/example_class_registry.rb +8 -0
- data/spec/git_spec.rb +58 -0
- data/spec/home_spec.rb +64 -0
- data/spec/metadata/authors/author_spec.rb +335 -0
- data/spec/metadata/authors_spec.rb +126 -0
- data/spec/metadata/description_spec.rb +74 -0
- data/spec/metadata/id_spec.rb +92 -0
- data/spec/metadata/references_spec.rb +100 -0
- data/spec/metadata/summary_spec.rb +74 -0
- data/spec/metadata/version_spec.rb +72 -0
- data/spec/params/mixin_spec.rb +484 -0
- data/spec/params/param_spec.rb +164 -0
- data/spec/params/types/boolean_spec.rb +56 -0
- data/spec/params/types/enum_spec.rb +94 -0
- data/spec/params/types/float_spec.rb +107 -0
- data/spec/params/types/integer_spec.rb +155 -0
- data/spec/params/types/numeric_spec.rb +138 -0
- data/spec/params/types/regexp_spec.rb +64 -0
- data/spec/params/types/string_spec.rb +174 -0
- data/spec/params/types/type_spec.rb +14 -0
- data/spec/params/types/uri_spec.rb +62 -0
- data/spec/spec_helper.rb +11 -0
- metadata +252 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'ronin/core/metadata/references'
|
|
3
|
+
|
|
4
|
+
describe Ronin::Core::Metadata::References do
|
|
5
|
+
describe ".references" do
|
|
6
|
+
subject { test_class }
|
|
7
|
+
|
|
8
|
+
context "and when references is not set in the class" do
|
|
9
|
+
module TestMetadataReferences
|
|
10
|
+
class WithNoReferencesSet
|
|
11
|
+
include Ronin::Core::Metadata::References
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
let(:test_class) { TestMetadataReferences::WithNoReferencesSet }
|
|
16
|
+
|
|
17
|
+
it "must default to []" do
|
|
18
|
+
expect(subject.references).to eq([])
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
context "and when references is set in the class" do
|
|
23
|
+
module TestMetadataReferences
|
|
24
|
+
class WithReferencesSet
|
|
25
|
+
include Ronin::Core::Metadata::References
|
|
26
|
+
|
|
27
|
+
references [
|
|
28
|
+
'https://example.com/link1',
|
|
29
|
+
'https://example.com/link2'
|
|
30
|
+
]
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
let(:test_class) { TestMetadataReferences::WithReferencesSet }
|
|
35
|
+
|
|
36
|
+
it "must return the set references" do
|
|
37
|
+
expect(subject.references).to eq(
|
|
38
|
+
[
|
|
39
|
+
'https://example.com/link1',
|
|
40
|
+
'https://example.com/link2'
|
|
41
|
+
]
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
context "but when the references was set in the superclass" do
|
|
47
|
+
module TestMetadataReferences
|
|
48
|
+
class InheritsItsReferences < WithReferencesSet
|
|
49
|
+
include Ronin::Core::Metadata::References
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
let(:test_class) { TestMetadataReferences::InheritsItsReferences }
|
|
54
|
+
|
|
55
|
+
it "must return the references set in the superclass" do
|
|
56
|
+
expect(subject.references).to eq(
|
|
57
|
+
[
|
|
58
|
+
'https://example.com/link1',
|
|
59
|
+
'https://example.com/link2'
|
|
60
|
+
]
|
|
61
|
+
)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
context "but the references is overridden in the sub-class" do
|
|
65
|
+
module TestMetadataReferences
|
|
66
|
+
class OverridesItsInheritedReferences < WithReferencesSet
|
|
67
|
+
include Ronin::Core::Metadata::References
|
|
68
|
+
|
|
69
|
+
references [
|
|
70
|
+
'https://example.com/link3'
|
|
71
|
+
]
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
let(:test_class) do
|
|
76
|
+
TestMetadataReferences::OverridesItsInheritedReferences
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
it "must return the references in the sub-class and the superclass" do
|
|
80
|
+
expect(subject.references).to eq(
|
|
81
|
+
[
|
|
82
|
+
'https://example.com/link1',
|
|
83
|
+
'https://example.com/link2',
|
|
84
|
+
'https://example.com/link3'
|
|
85
|
+
]
|
|
86
|
+
)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it "must not modify the superclass'es references" do
|
|
90
|
+
expect(subject.superclass.references).to eq(
|
|
91
|
+
[
|
|
92
|
+
'https://example.com/link1',
|
|
93
|
+
'https://example.com/link2'
|
|
94
|
+
]
|
|
95
|
+
)
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'ronin/core/metadata/summary'
|
|
3
|
+
|
|
4
|
+
describe Ronin::Core::Metadata::Summary do
|
|
5
|
+
describe ".summary" do
|
|
6
|
+
subject { test_class }
|
|
7
|
+
|
|
8
|
+
context "and when summary is not set in the class" do
|
|
9
|
+
module TestMetadataSummary
|
|
10
|
+
class WithNoSummarySet
|
|
11
|
+
include Ronin::Core::Metadata::Summary
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
let(:test_class) { TestMetadataSummary::WithNoSummarySet }
|
|
16
|
+
|
|
17
|
+
it "must default to nil" do
|
|
18
|
+
expect(subject.summary).to be(nil)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
context "and when summary is set in the class" do
|
|
23
|
+
module TestMetadataSummary
|
|
24
|
+
class WithSummarySet
|
|
25
|
+
include Ronin::Core::Metadata::Summary
|
|
26
|
+
|
|
27
|
+
summary 'test'
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
let(:test_class) { TestMetadataSummary::WithSummarySet }
|
|
32
|
+
|
|
33
|
+
it "must return the set summary" do
|
|
34
|
+
expect(subject.summary).to eq("test")
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
context "but when the summary was set in the superclass" do
|
|
39
|
+
module TestMetadataSummary
|
|
40
|
+
class InheritsItsSummary < WithSummarySet
|
|
41
|
+
include Ronin::Core::Metadata::Summary
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
let(:test_class) { TestMetadataSummary::InheritsItsSummary }
|
|
46
|
+
|
|
47
|
+
it "must return the summary set in the superclass" do
|
|
48
|
+
expect(subject.summary).to eq("test")
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
context "but the summary is overridden in the sub-class" do
|
|
52
|
+
module TestMetadataSummary
|
|
53
|
+
class OverridesItsInheritedSummary < WithSummarySet
|
|
54
|
+
include Ronin::Core::Metadata::Summary
|
|
55
|
+
|
|
56
|
+
summary "test2"
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
let(:test_class) do
|
|
61
|
+
TestMetadataSummary::OverridesItsInheritedSummary
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it "must return the summary set in the sub-class" do
|
|
65
|
+
expect(subject.summary).to eq("test2")
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it "must not modify the superclass'es summary" do
|
|
69
|
+
expect(subject.superclass.summary).to eq('test')
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'ronin/core/metadata/version'
|
|
3
|
+
|
|
4
|
+
describe Ronin::Core::Metadata::Version do
|
|
5
|
+
module TestMetadataVersion
|
|
6
|
+
class WithNoVersionSet
|
|
7
|
+
include Ronin::Core::Metadata::Version
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
class WithVersionSet
|
|
11
|
+
include Ronin::Core::Metadata::Version
|
|
12
|
+
|
|
13
|
+
version '0.1'
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe ".version" do
|
|
18
|
+
subject { test_class }
|
|
19
|
+
|
|
20
|
+
context "and when version is not set in the class" do
|
|
21
|
+
let(:test_class) { TestMetadataVersion::WithNoVersionSet }
|
|
22
|
+
|
|
23
|
+
it "must default to nil" do
|
|
24
|
+
expect(subject.version).to be(nil)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
context "and when version is set in the class" do
|
|
29
|
+
let(:test_class) { TestMetadataVersion::WithVersionSet }
|
|
30
|
+
|
|
31
|
+
it "must return the set version" do
|
|
32
|
+
expect(subject.version).to eq("0.1")
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
context "but when the version was set in the superclass" do
|
|
37
|
+
module TestMetadataVersion
|
|
38
|
+
class InheritsItsVersion < WithVersionSet
|
|
39
|
+
include Ronin::Core::Metadata::Version
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
let(:test_class) { TestMetadataVersion::InheritsItsVersion }
|
|
44
|
+
|
|
45
|
+
it "must return nil" do
|
|
46
|
+
expect(subject.version).to be(nil)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
context "but the version is overrversionden in the sub-class" do
|
|
50
|
+
module TestMetadataVersion
|
|
51
|
+
class OverrversionesItsInheritedVersion < WithVersionSet
|
|
52
|
+
include Ronin::Core::Metadata::Version
|
|
53
|
+
|
|
54
|
+
version '0.2'
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
let(:test_class) do
|
|
59
|
+
TestMetadataVersion::OverrversionesItsInheritedVersion
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it "must return the version set in the sub-class" do
|
|
63
|
+
expect(subject.version).to eq("0.2")
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "must not modify the superclass'es version" do
|
|
67
|
+
expect(subject.superclass.version).to eq('0.1')
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|