neoscout 0.1
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.
- data/.gitignore +9 -0
- data/.rspec +3 -0
- data/.rvmrc +2 -0
- data/AUTHORS +1 -0
- data/Gemfile +21 -0
- data/Gemfile.lock +138 -0
- data/LICENSE.txt +21 -0
- data/README.md +194 -0
- data/Rakefile +30 -0
- data/TODO.org +27 -0
- data/etc/neo4j.yml +16 -0
- data/lib/neoscout.rb +12 -0
- data/lib/neoscout/constraints.rb +35 -0
- data/lib/neoscout/gdb_neo4j.rb +147 -0
- data/lib/neoscout/json_schema.rb +136 -0
- data/lib/neoscout/main.rb +205 -0
- data/lib/neoscout/model.rb +148 -0
- data/lib/neoscout/scout.rb +119 -0
- data/lib/neoscout/tools.rb +156 -0
- data/lib/neoscout/version.rb +3 -0
- data/neoscout.gemspec +25 -0
- data/root/README.md +3 -0
- data/script/neoscout +15 -0
- data/spec/lib/neoscout/constraints_spec.rb +25 -0
- data/spec/lib/neoscout/gdb_neo4j_spec.rb +81 -0
- data/spec/lib/neoscout/gdb_neo4j_spec_counts.json +282 -0
- data/spec/lib/neoscout/gdb_neo4j_spec_schema.json +46 -0
- data/spec/lib/neoscout/model_spec.rb +42 -0
- data/spec/lib/neoscout/tools_spec.rb +139 -0
- data/spec/spec_helper.rb +5 -0
- metadata +84 -0
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec/spec_helper'
|
2
|
+
require 'neoscout'
|
3
|
+
|
4
|
+
module NeoScout
|
5
|
+
|
6
|
+
describe Verifier do
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
@it = Verifier.new
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'initialize node_constraints' do
|
13
|
+
@it.node_props[:movie].length.should be == 0
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'initialize edge_constraints' do
|
17
|
+
@it.edge_props[:movie].length.should be == 0
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
describe Scout do
|
23
|
+
|
24
|
+
before(:each) do
|
25
|
+
@it = Scout.new
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'initialize verifier default value' do
|
29
|
+
@it.verifier.should_not be nil?
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'initialize iterator default value' do
|
33
|
+
@it.iterator.should_not be nil?
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'initialize typer default value' do
|
37
|
+
@it.typer.should_not be nil?
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,139 @@
|
|
1
|
+
require 'spec/spec_helper'
|
2
|
+
require 'neoscout'
|
3
|
+
|
4
|
+
module NeoScout
|
5
|
+
|
6
|
+
describe ConstrainedSet do
|
7
|
+
|
8
|
+
it 'should check arguments on initialize' do
|
9
|
+
lambda { ConstrainedSet.new { |o| o.kind_of? Fixnum } }.should_not raise_error(ArgumentError)
|
10
|
+
lambda { ConstrainedSet.new([1, 2]) { |o| o.kind_of? Fixnum } }.should_not raise_error(ArgumentError)
|
11
|
+
lambda { ConstrainedSet.new([:a]) { |o| o.kind_of? Fixnum } }.should raise_error(ArgumentError)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should check elements on append' do
|
15
|
+
lambda { (ConstrainedSet.new { |o| o.kind_of? Fixnum }) << 0 }.should_not raise_error(ArgumentError)
|
16
|
+
lambda { (ConstrainedSet.new { |o| o.kind_of? Fixnum }) << :a }.should raise_error(ArgumentError)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should append' do
|
20
|
+
c = ConstrainedSet.new { |o| true }
|
21
|
+
c << 1
|
22
|
+
c << 2
|
23
|
+
c.to_a.should be == [1, 2]
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
describe Counter do
|
30
|
+
|
31
|
+
it 'initializes correctly' do
|
32
|
+
@it = Counter.new
|
33
|
+
@it.num_ok.should be == 0
|
34
|
+
@it.num_failed.should be == 0
|
35
|
+
@it.num_total.should be == 0
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'counts correctly' do
|
39
|
+
@it = Counter.new
|
40
|
+
@it.incr_ok
|
41
|
+
@it.incr_ok
|
42
|
+
@it.incr_ok
|
43
|
+
@it.incr_failed
|
44
|
+
@it.num_ok.should be == 3
|
45
|
+
@it.num_failed.should be == 1
|
46
|
+
@it.num_total.should be == 4
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'resets correctly' do
|
50
|
+
@it = Counter.new
|
51
|
+
@it.incr_ok
|
52
|
+
@it.incr_ok
|
53
|
+
@it.incr_ok
|
54
|
+
@it.incr_failed
|
55
|
+
@it.reset
|
56
|
+
@it.num_ok.should be == 0
|
57
|
+
@it.num_failed.should be == 0
|
58
|
+
@it.num_total.should be == 0
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'is convertible to string' do
|
62
|
+
@it = Counter.new
|
63
|
+
@it.incr_ok
|
64
|
+
@it.incr_ok
|
65
|
+
@it.incr_ok
|
66
|
+
@it.incr_failed
|
67
|
+
@it.to_s.should be == "(3/1/4)"
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'is convertible to json' do
|
71
|
+
@it = Counter.new
|
72
|
+
@it.incr_ok
|
73
|
+
@it.incr_ok
|
74
|
+
@it.incr_ok
|
75
|
+
@it.incr_failed
|
76
|
+
@it.to_json.should be == { 'num_failed' => 1, 'num_total' => 4 }
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
describe HashWithDefault do
|
83
|
+
it 'computes a default value again and again' do
|
84
|
+
count = 0
|
85
|
+
default = lambda { |key| count += 1 }
|
86
|
+
@it = HashWithDefault.new &default
|
87
|
+
[ @it.default(nil), @it.default(:y), @it[0] ].should be == [ 1, 2, 3 ]
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'can lookup via lookup()' do
|
91
|
+
@it = HashWithDefault.new { |key| 1 }
|
92
|
+
@it[:a] = 2
|
93
|
+
@it.lookup(:a).should be == 2
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'can lookup without creating a default value' do
|
97
|
+
@it = HashWithDefault.new { |key| 1 }
|
98
|
+
@it[:a] = 2
|
99
|
+
@it.lookup(:b).should be == nil
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
describe JSON do
|
105
|
+
|
106
|
+
it 'should cd into hashes' do
|
107
|
+
@it = {}
|
108
|
+
JSON.cd @it, [:a]
|
109
|
+
@it.should be == { :a => {} }
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'should cd into hashes deeply' do
|
113
|
+
@it = {}
|
114
|
+
JSON.cd @it, [:a, :b]
|
115
|
+
@it.should be == { :a => { :b => {} } }
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
it 'should return the last hash for further writing' do
|
120
|
+
@it = {}
|
121
|
+
(JSON.cd @it, [:a, :b])[:c] = 3
|
122
|
+
@it.should be == { :a => { :b => { :c => 3 } } }
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'should not clobber unrelated hashes' do
|
126
|
+
@it = { :x => 5 }
|
127
|
+
(JSON.cd @it, [:a, :b])[:c] = 3
|
128
|
+
@it.should be == { :a => { :b => { :c => 3 } }, :x => 5 }
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'should not clobber existing hashes' do
|
132
|
+
@it = { :a => { :y => 2 }, :x => 5 }
|
133
|
+
(JSON.cd @it, [:a, :b])[:c] = 3
|
134
|
+
@it.should be == { :a => { :b => { :c => 3 }, :y => 2 }, :x => 5 }
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: neoscout
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: '0.1'
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Stefan Plantikow
|
9
|
+
autorequire:
|
10
|
+
bindir: script
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-04-11 00:00:00.000000000Z
|
13
|
+
dependencies: []
|
14
|
+
description: Tool for validating the schema of a free form graph databases and for reporting errors, including a REST access layer for runtime checking
|
15
|
+
email: stefanp@moviepilot.com
|
16
|
+
executables:
|
17
|
+
- neoscout
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- .rspec
|
23
|
+
- .rvmrc
|
24
|
+
- AUTHORS
|
25
|
+
- Gemfile
|
26
|
+
- Gemfile.lock
|
27
|
+
- LICENSE.txt
|
28
|
+
- README.md
|
29
|
+
- Rakefile
|
30
|
+
- TODO.org
|
31
|
+
- etc/neo4j.yml
|
32
|
+
- lib/neoscout.rb
|
33
|
+
- lib/neoscout/constraints.rb
|
34
|
+
- lib/neoscout/gdb_neo4j.rb
|
35
|
+
- lib/neoscout/json_schema.rb
|
36
|
+
- lib/neoscout/main.rb
|
37
|
+
- lib/neoscout/model.rb
|
38
|
+
- lib/neoscout/scout.rb
|
39
|
+
- lib/neoscout/tools.rb
|
40
|
+
- lib/neoscout/version.rb
|
41
|
+
- neoscout.gemspec
|
42
|
+
- root/README.md
|
43
|
+
- script/neoscout
|
44
|
+
- spec/lib/neoscout/constraints_spec.rb
|
45
|
+
- spec/lib/neoscout/gdb_neo4j_spec.rb
|
46
|
+
- spec/lib/neoscout/gdb_neo4j_spec_counts.json
|
47
|
+
- spec/lib/neoscout/gdb_neo4j_spec_schema.json
|
48
|
+
- spec/lib/neoscout/model_spec.rb
|
49
|
+
- spec/lib/neoscout/tools_spec.rb
|
50
|
+
- spec/spec_helper.rb
|
51
|
+
homepage: http://moviepilot.github.com/neoscout
|
52
|
+
licenses:
|
53
|
+
- PUBLIC DOMAIN WITHOUT ANY WARRANTY
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options: []
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
none: false
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
none: false
|
70
|
+
requirements: []
|
71
|
+
rubyforge_project: neoscout
|
72
|
+
rubygems_version: 1.8.15
|
73
|
+
signing_key:
|
74
|
+
specification_version: 3
|
75
|
+
summary: Graph database schema extraction and validation tool
|
76
|
+
test_files:
|
77
|
+
- spec/lib/neoscout/constraints_spec.rb
|
78
|
+
- spec/lib/neoscout/gdb_neo4j_spec.rb
|
79
|
+
- spec/lib/neoscout/gdb_neo4j_spec_counts.json
|
80
|
+
- spec/lib/neoscout/gdb_neo4j_spec_schema.json
|
81
|
+
- spec/lib/neoscout/model_spec.rb
|
82
|
+
- spec/lib/neoscout/tools_spec.rb
|
83
|
+
- spec/spec_helper.rb
|
84
|
+
...
|