arcadedb 0.4 → 0.5.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1855060886e9837ef486e44f07155ae99cd242f76aceccb8a7bf4c2ab515eca0
4
- data.tar.gz: d99f2a402eba561fcf851a3838b3bec7eee58f1a788ab9fc7e2ce1208c33611a
3
+ metadata.gz: f030932c1444832b3ea224120f71cc655837ca732717b896ed8587a8cefc0dd4
4
+ data.tar.gz: 96f05185b21af4820ebc667d796635e4b0c6c3ac42b59dc360212df7b287934e
5
5
  SHA512:
6
- metadata.gz: 78936dfe0069d531c1bcfd6191f0269ed84a44cd8e0321a37ef9d569048ff8a20d38d0a221d0b0b93f3e64f39d61a758d2978545beec86d27baf5836c3cdbf4a
7
- data.tar.gz: 6ff4e9242c74887935074ed60810b144a08ad2dad7a6d3374bc0216f74873abb6a1b6f66428a2ed6e7fa9f49dec3ee07ebbe5cc64488744829f76eb037db286c
6
+ metadata.gz: 92ab840638f4a8e0cf56a5138d870bbb282223b9cc0c4b8f5bab39184712ce6742862ea0683a73b917e0b5a94acbd1bccc12ec6a52863caeba9a28b2aacf3132
7
+ data.tar.gz: 6fd195fb51f62fbcea2945f0688626084f8991936b745d6c939bae35bce4912414a80376535a379c3ca1166c4b62ffb2089c041d3951d87fe78ab5dcb421eae0
data/CHANGELOG.md CHANGED
@@ -15,5 +15,36 @@ All notable changes to this project will be documented in this file.
15
15
  ## 0.4.0 - 2023.10.28
16
16
  - completely remove pg-stuff
17
17
  - substitute typhoreous with HTTPX
18
- - include dry::monards to process raw-data
18
+
19
+ ## 0.4.1 - 2023.10.31
20
+ - redesign of transactions.
21
+ - Type.execute performs non idempotent queries in a (nested) transaction
22
+ - Type.transmit performs non idempotent queries
23
+ - Type.query performs idempotent queries
24
+ - Type.create returns a rid
25
+ - Type.insert returns a type-object
26
+ - Vertex.nodes supports conditions on edges
27
+ - Vertex.in, Vertex.out Vertex.inE, Vertex.outE support depth as second parameter
28
+ - IRuby-Support. Formatted output for Base-Objects
29
+
30
+ ## 0.5.0 - 2023-12-12
31
+ - Arcade::Match simple match-statement generator
32
+ - return to Arcade::QueryError messages instead of HTTPX::HTTPError
33
+ - The ProjectRoot Const is used to read configuration files (Changed from Arcade::ProjectRoot)
34
+
35
+ ## 0.5.1 - 2024-1-16
36
+ - Included Arcade::RevisionRecord and Arcade::Revision model classes
37
+ - Both provide basic support for audit proofed bookings
38
+ ## 0.5.2 - 2025-02-11
39
+ - Include method Object#descendants (part of active-support)
40
+ - Separate Dry::Type definitions to /lib/types.rb
41
+ - added Vertex#coe (count of edeges) as service method for to_human
42
+ - updated Match#inE, #outE methods to facilitate queries on properties on edges
43
+ ## - 2025-03-15
44
+ - support of Match.new vertex: {a prefetched Arcade::Vertex} and match.node( vertex: ...)
45
+ ## - 2025-03-25
46
+ - support of Vertex.match( where conditions [, as: :return_element] )
47
+ - added Vertex#match to build 'MATCH type: {class} rid: {rid}'
48
+
49
+
19
50
 
data/Gemfile.lock CHANGED
@@ -1,10 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- arcadedb (0.4)
4
+ arcadedb (0.4.1)
5
5
  dry-configurable
6
6
  dry-core
7
- dry-monads
8
7
  dry-schema
9
8
  dry-struct
10
9
  httpx
@@ -12,9 +11,7 @@ PATH
12
11
  GEM
13
12
  remote: https://rubygems.org/
14
13
  specs:
15
- ast (2.4.2)
16
14
  awesome_print (1.9.2)
17
- base64 (0.1.1)
18
15
  coderay (1.1.3)
19
16
  concurrent-ruby (1.2.2)
20
17
  diff-lcs (1.5.0)
