carbonmu 0.0.2 → 0.0.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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Rakefile +3 -2
  4. data/bin/carbonmu +2 -2
  5. data/carbonmu.gemspec +1 -2
  6. data/lib/carbonmu.rb +4 -8
  7. data/lib/{cli → carbonmu}/cli.rb +0 -0
  8. data/lib/{core → carbonmu}/command.rb +13 -2
  9. data/lib/{core → carbonmu}/command_context.rb +0 -0
  10. data/lib/{commands → carbonmu/commands}/locale_command.rb +2 -0
  11. data/lib/{commands → carbonmu/commands}/ping_command.rb +2 -0
  12. data/lib/{interactions/reboot.rb → carbonmu/commands/reboot_command.rb} +6 -2
  13. data/lib/{commands → carbonmu/commands}/say_command.rb +2 -0
  14. data/lib/{commands → carbonmu/commands}/unknown_command.rb +2 -0
  15. data/lib/{core → carbonmu}/configuration.rb +0 -0
  16. data/lib/{core → carbonmu}/connection.rb +0 -0
  17. data/lib/{edge_router → carbonmu/edge_router}/edge_connection.rb +0 -0
  18. data/lib/{edge_router → carbonmu/edge_router}/edge_router.rb +3 -0
  19. data/lib/{edge_router → carbonmu/edge_router}/edge_router_supervision_group.rb +4 -0
  20. data/lib/{edge_router → carbonmu/edge_router}/telnet_connection.rb +1 -0
  21. data/lib/{edge_router → carbonmu/edge_router}/telnet_receptor.rb +3 -2
  22. data/lib/{game_objects → carbonmu}/game_object.rb +0 -0
  23. data/lib/{game_objects → carbonmu/game_objects}/container.rb +0 -0
  24. data/lib/{game_objects → carbonmu/game_objects}/exit.rb +2 -0
  25. data/lib/{game_objects → carbonmu/game_objects}/movable.rb +0 -0
  26. data/lib/{game_objects → carbonmu/game_objects}/player.rb +3 -0
  27. data/lib/{game_objects → carbonmu/game_objects}/room.rb +2 -0
  28. data/lib/{game_objects → carbonmu/game_objects}/thing.rb +3 -0
  29. data/lib/{interactions → carbonmu/interactions}/notify.rb +0 -0
  30. data/lib/{core → carbonmu}/internationalization.rb +0 -0
  31. data/lib/{ipc → carbonmu/ipc}/carbon_ipc_socket.rb +0 -0
  32. data/lib/{ipc → carbonmu/ipc}/ipc_message.rb +0 -0
  33. data/lib/{ipc → carbonmu/ipc}/read_socket.rb +5 -2
  34. data/lib/{ipc → carbonmu/ipc}/write_socket.rb +4 -1
  35. data/lib/carbonmu/parser.rb +42 -0
  36. data/lib/{core → carbonmu}/server.rb +14 -3
  37. data/lib/{core → carbonmu}/server_supervision_group.rb +2 -0
  38. data/lib/{version.rb → carbonmu/version.rb} +1 -1
  39. data/spec/lib/{core → carbonmu}/command_context_spec.rb +0 -0
  40. data/spec/lib/{core → carbonmu}/command_spec.rb +0 -10
  41. data/spec/lib/{interactions/reboot_spec.rb → carbonmu/commands/reboot_command_spec.rb} +6 -2
  42. data/spec/lib/{commands → carbonmu/commands}/say_command_spec.rb +0 -0
  43. data/spec/lib/{core → carbonmu}/configuration_spec.rb +0 -0
  44. data/spec/lib/{core → carbonmu}/connection_spec.rb +0 -0
  45. data/spec/lib/{edge_router → carbonmu/edge_router}/edge_connection_spec.rb +0 -0
  46. data/spec/lib/{game_objects → carbonmu}/game_object_spec.rb +0 -0
  47. data/spec/lib/{game_objects → carbonmu/game_objects}/container_spec.rb +0 -0
  48. data/spec/lib/{game_objects → carbonmu/game_objects}/exit_spec.rb +0 -0
  49. data/spec/lib/{game_objects → carbonmu/game_objects}/movable_spec.rb +0 -0
  50. data/spec/lib/{game_objects → carbonmu/game_objects}/player_spec.rb +0 -0
  51. data/spec/lib/{game_objects → carbonmu/game_objects}/room_spec.rb +0 -0
  52. data/spec/lib/{game_objects → carbonmu/game_objects}/thing_spec.rb +0 -0
  53. data/spec/lib/{interactions → carbonmu/interactions}/notify_spec.rb +0 -0
  54. data/spec/lib/{core → carbonmu}/internationalization_spec.rb +0 -0
  55. data/spec/lib/{ipc → carbonmu/ipc}/carbon_ipc_socket_spec.rb +0 -0
  56. data/spec/lib/{ipc → carbonmu/ipc}/ipc_message_spec.rb +0 -0
  57. data/spec/lib/{ipc → carbonmu/ipc}/read_socket_spec.bak +0 -0
  58. data/spec/lib/{ipc → carbonmu/ipc}/write_socket_spec.bak +0 -0
  59. data/spec/lib/{core → carbonmu}/parser_spec.rb +5 -4
  60. data/spec/lib/{core → carbonmu}/server_spec.rb +0 -0
  61. data/spec/spec_helper.rb +9 -3
  62. data/spec/support/helpers.rb +7 -1
  63. metadata +78 -96
  64. data/Gemfile.lock +0 -159
  65. data/lib/commands/reboot_command.rb +0 -9
  66. data/lib/core/parser.rb +0 -29
  67. data/lib/errors.rb +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b4d4a83001aaf98215282b5a850822d56915f89
