ronin-core 0.1.0.beta1 → 0.1.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.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -0
  3. data/.yardopts +1 -1
  4. data/README.md +2 -1
  5. data/gemspec.yml +1 -1
  6. data/lib/ronin/core/class_registry.rb +3 -3
  7. data/lib/ronin/core/cli/command.rb +1 -1
  8. data/lib/ronin/core/cli/command_shell/command.rb +1 -1
  9. data/lib/ronin/core/cli/command_shell.rb +2 -2
  10. data/lib/ronin/core/cli/generator/options/author.rb +1 -1
  11. data/lib/ronin/core/cli/generator/options/description.rb +1 -1
  12. data/lib/ronin/core/cli/generator/options/reference.rb +1 -1
  13. data/lib/ronin/core/cli/generator/options/summary.rb +1 -1
  14. data/lib/ronin/core/cli/generator.rb +1 -1
  15. data/lib/ronin/core/cli/logging.rb +1 -1
  16. data/lib/ronin/core/cli/options/param.rb +1 -1
  17. data/lib/ronin/core/cli/options/values/arches.rb +1 -1
  18. data/lib/ronin/core/cli/options/values/oses.rb +1 -1
  19. data/lib/ronin/core/cli/printing/arch.rb +1 -1
  20. data/lib/ronin/core/cli/printing/metadata.rb +2 -2
  21. data/lib/ronin/core/cli/printing/os.rb +1 -1
  22. data/lib/ronin/core/cli/printing/params.rb +1 -1
  23. data/lib/ronin/core/cli/ruby_shell.rb +1 -1
  24. data/lib/ronin/core/cli/shell.rb +2 -2
  25. data/lib/ronin/core/git.rb +1 -1
  26. data/lib/ronin/core/home.rb +1 -1
  27. data/lib/ronin/core/metadata/authors/author.rb +1 -1
  28. data/lib/ronin/core/metadata/authors.rb +1 -1
  29. data/lib/ronin/core/metadata/description.rb +1 -1
  30. data/lib/ronin/core/metadata/id.rb +1 -1
  31. data/lib/ronin/core/metadata/references.rb +1 -1
  32. data/lib/ronin/core/metadata/summary.rb +1 -1
  33. data/lib/ronin/core/metadata/version.rb +1 -1
  34. data/lib/ronin/core/params/exceptions.rb +1 -1
  35. data/lib/ronin/core/params/mixin.rb +2 -2
  36. data/lib/ronin/core/params/param.rb +2 -2
  37. data/lib/ronin/core/params/types/boolean.rb +1 -1
  38. data/lib/ronin/core/params/types/enum.rb +1 -1
  39. data/lib/ronin/core/params/types/float.rb +1 -1
  40. data/lib/ronin/core/params/types/integer.rb +1 -1
  41. data/lib/ronin/core/params/types/numeric.rb +1 -1
  42. data/lib/ronin/core/params/types/regexp.rb +1 -1
  43. data/lib/ronin/core/params/types/string.rb +1 -1
  44. data/lib/ronin/core/params/types/type.rb +1 -1
  45. data/lib/ronin/core/params/types/uri.rb +1 -1
  46. data/lib/ronin/core/params/types.rb +1 -1
  47. data/lib/ronin/core/params.rb +1 -1
  48. data/lib/ronin/core/version.rb +2 -2
  49. data/ronin-core.gemspec +2 -1
  50. metadata +4 -90
  51. data/spec/class_registry_spec.rb +0 -224
  52. data/spec/cli/command_shell/command_spec.rb +0 -113
  53. data/spec/cli/command_shell_spec.rb +0 -1114
  54. data/spec/cli/command_spec.rb +0 -16
  55. data/spec/cli/fixtures/irb_command +0 -8
  56. data/spec/cli/fixtures/template/dir/file1.txt +0 -1
  57. data/spec/cli/fixtures/template/dir/file2.txt +0 -1
  58. data/spec/cli/fixtures/template/file.erb +0 -1
  59. data/spec/cli/fixtures/template/file.txt +0 -1
  60. data/spec/cli/generator/options/author_spec.rb +0 -121
  61. data/spec/cli/generator/options/description_spec.rb +0 -45
  62. data/spec/cli/generator/options/reference_spec.rb +0 -53
  63. data/spec/cli/generator/options/summary_spec.rb +0 -45
  64. data/spec/cli/generator_spec.rb +0 -244
  65. data/spec/cli/logging_spec.rb +0 -95
  66. data/spec/cli/options/param_spec.rb +0 -67
  67. data/spec/cli/options/values/arches_spec.rb +0 -62
  68. data/spec/cli/printing/arch_spec.rb +0 -130
  69. data/spec/cli/printing/metadata_spec.rb +0 -211
  70. data/spec/cli/printing/os_spec.rb +0 -64
  71. data/spec/cli/printing/params_spec.rb +0 -63
  72. data/spec/cli/ruby_shell.rb +0 -99
  73. data/spec/cli/shell_spec.rb +0 -211
  74. data/spec/fixtures/example_class_registry/base_class.rb +0 -9
  75. data/spec/fixtures/example_class_registry/classes/loaded_class.rb +0 -9
  76. data/spec/fixtures/example_class_registry/classes/name_mismatch.rb +0 -9
  77. data/spec/fixtures/example_class_registry/classes/no_module.rb +0 -4
  78. data/spec/fixtures/example_class_registry.rb +0 -8
  79. data/spec/git_spec.rb +0 -58
  80. data/spec/home_spec.rb +0 -64
  81. data/spec/metadata/authors/author_spec.rb +0 -335
  82. data/spec/metadata/authors_spec.rb +0 -126
  83. data/spec/metadata/description_spec.rb +0 -74
  84. data/spec/metadata/id_spec.rb +0 -92
  85. data/spec/metadata/references_spec.rb +0 -100
  86. data/spec/metadata/summary_spec.rb +0 -74
  87. data/spec/metadata/version_spec.rb +0 -72
  88. data/spec/params/mixin_spec.rb +0 -484
  89. data/spec/params/param_spec.rb +0 -164
  90. data/spec/params/types/boolean_spec.rb +0 -56
  91. data/spec/params/types/enum_spec.rb +0 -94
  92. data/spec/params/types/float_spec.rb +0 -107
  93. data/spec/params/types/integer_spec.rb +0 -155
  94. data/spec/params/types/numeric_spec.rb +0 -138
  95. data/spec/params/types/regexp_spec.rb +0 -64
  96. data/spec/params/types/string_spec.rb +0 -174
  97. data/spec/params/types/type_spec.rb +0 -14
  98. data/spec/params/types/uri_spec.rb +0 -62
  99. data/spec/spec_helper.rb +0 -11