@@ -30,10 +27,6 @@ GEM
30
27
  concurrent-ruby (~> 1.0)
31
28
  dry-core (~> 1.0, < 2)
32
29
  zeitwerk (~> 2.6)
33
- dry-monads (1.6.0)
34
- concurrent-ruby (~> 1.0)
35
- dry-core (~> 1.0, < 2)
36
- zeitwerk (~> 2.6)
37
30
  dry-schema (1.13.3)
38
31
  concurrent-ruby (~> 1.0)
39
32
  dry-configurable (~> 1.0, >= 1.0.1)
@@ -72,11 +65,9 @@ GEM
72
65
  guard-compat (~> 1.1)
73
66
  rspec (>= 2.99.0, < 4.0)
74
67
  http-2-next (1.0.1)
75
- httpx (1.0.2)
68
+ httpx (1.1.0)
76
69
  http-2-next (>= 1.0.1)
77
70
  ice_nine (0.11.2)
78
- json (2.6.3)
79
- language_server-protocol (3.17.0.3)
80
71
  listen (3.8.0)
81
72
  rb-fsevent (~> 0.10, >= 0.10.3)
82
73
  rb-inotify (~> 0.9, >= 0.9.10)
@@ -86,10 +77,6 @@ GEM
86
77
  notiffany (0.1.3)
87
78
  nenv (~> 0.1)
88
79
  shellany (~> 0.0)
89
- parallel (1.23.0)
90
- parser (3.2.2.4)
91
- ast (~> 2.4.1)
92
- racc
93
80
  pastel (0.8.0)
94
81
  tty-color (~> 0.5)
95
82
  pry (0.14.2)
@@ -97,16 +84,12 @@ GEM
97
84
  method_source (~> 1.0)
98
85
  psych (5.1.1.1)
99
86
  stringio
100
- racc (1.7.1)
101
- rainbow (3.1.1)
102
87
  rake (13.0.6)
103
88
  rb-fsevent (0.11.2)
104
89
  rb-inotify (0.10.1)
105
90
  ffi (~> 1.0)
106
91
  rdoc (6.5.0)
107
92
  psych (>= 4.0.0)
108
- regexp_parser (2.8.2)
109
- rexml (3.2.6)
110
93
  rspec (3.12.0)
111
94
  rspec-core (~> 3.12.0)
112
95
  rspec-expectations (~> 3.12.0)
@@ -131,21 +114,6 @@ GEM
131
114
  diff-lcs (>= 1.2.0, < 2.0)
132
115
  rspec-support (~> 3.12.0)
133
116
  rspec-support (3.12.1)
134
- rubocop (1.57.1)
135
- base64 (~> 0.1.1)
136
- json (~> 2.3)
137
- language_server-protocol (>= 3.17.0)
138
- parallel (~> 1.10)
139
- parser (>= 3.2.2.4)
140
- rainbow (>= 2.2.2, < 4.0)
141
- regexp_parser (>= 1.8, < 3.0)
142
- rexml (>= 3.2.5, < 4.0)
143
- rubocop-ast (>= 1.28.1, < 2.0)
144
- ruby-progressbar (~> 1.7)
145
- unicode-display_width (>= 2.4.0, < 3.0)
146
- rubocop-ast (1.29.0)
147
- parser (>= 3.2.1.0)
148
- ruby-progressbar (1.13.0)
149
117
  sdoc (2.6.1)
150
118
  rdoc (>= 5.0)
151
119
  shellany (0.0.1)
@@ -168,7 +136,6 @@ DEPENDENCIES
168
136
  guard
169
137
  guard-rspec
170
138
  pastel
171
- pry
172
139
  rake (~> 13.0)
173
140
  rb-inotify
174
141
  rspec
@@ -177,7 +144,6 @@ DEPENDENCIES
177
144
  rspec-given
178
145
  rspec-its
179
146
  rspec-legacy_formatters
180
- rubocop
181
147
  sdoc
182
148
  terminal-table
183
149
  zeitwerk