4
- data.tar.gz: b2844a5cefe2228312075bb0702e726866e61733
3
+ metadata.gz: 787de7bd27a377385f003218df86ac84e3d9dc95
4
+ data.tar.gz: c64cf9f3dd0048b0ebbb57475c2bf8bf3e968b6d
5
5
  SHA512:
6
- metadata.gz: 061181719392b61fb2a05dce2de3de5d95b60bfbca03673ed17153fcb37bb3d1b064b52933f3a5358361582b62da896e6cf638a8660f5e711455791f5bba8269
7
- data.tar.gz: e5ee87d82e8f7ba9d3f742aff2eab23413cdf1fa8794255befc15c6980bca1f4abb7fd9b4b61f8abdda770ffeb86a67543c7ef4f63932be8dd0e4ab951b1cfd2
6
+ metadata.gz: 8095cf0352b004008ef17377f84b4041f74b8404c77a949c69607748cebf362b3872e4225d3d153dffdb78e9320d6e3f57b00cc82adb7c5ae50c990fe7876774
7
+ data.tar.gz: b871309893b1577141c5211cd7652861c5b670777c451fd79c428fbc413559798fe78f540f31471c32667f893fb233b1c165ac344ff8efc63b9e78d58930282d
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ Gemfile.lock
1
2
  .yardoc
2
3
  .*.swp
3
4
  coverage
data/Rakefile CHANGED
@@ -1,5 +1,4 @@
1
- $:.push('lib')
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
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $LOAD_PATH.unshift("../lib")
4
- require 'carbonmu'
3
+ require "carbonmu"
4
+ require "carbonmu/cli"
5
5
 
6
6
  CarbonMU::CLI.new(ARGV).execute
@@ -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"
@@ -1,11 +1,7 @@
1
- require 'rubygems'
2
- require 'bundler/setup'
3
-
4
- require 'require_all'
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
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
 
@@ -1,3 +1,5 @@
1
+ require "carbonmu/interactions/notify"
2
+
1
3
  # TODO TEMP
2
4
  module CarbonMU
3
5
  class LocaleCommand < Command
@@ -1,3 +1,5 @@
1
+ require "carbonmu/interactions/notify"
2
+
1
3
  module CarbonMU
2
4
  class PingCommand < Command
3
5
  syntax "ping"
@@ -1,6 +1,10 @@
1
+ require "carbonmu/interactions/notify"
2
+
1
3
  module CarbonMU
2
- class Reboot
3
- def self.reboot
4
+ class RebootCommand < Command
5
+ syntax "reboot"
6
+
7
+ def execute
4
8
  Notify.all("SERVER: ".white.on_red + "Rebooting, please wait...")
5
9
  Server.trigger_reboot
6
10
  end
