orientdb 0.0.1-jruby → 0.0.2-jruby

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -20,6 +20,7 @@ tmtags
20
20
  .rvmrc
21
21
 
22
22
  ## PROJECT::GENERAL
23
+ .bundle
23
24
  coverage
24
25
  rdoc
25
26
  pkg
data/Gemfile.lock ADDED
@@ -0,0 +1,20 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ orientdb (0.0.1-java)
5
+ hashie
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ awesome_print (0.2.1)
11
+ hashie (0.4.0)
12
+
13
+ PLATFORMS
14
+ java
15
+
16
+ DEPENDENCIES
17
+ awesome_print
18
+ bundler (>= 1.0.0)
19
+ hashie
20
+ orientdb!
data/README.rdoc ADDED
@@ -0,0 +1,85 @@
1
+ = orientdb
2
+
3
+ orientdb is a little gem that wraps the Java OrientDB library into a more comfortable Ruby package (in JRuby, of course).
4
+
5
+ == What is OrientDB?
6
+
7
+ According to the website:
8
+
9
+ OrientDB is a new Open Source NoSQL DBMS born with the best features of all the others. It's written in Java and it's amazing fast: can store up to 150,000 records per second on common hardware. Even if it's Document based database the relationships are managed as in Graph Databases with direct connections among records. You can travere entire or part of trees and graphs of records in few milliseconds. Supports schema-less, schema-full and schema-mixed modes. Has a strong security profiling system based on user and roles and support the SQL between the query languages. Thank to the SQL layer it's straightforward to use it for people skilled in Relational world.
10
+
11
+ == Getting started
12
+
13
+ Let's get the gem installed and test out the interactive console.
14
+
15
+ shell> rvm jruby
16
+ shell> gem install orientdb
17
+ shell> orientdb_console
18
+
19
+ >> db = OrientDB::Database.connect "remote:localhost/demo", 'admin', 'admin'
20
+ => #<OrientDB::Database:0x6a346239 @proxy_object=#<Java::ComOrientechnologiesOrientCoreDbDocument::ODatabaseDocumentTx:0x14860315>
21
+ >> customer = db.get_class "Customer"
22
+ => #<OrientDB::OClass:Customer name:string>
23
+ >> customer.add :name, :string
24
+ => true
25
+ >> db.schema.save
26
+ => #<Java::ComOrientechnologiesOrientCoreMetadataSchema::OSchema:0x4a5afcb1>
27
+ >> invoice = db.get_or_create_class "Invoice"
28
+ => #<OrientDB::OClass:Invoice id:integer date:date customer:link total:float>
29
+ >> invoice.add :id, :int
30
+ => true
31
+ >> invoice.add :date, :date
32
+ => true
33
+ >> invoice.add :total, :float
34
+ => true
35
+ >> invoice.add :customer, customer
36
+ => true
37
+ >> db.schema.save
38
+ => #<Java::ComOrientechnologiesOrientCoreMetadataSchema::OSchema:0x4a5afcb1>
39
+ >> c1 = OrientDB::Document.create db, "Customer", :name => "Leonardo"
40
+ => #<OrientDB::Document:Customer name:Leonardo>
41
+ >> i1 = OrientDB::Document.create db, "Invoice", :id => 1, :data => DateTime.now, :total => 350.75, :customer => c1
42
+ => #<OrientDB::Document:Invoice total:350.75 id:1 data:Wed Nov 02 18:21:13 MDT 3910 customer:#<OrientDB::Document:Customer name:Leonardo>>
43
+ >> i2 = OrientDB::Document.new db, "Invoice", :id => 12
44
+ => #<OrientDB::Document:Invoice id:12>
45
+ >> i2.date = DateTime.now
46
+ => #<DateTime: 5893210835369/2400000,-1/4,2299161>
47
+ >> i2.total = 275.25
48
+ => 275.25
49
+ >> i2.customer = c1
50
+ => #<OrientDB::Document:Customer name:Leonardo>
51
+ >> i2.extra = [3.50, 0.75]
52
+ => [3.5, 0.75]
53
+ >> i2.save
54
+ => #<Java::ComOrientechnologiesOrientCoreRecordImpl::ODocument:0x18b9459c>
55
+ >> i2
56
+ => #<OrientDB::Document:Invoice total:275.25 id:12 extra:3.50.75 customer:#<OrientDB::Document:Customer name:Leonardo> date:Wed Nov 02 18:21:13 MDT 3910>
57
+ >> db.count_class "Customer"
58
+ => 1
59
+ >> db.count_class "Invoice"
60
+ => 2
61
+ >> cs = db.all_in_class "Customer"
62
+ => [#<OrientDB::Document:Customer name:Leonardo>]
63
+ >> c1 = cs.first
64
+ => #<OrientDB::Document:Customer name:Leonardo>
65
+ >> is = db.all_in_class "Invoice"
66
+ => [#<OrientDB::Document:Invoice total:275.25 id:12 extra:[3.5, 0.75] customer:#<OrientDB::Document:Customer name:Leonardo> date:Wed Nov 02 18:21:13 MDT 3910>, #<OrientDB::Document:Invoice total:350.75 id:1 data:61246887673000 customer:#<OrientDB::Document:Customer name:Leonardo>>]
67
+ >> i1 = is.first
68
+ => #<OrientDB::Document:Invoice total:275.25 id:12 extra:[3.5, 0.75] customer:#<OrientDB::Document:Customer name:Leonardo> date:Wed Nov 02 18:21:13 MDT 3910>
69
+ >> i2 = is.last
70
+ => #<OrientDB::Document:Invoice total:350.75 id:1 data:61246887673000 customer:#<OrientDB::Document:Customer name:Leonardo>>
71
+
72
+
73
+ == Note on Patches/Pull Requests
74
+
75
+ * Fork the project.
76
+ * Make your feature addition or bug fix.
77
+ * Add tests for it. This is important so I don't break it in a
78
+ future version unintentionally.
79
+ * Commit, do not mess with rakefile, version, or history.
80
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
81
+ * Send me a pull request. Bonus points for topic branches.
82
+
83
+ == Copyright
84
+
85
+ Copyright (c) 2010 Adrian Madrid. See LICENSE for details.
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env jruby
2
+ require File.expand_path(File.dirname(__FILE__) + "/../lib/orientdb")
3
+
4
+ require 'irb'
5
+ ARGV.clear
6
+ IRB.start(__FILE__)
data/lib/orientdb.rb CHANGED
@@ -1,18 +1,24 @@
1
1
  raise "Rubyhaze only runs on JRuby. Sorry!" unless (RUBY_PLATFORM =~ /java/)
2
2
 
3
3
  $: << File.dirname(__FILE__)
4
- path = File.expand_path('../../jars/', __FILE__)
5
- puts "path : #{path}"
6
- $: << path
4
+ $: << File.expand_path('../../jars/', __FILE__)
7
5
 
8
6
  require 'java'
9
7
  require 'orientdb-client-0.9.23'
10
8
 
11
- module OrientDB
9
+ class OrientDB
10
+
11
+ def self.const_missing(missing)
12
+ puts "[#{name}:const_missing] #{missing}"
13
+ super
14
+ end
15
+
12
16
  end
13
17
 
18
+ require 'orientdb/ext'
14
19
  require 'orientdb/version'
15
- require 'orientdb/mixins/proxy'
20
+ require 'orientdb/proxy_mixin'
16
21
  require 'orientdb/user'
17
22
  require 'orientdb/database'
18
23
  require 'orientdb/document'
24
+ require 'orientdb/oclass'
@@ -1,8 +1,12 @@
1
1
  class OrientDB::Database
2
2
 
3
- include OrientDB::Mixins::Proxy
3
+ include OrientDB::ProxyMixin
4
4
 
5
- KLASS = com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx
5
+ KLASS = com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx
6
+
7
+ Record = com.orientechnologies.orient.core.record.ORecord
8
+ Schema = com.orientechnologies.orient.core.metadata.schema.OSchema
9
+ SQLQuery = com.orientechnologies.orient.core.sql.query.OSQLSynchQuery
6
10
 
7
11
  def initialize(database_url)
8
12
  @proxy_object = KLASS.new database_url
@@ -13,21 +17,105 @@ class OrientDB::Database
13
17
  end
14
18
 
15
19
  def user
16
- OrientDB::User.from_ouser proxy_object.getUser
20
+ User.from_ouser proxy_object.getUser
21
+ end
22
+
23
+ def query(sql_query = nil)
24
+ sql_query = prepare_sql_query sql_query
25
+ proxy_object.query(sql_query).map { |x| OrientDB::Document.new x }
26
+ end
27
+
28
+ alias :find :query
29
+
30
+ def first(sql_query = nil)
31
+ sql_query = prepare_sql_query sql_query
32
+ proxy_object.query(sql_query).setLimit(1).map { |x| Document.new x }.first
33
+ end
34
+
35
+ def prepare_sql_query(sql_query)
36
+ return if sql_query.nil?
37
+ case sql_query
38
+ when SQLQuery
39
+ sql_query
40
+ when String
41
+ SQLQuery.new sql_query
42
+ when Hash
43
+ SQLQuery.new sql_query_from_hash(sql_query)
44
+ else
45
+ raise "Unknown query type"
46
+ end
47
+ end
48
+
49
+ def sql_query_from_hash(options = {})
50
+ klass_name = options.delete :class
51
+ raise "Missing class name" unless klass_name
52
+ columns = options.delete(:columns) || '*'
53
+ order = options.delete :order
54
+ order_sql = order ? " ORDER BY #{order}" : ''
55
+ fields = options.map do |field, value|
56
+ cmp = '='
57
+ if value.is_a?(String)
58
+ value = "'" + value + "'"
59
+ cmp = 'LIKE' if value.index('%')
60
+ end
61
+ "#{field} #{cmp} #{value}"
62
+ end
63
+ "SELECT #{columns} FROM #{klass_name} WHERE #{fields.join(' AND ')}#{order_sql}"
64
+ end
65
+
66
+ def schema
67
+ proxy_object.getMetadata.getSchema
68
+ end
69
+
70
+ def storage
71
+ proxy_object.storage
72
+ end
73
+
74
+ def create_class(name, fields = {})
75
+ OrientDB::OClass.create self, name, fields
76
+ end
77
+
78
+ def each_in_class(klass_name)
79
+ proxy_object.browseClass(klass_name.to_s).each do |record|
80
+ yield OrientDB::Document.new(record)
81
+ end
17
82
  end
18
83
 
19
- alias :each_in_class :browseClass
20
- alias :each_in_custer :browseCluster
84
+ def all_in_class(klass_name)
85
+ proxy_object.browseClass(klass_name.to_s).map { |x| OrientDB::Document.new x }
86
+ end
21
87
 
88
+ def each_in_custer(cluster_name)
89
+ proxy_object.browseCluster(cluster_name.to_s).each do |record|
90
+ yield OrientDB::Document.new(record)
91
+ end
92
+ end
93
+
94
+ def all_in_custer(cluster_name)
95
+ proxy_object.browseCluster(cluster_name.to_s).map { |x| OrientDB::Document.new x }
96
+ end
97
+
98
+ def get_class(klass_name)
99
+ klass = schema.get_class klass_name
100
+ klass && OrientDB::OClass.new(klass)
101
+ end
102
+
103
+ def get_or_create_class(klass_name)
104
+ get_class(klass_name) || OrientDB::OClass.create(klass_name)
105
+ end
22
106
 
23
107
  class << self
24
108
 
25
109
  def create(database_url)
26
- new(database_url).create
110
+ obj = new(database_url)
111
+ obj.create
112
+ obj
27
113
  end
28
114
 
29
115
  def connect(database_url, username, password)
30
- new(database_url).auth(username, password)
116
+ obj = new(database_url)
117
+ obj.auth(username, password)
118
+ obj
31
119
  end
32
120
 
33
121
  end
@@ -1,6 +1,6 @@
1
1
  class OrientDB::DatabasePool
2
2
 
3
- include OrientDB::Mixins::Proxy
3
+ include OrientDB::ProxyMixin
4
4
 
5
5
  KLASS = com.orientechnologies.orient.core.db.document.ODatabaseDocumentPool
6
6
 
@@ -11,7 +11,8 @@ class OrientDB::DatabasePool
11
11
  class << self
12
12
 
13
13
  def connect(database_url, username, password)
14
- new database_url, username, password
14
+ obj = new database_url, username, password
15
+ obj
15
16
  end
16
17
 
17
18
  end
@@ -1,21 +1,78 @@
1
1
  class OrientDB::Document
2
2
 
3
- include OrientDB::Mixins::Proxy
3
+ include OrientDB::ProxyMixin
4
4
 
5
5
  KLASS = com.orientechnologies.orient.core.record.impl.ODocument
6
6
 
7
- def initialize(db, klass_name, fields = {})
8
- @proxy_object = KLASS.new db, klass_name
9
- fields.each do |name, value|
10
- @proxy_object.field name.to_s, value
7
+ def initialize(*args)
8
+ if args.first.is_a?(KLASS)
9
+ @proxy_object = args.first
10
+ else
11
+ db, klass_name = args[0], args[1]
12
+ fields = args[2] || {}
13
+ if db && klass_name
14
+ @proxy_object = KLASS.new db.proxy_object, klass_name
15
+ fields.each do |name, value|
16
+ self[name] = value
17
+ end
18
+ else
19
+ @proxy_object = KLASS.new
20
+ end
11
21
  end
12
22
  end
13
23
 
24
+ def values
25
+ proxy_object.fieldNames.map{|field_name| [field_name, self[field_name]] }
26
+ end
27
+
28
+ def db
29
+ proxy_object.getDatabase
30
+ end
31
+
32
+ # def save
33
+ # db.save proxy_object
34
+ # end
35
+
36
+ def [](field_name)
37
+ value = proxy_object.field field_name.to_s
38
+ value = OrientDB::Document.new(value) if value.is_a?(KLASS)
39
+ value
40
+ end
41
+
42
+ def []=(field_name, value)
43
+ value = value.proxy_object if value.respond_to?(:proxy_object)
44
+ # value = value.to_java if value.respond_to?(:to_java)
45
+ proxy_object.field field_name.to_s, value
46
+ end
47
+
48
+ def method_missing(method_name, *args, &blk)
49
+ return self[method_name] if proxy_object.containsField(method_name.to_s)
50
+ match = method_name.to_s.match(/(.*?)([?=!]?)$/)
51
+ case match[2]
52
+ when "="
53
+ self[match[1]] = args.first
54
+ when "?"
55
+ !!self[match[1]]
56
+ else
57
+ super
58
+ end
59
+ end
60
+
61
+ def inspect
62
+ props = values.map{|k,v| "#{k}:#{v}" }.join(' ')
63
+ %{#<OrientDB::Document:#{proxy_object.getClassName}#{props.empty? ? '' : ' ' + props}>}
64
+ end
65
+
66
+ alias :to_s :inspect
67
+
14
68
  class << self
15
69
 
16
70
  def create(db, klass_name, fields = {})
17
- new(db, klass_name, fields).save
71
+ obj = new(db, klass_name, fields)
72
+ obj.save
73
+ obj
18
74
  end
75
+
19
76
  end
20
77
 
21
78
  end
@@ -0,0 +1,13 @@
1
+ require 'date'
2
+
3
+ class Date
4
+ def proxy_object
5
+ java.util.Date.new year, month - 1, day - 1, 0, 0, 0
6
+ end
7
+ end
8
+
9
+ class DateTime
10
+ def proxy_object
11
+ java.util.Date.new year, month - 1, day - 1, hour, min, sec
12
+ end
13
+ end
@@ -0,0 +1,145 @@
1
+ class OrientDB::OClass
2
+
3
+ include OrientDB::ProxyMixin
4
+
5
+ KLASS = com.orientechnologies.orient.core.metadata.schema.OClass
6
+
7
+ SchemaType = com.orientechnologies.orient.core.metadata.schema.OType
8
+ ClusterType = com.orientechnologies.orient.core.storage.OStorage::CLUSTER_TYPE
9
+ IndexType = com.orientechnologies.orient.core.metadata.schema.OProperty::INDEX_TYPE
10
+
11
+ FIELD_TYPES = {
12
+ :binary => "BINARY",
13
+ :bool => "BOOLEAN",
14
+ :boolean => "BOOLEAN",
15
+ :double => "BYTE",
16
+ :date => "DATE",
17
+ :datetime => "DATE",
18
+ :decimal => "FLOAT",
19
+ :double => "DOUBLE",
20
+ :embedded => "EMBEDDED",
21
+ :embedded_list => "EMBEDDEDLIST",
22
+ :embedded_map => "EMBEDDEDMAP",
23
+ :embedded_set => "EMBEDDEDSET",
24
+ :float => "FLOAT",
25
+ :int => "INTEGER",
26
+ :integer => "INTEGER",
27
+ :link => "LINK",
28
+ :link_list => "LINKLIST",
29
+ :link_map => "LINKMAP",
30
+ :link_set => "LINKSET",
31
+ :long => "LONG",
32
+ :short => "SHORT",
33
+ :string => "STRING",
34
+ }.inject({}) do |h, (k, v)|
35
+ h[k] = SchemaType.const_get v
36
+ h
37
+ end
38
+
39
+ STORAGE_TYPES = %w{ LOGICAL MEMORY PHYSICAL }.inject({}) do |h, s|
40
+ h[s.downcase.to_sym] = ClusterType.const_get s
41
+ h
42
+ end
43
+
44
+ INDEX_TYPES = %w{ FULLTEXT NOT_UNIQUE UNIQUE }.inject({}) do |h, s|
45
+ h[s.downcase.to_sym] = IndexType.const_get s
46
+ h
47
+ end
48
+
49
+ def initialize(*args)
50
+ if args.first.is_a?(KLASS)
51
+ @proxy_object = args.first
52
+ else
53
+ @proxy_object = KLASS.new
54
+ end
55
+ end
56
+
57
+ def add(property_name, type)
58
+ property_name = property_name.to_s
59
+ if proxy_object.existsProperty(property_name)
60
+ puts "We already have that property name [#{property_name}]"
61
+ return false
62
+ end
63
+
64
+ case type
65
+ when Symbol
66
+ proxy_object.createProperty property_name, FIELD_TYPES[type]
67
+ when OrientDB::OClass
68
+ proxy_object.createProperty property_name, FIELD_TYPES[:link], type.proxy_object
69
+ when Array
70
+ type[0] = FIELD_TYPES[type[0]] if type[0].is_a?(Symbol)
71
+ proxy_object.createProperty property_name, *type
72
+ when Hash
73
+ type[:type] = FIELD_TYPES[:link] if type[:type].is_a?(Symbol)
74
+ prop = proxy_object.createProperty property_name, type[:type]
75
+ prop.setMin(type[:min]) unless type[:min].nil?
76
+ prop.setMax(type[:max]) unless type[:max].nil?
77
+ prop.setMandatory(!!type[:mandatory]) unless type[:mandatory].nil?
78
+ prop.setNotNull(type[:not_null]) unless type[:not_null].nil?
79
+ unless type[:index].nil?
80
+ index_type = type[:index] == true ? INDEX_TYPES[:not_unique] : INDEX_TYPES[type[:index]]
81
+ prop.createIndex index_type
82
+ end
83
+ else
84
+ puts "ERROR! Unknown type [ #{property_name} | #{type} : #{type.class.name} ]"
85
+ end
86
+ self
87
+ end
88
+
89
+ def [](property_name)
90
+ property_name = property_name.to_s
91
+ proxy_object.exists_property(property_name) ? proxy_object.getProperty(property_name) : nil
92
+ end
93
+
94
+ def db
95
+ proxy_object.getDocument.getDatabase
96
+ end
97
+
98
+ def schema
99
+ db.getMetadata.getSchema
100
+ end
101
+
102
+ def create_document(fields = {})
103
+ OrientDB::Document.create db, name, fields
104
+ end
105
+ alias :ceate :create_document
106
+
107
+ def inspect
108
+ props = properties.map { |x| "#{x.getName}:#{x.getType.to_s.downcase}" }.join(' ')
109
+ %{#<OrientDB::OClass:#{name}#{props.empty? ? '' : ' ' + props}>}
110
+ end
111
+
112
+ alias :to_s :inspect
113
+
114
+ class << self
115
+
116
+ def create(db, name, fields = {})
117
+ add_cluster = fields.delete :add_cluster
118
+ add_cluster = true if add_cluster.nil?
119
+
120
+ if add_cluster
121
+ cluster = db.storage.addCluster name.downcase, STORAGE_TYPES[:physical]
122
+ klass = db.schema.createClass name, cluster
123
+ else
124
+ klass = db.schema.createClass name
125
+ end
126
+
127
+ super_klass = fields.delete :super
128
+ klass.setSuperClass(super_klass) if super_klass
129
+ db.schema.save
130
+
131
+ obj = new klass
132
+
133
+ unless fields.empty?
134
+ fields.each do |property_name, type|
135
+ obj.add property_name, type
136
+ end
137
+ db.schema.save
138
+ end
139
+
140
+ obj
141
+ end
142
+
143
+ end
144
+
145
+ end
@@ -0,0 +1,65 @@
1
+ class OrientDB
2
+ module ProxyMixin
3
+
4
+ def self.included(base)
5
+ base.extend ClassMethods
6
+ end
7
+
8
+ attr_reader :proxy_object
9
+
10
+ def respond_to?(meth)
11
+ proxy_object.respond_to?(meth) || super
12
+ end
13
+
14
+ def method_missing(meth, *args, &blk)
15
+ if proxy_object.respond_to? meth
16
+ puts "mm : #{meth}"
17
+ proxy_object.send meth, *args, &blk
18
+ else
19
+ super
20
+ end
21
+ end
22
+
23
+ alias_method :decorator_methods, :methods
24
+
25
+ def methods
26
+ (decorator_methods + proxy_object.methods).uniq
27
+ end
28
+
29
+ module ClassMethods
30
+
31
+ def proxy_method(aliased_name, real_name = nil)
32
+ real_name ||= aliased_name
33
+ class_eval %{def #{aliased_name}(*args) puts "pm : #{real_name}"; proxy_object.send :#{real_name}, *args end}
34
+ end
35
+
36
+ def proxy_methods(*args)
37
+ args.each { |arg| proxy_method *arg }
38
+ end
39
+
40
+ def proxy_accessor(aliased_name, real_name = nil)
41
+ real_name ||= aliased_name
42
+ aliased_name = aliased_name.to_s
43
+ if aliased_name[-1, 1] == '?'
44
+ class_eval %{def #{aliased_name[0..-2]}() puts "pa : #{real_name}"; proxy_object.send :is_#{real_name}? end}
45
+ class_eval %{def #{aliased_name}() puts "pa : #{real_name}"; proxy_object.send :is_#{real_name}? end}
46
+ class_eval %{def #{aliased_name[0..-2]}=(v) puts "pa : #{real_name}"; proxy_object.send :set_#{real_name}, v end}
47
+ else
48
+ class_eval %{def #{aliased_name}() puts "pa : #{real_name}"; proxy_object.send :get_#{real_name}? end}
49
+ class_eval %{def #{aliased_name}=(v) puts "pa : #{real_name}"; proxy_object.send :set_#{real_name}, v end}
50
+ end
51
+ end
52
+
53
+ def proxy_accessors(*args)
54
+ args.each { |arg| proxy_accessor *arg }
55
+ end
56
+
57
+ def self.const_missing(missing)
58
+ puts "[#{name}:const_missing] #{missing}"
59
+ super
60
+ end
61
+
62
+ end
63
+
64
+ end
65
+ end
data/lib/orientdb/user.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  class OrientDB::User
2
2
 
3
- include OrientDB::Mixins::Proxy
3
+ include OrientDB::ProxyMixin
4
4
 
5
5
  KLASS = com.orientechnologies.orient.core.metadata.security.OUser
6
6
 
@@ -1,3 +1,3 @@
1
- module OrientDB
2
- VERSION = "0.0.1"
1
+ class OrientDB
2
+ VERSION = "0.0.2"
3
3
  end
data/orientdb.gemspec CHANGED
@@ -14,7 +14,9 @@ Gem::Specification.new do |s|
14
14
  s.required_rubygems_version = ">= 1.3.6"
15
15
  s.rubyforge_project = "orientdb"
16
16
 
17
+ s.add_dependency "hashie"
17
18
  s.add_development_dependency "bundler", ">= 1.0.0"
19
+ s.add_development_dependency "awesome_print"
18
20
 
19
21
  s.files = `git ls-files`.split("\n")
20
22
  s.test_files = Dir["test/test*.rb"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: jruby
11
11
  authors:
12
12
  - Adrian Madrid
@@ -14,13 +14,25 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-02 00:00:00 -06:00
17
+ date: 2010-11-03 00:00:00 -06:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: bundler
21
+ name: hashie
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: bundler
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
24
36
  requirements:
25
37
  - - ">="
26
38
  - !ruby/object:Gem::Version
@@ -30,12 +42,24 @@ dependencies:
30
42
  - 0
31
43
  version: 1.0.0
32
44
  type: :development
33
- version_requirements: *id001
45
+ version_requirements: *id002
46
+ - !ruby/object:Gem::Dependency
47
+ name: awesome_print
48
+ prerelease: false
49
+ requirement: &id003 !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ type: :development
57
+ version_requirements: *id003
34
58
  description: JRuby wrapper for OrientDB
35
59
  email:
36
60
  - aemadrid@gmail.com
37
- executables: []
38
-
61
+ executables:
62
+ - orientdb_console
39
63
  extensions: []
40
64
 
41
65
  extra_rdoc_files: []
@@ -44,7 +68,10 @@ files:
44
68
  - .gitignore
45
69
  - .rvmrc
46
70
  - Gemfile
71
+ - Gemfile.lock
72
+ - README.rdoc
47
73
  - Rakefile
74
+ - bin/orientdb_console
48
75
  - jars/orient-commons-0.9.23.jar
49
76
  - jars/orientdb-client-0.9.23.jar
50
77
  - jars/orientdb-core-0.9.23.jar
@@ -55,7 +82,9 @@ files:
55
82
  - lib/orientdb/database.rb
56
83
  - lib/orientdb/database_pool.rb
57
84
  - lib/orientdb/document.rb
58
- - lib/orientdb/mixins/proxy.rb
85
+ - lib/orientdb/ext.rb
86
+ - lib/orientdb/oclass.rb
87
+ - lib/orientdb/proxy_mixin.rb
59
88
  - lib/orientdb/user.rb
60
89
  - lib/orientdb/version.rb
61
90
  - orientdb.gemspec
@@ -1,46 +0,0 @@
1
- module OrientDB
2
- module Mixins
3
- module Proxy
4
-
5
- def self.included(base)
6
- base.extend ClassMethods
7
- end
8
-
9
- attr_reader :proxy_object
10
-
11
- def respond_to?(meth)
12
- proxy_object.respond_to?(meth) || super
13
- end
14
-
15
- def method_missing(meth, *args, &blk)
16
- if proxy_object.respond_to? meth
17
- proxy_object.send meth, *args, &blk
18
- else
19
- super
20
- end
21
- end
22
-
23
- module ClassMethods
24
-
25
- def proxy_accessor(aliased_name, real_name = nil)
26
- real_name ||= aliased_name
27
- aliased_name = aliased_name.to_s
28
- if aliased_name[-1,1] == '?'
29
- class_eval %{def #{aliased_name[0..-2]}() proxy_object.send :is_#{real_name}? end}
30
- class_eval %{def #{aliased_name}() proxy_object.send :is_#{real_name}? end}
31
- class_eval %{def #{aliased_name[0..-2]}=(v) proxy_object.send :set_#{real_name}, v end}
32
- else
33
- class_eval %{def #{aliased_name}() proxy_object.send :get_#{real_name}? end}
34
- class_eval %{def #{aliased_name}=(v) proxy_object.send :set_#{real_name}, v end}
35
- end
36
- end
37
-
38
- def proxy_accessors(*args)
39
- args.each { |arg| proxy_accessor *arg }
40
- end
41
-
42
- end
43
-
44
- end
45
- end
46
- end