ronin 0.1.2 → 0.1.3
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/History.txt +58 -25
- data/Manifest.txt +15 -16
- data/README.txt +16 -11
- data/Rakefile +9 -7
- data/TODO.txt +6 -1
- data/lib/ronin.rb +1 -1
- data/lib/ronin/arch.rb +7 -15
- data/lib/ronin/author.rb +1 -1
- data/lib/ronin/cache.rb +1 -1
- data/lib/ronin/cache/cache.rb +1 -1
- data/lib/ronin/cache/config.rb +1 -1
- data/lib/ronin/cache/exceptions.rb +1 -1
- data/lib/ronin/cache/exceptions/extension_not_found.rb +1 -1
- data/lib/ronin/cache/exceptions/overlay_cached.rb +1 -1
- data/lib/ronin/cache/exceptions/overlay_not_found.rb +1 -1
- data/lib/ronin/cache/extension.rb +15 -190
- data/lib/ronin/cache/extension_cache.rb +2 -2
- data/lib/ronin/cache/maintainer.rb +1 -1
- data/lib/ronin/cache/overlay.rb +8 -7
- data/lib/ronin/cache/overlay_cache.rb +1 -1
- data/lib/ronin/cache/ronin.rb +1 -1
- data/lib/ronin/chars.rb +1 -1
- data/lib/ronin/chars/char_set.rb +1 -1
- data/lib/ronin/chars/chars.rb +1 -1
- data/lib/ronin/code/emittable.rb +1 -1
- data/lib/ronin/code/reference.rb +1 -1
- data/lib/ronin/code/symbol_table.rb +1 -1
- data/lib/ronin/code/token.rb +1 -1
- data/lib/ronin/config.rb +16 -9
- data/lib/ronin/database.rb +2 -113
- data/lib/ronin/database/database.rb +124 -0
- data/lib/ronin/{exceptions/unknown_context.rb → database/exceptions.rb} +2 -5
- data/lib/ronin/{exceptions/context_not_found.rb → database/exceptions/invalid_config.rb} +4 -2
- data/lib/ronin/extensions.rb +1 -1
- data/lib/ronin/extensions/hash.rb +1 -1
- data/lib/ronin/extensions/meta.rb +1 -1
- data/lib/ronin/extensions/string.rb +1 -1
- data/lib/ronin/extensions/uri.rb +1 -1
- data/lib/ronin/extensions/uri/http.rb +1 -1
- data/lib/ronin/extensions/uri/query_params.rb +1 -1
- data/lib/ronin/formatting.rb +1 -1
- data/lib/ronin/formatting/binary.rb +1 -1
- data/lib/ronin/formatting/digest.rb +1 -1
- data/lib/ronin/formatting/extensions.rb +1 -1
- data/lib/ronin/formatting/extensions/binary.rb +1 -1
- data/lib/ronin/formatting/extensions/binary/integer.rb +1 -1
- data/lib/ronin/formatting/extensions/binary/string.rb +1 -1
- data/lib/ronin/formatting/extensions/digest.rb +1 -1
- data/lib/ronin/formatting/extensions/digest/string.rb +1 -1
- data/lib/ronin/formatting/extensions/html.rb +1 -1
- data/lib/ronin/formatting/extensions/html/string.rb +1 -1
- data/lib/ronin/formatting/extensions/http.rb +1 -1
- data/lib/ronin/formatting/extensions/http/string.rb +1 -1
- data/lib/ronin/formatting/extensions/text.rb +1 -1
- data/lib/ronin/formatting/extensions/text/string.rb +1 -1
- data/lib/ronin/formatting/html.rb +1 -1
- data/lib/ronin/formatting/http.rb +1 -1
- data/lib/ronin/formatting/text.rb +1 -1
- data/lib/ronin/{pending_context.rb → has_license.rb} +21 -22
- data/lib/ronin/hexdump.rb +1 -1
- data/lib/ronin/hexdump/extensions.rb +1 -1
- data/lib/ronin/hexdump/extensions/file.rb +1 -1
- data/lib/ronin/hexdump/extensions/kernel.rb +1 -1
- data/lib/ronin/hexdump/hexdump.rb +1 -1
- data/lib/ronin/license.rb +10 -15
- data/lib/ronin/model.rb +14 -12
- data/lib/ronin/models.rb +2 -2
- data/lib/ronin/network.rb +1 -1
- data/lib/ronin/network/esmtp.rb +1 -1
- data/lib/ronin/network/extensions.rb +1 -1
- data/lib/ronin/network/extensions/esmtp.rb +1 -1
- data/lib/ronin/network/extensions/esmtp/net.rb +1 -1
- data/lib/ronin/network/extensions/http.rb +1 -1
- data/lib/ronin/network/extensions/http/net.rb +1 -1
- data/lib/ronin/network/extensions/imap.rb +1 -1
- data/lib/ronin/network/extensions/imap/net.rb +1 -1
- data/lib/ronin/network/extensions/pop3.rb +1 -1
- data/lib/ronin/network/extensions/pop3/net.rb +1 -1
- data/lib/ronin/network/extensions/smtp.rb +1 -1
- data/lib/ronin/network/extensions/smtp/net.rb +1 -1
- data/lib/ronin/network/extensions/tcp.rb +1 -1
- data/lib/ronin/network/extensions/tcp/net.rb +17 -1
- data/lib/ronin/network/extensions/telnet.rb +1 -1
- data/lib/ronin/network/extensions/telnet/net.rb +1 -1
- data/lib/ronin/network/extensions/udp.rb +1 -1
- data/lib/ronin/network/extensions/udp/net.rb +1 -1
- data/lib/ronin/network/http.rb +1 -1
- data/lib/ronin/network/http/exceptions.rb +1 -1
- data/lib/ronin/network/http/exceptions/unknown_request.rb +1 -1
- data/lib/ronin/network/imap.rb +1 -1
- data/lib/ronin/network/pop3.rb +1 -1
- data/lib/ronin/network/smtp.rb +1 -1
- data/lib/ronin/network/smtp/email.rb +1 -1
- data/lib/ronin/network/smtp/smtp.rb +1 -1
- data/lib/ronin/network/tcp.rb +1 -1
- data/lib/ronin/network/telnet.rb +1 -1
- data/lib/ronin/network/udp.rb +1 -1
- data/lib/ronin/objectify.rb +24 -0
- data/lib/ronin/{exceptions/invalid_database_config.rb → objectify/exceptions.rb} +3 -5
- data/lib/ronin/{exceptions → objectify/exceptions}/object_context_not_found.rb +1 -1
- data/lib/ronin/{exceptions → objectify/exceptions}/unknown_object_context.rb +1 -1
- data/lib/ronin/{object_context.rb → objectify/objectify.rb} +54 -45
- data/lib/ronin/path.rb +1 -1
- data/lib/ronin/platform.rb +3 -1
- data/lib/ronin/product.rb +2 -1
- data/lib/ronin/ronin.rb +10 -10
- data/lib/ronin/rpc.rb +1 -1
- data/lib/ronin/rpc/call.rb +1 -1
- data/lib/ronin/rpc/client.rb +1 -1
- data/lib/ronin/rpc/console.rb +1 -1
- data/lib/ronin/rpc/exceptions.rb +1 -1
- data/lib/ronin/rpc/exceptions/not_implemented.rb +1 -1
- data/lib/ronin/rpc/exceptions/response_missing.rb +1 -1
- data/lib/ronin/rpc/response.rb +1 -1
- data/lib/ronin/rpc/service.rb +1 -1
- data/lib/ronin/rpc/shell.rb +1 -1
- data/lib/ronin/sessions.rb +1 -1
- data/lib/ronin/sessions/esmtp.rb +6 -8
- data/lib/ronin/sessions/http.rb +1 -1
- data/lib/ronin/sessions/imap.rb +6 -8
- data/lib/ronin/sessions/pop3.rb +6 -8
- data/lib/ronin/sessions/session.rb +1 -1
- data/lib/ronin/sessions/smtp.rb +6 -8
- data/lib/ronin/sessions/tcp.rb +48 -36
- data/lib/ronin/sessions/telnet.rb +7 -10
- data/lib/ronin/sessions/udp.rb +28 -29
- data/lib/ronin/sessions/web.rb +5 -7
- data/lib/ronin/target.rb +1 -0
- data/lib/ronin/translators/translator.rb +1 -1
- data/lib/ronin/ui/command_line.rb +1 -1
- data/lib/ronin/ui/command_line/command.rb +1 -1
- data/lib/ronin/ui/command_line/command_line.rb +7 -2
- data/lib/ronin/ui/command_line/commands.rb +2 -2
- data/lib/ronin/ui/command_line/commands/add.rb +8 -8
- data/lib/ronin/ui/command_line/commands/default.rb +1 -1
- data/lib/ronin/ui/command_line/commands/extension.rb +13 -26
- data/lib/ronin/ui/command_line/commands/help.rb +1 -1
- data/lib/ronin/ui/command_line/commands/install.rb +7 -7
- data/lib/ronin/ui/command_line/commands/list.rb +13 -7
- data/lib/ronin/ui/command_line/commands/overlay.rb +1 -1
- data/lib/ronin/ui/command_line/commands/remove.rb +4 -4
- data/lib/ronin/ui/command_line/commands/uninstall.rb +4 -4
- data/lib/ronin/ui/command_line/commands/update.rb +3 -3
- data/lib/ronin/ui/command_line/exceptions.rb +1 -1
- data/lib/ronin/ui/command_line/exceptions/unknown_command.rb +1 -1
- data/lib/ronin/ui/command_line/options.rb +1 -1
- data/lib/ronin/ui/command_line/param_parser.rb +73 -0
- data/lib/ronin/ui/console.rb +1 -1
- data/lib/ronin/ui/shell.rb +1 -1
- data/lib/ronin/version.rb +2 -2
- data/lib/ronin/web.rb +1 -1
- data/lib/ronin/web/web.rb +1 -1
- data/spec/chars/char_set_spec.rb +116 -118
- data/spec/chars/chars_spec.rb +54 -63
- data/spec/formatting/{binary_spec.rb → binary/integer_spec.rb} +0 -19
- data/spec/formatting/binary/string_spec.rb +32 -0
- data/spec/{object_context/object_context_spec.rb → objectify/objectify_spec.rb} +5 -3
- data/spec/path_spec.rb +21 -23
- data/spec/translators/translator_spec.rb +38 -40
- data/spec/ui/command_line/param_parser_spec.rb +58 -0
- data/static/extension.rb +9 -0
- metadata +43 -24
- data/lib/ronin/context.rb +0 -236
- data/spec/context/context_spec.rb +0 -84
- data/spec/context/helpers/book_context.rb +0 -15
- data/spec/context/helpers/book_review_context.rb +0 -21
- data/spec/context/helpers/contexts/neuromancer_review.rb +0 -15
- data/spec/context/helpers/contexts/snow_crash.rb +0 -8
- data/static/extension.rb.erb +0 -16
data/lib/ronin/context.rb
DELETED
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
#--
|
|
3
|
-
# Ronin - A Ruby platform designed for information security and data
|
|
4
|
-
# exploration tasks.
|
|
5
|
-
#
|
|
6
|
-
# Copyright (c) 2006-2008 Hal Brodigan (postmodern.mod3 at gmail.com)
|
|
7
|
-
#
|
|
8
|
-
# This program is free software; you can redistribute it and/or modify
|
|
9
|
-
# it under the terms of the GNU General Public License as published by
|
|
10
|
-
# the Free Software Foundation; either version 2 of the License, or
|
|
11
|
-
# (at your option) any later version.
|
|
12
|
-
#
|
|
13
|
-
# This program is distributed in the hope that it will be useful,
|
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
# GNU General Public License for more details.
|
|
17
|
-
#
|
|
18
|
-
# You should have received a copy of the GNU General Public License
|
|
19
|
-
# along with this program; if not, write to the Free Software
|
|
20
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
21
|
-
#++
|
|
22
|
-
#
|
|
23
|
-
|
|
24
|
-
require 'ronin/exceptions/unknown_context'
|
|
25
|
-
require 'ronin/exceptions/context_not_found'
|
|
26
|
-
require 'ronin/pending_context'
|
|
27
|
-
require 'ronin/extensions/meta'
|
|
28
|
-
|
|
29
|
-
module Ronin
|
|
30
|
-
module Context
|
|
31
|
-
def self.included(base)
|
|
32
|
-
base.module_eval do
|
|
33
|
-
def self.contextify(name)
|
|
34
|
-
name = name.to_sym
|
|
35
|
-
|
|
36
|
-
Context.contexts[name] = self
|
|
37
|
-
|
|
38
|
-
meta_def(:context_name) { name }
|
|
39
|
-
|
|
40
|
-
class_def(:context_name) { name }
|
|
41
|
-
|
|
42
|
-
meta_def(:load_context) do |path,*args|
|
|
43
|
-
Context.load_context(self.context_name,path,*args)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
# define the top-level context wrappers
|
|
47
|
-
Kernel.module_eval %{
|
|
48
|
-
def ronin_#{name}(*args,&block)
|
|
49
|
-
if (args.empty? && Ronin::Context.is_pending?)
|
|
50
|
-
Ronin::Context.pending.blocks[:#{name}] = block
|
|
51
|
-
return nil
|
|
52
|
-
else
|
|
53
|
-
new_context = #{self}.new(*args)
|
|
54
|
-
new_context.instance_eval(&block) if block
|
|
55
|
-
return new_context
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
# define the Ronin-level context loader
|
|
61
|
-
Ronin.module_eval %{
|
|
62
|
-
def ronin_load_#{name}(path,*args,&block)
|
|
63
|
-
new_context = #{self}.load_context(path,*args)
|
|
64
|
-
|
|
65
|
-
block.call(new_context) if block
|
|
66
|
-
return new_context
|
|
67
|
-
end
|
|
68
|
-
}
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
#
|
|
74
|
-
# Returns a Hash of all defined contexts.
|
|
75
|
-
#
|
|
76
|
-
def Context.contexts
|
|
77
|
-
@@ronin_contexts ||= {}
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
#
|
|
81
|
-
# Returns +true+ if there is a context defined with the specified
|
|
82
|
-
# _name_, returns +false+ otherwise.
|
|
83
|
-
#
|
|
84
|
-
def Context.is_context?(name)
|
|
85
|
-
Context.contexts.has_key?(name.to_sym)
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
#
|
|
89
|
-
# Converts the name of the _base_ class to a context name, returning
|
|
90
|
-
# it in +String+ form.
|
|
91
|
-
#
|
|
92
|
-
# Context.namify(Ronin::Resources) # => "ronin_resources"
|
|
93
|
-
#
|
|
94
|
-
# Context.namify(Analysis::Audio) # => "ronin_analysis_audio"
|
|
95
|
-
#
|
|
96
|
-
def Context.namify(base)
|
|
97
|
-
base.to_s.downcase.gsub(/::/,'_').gsub(/^ronin_/,'').to_sym
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
#
|
|
101
|
-
# Returns the Array of contexts which are waiting to be loaded.
|
|
102
|
-
#
|
|
103
|
-
def Context.waiting
|
|
104
|
-
@@ronin_waiting_contexts ||= []
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
#
|
|
108
|
-
# Returns the pending context being loaded.
|
|
109
|
-
#
|
|
110
|
-
def Context.pending
|
|
111
|
-
Context.waiting.first
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
#
|
|
115
|
-
# Returns +true+ if there is a pending context present, returns
|
|
116
|
-
# +false+ otherwise.
|
|
117
|
-
#
|
|
118
|
-
def Context.is_pending?
|
|
119
|
-
!(Context.waiting.empty?)
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
#
|
|
123
|
-
# Returns the first pending context with the specified _path_.
|
|
124
|
-
#
|
|
125
|
-
def Context.loading(path)
|
|
126
|
-
Context.waiting.each do |pending|
|
|
127
|
-
if pending.path == path
|
|
128
|
-
return pending
|
|
129
|
-
end
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
return nil
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
#
|
|
136
|
-
# Returns +true+ if the pending context with the specified _path_
|
|
137
|
-
# is present, returns +false+ otherwise.
|
|
138
|
-
#
|
|
139
|
-
def Context.is_loading?(path)
|
|
140
|
-
!(Context.loading(path).nil?)
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
#
|
|
144
|
-
# Loads all context blocks from the specified _path_, returning a
|
|
145
|
-
# PendingContext object containing the context blocks.
|
|
146
|
-
#
|
|
147
|
-
def Context.load_blocks(path,&block)
|
|
148
|
-
path = File.expand_path(path)
|
|
149
|
-
|
|
150
|
-
unless File.file?(path)
|
|
151
|
-
raise(ContextNotFound,"context #{path.dump} doest not exist",caller)
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
# prevent circular loading of contexts
|
|
155
|
-
unless Context.is_pending?
|
|
156
|
-
# push on the new pending context
|
|
157
|
-
Context.waiting.unshift(PendingContext.new(path))
|
|
158
|
-
|
|
159
|
-
load(path)
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
# pop off and return the pending context
|
|
163
|
-
pending_context = Context.waiting.shift
|
|
164
|
-
|
|
165
|
-
block.call(pending_context) if block
|
|
166
|
-
return pending_context
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
#
|
|
170
|
-
# Loads the context block of the specified _name_ from the specified
|
|
171
|
-
# _path_, returning the context block. If a _block_ is given it will
|
|
172
|
-
# be passed the loaded context block.
|
|
173
|
-
#
|
|
174
|
-
# Context.load_block('/path/to/my_exploit.rb',:exploit) # => Proc
|
|
175
|
-
#
|
|
176
|
-
# Context.load_block('/path/to/my_shellcode.rb',:shellcode)
|
|
177
|
-
# do |block|
|
|
178
|
-
# ...
|
|
179
|
-
# end
|
|
180
|
-
#
|
|
181
|
-
def Context.load_block(name,path,&block)
|
|
182
|
-
context_block = Context.load_blocks(path).blocks[name.to_sym]
|
|
183
|
-
|
|
184
|
-
block.call(context_block) if block
|
|
185
|
-
return context_block
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
#
|
|
189
|
-
# Loads the context of the specified _name_ and from the specified
|
|
190
|
-
# _path_ with the given _args_. If no contexts were defined with the
|
|
191
|
-
# specified _name_, an UnknownContext exception will be raised.
|
|
192
|
-
#
|
|
193
|
-
# Context.load_context(:note,'/path/to/my_notes.rb') # => Note
|
|
194
|
-
#
|
|
195
|
-
def Context.load_context(name,path,*args)
|
|
196
|
-
name = name.to_sym
|
|
197
|
-
|
|
198
|
-
unless Context.is_context?(name)
|
|
199
|
-
raise(UnknownContext,"unknown context '#{name}'",caller)
|
|
200
|
-
end
|
|
201
|
-
|
|
202
|
-
new_context = Context.contexts[name].new(*args)
|
|
203
|
-
|
|
204
|
-
Context.load_block(name,path) do |context_block|
|
|
205
|
-
new_context.instance_eval(&context_block) if context_block
|
|
206
|
-
end
|
|
207
|
-
|
|
208
|
-
return new_context
|
|
209
|
-
end
|
|
210
|
-
|
|
211
|
-
#
|
|
212
|
-
# Loads all contexts from the specified _path_ returning an +Array+
|
|
213
|
-
# of loaded contexts. If a _block_ is given, it will be passed
|
|
214
|
-
# each loaded context.
|
|
215
|
-
#
|
|
216
|
-
# Context.load_contexts('/path/to/misc_contexts.rb') # => [...]
|
|
217
|
-
#
|
|
218
|
-
def Context.load_contexts(path,&block)
|
|
219
|
-
new_objs = []
|
|
220
|
-
|
|
221
|
-
Context.load_blocks(path) do |pending|
|
|
222
|
-
pending.each_block do |name,context_block|
|
|
223
|
-
if Context.is_context?(name)
|
|
224
|
-
new_obj = Context.contexts[name].new
|
|
225
|
-
new_obj.instance_eval(&context_block)
|
|
226
|
-
|
|
227
|
-
block.call(new_obj) if block
|
|
228
|
-
new_objs << new_obj
|
|
229
|
-
end
|
|
230
|
-
end
|
|
231
|
-
end
|
|
232
|
-
|
|
233
|
-
return new_objs
|
|
234
|
-
end
|
|
235
|
-
end
|
|
236
|
-
end
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
require 'ronin/context'
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
describe Ronin do
|
|
6
|
-
describe Context do
|
|
7
|
-
before(:all) do
|
|
8
|
-
require 'context/helpers/book_context'
|
|
9
|
-
require 'context/helpers/book_review_context'
|
|
10
|
-
|
|
11
|
-
@contexts_dir = File.expand_path(File.join(File.dirname(__FILE__),'helpers','contexts'))
|
|
12
|
-
@snow_crash_path = File.join(@contexts_dir,'snow_crash.rb')
|
|
13
|
-
@neuromancer_path = File.join(@contexts_dir,'neuromancer_review.rb')
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it "should contain defined contexts" do
|
|
17
|
-
Context.is_context?(:book).should == true
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it "should create a class-level context name" do
|
|
21
|
-
Book.context_name.should == :book
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
it "should raise an UnknownContext exception when loading unknwon-contexts" do
|
|
25
|
-
lambda {
|
|
26
|
-
Context.load_context(:nothing, 'some_path.rb')
|
|
27
|
-
}.should raise_error(UnknownContext)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it "should raise a ContextNotFound exception when loading from non-existant files" do
|
|
31
|
-
lambda {
|
|
32
|
-
Context.load_context(:book, 'not_here.rb')
|
|
33
|
-
}.should raise_error(ContextNotFound)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
it "should load contexts by context-name from a file" do
|
|
37
|
-
@book = Context.load_context(:book, @snow_crash_path)
|
|
38
|
-
@book.should_not be_nil
|
|
39
|
-
@book.class.should == Book
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
it "should load a specific context from a file with multiple contexts" do
|
|
43
|
-
@book = Context.load_context(:book, @neuromancer_path)
|
|
44
|
-
@book.should_not be_nil
|
|
45
|
-
@book.class.should == Book
|
|
46
|
-
|
|
47
|
-
@review = Context.load_context(:book_review, @neuromancer_path)
|
|
48
|
-
@review.should_not be_nil
|
|
49
|
-
@review.class.should == BookReview
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it "should provide class-level methods for loading a context" do
|
|
53
|
-
@book = Book.load_context(@snow_crash_path)
|
|
54
|
-
@book.should_not be_nil
|
|
55
|
-
@book.class.should == Book
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
it "should provide top-level ronin methods for loading a context" do
|
|
59
|
-
@book = ronin_load_book(@snow_crash_path)
|
|
60
|
-
@book.should_not be_nil
|
|
61
|
-
@book.class.should == Book
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
describe "loaded contexts" do
|
|
65
|
-
before(:all) do
|
|
66
|
-
@book = Book.load_context(@snow_crash_path)
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
it "should have a context name" do
|
|
70
|
-
@book.context_name.should == :book
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
it "should have attributes" do
|
|
74
|
-
@book.title.should == 'Snow Crash'
|
|
75
|
-
@book.author.should == 'Neal Stephenson'
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
it "should have instance methods" do
|
|
79
|
-
@book.methods.include?('rating').should == true
|
|
80
|
-
@book.rating.should == 10
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
require 'ronin/context'
|
|
2
|
-
|
|
3
|
-
class BookReview
|
|
4
|
-
|
|
5
|
-
include Context
|
|
6
|
-
|
|
7
|
-
contextify :book_review
|
|
8
|
-
|
|
9
|
-
# Title of the book
|
|
10
|
-
attr_accessor :book_title
|
|
11
|
-
|
|
12
|
-
# Author of the book
|
|
13
|
-
attr_accessor :book_author
|
|
14
|
-
|
|
15
|
-
# Author of this review
|
|
16
|
-
attr_accessor :author
|
|
17
|
-
|
|
18
|
-
# Summary
|
|
19
|
-
attr_accessor :summary
|
|
20
|
-
|
|
21
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
ronin_book do
|
|
2
|
-
@title = 'Neuromancer'
|
|
3
|
-
@author = 'William Gibson'
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
ronin_book_review do
|
|
7
|
-
@book_title = 'Neuromancer'
|
|
8
|
-
@book_author = 'William Gibson'
|
|
9
|
-
|
|
10
|
-
@author = 'postmodern'
|
|
11
|
-
@summary = %{
|
|
12
|
-
Classic cyber-punk book. Provides you with a very realistic and gritty
|
|
13
|
-
vision of the future and the characters that inhabit it.
|
|
14
|
-
}
|
|
15
|
-
end
|