@@ -1,3 +1,5 @@
1
+ require "carbonmu/interactions/notify"
2
+
1
3
  module CarbonMU
2
4
  class SayCommand < Command
3
5
  syntax /^say (?<text>.*)/
@@ -1,3 +1,5 @@
1
+ require "carbonmu/interactions/notify"
2
+
1
3
  module CarbonMU
2
4
  class UnknownCommand < Command
3
5
  def execute
File without changes
File without changes
@@ -1,6 +1,9 @@
1
1
  require 'celluloid/autostart'
2
2
  require 'celluloid/io'
3
3
  require 'celluloid/zmq'
4
+ require "carbonmu/edge_router/telnet_receptor"
5
+ require "carbonmu/ipc/read_socket"
6
+ require "carbonmu/ipc/write_socket"
4
7
 
5
8
  module CarbonMU
6
9
  class EdgeRouter
@@ -1,3 +1,7 @@
1
+ require "carbonmu/edge_router/edge_router"
2
+
3
+ Celluloid::ZMQ.init
4
+
1
5
  module CarbonMU
2
6
  class EdgeRouterSupervisionGroup < Celluloid::SupervisionGroup
3
7
  supervise EdgeRouter, as: :edge_router, args: ["0.0.0.0", 8421]
@@ -1,4 +1,5 @@
1
1
  require 'forwardable'
2
+ require "carbonmu/edge_router/edge_connection"
2
3
 
3
4
  module CarbonMU
4
5
  class TelnetConnection < EdgeConnection
@@ -1,5 +1,6 @@
1
- require 'celluloid/autostart'
2
- require 'celluloid/io'
1
+ require "celluloid/autostart"
2
+ require "celluloid/io"
3
+ require "carbonmu/edge_router/telnet_connection"
3
4
 
4
5
  module CarbonMU
5
6
  class TelnetReceptor
@@ -1,3 +1,5 @@
1
+ require "carbonmu/game_objects/movable"
2
+
1
3
  module CarbonMU
2
4
  class Exit < GameObject
3
5
  include Mongoid::Document
@@ -1,3 +1,6 @@
1
+ require "carbonmu/game_objects/movable"
2
+ require "carbonmu/game_objects/container"
3
+
1
4
  module CarbonMU
2
5
  class Player < GameObject
3
6
  include Mongoid::Document
@@ -1,3 +1,5 @@
1
+ require "carbonmu/game_objects/container"
2
+
1
3
  module CarbonMU
2
4
  class Room < GameObject
3
5
  include Mongoid::Document
@@ -1,3 +1,6 @@
1
+ require "carbonmu/game_objects/movable"
2
+ require "carbonmu/game_objects/container"
3
+
1
4
  module CarbonMU
2
5
  class Thing < GameObject
3
6
  include Mongoid::Document
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
@@ -1,3 +1,6 @@
1
+ require "carbonmu/ipc/carbon_ipc_socket"
2
+ require "celluloid/zmq"
3
+
1
4
  module CarbonMU
2
5
  class WriteSocket < CarbonIPCSocket
3
6
  def initialize(port = '15000')
@@ -9,4 +12,4 @@ module CarbonMU
9
12
  @zmq_socket.send(message)
10
13
  end
11
14
  end
12
- end
15
+ 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 'mongoid'
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
- Parser.parse_and_execute(connection, input)
69
+ @parser.parse_and_execute(connection, input)
59
70
  end
60
71
 
61
72
  def write_to_connection(connection_id, str)
@@ -1,3 +1,5 @@
1
+ require "carbonmu/server"
2
+
1
3
  module CarbonMU
2
4
  class ServerSupervisionGroup < Celluloid::SupervisionGroup
3
5
  supervise Server, as: :server
@@ -1,7 +1,7 @@
1
1
  module CarbonMU
2
2
  VERSION_MAJOR = 0
3
3
  VERSION_MINOR = 0
4
- VERSION_TINY = 2
4
+ VERSION_TINY = 3
5
5
 
6
6
  VERSION = "#{VERSION_MAJOR}.#{VERSION_MINOR}.#{VERSION_TINY}"
7
7
  end
@@ -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 Reboot do
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
- Reboot.reboot
11
+ run_command(RebootCommand)
8
12
  end
9
13
  end
