diff --git a/trunk/README b/trunk/README index ad9730a..ab6087d 100644 --- a/trunk/README +++ b/trunk/README @@ -10,7 +10,7 @@ Preliminarily, - array (E.g. has_many :airports) Nice to have extensions: -- schema.rb which will contain schemas for the ActiveCouch documents +- schema.rb which will contain schemas for ActiveCouch documents - Migrations to change document schemas Pre-requisites: diff --git a/trunk/active_couch.rb b/trunk/active_couch.rb index d0a157a..22cfb50 100644 --- a/trunk/active_couch.rb +++ b/trunk/active_couch.rb @@ -1,4 +1,6 @@ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) -require 'active_couch/base' \ No newline at end of file +require 'active_couch/errors' +require 'active_couch/base' +require 'active_couch/connection' \ No newline at end of file diff --git a/trunk/active_couch/base.rb b/trunk/active_couch/base.rb index dbe2a7f..43b6807 100644 --- a/trunk/active_couch/base.rb +++ b/trunk/active_couch/base.rb @@ -1,12 +1,12 @@ module ActiveCouch - class ActiveCouchError < StandardError - end - - class IllegalArgumentError < ActiveCouchError - end - class Base class << self + attr_writer :connection + + def connection + @connection + end + def define_instance_variable(var_name, default_value) unless var_name.is_a?(Symbol) || var_name.is_a?(String) raise IllegalArgumentError, "#{sym.inspect} is neither a String nor a Symbol" diff --git a/trunk/active_couch/connection.rb b/trunk/active_couch/connection.rb new file mode 100644 index 0000000..9490b82 --- /dev/null +++ b/trunk/active_couch/connection.rb @@ -0,0 +1,22 @@ +module ActiveCouch + class Connection + attr_accessor :server, :port + + def initialize(options = {}) + if options.has_key?(:server) && options.has_key?(:port) + @server = options[:server] + @port = options[:port] + else + raise ConfigurationMissingError, "Configuration hash must contain keys for server and port" + end + end + + def get + nil + end + + def put(data) + + end + end +end \ No newline at end of file diff --git a/trunk/active_couch/errors.rb b/trunk/active_couch/errors.rb new file mode 100644 index 0000000..4bbd3b2 --- /dev/null +++ b/trunk/active_couch/errors.rb @@ -0,0 +1,10 @@ +module ActiveCouch + class ActiveCouchError < StandardError + end + + class IllegalArgumentError < ActiveCouchError + end + + class ConfigurationMissingError < ActiveCouchError + end +end \ No newline at end of file