active-orient 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -9
- data/VERSION +1 -0
- data/{acitve-orient.gemspec → active-orient.gemspec} +3 -3
- data/lib/active-orient.rb +7 -0
- data/lib/rest.rb +15 -8
- metadata +24 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: babcbd90fcc89be93302da2907357f3049ec4ae4
|
4
|
+
data.tar.gz: a5a95791f21342e4272f58a777febe243f25af3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c38d7aa2efb71e1d240f613fb9b1dd72475f846601f18a8b3d7fc1bfd9c49da289a8d4e64bf9f0cd765bf8a693ef2ed8fd079ea84bb806b830d92d4ee1b27301
|
7
|
+
data.tar.gz: d9a94362684f5f988cc6f667c91e9094b77bf487d895dbbeab51321160d6377bc7515db4ec3bedfb3ed41846739313b3c27d9cff58a366b369b07390a88cccb5
|
data/README.md
CHANGED
@@ -6,21 +6,23 @@ The Package ist tested with Ruby 2.2.1 and Orientdb 2.1.
|
|
6
6
|
|
7
7
|
|
8
8
|
To start you need a ruby 2.x Installation and a working OrientDB-Instance.
|
9
|
-
|
10
|
-
then modify »config/connect.yml«.
|
11
|
-
Its adviserable to generate the rdoc-documentation with executing
|
12
|
-
```
|
13
|
-
rdoc
|
14
|
-
```
|
15
|
-
from the source directory of AcitiveOrient and then to load the doc-directory into any browser.
|
9
|
+
Install the Gem the usual way
|
16
10
|
|
17
11
|
For a quick start, go to the home directory of the package and start an irb-session
|
18
12
|
|
19
|
-
|
13
|
+
```ruby
|
14
|
+
require 'bundler/setup'
|
15
|
+
require 'active-orient'
|
16
|
+
```
|
20
17
|
|
18
|
+
First, the Database-Server has to be specified. Then we can connect to a database.
|
19
|
+
Assuming, the server is located on localhost, we just define »default-server«
|
21
20
|
```ruby
|
22
|
-
|
21
|
+
ActiveOrient::OrientDB.default_server= { user: 'your user', password: 'your password' }
|
22
|
+
|
23
|
+
|
23
24
|
r = ActiveOrient::OrientDB.new database: 'First'
|
25
|
+
=> I, [2015-08-18T09:49:18.858758 #88831] INFO -- OrientDB#Connect: Connected to database First
|
24
26
|
=> #<ActiveOrient::OrientDB:0x000000048d0488 @res=#<RestClient::Resource:0x00000004927288
|
25
27
|
@url="http://localhost:2480", @block=nil,
|
26
28
|
@options={:user=>"xx", :password=>"***"}>, @database="First", @classes=[]>
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.3
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "active-orient"
|
6
6
|
s.version = File.open('VERSION').read.strip
|
7
|
-
s.authors = ["
|
7
|
+
s.authors = ["Hartmut Bischoff"]
|
8
8
|
s.email = ["topofocus@gmail.com"]
|
9
9
|
s.homepage = 'https://github.com/topofocus/active-orient'
|
10
10
|
s.licenses = ['MIT']
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
|
22
22
|
s.add_development_dependency "bundler", "~> 1.8"
|
23
23
|
s.add_development_dependency "rake", "~> 10.0"
|
24
|
-
s.add_dependency 'activesupport'
|
25
|
-
|
24
|
+
s.add_dependency 'activesupport', "~> 4.2"
|
25
|
+
s.add_dependency 'rest-client', "~> 2.0.0.alpha"
|
26
26
|
|
27
27
|
end
|
data/lib/rest.rb
CHANGED
@@ -24,6 +24,9 @@ A Sample:
|
|
24
24
|
|
25
25
|
class OrientDB
|
26
26
|
mattr_accessor :logger ## borrowed from active_support
|
27
|
+
mattr_accessor :default_server ##
|
28
|
+
## expected
|
29
|
+
# ActiveOrient::OrientDB.default_server = { server: 'localhost', port: 2480, user: '**', password: '**', database: 'temp'
|
27
30
|
include OrientSupport::Support
|
28
31
|
|
29
32
|
=begin
|
@@ -41,9 +44,13 @@ accesses the database »my_fency_database«. The database is created if its not
|
|
41
44
|
initialises the Database-Connection and publishes the Instance to any ActiveOrient::Model-Object
|
42
45
|
=end
|
43
46
|
|
47
|
+
|
44
48
|
def initialize database: nil, connect: true
|
49
|
+
self.default_server = { :server => 'localhost', :port => 2480, :protocol => 'http',
|
50
|
+
:user => 'root', :password => 'root', :database => 'temp' }.merge default_server
|
45
51
|
@res = get_ressource
|
46
|
-
@database = database.presence ||
|
52
|
+
@database = database.presence || default_server[:database]
|
53
|
+
self.logger = Logger.new('/dev/stdout') unless logger.present?
|
47
54
|
# @database=@database#.camelcase
|
48
55
|
connect() if connect
|
49
56
|
# save existing classes
|
@@ -57,6 +64,13 @@ initialises the Database-Connection and publishes the Instance to any ActiveOrie
|
|
57
64
|
end
|
58
65
|
##
|
59
66
|
|
67
|
+
# called in the beginning or after a 404-Error
|
68
|
+
def get_ressource
|
69
|
+
login = [ default_server[:user].to_s , default_server[:password].to_s ]
|
70
|
+
server_adress = [ default_server[:protocol] ,"://" , default_server[ :server ], ":" , default_server[ :port ]].map(&:to_s).join('')
|
71
|
+
RestClient::Resource.new( server_adress, *login )
|
72
|
+
end
|
73
|
+
|
60
74
|
def connect
|
61
75
|
i = 0
|
62
76
|
begin
|
@@ -902,13 +916,6 @@ def property_uri(this_class_name)
|
|
902
916
|
"property/#{ @database }/#{this_class_name}"
|
903
917
|
end
|
904
918
|
end
|
905
|
-
# called in the beginning or after a 404-Error
|
906
|
-
def get_ressource
|
907
|
-
read_yml = ->( key ){ YAML::load_file( File.expand_path('../../config/connect.yml',__FILE__))[:orientdb][key] }
|
908
|
-
login = read_yml[ :admin ].values
|
909
|
-
server_adress = read_yml[ :server ] + ":" + read_yml[ :port ].to_s
|
910
|
-
RestClient::Resource.new('http://' << server_adress, *login )
|
911
|
-
end
|
912
919
|
|
913
920
|
def self.simple_uri *names
|
914
921
|
names.each do | name |
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active-orient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Hartmut Bischoff
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,16 +42,30 @@ dependencies:
|
|
42
42
|
name: activesupport
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '4.2'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rest-client
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.0.0.alpha
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
68
|
+
version: 2.0.0.alpha
|
55
69
|
description: Persistent ORM for OrientDB, based on ActiveModel
|
56
70
|
email:
|
57
71
|
- topofocus@gmail.com
|
@@ -65,9 +79,11 @@ files:
|
|
65
79
|
- Guardfile
|
66
80
|
- LICENSE
|
67
81
|
- README.md
|
68
|
-
-
|
82
|
+
- VERSION
|
83
|
+
- active-orient.gemspec
|
69
84
|
- config/boot.rb
|
70
85
|
- config/connect.yml
|
86
|
+
- lib/active-orient.rb
|
71
87
|
- lib/base.rb
|
72
88
|
- lib/base_properties.rb
|
73
89
|
- lib/model.rb
|