Skip to content
Browse files

Updated Cucub::Protocol::SpecificationSet

  • Loading branch information...
1 parent e497075 commit 0b1d009a016dac2da8e7f3fa93a1aa2a6ed63a42 @krakatoa krakatoa committed Oct 22, 2012
Showing with 42 additions and 13 deletions.
  1. +1 −1 Gemfile
  2. +1 −1 Gemfile.lock
  3. +20 −10 cucub-protocol.gemspec
  4. +2 −0 lib/cucub-protocol.rb
  5. +6 −1 lib/protocol/loader.rb
  6. +12 −0 lib/protocol/specification_set.rb
View
2 Gemfile
@@ -10,7 +10,7 @@ gem "msgpack"
# Include everything needed to run rake, tests, features, etc.
group :development do
gem "rspec"
- gem "bundler", "~> 1.1.3"
+ gem "bundler", "~> 1.2.1"
gem "jeweler", "~> 1.8.4"
gem "simplecov"
end
View
2 Gemfile.lock
@@ -32,7 +32,7 @@ PLATFORMS
ruby
DEPENDENCIES
- bundler (~> 1.1.3)
+ bundler (~> 1.2.1)
inifile
jeweler (~> 1.8.4)
msgpack
View
30 cucub-protocol.gemspec
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Fernando Alonso"]
- s.date = "2012-09-02"
+ s.date = "2012-10-22"
s.description = "longer description of your gem"
s.email = "krakatoa1987@gmail.com"
s.extra_rdoc_files = [
@@ -19,13 +19,23 @@ Gem::Specification.new do |s|
s.files = [
".document",
"Gemfile",
+ "Gemfile.lock",
"LICENSE.txt",
"README.rdoc",
"Rakefile",
"VERSION",
+ "cucub-protocol.gemspec",
"lib/cucub-protocol.rb",
"lib/message.rb",
"lib/protocol.rb",
+ "lib/protocol/action_specification.rb",
+ "lib/protocol/loader.rb",
+ "lib/protocol/object_specification.rb",
+ "lib/protocol/specification.rb",
+ "lib/protocol/specification_set.rb",
+ "spec/mock/protocol.ini",
+ "spec/protocol_spec.rb",
+ "spec/spec_helper.rb",
"test/helper.rb",
"test/test_cucub-protocol.rb"
]
@@ -39,25 +49,25 @@ Gem::Specification.new do |s|
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<inifile>, [">= 0"])
s.add_runtime_dependency(%q<msgpack>, [">= 0"])
- s.add_development_dependency(%q<shoulda>, [">= 0"])
- s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
- s.add_development_dependency(%q<bundler>, ["~> 1.1.3"])
+ s.add_development_dependency(%q<rspec>, [">= 0"])
+ s.add_development_dependency(%q<bundler>, ["~> 1.2.1"])
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
s.add_development_dependency(%q<simplecov>, [">= 0"])
else
+ s.add_dependency(%q<inifile>, [">= 0"])
s.add_dependency(%q<msgpack>, [">= 0"])
- s.add_dependency(%q<shoulda>, [">= 0"])
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
- s.add_dependency(%q<bundler>, ["~> 1.1.3"])
+ s.add_dependency(%q<rspec>, [">= 0"])
+ s.add_dependency(%q<bundler>, ["~> 1.2.1"])
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
s.add_dependency(%q<simplecov>, [">= 0"])
end
else
+ s.add_dependency(%q<inifile>, [">= 0"])
s.add_dependency(%q<msgpack>, [">= 0"])
- s.add_dependency(%q<shoulda>, [">= 0"])
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
- s.add_dependency(%q<bundler>, ["~> 1.1.3"])
+ s.add_dependency(%q<rspec>, [">= 0"])
+ s.add_dependency(%q<bundler>, ["~> 1.2.1"])
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
s.add_dependency(%q<simplecov>, [">= 0"])
end
View
2 lib/cucub-protocol.rb
@@ -1,2 +1,4 @@
+require 'inifile'
+
require 'message'
require 'protocol'
View
7 lib/protocol/loader.rb
@@ -5,6 +5,11 @@ module Protocol
class Loader
include Singleton
+ # Sets the path from where the config will be read
+ #
+ # @param [String] filepath
+ # The filepath from where the config will be read
+ #
def set_path(filepath)
@filepath = filepath
end
@@ -14,7 +19,7 @@ def specifications
end
def parse
- basefile = IniFile.load(@filepath)
+ basefile = ::IniFile.load(@filepath)
return false if not basefile
current_specifications = Cucub::Protocol::SpecificationSet.new
View
12 lib/protocol/specification_set.rb
@@ -13,6 +13,18 @@ def object_specifications
@object_specifications
end
+ def uses_box
+ @object_specifications.select(&:uses_box).empty?
+ end
+
+ def uses_mailbox
+ @object_specifications.select(&:uses_mailbox).empty?
+ end
+
+ def uses_board
+ @object_specifications.select(&:uses_board).empty?
+ end
+
def [](class_name)
# TODO there should be a method to facilitate search in to spec_set for a class
object_specification = @object_specifications.select {|spec| spec.class_name == class_name }.first

0 comments on commit 0b1d009

Please sign in to comment.
Something went wrong with that request. Please try again.