carbonmu 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Rakefile +3 -2
- data/bin/carbonmu +2 -2
- data/carbonmu.gemspec +1 -2
- data/lib/carbonmu.rb +4 -8
- data/lib/{cli → carbonmu}/cli.rb +0 -0
- data/lib/{core → carbonmu}/command.rb +13 -2
- data/lib/{core → carbonmu}/command_context.rb +0 -0
- data/lib/{commands → carbonmu/commands}/locale_command.rb +2 -0
- data/lib/{commands → carbonmu/commands}/ping_command.rb +2 -0
- data/lib/{interactions/reboot.rb → carbonmu/commands/reboot_command.rb} +6 -2
- data/lib/{commands → carbonmu/commands}/say_command.rb +2 -0
- data/lib/{commands → carbonmu/commands}/unknown_command.rb +2 -0
- data/lib/{core → carbonmu}/configuration.rb +0 -0
- data/lib/{core → carbonmu}/connection.rb +0 -0
- data/lib/{edge_router → carbonmu/edge_router}/edge_connection.rb +0 -0
- data/lib/{edge_router → carbonmu/edge_router}/edge_router.rb +3 -0
- data/lib/{edge_router → carbonmu/edge_router}/edge_router_supervision_group.rb +4 -0
- data/lib/{edge_router → carbonmu/edge_router}/telnet_connection.rb +1 -0
- data/lib/{edge_router → carbonmu/edge_router}/telnet_receptor.rb +3 -2
- data/lib/{game_objects → carbonmu}/game_object.rb +0 -0
- data/lib/{game_objects → carbonmu/game_objects}/container.rb +0 -0
- data/lib/{game_objects → carbonmu/game_objects}/exit.rb +2 -0
- data/lib/{game_objects → carbonmu/game_objects}/movable.rb +0 -0
- data/lib/{game_objects → carbonmu/game_objects}/player.rb +3 -0
- data/lib/{game_objects → carbonmu/game_objects}/room.rb +2 -0
- data/lib/{game_objects → carbonmu/game_objects}/thing.rb +3 -0
- data/lib/{interactions → carbonmu/interactions}/notify.rb +0 -0
- data/lib/{core → carbonmu}/internationalization.rb +0 -0
- data/lib/{ipc → carbonmu/ipc}/carbon_ipc_socket.rb +0 -0
- data/lib/{ipc → carbonmu/ipc}/ipc_message.rb +0 -0
- data/lib/{ipc → carbonmu/ipc}/read_socket.rb +5 -2
- data/lib/{ipc → carbonmu/ipc}/write_socket.rb +4 -1
- data/lib/carbonmu/parser.rb +42 -0
- data/lib/{core → carbonmu}/server.rb +14 -3
- data/lib/{core → carbonmu}/server_supervision_group.rb +2 -0
- data/lib/{version.rb → carbonmu/version.rb} +1 -1
- data/spec/lib/{core → carbonmu}/command_context_spec.rb +0 -0
- data/spec/lib/{core → carbonmu}/command_spec.rb +0 -10
- data/spec/lib/{interactions/reboot_spec.rb → carbonmu/commands/reboot_command_spec.rb} +6 -2
- data/spec/lib/{commands → carbonmu/commands}/say_command_spec.rb +0 -0
- data/spec/lib/{core → carbonmu}/configuration_spec.rb +0 -0
- data/spec/lib/{core → carbonmu}/connection_spec.rb +0 -0
- data/spec/lib/{edge_router → carbonmu/edge_router}/edge_connection_spec.rb +0 -0
- data/spec/lib/{game_objects → carbonmu}/game_object_spec.rb +0 -0
- data/spec/lib/{game_objects → carbonmu/game_objects}/container_spec.rb +0 -0
- data/spec/lib/{game_objects → carbonmu/game_objects}/exit_spec.rb +0 -0
- data/spec/lib/{game_objects → carbonmu/game_objects}/movable_spec.rb +0 -0
- data/spec/lib/{game_objects → carbonmu/game_objects}/player_spec.rb +0 -0
- data/spec/lib/{game_objects → carbonmu/game_objects}/room_spec.rb +0 -0
- data/spec/lib/{game_objects → carbonmu/game_objects}/thing_spec.rb +0 -0
- data/spec/lib/{interactions → carbonmu/interactions}/notify_spec.rb +0 -0
- data/spec/lib/{core → carbonmu}/internationalization_spec.rb +0 -0
- data/spec/lib/{ipc → carbonmu/ipc}/carbon_ipc_socket_spec.rb +0 -0
- data/spec/lib/{ipc → carbonmu/ipc}/ipc_message_spec.rb +0 -0
- data/spec/lib/{ipc → carbonmu/ipc}/read_socket_spec.bak +0 -0
- data/spec/lib/{ipc → carbonmu/ipc}/write_socket_spec.bak +0 -0
- data/spec/lib/{core → carbonmu}/parser_spec.rb +5 -4
- data/spec/lib/{core → carbonmu}/server_spec.rb +0 -0
- data/spec/spec_helper.rb +9 -3
- data/spec/support/helpers.rb +7 -1
- metadata +78 -96
- data/Gemfile.lock +0 -159
- data/lib/commands/reboot_command.rb +0 -9
- data/lib/core/parser.rb +0 -29
- data/lib/errors.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 787de7bd27a377385f003218df86ac84e3d9dc95
|
4
|
+
data.tar.gz: c64cf9f3dd0048b0ebbb57475c2bf8bf3e968b6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8095cf0352b004008ef17377f84b4041f74b8404c77a949c69607748cebf362b3872e4225d3d153dffdb78e9320d6e3f57b00cc82adb7c5ae50c990fe7876774
|
7
|
+
data.tar.gz: b871309893b1577141c5211cd7652861c5b670777c451fd79c428fbc413559798fe78f540f31471c32667f893fb233b1c165ac344ff8efc63b9e78d58930282d
|
data/.gitignore
CHANGED
data/Rakefile
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
require 'version'
|
1
|
+
require 'carbonmu/version'
|
3
2
|
require 'rspec/core/rake_task'
|
4
3
|
|
5
4
|
RSpec::Core::RakeTask.new(:spec)
|
@@ -29,5 +28,7 @@ namespace :gem do
|
|
29
28
|
desc "Release new gem."
|
30
29
|
task :release => :build do
|
31
30
|
system "gem push carbonmu-#{CarbonMU::VERSION}.gem"
|
31
|
+
system "git tag #{CarbonMU::VERSION}"
|
32
|
+
puts "Don't forget to `git push --tags`."
|
32
33
|
end
|
33
34
|
end
|
data/bin/carbonmu
CHANGED
data/carbonmu.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.push('lib')
|
3
|
-
require "version"
|
3
|
+
require "carbonmu/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "carbonmu"
|
@@ -19,7 +19,6 @@ under active development and not yet ready for general use.
|
|
19
19
|
EOF
|
20
20
|
|
21
21
|
s.add_dependency "celluloid-io", "~> 0.16.1"
|
22
|
-
s.add_dependency "require_all", "~> 1.3.2"
|
23
22
|
s.add_dependency "multi_json", "~> 1.9.2"
|
24
23
|
s.add_dependency "celluloid-zmq", "~> 0.16.0"
|
25
24
|
s.add_dependency "colorize", "~> 0.7.3"
|
data/lib/carbonmu.rb
CHANGED
@@ -1,11 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
|
4
|
-
require
|
5
|
-
require 'colorize' # An exception to our require-where-used rule, since it's likely to be used many places.
|
6
|
-
require_all File.dirname(__FILE__)
|
7
|
-
|
8
|
-
Celluloid::ZMQ.init
|
1
|
+
require "carbonmu/configuration"
|
2
|
+
require "carbonmu/version"
|
3
|
+
require "carbonmu/edge_router/edge_router_supervision_group"
|
4
|
+
require "carbonmu/server_supervision_group"
|
9
5
|
|
10
6
|
module CarbonMU
|
11
7
|
class << self
|
data/lib/{cli → carbonmu}/cli.rb
RENAMED
File without changes
|
@@ -1,14 +1,25 @@
|
|
1
|
+
require "carbonmu/parser"
|
2
|
+
|
1
3
|
module CarbonMU
|
2
4
|
class Command
|
3
5
|
class << self
|
6
|
+
|
4
7
|
def syntax(value)
|
5
8
|
@syntaxes ||= []
|
6
9
|
@syntaxes << value
|
7
|
-
Parser.register_syntax(value, self)
|
8
10
|
end
|
9
11
|
|
10
12
|
def syntaxes
|
11
|
-
@syntaxes
|
13
|
+
@syntaxes || []
|
14
|
+
end
|
15
|
+
|
16
|
+
def inherited(child)
|
17
|
+
@command_classes ||= []
|
18
|
+
@command_classes << child
|
19
|
+
end
|
20
|
+
|
21
|
+
def command_classes
|
22
|
+
@command_classes || []
|
12
23
|
end
|
13
24
|
end
|
14
25
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,3 +1,6 @@
|
|
1
|
+
require "carbonmu/ipc/carbon_ipc_socket"
|
2
|
+
require "celluloid/zmq"
|
3
|
+
|
1
4
|
module CarbonMU
|
2
5
|
class ReadSocket < CarbonIPCSocket
|
3
6
|
def initialize(port = '*')
|
@@ -13,6 +16,6 @@ module CarbonMU
|
|
13
16
|
raw_endpoint = @zmq_socket.get(::ZMQ::LAST_ENDPOINT) || nil
|
14
17
|
return nil if raw_endpoint.nil?
|
15
18
|
raw_endpoint.match(/\:(\d+)/)[1].to_i
|
16
|
-
end
|
19
|
+
end
|
17
20
|
end
|
18
|
-
end
|
21
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "active_support/inflector"
|
2
|
+
require "carbonmu/command_context"
|
3
|
+
require "carbonmu/command"
|
4
|
+
require "core_ext/match_data"
|
5
|
+
|
6
|
+
Dir[File.dirname(__FILE__) + '/commands/*.rb'].each {|file| require file }
|
7
|
+
|
8
|
+
module CarbonMU
|
9
|
+
class Parser
|
10
|
+
attr_reader :syntaxes
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@syntaxes = {}
|
14
|
+
Command.command_classes.each { |klass| register_command_class(klass) }
|
15
|
+
end
|
16
|
+
|
17
|
+
def parse_and_execute(enacting_connection, input)
|
18
|
+
command_class, params = parse(input)
|
19
|
+
|
20
|
+
context = CommandContext.new(enacting_connection: enacting_connection, raw_command: input, params: params)
|
21
|
+
command_class.new(context).execute
|
22
|
+
end
|
23
|
+
|
24
|
+
def parse(input)
|
25
|
+
syntax_match_data = {}
|
26
|
+
syntax_and_class = @syntaxes.detect { |syntax, klass| syntax_match_data = syntax.match(input) }
|
27
|
+
|
28
|
+
command_class = syntax_and_class.nil? ? UnknownCommand : syntax_and_class[1]
|
29
|
+
syntax_match_data ||= {} # if no syntaxes matched
|
30
|
+
|
31
|
+
[command_class, syntax_match_data.to_hash]
|
32
|
+
end
|
33
|
+
|
34
|
+
def register_command_class(klass)
|
35
|
+
klass.syntaxes.each { |syntax| register_syntax(syntax, klass) }
|
36
|
+
end
|
37
|
+
|
38
|
+
def register_syntax(syntax, klass)
|
39
|
+
@syntaxes[syntax] = klass
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,6 +1,15 @@
|
|
1
1
|
require 'celluloid/io'
|
2
2
|
require 'celluloid/zmq'
|
3
|
-
require
|
3
|
+
require "mongoid"
|
4
|
+
require "colorize"
|
5
|
+
require "core_ext/string"
|
6
|
+
require "carbonmu/internationalization"
|
7
|
+
require "carbonmu/game_object"
|
8
|
+
require "carbonmu/parser"
|
9
|
+
require "carbonmu/ipc/ipc_message"
|
10
|
+
require "carbonmu/connection"
|
11
|
+
|
12
|
+
Dir[File.dirname(__FILE__) + '/game_objects/*.rb'].each {|file| require file }
|
4
13
|
|
5
14
|
module CarbonMU
|
6
15
|
class Server
|
@@ -10,7 +19,7 @@ module CarbonMU
|
|
10
19
|
|
11
20
|
finalizer :shutdown
|
12
21
|
|
13
|
-
attr_reader :connections
|
22
|
+
attr_reader :connections, :parser
|
14
23
|
|
15
24
|
def initialize(standalone = false)
|
16
25
|
Internationalization.setup
|
@@ -18,6 +27,8 @@ module CarbonMU
|
|
18
27
|
info "*** Starting CarbonMU game server to connect to edge router port #{CarbonMU.edge_router_receive_port}."
|
19
28
|
CarbonMU.server = Actor.current
|
20
29
|
|
30
|
+
@parser = Parser.new
|
31
|
+
|
21
32
|
Server.initialize_database
|
22
33
|
Server.create_starter_objects
|
23
34
|
|
@@ -55,7 +66,7 @@ module CarbonMU
|
|
55
66
|
|
56
67
|
def handle_command(input, connection_id)
|
57
68
|
connection = @connections.find { |c| c.id == connection_id }
|
58
|
-
|
69
|
+
@parser.parse_and_execute(connection, input)
|
59
70
|
end
|
60
71
|
|
61
72
|
def write_to_connection(connection_id, str)
|
File without changes
|
@@ -10,16 +10,6 @@ describe Command do
|
|
10
10
|
expect(TestCommand.syntaxes).to eq(["bar", /foo/])
|
11
11
|
end
|
12
12
|
|
13
|
-
it "sends syntaxes to parser" do
|
14
|
-
expect(Parser).to receive(:register_syntax).with("baz", duck_type(:syntax))
|
15
|
-
expect(Parser).to receive(:register_syntax).with("bat", duck_type(:syntax))
|
16
|
-
|
17
|
-
class ParseTestCommand < Command
|
18
|
-
syntax "baz"
|
19
|
-
syntax "bat"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
13
|
context "command contexts" do
|
24
14
|
before(:each) do
|
25
15
|
@context = double("Context").as_null_object
|
@@ -1,9 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe
|
3
|
+
describe RebootCommand do
|
4
|
+
context "syntax" do
|
5
|
+
it { expect(command_parse_results("reboot")).to eq(parse_to(RebootCommand)) }
|
6
|
+
end
|
7
|
+
|
4
8
|
it "notifies all of reboot and signals server" do
|
5
9
|
expect(Notify).to receive(:all).with(/Rebooting, please wait/)
|
6
10
|
expect(Server).to receive(:trigger_reboot)
|
7
|
-
|
11
|
+
run_command(RebootCommand)
|
8
12
|
end
|
9
13
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -5,26 +5,27 @@ describe Parser do
|
|
5
5
|
syntax "testing_good_command"
|
6
6
|
end
|
7
7
|
|
8
|
+
let (:parser) { Parser.new }
|
8
9
|
let (:connection) { double(Connection).as_null_object }
|
9
10
|
|
10
11
|
context '.parse_and_execute' do
|
11
12
|
it "handles a bad command" do
|
12
13
|
expect_any_instance_of(UnknownCommand).to receive(:execute)
|
13
14
|
|
14
|
-
|
15
|
+
parser.parse_and_execute(connection, "DEFINITELY_NEVER_GOING_TO_BE_A_GOOD_COMMAND")
|
15
16
|
end
|
16
17
|
|
17
18
|
it "calls .execute on a good command" do
|
18
19
|
expect_any_instance_of(ParseTestCommand).to receive(:execute)
|
19
|
-
|
20
|
+
parser.parse_and_execute(connection, "testing_good_command")
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
23
24
|
context '.register_syntax' do
|
24
25
|
it "remembers a given syntax and class" do
|
25
26
|
class TestEmptyClass; end
|
26
|
-
|
27
|
-
expect(
|
27
|
+
parser.register_syntax("foo", TestEmptyClass)
|
28
|
+
expect(parser.syntaxes["foo"]).to eq(TestEmptyClass)
|
28
29
|
end
|
29
30
|
end
|
30
31
|
end
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
@@ -17,16 +17,22 @@
|
|
17
17
|
|
18
18
|
ENV['MONGOID_ENV'] = "testing"
|
19
19
|
|
20
|
-
require 'bundler'
|
20
|
+
require 'bundler/setup'
|
21
|
+
Bundler.setup
|
22
|
+
|
23
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
24
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
25
|
+
require 'carbonmu'
|
26
|
+
include CarbonMU
|
27
|
+
|
28
|
+
require 'mongoid'
|
21
29
|
require 'timecop'
|
22
|
-
require_relative '../lib/carbonmu.rb'
|
23
30
|
require 'pry'
|
24
31
|
require 'mongoid-rspec'
|
25
32
|
require 'database_cleaner'
|
26
33
|
|
27
34
|
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}
|
28
35
|
|
29
|
-
include CarbonMU
|
30
36
|
CarbonMU.configure do |c|
|
31
37
|
c.logger = Logger.new(nil)
|
32
38
|
end
|
data/spec/support/helpers.rb
CHANGED
@@ -6,10 +6,16 @@ module Helpers
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def command_parse_results(raw_command)
|
9
|
-
Parser.parse(raw_command)
|
9
|
+
Parser.new.parse(raw_command)
|
10
10
|
end
|
11
11
|
|
12
12
|
def parse_to(klass, params={})
|
13
13
|
[klass, params]
|
14
14
|
end
|
15
|
+
|
16
|
+
def run_command(klass, params = {})
|
17
|
+
c = Connection.new(1)
|
18
|
+
cc = CommandContext.new({enacting_connection: c, params: params})
|
19
|
+
klass.new(cc).execute
|
20
|
+
end
|
15
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carbonmu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Krajcar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid-io
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.16.1
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: require_all
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.3.2
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 1.3.2
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: multi_json
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -263,7 +249,6 @@ files:
|
|
263
249
|
- ".ruby-version"
|
264
250
|
- ".travis.yml"
|
265
251
|
- Gemfile
|
266
|
-
- Gemfile.lock
|
267
252
|
- Guardfile
|
268
253
|
- LICENSE.txt
|
269
254
|
- README.md
|
@@ -276,66 +261,64 @@ files:
|
|
276
261
|
- config/locales/nl.yml
|
277
262
|
- doc/architecture.png
|
278
263
|
- lib/carbonmu.rb
|
279
|
-
- lib/
|
280
|
-
- lib/
|
281
|
-
- lib/
|
282
|
-
- lib/commands/
|
283
|
-
- lib/commands/
|
284
|
-
- lib/commands/
|
285
|
-
- lib/
|
286
|
-
- lib/
|
287
|
-
- lib/
|
288
|
-
- lib/
|
289
|
-
- lib/
|
290
|
-
- lib/
|
291
|
-
- lib/
|
292
|
-
- lib/
|
264
|
+
- lib/carbonmu/cli.rb
|
265
|
+
- lib/carbonmu/command.rb
|
266
|
+
- lib/carbonmu/command_context.rb
|
267
|
+
- lib/carbonmu/commands/locale_command.rb
|
268
|
+
- lib/carbonmu/commands/ping_command.rb
|
269
|
+
- lib/carbonmu/commands/reboot_command.rb
|
270
|
+
- lib/carbonmu/commands/say_command.rb
|
271
|
+
- lib/carbonmu/commands/unknown_command.rb
|
272
|
+
- lib/carbonmu/configuration.rb
|
273
|
+
- lib/carbonmu/connection.rb
|
274
|
+
- lib/carbonmu/edge_router/edge_connection.rb
|
275
|
+
- lib/carbonmu/edge_router/edge_router.rb
|
276
|
+
- lib/carbonmu/edge_router/edge_router_supervision_group.rb
|
277
|
+
- lib/carbonmu/edge_router/telnet_connection.rb
|
278
|
+
- lib/carbonmu/edge_router/telnet_receptor.rb
|
279
|
+
- lib/carbonmu/game_object.rb
|
280
|
+
- lib/carbonmu/game_objects/container.rb
|
281
|
+
- lib/carbonmu/game_objects/exit.rb
|
282
|
+
- lib/carbonmu/game_objects/movable.rb
|
283
|
+
- lib/carbonmu/game_objects/player.rb
|
284
|
+
- lib/carbonmu/game_objects/room.rb
|
285
|
+
- lib/carbonmu/game_objects/thing.rb
|
286
|
+
- lib/carbonmu/interactions/notify.rb
|
287
|
+
- lib/carbonmu/internationalization.rb
|
288
|
+
- lib/carbonmu/ipc/carbon_ipc_socket.rb
|
289
|
+
- lib/carbonmu/ipc/ipc_message.rb
|
290
|
+
- lib/carbonmu/ipc/read_socket.rb
|
291
|
+
- lib/carbonmu/ipc/write_socket.rb
|
292
|
+
- lib/carbonmu/parser.rb
|
293
|
+
- lib/carbonmu/server.rb
|
294
|
+
- lib/carbonmu/server_supervision_group.rb
|
295
|
+
- lib/carbonmu/version.rb
|
293
296
|
- lib/core_ext/match_data.rb
|
294
297
|
- lib/core_ext/string.rb
|
295
|
-
- lib/edge_router/edge_connection.rb
|
296
|
-
- lib/edge_router/edge_router.rb
|
297
|
-
- lib/edge_router/edge_router_supervision_group.rb
|
298
|
-
- lib/edge_router/telnet_connection.rb
|
299
|
-
- lib/edge_router/telnet_receptor.rb
|
300
|
-
- lib/errors.rb
|
301
|
-
- lib/game_objects/container.rb
|
302
|
-
- lib/game_objects/exit.rb
|
303
|
-
- lib/game_objects/game_object.rb
|
304
|
-
- lib/game_objects/movable.rb
|
305
|
-
- lib/game_objects/player.rb
|
306
|
-
- lib/game_objects/room.rb
|
307
|
-
- lib/game_objects/thing.rb
|
308
|
-
- lib/interactions/notify.rb
|
309
|
-
- lib/interactions/reboot.rb
|
310
|
-
- lib/ipc/carbon_ipc_socket.rb
|
311
|
-
- lib/ipc/ipc_message.rb
|
312
|
-
- lib/ipc/read_socket.rb
|
313
|
-
- lib/ipc/write_socket.rb
|
314
|
-
- lib/version.rb
|
315
298
|
- spec/carbonmu_spec.rb
|
316
299
|
- spec/i18n_spec.rb
|
317
|
-
- spec/lib/
|
318
|
-
- spec/lib/
|
319
|
-
- spec/lib/
|
320
|
-
- spec/lib/
|
321
|
-
- spec/lib/
|
322
|
-
- spec/lib/
|
323
|
-
- spec/lib/
|
324
|
-
- spec/lib/
|
325
|
-
- spec/lib/
|
326
|
-
- spec/lib/game_objects/
|
327
|
-
- spec/lib/game_objects/
|
328
|
-
- spec/lib/game_objects/
|
329
|
-
- spec/lib/game_objects/
|
330
|
-
- spec/lib/game_objects/
|
331
|
-
- spec/lib/
|
332
|
-
- spec/lib/
|
333
|
-
- spec/lib/
|
334
|
-
- spec/lib/
|
335
|
-
- spec/lib/ipc/
|
336
|
-
- spec/lib/ipc/
|
337
|
-
- spec/lib/
|
338
|
-
- spec/lib/
|
300
|
+
- spec/lib/carbonmu/command_context_spec.rb
|
301
|
+
- spec/lib/carbonmu/command_spec.rb
|
302
|
+
- spec/lib/carbonmu/commands/reboot_command_spec.rb
|
303
|
+
- spec/lib/carbonmu/commands/say_command_spec.rb
|
304
|
+
- spec/lib/carbonmu/configuration_spec.rb
|
305
|
+
- spec/lib/carbonmu/connection_spec.rb
|
306
|
+
- spec/lib/carbonmu/edge_router/edge_connection_spec.rb
|
307
|
+
- spec/lib/carbonmu/game_object_spec.rb
|
308
|
+
- spec/lib/carbonmu/game_objects/container_spec.rb
|
309
|
+
- spec/lib/carbonmu/game_objects/exit_spec.rb
|
310
|
+
- spec/lib/carbonmu/game_objects/movable_spec.rb
|
311
|
+
- spec/lib/carbonmu/game_objects/player_spec.rb
|
312
|
+
- spec/lib/carbonmu/game_objects/room_spec.rb
|
313
|
+
- spec/lib/carbonmu/game_objects/thing_spec.rb
|
314
|
+
- spec/lib/carbonmu/interactions/notify_spec.rb
|
315
|
+
- spec/lib/carbonmu/internationalization_spec.rb
|
316
|
+
- spec/lib/carbonmu/ipc/carbon_ipc_socket_spec.rb
|
317
|
+
- spec/lib/carbonmu/ipc/ipc_message_spec.rb
|
318
|
+
- spec/lib/carbonmu/ipc/read_socket_spec.bak
|
319
|
+
- spec/lib/carbonmu/ipc/write_socket_spec.bak
|
320
|
+
- spec/lib/carbonmu/parser_spec.rb
|
321
|
+
- spec/lib/carbonmu/server_spec.rb
|
339
322
|
- spec/spec_helper.rb
|
340
323
|
- spec/support/helpers.rb
|
341
324
|
- spec/support/matchers/be_boolean.rb
|
@@ -370,28 +353,28 @@ summary: CarbonMU is a general-purpose, extendable MUD/MUSH server written in Ru
|
|
370
353
|
test_files:
|
371
354
|
- spec/carbonmu_spec.rb
|
372
355
|
- spec/i18n_spec.rb
|
373
|
-
- spec/lib/
|
374
|
-
- spec/lib/
|
375
|
-
- spec/lib/
|
376
|
-
- spec/lib/
|
377
|
-
- spec/lib/
|
378
|
-
- spec/lib/
|
379
|
-
- spec/lib/
|
380
|
-
- spec/lib/
|
381
|
-
- spec/lib/
|
382
|
-
- spec/lib/game_objects/
|
383
|
-
- spec/lib/game_objects/
|
384
|
-
- spec/lib/game_objects/
|
385
|
-
- spec/lib/game_objects/
|
386
|
-
- spec/lib/game_objects/
|
387
|
-
- spec/lib/
|
388
|
-
- spec/lib/
|
389
|
-
- spec/lib/
|
390
|
-
- spec/lib/
|
391
|
-
- spec/lib/ipc/
|
392
|
-
- spec/lib/ipc/
|
393
|
-
- spec/lib/
|
394
|
-
- spec/lib/
|
356
|
+
- spec/lib/carbonmu/command_context_spec.rb
|
357
|
+
- spec/lib/carbonmu/command_spec.rb
|
358
|
+
- spec/lib/carbonmu/commands/reboot_command_spec.rb
|
359
|
+
- spec/lib/carbonmu/commands/say_command_spec.rb
|
360
|
+
- spec/lib/carbonmu/configuration_spec.rb
|
361
|
+
- spec/lib/carbonmu/connection_spec.rb
|
362
|
+
- spec/lib/carbonmu/edge_router/edge_connection_spec.rb
|
363
|
+
- spec/lib/carbonmu/game_object_spec.rb
|
364
|
+
- spec/lib/carbonmu/game_objects/container_spec.rb
|
365
|
+
- spec/lib/carbonmu/game_objects/exit_spec.rb
|
366
|
+
- spec/lib/carbonmu/game_objects/movable_spec.rb
|
367
|
+
- spec/lib/carbonmu/game_objects/player_spec.rb
|
368
|
+
- spec/lib/carbonmu/game_objects/room_spec.rb
|
369
|
+
- spec/lib/carbonmu/game_objects/thing_spec.rb
|
370
|
+
- spec/lib/carbonmu/interactions/notify_spec.rb
|
371
|
+
- spec/lib/carbonmu/internationalization_spec.rb
|
372
|
+
- spec/lib/carbonmu/ipc/carbon_ipc_socket_spec.rb
|
373
|
+
- spec/lib/carbonmu/ipc/ipc_message_spec.rb
|
374
|
+
- spec/lib/carbonmu/ipc/read_socket_spec.bak
|
375
|
+
- spec/lib/carbonmu/ipc/write_socket_spec.bak
|
376
|
+
- spec/lib/carbonmu/parser_spec.rb
|
377
|
+
- spec/lib/carbonmu/server_spec.rb
|
395
378
|
- spec/spec_helper.rb
|
396
379
|
- spec/support/helpers.rb
|
397
380
|
- spec/support/matchers/be_boolean.rb
|
@@ -399,4 +382,3 @@ test_files:
|
|
399
382
|
- spec/support/shared_examples/container.rb
|
400
383
|
- spec/support/shared_examples/game_object.rb
|
401
384
|
- spec/support/shared_examples/movable.rb
|
402
|
-
has_rdoc:
|
data/Gemfile.lock
DELETED
@@ -1,159 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
carbonmu (0.0.1)
|
5
|
-
celluloid-io (~> 0.16.1)
|
6
|
-
celluloid-zmq (~> 0.16.0)
|
7
|
-
colorize (~> 0.7.3)
|
8
|
-
i18n (~> 0.7.0)
|
9
|
-
mongoid (~> 4.0.2)
|
10
|
-
multi_json (~> 1.9.2)
|
11
|
-
require_all (~> 1.3.2)
|
12
|
-
|
13
|
-
GEM
|
14
|
-
remote: https://rubygems.org/
|
15
|
-
specs:
|
16
|
-
activemodel (4.2.0)
|
17
|
-
activesupport (= 4.2.0)
|
18
|
-
builder (~> 3.1)
|
19
|
-
activesupport (4.2.0)
|
20
|
-
i18n (~> 0.7)
|
21
|
-
json (~> 1.7, >= 1.7.7)
|
22
|
-
minitest (~> 5.1)
|
23
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
24
|
-
tzinfo (~> 1.1)
|
25
|
-
awesome_print (1.6.1)
|
26
|
-
bson (2.3.0)
|
27
|
-
builder (3.2.2)
|
28
|
-
celluloid (0.16.0)
|
29
|
-
timers (~> 4.0.0)
|
30
|
-
celluloid-io (0.16.2)
|
31
|
-
celluloid (>= 0.16.0)
|
32
|
-
nio4r (>= 1.1.0)
|
33
|
-
celluloid-zmq (0.16.0)
|
34
|
-
celluloid (>= 0.15.0)
|
35
|
-
ffi
|
36
|
-
ffi-rzmq
|
37
|
-
coderay (1.1.0)
|
38
|
-
colorize (0.7.5)
|
39
|
-
connection_pool (2.1.1)
|
40
|
-
database_cleaner (1.3.0)
|
41
|
-
diff-lcs (1.2.5)
|
42
|
-
easy_translate (0.5.0)
|
43
|
-
json
|
44
|
-
thread
|
45
|
-
thread_safe
|
46
|
-
erubis (2.7.0)
|
47
|
-
ffi (1.9.6)
|
48
|
-
ffi-rzmq (2.0.4)
|
49
|
-
ffi-rzmq-core (>= 1.0.1)
|
50
|
-
ffi-rzmq-core (1.0.3)
|
51
|
-
ffi (~> 1.9)
|
52
|
-
formatador (0.2.5)
|
53
|
-
guard (2.12.4)
|
54
|
-
formatador (>= 0.2.4)
|
55
|
-
listen (~> 2.7)
|
56
|
-
lumberjack (~> 1.0)
|
57
|
-
nenv (~> 0.1)
|
58
|
-
notiffany (~> 0.0)
|
59
|
-
pry (>= 0.9.12)
|
60
|
-
shellany (~> 0.0)
|
61
|
-
thor (>= 0.18.1)
|
62
|
-
guard-compat (1.2.1)
|
63
|
-
guard-rspec (4.5.0)
|
64
|
-
guard (~> 2.1)
|
65
|
-
guard-compat (~> 1.1)
|
66
|
-
rspec (>= 2.99.0, < 4.0)
|
67
|
-
highline (1.7.1)
|
68
|
-
hitimes (1.2.2)
|
69
|
-
i18n (0.7.0)
|
70
|
-
i18n-tasks (0.7.12)
|
71
|
-
activesupport
|
72
|
-
easy_translate (>= 0.5.0)
|
73
|
-
erubis
|
74
|
-
highline
|
75
|
-
i18n
|
76
|
-
slop (~> 3.5)
|
77
|
-
term-ansicolor
|
78
|
-
terminal-table
|
79
|
-
json (1.8.2)
|
80
|
-
listen (2.8.5)
|
81
|
-
celluloid (>= 0.15.2)
|
82
|
-
rb-fsevent (>= 0.9.3)
|
83
|
-
rb-inotify (>= 0.9)
|
84
|
-
lumberjack (1.0.9)
|
85
|
-
method_source (0.8.2)
|
86
|
-
minitest (5.5.1)
|
87
|
-
mongoid (4.0.2)
|
88
|
-
activemodel (~> 4.0)
|
89
|
-
moped (~> 2.0.0)
|
90
|
-
origin (~> 2.1)
|
91
|
-
tzinfo (>= 0.3.37)
|
92
|
-
mongoid-rspec (2.1.0)
|
93
|
-
mongoid (~> 4.0.0)
|
94
|
-
rake
|
95
|
-
rspec (~> 3.1)
|
96
|
-
moped (2.0.4)
|
97
|
-
bson (~> 2.2)
|
98
|
-
connection_pool (~> 2.0)
|
99
|
-
optionable (~> 0.2.0)
|
100
|
-
multi_json (1.9.3)
|
101
|
-
nenv (0.2.0)
|
102
|
-
nio4r (1.1.0)
|
103
|
-
notiffany (0.0.6)
|
104
|
-
nenv (~> 0.1)
|
105
|
-
shellany (~> 0.0)
|
106
|
-
optionable (0.2.0)
|
107
|
-
origin (2.1.1)
|
108
|
-
pry (0.10.1)
|
109
|
-
coderay (~> 1.1.0)
|
110
|
-
method_source (~> 0.8.1)
|
111
|
-
slop (~> 3.4)
|
112
|
-
rake (10.4.2)
|
113
|
-
rb-fsevent (0.9.4)
|
114
|
-
rb-inotify (0.9.5)
|
115
|
-
ffi (>= 0.5.0)
|
116
|
-
require_all (1.3.2)
|
117
|
-
rspec (3.2.0)
|
118
|
-
rspec-core (~> 3.2.0)
|
119
|
-
rspec-expectations (~> 3.2.0)
|
120
|
-
rspec-mocks (~> 3.2.0)
|
121
|
-
rspec-core (3.2.1)
|
122
|
-
rspec-support (~> 3.2.0)
|
123
|
-
rspec-expectations (3.2.0)
|
124
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
125
|
-
rspec-support (~> 3.2.0)
|
126
|
-
rspec-mocks (3.2.1)
|
127
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
128
|
-
rspec-support (~> 3.2.0)
|
129
|
-
rspec-support (3.2.2)
|
130
|
-
shellany (0.0.1)
|
131
|
-
slop (3.6.0)
|
132
|
-
term-ansicolor (1.3.0)
|
133
|
-
tins (~> 1.0)
|
134
|
-
terminal-table (1.4.5)
|
135
|
-
thor (0.19.1)
|
136
|
-
thread (0.1.5)
|
137
|
-
thread_safe (0.3.4)
|
138
|
-
timecop (0.7.3)
|
139
|
-
timers (4.0.1)
|
140
|
-
hitimes
|
141
|
-
tins (1.3.5)
|
142
|
-
tzinfo (1.2.2)
|
143
|
-
thread_safe (~> 0.1)
|
144
|
-
|
145
|
-
PLATFORMS
|
146
|
-
ruby
|
147
|
-
|
148
|
-
DEPENDENCIES
|
149
|
-
awesome_print
|
150
|
-
carbonmu!
|
151
|
-
database_cleaner (~> 1.3.0)
|
152
|
-
guard (~> 2.12.4)
|
153
|
-
guard-rspec (~> 4.5.0)
|
154
|
-
i18n-tasks (~> 0.7.12)
|
155
|
-
mongoid-rspec
|
156
|
-
pry
|
157
|
-
rake
|
158
|
-
rspec (~> 3.2.0)
|
159
|
-
timecop
|
data/lib/core/parser.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
module CarbonMU
|
2
|
-
module Parser
|
3
|
-
def self.parse_and_execute(enacting_connection, input)
|
4
|
-
command_class, params = parse(input)
|
5
|
-
|
6
|
-
context = CommandContext.new(enacting_connection: enacting_connection, raw_command: input, params: params)
|
7
|
-
command_class.new(context).execute
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.parse(input)
|
11
|
-
syntax_match_data = {}
|
12
|
-
syntax_and_class = @@syntaxes.detect { |syntax, klass| syntax_match_data = syntax.match(input) }
|
13
|
-
|
14
|
-
command_class = syntax_and_class.nil? ? UnknownCommand : syntax_and_class[1]
|
15
|
-
syntax_match_data ||= {} # if no syntaxes matched
|
16
|
-
|
17
|
-
[command_class, syntax_match_data.to_hash]
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.register_syntax(syntax, klass)
|
21
|
-
@@syntaxes ||= {}
|
22
|
-
@@syntaxes[syntax] = klass
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.syntaxes
|
26
|
-
@@syntaxes
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/lib/errors.rb
DELETED