data/README.md CHANGED
@@ -5,19 +5,26 @@ Ruby Interface to a [Arcade Database](https://arcadedb.com/).
5
5
  The program utilizes the HTTP-JSON API to direct database queries to an ArcadeDB server.
6
6
  The server's response is then mapped to an ORM (Object-Relational Mapping) based on DRY::Struct.
7
7
  Each database type is represented by a dedicated Model Class, where complex queries are encapsulated.
8
- The program also includes a Query-Preprocessor for constructing custom queries in ruby fashion.
8
+ The program also includes a Query-Preprocessor and Match-statment generator for constructing custom queries in ruby fashion.
9
9
 
10
- ***ArcadeDB internally uses `Arcade` as primary namespace****
10
+ ***ArcadeDB internally uses `Arcade` as primary namespace***
11
11
 
12
12
  ## Prerequisites
13
13
 
14
14
  A running AracdeDB-Instance. [Quick-Start-Guide](https://docs.arcadedb.com/#Quick-Start-Docker).
15
15
 
16
- [ArcadeDB V 22.10.1](https://github.com/ArcadeData/arcadedb/releases/tag/22.10.1)ff is supported
16
+ ## New Project
17
17
 
18
- ## Config
19
-
20
- Edit the file `arcade.yml` and provide suitable databases for test, development and production environment.
18
+ ```
19
+ mkdir project && cd project
20
+ bundle init
21
+ bundle add arcadedb
22
+ bundle add pastel # for console output
23
+ mkdir model
24
+ mkdir bin
25
+ ```
26
+ copy `https://github.com/topofocus/arcadedb/blob/main/bin/console` to the `bin` directory
27
+ copy `https://github.com/topofocus/arcadedb/blob/main/arcade.yml` to the project root and modify to your needs
21
28
 
22
29
  ## Console
23
30
 
@@ -25,8 +32,18 @@ To start an interactive console, a script is provided in the bin-directory.
25
32
  ```
26
33
  $ cd bin && ./console.rb t ( or "d" or "p" for Test, Development and Production environment)
27
34
 
28
- **Database definitions (model-files) of the test-suite are included!**
35
+ **in Test environment Database definitions (model-files) of the test-suite are included!**
36
+ ```
37
+
38
+ ## Add to a project
39
+ Just require it in your program:
40
+ ```ruby
41
+ require "arcade"
29
42
  ```
43
+ ## Config
44
+
45
+ Add a file `arcade.yml` at the root of your program or in the `config`-dir and provide suitable databases for test, development and production environment.
46
+
30
47
 
31
48
  ## Examples & Specs
32
49
 
@@ -39,14 +56,13 @@ The `spec`-files in the rspec-test-suite-section are worth reading, too.
39
56
  The adapter uses a 3 layer concept.
40
57
 
41
58
  Top-Layer : `Arcade::Base`-Model-Objects.
42
- They operate similar to ActiveRecord Model Objects but are based on [Dry-Struct](https://dry-rb.org/gems/dry-struct/1.0/).
59
+ Similar to ActiveRecord Model Objects but based on [Dry-Struct](https://dry-rb.org/gems/dry-struct/1.0/).
43
60
 
44
61
  ```ruby
45
62
  # Example model file /model/demo/user.rb
46
63
  module Demo
47
- class Person < Arcade::Vertex
64
+ class User < Arcade::Vertex
48
65
  attribute :name, Types::Nominal::String
49
- timestamps true
50
66
 
51
67
  def grandparents
52
68
  db.query( "select in('is_family') from #{rid} ") &.allocate_model
@@ -58,14 +74,14 @@ __END__
58
74
  CREATE INDEX on demo_user( name ) UNIQUE
59
75
  ```
60
76
 
61
- Only the `name` attribute is declared. Timestamps (created & updated attributes) are included, too
77
+ Only the `name` attribute is declared.
62
78
 
63
- `Demo::User.create_type` creates the type and executes the database-commands after __END__.
79
+ `Demo::User.create_type` creates the type and executes provided database-commands after `__END__`.
64
80
 
65
- Other properties are schemaless.
81
+ Other properties are schemaless. They are present in the database and are mapped to the `value`-attribute on the ruby side.
66
82
 
67
83
  ```ruby
68
- Person.create name: "Hubert", age: 35
84
+ Person.insert name: "Hubert", age: 35
69
85
  Person.update set: { age: 36 }, where: { name: 'Hubert' }
70
86
  persons = Person.where "age > 40"
71
87
  persons.first.update age: 37
@@ -75,9 +91,118 @@ Person.all
75
91
  Person.delete all: true || where: age: 56 , ...
76
92
  ```
77
93
 
94
+ ### Nodes and Traverse
95
+
96
+ `ArcadeDB` wraps common queries of bidirectional connected vertices.
97
+
98
+ Suppose
99
+ ```ruby
100
+ m = Person.insert name: 'Hubert', age: 25
101
+ f = Person.insert name: 'Pauline', age: 28
102
+ m.assign via: IsMarriedTo, vertex: f , divorced: false
103
+
104
+ ```
105
+ This creates the simple graph
106
+ > Hubert --- is_married_to --> Pauline
107
+ > |
108
+ > -- divorced (attribute on the edge)
109
+
110
+ This can be queried through
111
+
112
+ ```ruby
113
+ hubert = Person.find name: 'Hubert'
114
+ pauline = hubert.nodes( :out, via: IsMarriedTo ).first
115
+ # or simply
116
+ pauline = hubert.out.first
117
+
118
+ ```
119
+ Conditions may be set, too.
120
+ ```ruby
121
+ hubert.nodes( :out, via: IsMarriedTo, where: "age < 30" )
122
+ ```
123
+ gets all wives of hubert, who are younger then 30 years.
124
+ or
125
+ ```ruby
126
+ Person.nodes( :outE, via: IsMarriedTo, where: { divorced: false } )
127
+
128
+ ```
129
+ gets all wives where the divorced-condition, which is set on the edge, is false.
130
+
131
+ ### Query
132
+
78
133
  A **Query Preprocessor** is implemented. Its adapted from ActiveOrient. The [documentation](https://github.com/topofocus/active-orient/wiki/OrientQuery)
79
- is still valid, however the class has changed to `Arcade::Query`.
134
+ is still valid, but the class has changed to `Arcade::Query`.
135
+
136
+ ### Match
80
137
 
138
+ A simple **Match Statement Generator** is provided for convenience. As the [declarative syntax](https://github.com/ArcadeData/arcadedb-docs/blob/main/src/main/asciidoc/sql/SQL-Match.adoc) is very intuitive, a preprocessor should not be
139
+ necessary. However, with the help of some ruby magic, the creation of match-statements is simply an no-brainer.
140
+
141
+ ```ruby
142
+ a = Arcade::Match.new( type: Person, as: :persons)
143
+ .out( IsMarriedTo )
144
+ .node( where: 'age < 30')
145
+ a.to_s
146
+ => Match { type: person, as: persons }.out('is_married_to'){ where: ( age < 30) } RETURN persons
147
+
148
+ a.execute.select_results # sends the statement to the database and returns Arcade Objects.
149
+ ```
150
+
151
+ To query properties on Edges, `inE`, and `outE` are present.
152
+ ```ruby
153
+ a = Arcade::Match.new( type: Person, as: :persons) -> Match { type: person, as: persons}
154
+ a.outE via: IsMarriedTo, where: { year: 1990..2000 } -> .outE('is_married_to'){ where: year between 1990 and 2000}
155
+ -> .outV('is_maried_to') ...
156
+
157
+ a.outE via: [IsMarriedTo, IsMarriedIn], where: { year: 1990..2000 }, as: :bride
158
+ -> .outV('is_married_in') ...
159
+ ```
160
+
161
+ Match statements can also refer to a vertex:
162
+ ```ruby
163
+ p = Person.find name: 'tux'
164
+ c = Person.find name: 'hilde'
165
+ a = Arcade::Match.new( vertex: p ) -> Match { type: person, rid: 2:0 }
166
+ .out( IsMarriedTo ) -> .out('is_married_to')
167
+ .node( as: :wife ) -> { as: wife }
168
+ .out( HasChild ) -> .out('has_child')
169
+ .node( vertex: c ) -> { type: person, rid: 2:1 }
170
+ -> Return wife
171
+ ```
172
+ fetches the vertex between two known vertices. This is the fastest lookup mechanism if the vertices are prefetched.
173
+
174
+ Arcade::Match-objects can be used as `from:` argument to Arcade::Query-Statements; hybrid queries are
175
+ easily constructed without extensive string-manipulations.
176
+
177
+ #### Vertex based Match statements
178
+
179
+ A `match`-method is implemented for Vertex-Classes and vertices.
180
+
181
+ The class-method takes any argument (except `as:`) as part of a `where`-condition.
182
+
183
+ ```ruby
184
+
185
+ m = Watchlist.match( symbol: 'iBit', as: :ibit )
186
+ .out( HasUnderlying)
187
+ .node( as: :u )
188
+
189
+ m.to_s
190
+ => "MATCH { type: watchlist, where: ( symbol='iBit' ), as: ibit }
191
+ .out('has_underlying'){ as: u }
192
+ RETURN ibit,u "
193
+ ```
194
+
195
+ The instance-method is extremly handy in web-applications. If the `rid` is part of the `params`-hash,
196
+ associated nodes are easily selected
197
+
198
+ ```ruby
199
+ params[:rid] => "#49:0"
200
+
201
+ m= params[:rid].load_rid.match.out( HasUnterlying ).node( as: :u )
202
+ m.to_s
203
+ => "MATCH { type: strategie, rid: #49:0 }.out('has_underlying'){ as: u } RETURN u "
204
+ ```
205
+ ## Low Level Database Requests
81
206
  The **second Layer** handles Database-Requests.
82
207
  In its actual implementation, these requests are delegated to the HTTP/JSON-API.
83
208
 
@@ -85,37 +210,36 @@ In its actual implementation, these requests are delegated to the HTTP/JSON-API.
85
210
  The database-handle is always present through `Arcade::Init.db`
86
211
 
87
212
  ```ruby
88
- DB = Arcade::Init.db
213
+ db = Arcade::Init.db
89
214
 
90
- $ DB.get nn, mm # returns a Aracde:Base object
215
+ $ db.get nn, mm # nn=2; mm=0 # returns a Aracde:Base object
91
216
  # rid is either "#11:10:" or two numbers
92
- $ DB.query querystring # returns either an Array of results (as Hash)
93
- $ DB.execute { querystring } #
94
- $ DB.create <name>, attribute: value .... # Creates a new <Document | Vertex> and returns the rid
217
+ $ db.query querystring # returns either an Array of results (as Hash)
218
+ $ db.execute { querystring } # execute a non idempotent query within a (nested) transaction
219
+ $ db.create <name>, attribute: value .... # Creates a new <Document | Vertex> and returns the rid
95
220
  # Operation is performed as Database-Transaction and is rolled back on error
96
- $ DB.insert <name>, attribute: value .... # Inserts a new <Document | Vertex> and returns the rid
97
- $ DB.create_edge <name>, from: <rid> or [rid, rid, ..] , to: <rid> or [rid, rid, ..]
221
+ $ db.insert <name>, attribute: value .... # Inserts a new <Document | Vertex> and returns the new object
222
+ $ db.create_edge <name>, from: <rid> or [rid, rid, ..] , to: <rid> or [rid, rid, ..]
98
223
 
99
- DB.query " Select from person where age > 40 "
100
- DB.execute { " Update person set name='Hubert' return after $current where age = 36 " }
101
224
  ```
102
225
 
103
226
  **Convert database input to Arcade::Base Models**
104
227
 
105
- Either `DB.query` or `DB.execute` return the raw JSON-input from the database. It can always converted to model-objects by chaining
106
- `allocatet_model`.
228
+ Either `db.query` or `db.execute` return the raw JSON-input from the database. It can always converted to model-objects by chaining
229
+ `allocate_model` or `select_result`.
107
230
 
108
231
  ```ruby
109
- $ DB.query "select from my_names limit 1"
232
+ $ db.query "select from my_names limit 1"
110
233
  # which is identical to
111
- $ My::Names.query( limit: 1).query
234
+ $ My::Names.query( limit: 1).execute
112
235
  => [{:@out=>0, :@rid=>"#225:6", :@in=>0, :@type=>"my_names", :@cat=>"v", :name=>"Zaber"}]
113
236
  # then
114
- $ My::Names.query( limit: 1).query.allocate_model.to_human
237
+ $ My::Names.query( limit: 1).execute.allocate_model.to_human
115
238
  => ["<my_names[#225:6]: name: Zaber>" ]
116
239
  # replaces the hash with a My::Names Object
117
240
  ```
118
241
 
242
+
119
243
  The **Base Layer** implements a low level access to the database API.
120
244
 
121
245
  ```ruby
@@ -217,21 +341,47 @@ Select a range of nodes and perform a mathematical operation
217
341
  -=> select median(note_count) from ( traverse out(connects) from #52:0 while $depth < 100 ) where $depth>=50
218
342
  => {:"median(note_count)"=>75.5 }
219
343
  ```
220
- ## Include in your own project
221
344
 
222
- Until a gem is released, first clone the project and set up your project environment
345
+ ### Transactions
346
+
347
+ Database-Transactions are largely encapsulated
348
+
223
349
  ```
224
- mkdir workspace && cd workspace
225
- git clone https://github.com/topofocus/arcadedb
226
- mkdir my-project && cd my-project
227
- bundle init
228
- cat "gem arcadedb, path='../arcadedb' " >> Gemfile
229
- bundle install && bundle upate
230
- cp ../arcadedb/config.yml .
231
- mkdir bin
232
- cp ../arcadedb/bin/console bin/
233
- ````
350
+ db = Arcade::Init.db
351
+ db.begin_transaction
352
+
353
+ { perform insert, update, query, etc tasks in the database }
354
+
355
+ db.commit
356
+
357
+ # or
358
+
359
+ db.rollback
360
+
361
+ ```
362
+ ### Audit proofed Bookings
234
363
 
364
+ Although ArcadeDB is a mutable database, the ruby-Interface supports basic audit proofed transactions.
365
+ Two specialized Database-Types are included:
366
+
367
+ * Arcade::RevisionRecord – A document class, intended to be embedded in Revision-Records
368
+ * Arcade::Revision – A vertex-class with specialized `insert-` and `update-` methods
369
+
370
+ If a vertex is based on `Arcade::Revision`, a `protocol`-property is included. Its initialised with a single `Arcade::RevisionRecord` Object. Each `update` adds an `Arcade::RevisionRecord` to the protocol stack.
371
+
372
+ ```ruby
373
+ m= Member.insert( name: "Hubert",
374
+ surname: "Hugo",
375
+ birth: Date.new( 1976,3,15 ) ) { 'record initiated' }
376
+
377
+ m.update( birth: Date.new( 1978,3,15 ) ) { "member provided correct date via mail" }
378
+
379
+ m.protocol => Date | User | Action | old
380
+ --------------------------------------------------------------------------------
381
+ => 1.1.2024 | root | record initiated |
382
+ => 1.2.2024 | root | member provided correct date via mail | birth: "1976-3-15"
383
+
384
+ ```
235
385
 
236
386
  ## Contributing
237
387
 
data/arcade.yml CHANGED
@@ -13,7 +13,7 @@
13
13
  user: root
14
14
  pass: topo1focus
15
15
  :admin:
16
- :host: 10.247.8.109
16
+ :host: localhost
17
17
  :port: 2480
18
18
  :user: root
19
19
  :pass: topo1focus
data/bin/console CHANGED
@@ -1,14 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
- ## loads the active-orient environment
2
+ ## loads the arcadeDB environment
3
3
  ## and starts an interactive shell
4
4
  ##
5
- ## Parameter:
5
+ ## Parameter:
6
6
  ## production (p)
7
7
  ## development (d) [default]
8
8
  ## test (t)
9
9
  require 'bundler/setup'
10
- require 'terminal-table'
10
+ #require 'terminal-table'
11
11
  require 'zeitwerk'
12
+ ProjectRoot = Pathname.new( Dir.pwd ).parent
12
13
  require 'pastel'
13
14
  require 'arcade'
14
15
  #require 'pry'
@@ -66,10 +67,6 @@ def browse db: Arcade::Api.databases.first , extended: false
66
67
  end
67
68
 
68
69
 
69
-
70
-
71
-
72
-
73
70
  include Arcade
74
71
 
75
72
  def help
@@ -106,21 +103,25 @@ end
106
103
 
107
104
  help
108
105
  e= ARGV.empty? ? :development : ARGV.last.downcase.to_sym
109
- ## load test model files
110
- #require "#{__dir__}/../spec/model_helper"
111
-
112
106
  loader = Zeitwerk::Loader.new
113
- loader.push_dir ("#{__dir__}/../spec/model")
107
+ if e.to_s[0] == 't'
108
+ loader.push_dir ("#{__dir__}/../spec/model")
109
+ else
110
+ loader.push_dir ("#{__dir__}/../lib/model")
111
+
112
+ end
114
113
  loader.setup
115
114
  puts "DB = Arcade::Database-instance"
116
115
  DB = Arcade::Init.connect e
117
116
  #require 'pry'
117
+ #if e.to_s[0] == 't'
118
+ # DB.create_type :document, 'test_document'
119
+ # DB.create_type :vertex, :test_vertex
120
+ #
121
+ #end
118
122
  require 'irb'
119
123
  ARGV.clear
120
- #begin
124
+
121
125
  IRB.start(__FILE__)
122
- #rescue ArgumentError => e
123
- # puts e
124
- ## retry
125
- #end
126
+
126
127
  #Pry.start(__FILE__)