@@ -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
- subject.parse_and_execute(connection, "DEFINITELY_NEVER_GOING_TO_BE_A_GOOD_COMMAND")
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
- subject.parse_and_execute(connection, "testing_good_command")
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
- Parser.register_syntax("foo", TestEmptyClass)
27
- expect(Parser.syntaxes["foo"]).to eq(TestEmptyClass)
27
+ parser.register_syntax("foo", TestEmptyClass)
28
+ expect(parser.syntaxes["foo"]).to eq(TestEmptyClass)
28
29
  end
29
30
  end
30
31
  end
@@ -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
@@ -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.2
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-25 00:00:00.000000000 Z
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/cli/cli.rb
280
- - lib/commands/locale_command.rb
281
- - lib/commands/ping_command.rb
282
- - lib/commands/reboot_command.rb
283
- - lib/commands/say_command.rb
284
- - lib/commands/unknown_command.rb
285
- - lib/core/command.rb
286
- - lib/core/command_context.rb
287
- - lib/core/configuration.rb
288
- - lib/core/connection.rb
289
- - lib/core/internationalization.rb
290
- - lib/core/parser.rb
291
- - lib/core/server.rb
292
- - lib/core/server_supervision_group.rb
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/commands/say_command_spec.rb
318
- - spec/lib/core/command_context_spec.rb
319
- - spec/lib/core/command_spec.rb
320
- - spec/lib/core/configuration_spec.rb
321
- - spec/lib/core/connection_spec.rb
322
- - spec/lib/core/internationalization_spec.rb
323
- - spec/lib/core/parser_spec.rb
324
- - spec/lib/core/server_spec.rb
325
- - spec/lib/edge_router/edge_connection_spec.rb
326
- - spec/lib/game_objects/container_spec.rb
327
- - spec/lib/game_objects/exit_spec.rb
328
- - spec/lib/game_objects/game_object_spec.rb
329
- - spec/lib/game_objects/movable_spec.rb
330
- - spec/lib/game_objects/player_spec.rb
331
- - spec/lib/game_objects/room_spec.rb
332
- - spec/lib/game_objects/thing_spec.rb
333
- - spec/lib/interactions/notify_spec.rb
334
- - spec/lib/interactions/reboot_spec.rb
335
- - spec/lib/ipc/carbon_ipc_socket_spec.rb
336
- - spec/lib/ipc/ipc_message_spec.rb
337
- - spec/lib/ipc/read_socket_spec.bak
338
- - spec/lib/ipc/write_socket_spec.bak
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/commands/say_command_spec.rb
374
- - spec/lib/core/command_context_spec.rb
375
- - spec/lib/core/command_spec.rb
376
- - spec/lib/core/configuration_spec.rb
377
- - spec/lib/core/connection_spec.rb
378
- - spec/lib/core/internationalization_spec.rb
379
- - spec/lib/core/parser_spec.rb
380
- - spec/lib/core/server_spec.rb
381
- - spec/lib/edge_router/edge_connection_spec.rb
382
- - spec/lib/game_objects/container_spec.rb
383
- - spec/lib/game_objects/exit_spec.rb
384
- - spec/lib/game_objects/game_object_spec.rb
385
- - spec/lib/game_objects/movable_spec.rb
386
- - spec/lib/game_objects/player_spec.rb
387
- - spec/lib/game_objects/room_spec.rb
388
- - spec/lib/game_objects/thing_spec.rb
389
- - spec/lib/interactions/notify_spec.rb
390
- - spec/lib/interactions/reboot_spec.rb
391
- - spec/lib/ipc/carbon_ipc_socket_spec.rb
392
- - spec/lib/ipc/ipc_message_spec.rb
393
- - spec/lib/ipc/read_socket_spec.bak
394
- - spec/lib/ipc/write_socket_spec.bak
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:
@@ -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
@@ -1,9 +0,0 @@
1
- module CarbonMU
2
- class RebootCommand < Command
3
- syntax "reboot"
4
-
5
- def execute
6
- Reboot.reboot
7
- end
8
- end
9
- end
@@ -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
@@ -1,4 +0,0 @@
1
- module CarbonMU
2
- class ObjectNotFoundError < StandardError; end
3
- class InvalidObjectError < StandardError; end
4
- end