@@ -1,174 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/core/params/types/string'
3
-
4
- describe Ronin::Core::Params::Types::String do
5
- describe "#initialize" do
6
- it "must default #allow_empty? to false" do
7
- expect(subject.allow_empty?).to be(false)
8
- end
9
-
10
- it "must default #allow_blank? to false" do
11
- expect(subject.allow_blank?).to be(false)
12
- end
13
-
14
- it "must default #format to nil" do
15
- expect(subject.format).to be(nil)
16
- end
17
-
18
- context "when given the format: keyword argument" do
19
- let(:format) { /foo/ }
20
-
21
- subject { described_class.new(format: format) }
22
-
23
- it "must set #format" do
24
- expect(subject.format).to eq(format)
25
- end
26
- end
27
- end
28
-
29
- describe "#allow_empty?" do
30
- context "when initialized with allow_empty: true" do
31
- subject { described_class.new(allow_empty: true) }
32
-
33
- it "must return true" do
34
- expect(subject.allow_empty?).to be(true)
35
- end
36
- end
37
-
38
- context "when initialized with allow_empty: false" do
39
- subject { described_class.new(allow_empty: false) }
40
-
41
- it "must return false" do
42
- expect(subject.allow_empty?).to be(false)
43
- end
44
- end
45
- end
46
-
47
- describe "#allow_blank?" do
48
- context "when initialized with allow_blank: true" do
49
- subject { described_class.new(allow_blank: true) }
50
-
51
- it "must return true" do
52
- expect(subject.allow_blank?).to be(true)
53
- end
54
- end
55
-
56
- context "when initialized with allow_blank: false" do
57
- subject { described_class.new(allow_blank: false) }
58
-
59
- it "must return false" do
60
- expect(subject.allow_blank?).to be(false)
61
- end
62
- end
63
- end
64
-
65
- describe "#coerce" do
66
- context "when given an Enumerable" do
67
- let(:value) { ["foo", "bar"] }
68
-
69
- it do
70
- expect {
71
- subject.coerce(value)
72
- }.to raise_error(Ronin::Core::Params::ValidationError,"cannot convert an Enumerable into a String (#{value.inspect})")
73
- end
74
- end
75
-
76
- context "when given a String" do
77
- let(:value) { "foo" }
78
-
79
- it "must return the String" do
80
- expect(subject.coerce(value)).to eq(value)
81
- end
82
-
83
- context "but when #format is set" do
84
- subject { described_class.new(format: /foo/) }
85
-
86
- context "and the given value matches #format" do
87
- it "must return the String value" do
88
- expect(subject.coerce(value)).to eq(value)
89
- end
90
- end
91
-
92
- context "but the given value does not match #format" do
93
- let(:value) { "bar" }
94
-
95
- it do
96
- expect {
97
- subject.coerce(value)
98
- }.to raise_error(Ronin::Core::Params::ValidationError,"does not match the format (#{value.inspect})")
99
- end
100
- end
101
- end
102
-
103
- context "but the string is empty" do
104
- let(:value) { "" }
105
-
106
- it do
107
- expect {
108
- subject.coerce(value)
109
- }.to raise_error(Ronin::Core::Params::ValidationError,"value cannot be empty")
110
- end
111
-
112
- context "and when initialized with allow_empty: true" do
113
- subject { described_class.new(allow_empty: true) }
114
-
115
- it "must return the empty String" do
116
- expect(subject.coerce(value)).to eq(value)
117
- end
118
- end
119
- end
120
-
121
- context "but the String is all whitespace" do
122
- let(:value) { " \t\n\r" }
123
-
124
- it do
125
- expect {
126
- subject.coerce(value)
127
- }.to raise_error(Ronin::Core::Params::ValidationError,"value cannot contain all whitespace (#{value.inspect})")
128
- end
129
-
130
- context "and when initialized with allow_blank: true" do
131
- subject { described_class.new(allow_blank: true) }
132
-
133
- it "must return the blank String" do
134
- expect(subject.coerce(value)).to eq(value)
135
- end
136
- end
137
- end
138
- end
139
-
140
- context "when given a non-String object" do
141
- context "and it defines a #to_s method" do
142
- module TestTypesString
143
- class ObjectWithToS
144
- def to_s
145
- "foo"
146
- end
147
- end
148
- end
149
-
150
- let(:value) { TestTypesString::ObjectWithToS.new }
151
-
152
- it "must call #to_s on the value" do
153
- expect(subject.coerce(value)).to eq(value.to_s)
154
- end
155
- end
156
-
157
- context "but it does not respond to #to_s" do
158
- module TestTypesString
159
- class ObjectWithoutToS
160
- undef to_s
161
- end
162
- end
163
-
164
- let(:value) { TestTypesString::ObjectWithoutToS.new }
165
-
166
- it do
167
- expect {
168
- subject.coerce(value)
169
- }.to raise_error(Ronin::Core::Params::ValidationError,"value does not define a #to_s method (#{value.inspect})")
170
- end
171
- end
172
- end
173
- end
174
- end
@@ -1,14 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/core/params/types/type'
3
-
4
- describe Ronin::Core::Params::Types::Type do
5
- describe "#corece" do
6
- let(:value) { Object.new }
7
-
8
- it do
9
- expect {
10
- subject.coerce(value)
11
- }.to raise_error(NotImplementedError,"#{described_class}#coerce method was not implemented")
12
- end
13
- end
14
- end
@@ -1,62 +0,0 @@
1
- require 'spec_helper'
2
- require 'ronin/core/params/types/uri'
3
-
4
- describe Ronin::Core::Params::Types::URI do
5
- describe "#coerce" do
6
- context "when given a Regexp value" do
7
- let(:value) { URI('https://example.com/') }
8
-
9
- it "must return the Regexp" do
10
- expect(subject.coerce(value)).to eq(value)
11
- end
12
- end
13
-
14
- context "when given a String value" do
15
- let(:value) { "https://example.com/" }
16
-
17
- it "must parse the String as a URI" do
18
- expect(subject.coerce(value)).to eq(URI.parse(value))
19
- end
20
-
21
- context "but the String is empty" do
22
- let(:value) { "" }
23
-
24
- it do
25
- expect {
26
- subject.coerce(value)
27
- }.to raise_error(Ronin::Core::Params::ValidationError,"value must not be empty")
28
- end
29
- end
30
-
31
- context "but the String does not start with a 'scheme:'" do
32
- let(:value) { "foo" }
33
-
34
- it do
35
- expect {
36
- subject.coerce(value)
37
- }.to raise_error(Ronin::Core::Params::ValidationError,"value must start with a 'scheme:' (#{value.inspect})")
38
- end
39
- end
40
-
41
- context "but the String cannot be parsed as a valid URI" do
42
- let(:value) { "https:// \n" }
43
-
44
- it do
45
- expect {
46
- subject.coerce(value)
47
- }.to raise_error(Ronin::Core::Params::ValidationError,"value is not a valid URI (#{value.inspect})")
48
- end
49
- end
50
- end
51
-
52
- context "when given a non-URI and non-String value" do
53
- let(:value) { Object.new }
54
-
55
- it do
56
- expect {
57
- subject.coerce(value)
58
- }.to raise_error(Ronin::Core::Params::ValidationError,"value must be either a String or a URI (#{value.inspect})")
59
- end
60
- end
61
- end
62
- end
data/spec/spec_helper.rb DELETED
@@ -1,11 +0,0 @@
1
- require 'rspec'
2
- require 'simplecov'
3
- SimpleCov.start
4
-
5
- ENV.delete('XDG_CACHE_HOME')
6
- ENV.delete('XDG_CONFIG_HOME')
7
- ENV.delete('XDG_DATA_HOME')
8
-
9
- require 'ronin/core/version'
10
-
11
- include Ronin