geoff 0.1.1 → 0.1.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.
data/.rspec ADDED
@@ -0,0 +1,6 @@
1
+ --tty
2
+ --color
3
+ --tag ~sanity
4
+ --tag ~benchmark
5
+ --tag ~ci_only
6
+ --profile
data/.rvmrc CHANGED
@@ -1 +1,54 @@
1
- rvm use jruby
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
+ # Only full ruby name is supported here, for short names use:
8
+ # echo "rvm use jruby" > .rvmrc
9
+ environment_id="jruby-1.7.0@geoff"
10
+ export JRUBY_OPTS='-J-Xms1024m -J-Xmx1024m -J-XX:+UseConcMarkSweepGC -J-XX:MaxPermSize=512m -J-Djruby.thread.pooling=true'
11
+
12
+ # Uncomment the following lines if you want to verify rvm version per project
13
+ # rvmrc_rvm_version="1.14.2 ()" # 1.10.1 seams as a safe start
14
+ # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
15
+ # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
16
+ # return 1
17
+ # }
18
+
19
+ # Uncomment following line if you want options to be set only for given project.
20
+ # PROJECT_JRUBY_OPTS=( --1.9 )
21
+ # The variable PROJECT_JRUBY_OPTS requires the following to be run in shell:
22
+ # chmod +x ${rvm_path}/hooks/after_use_jruby_opts
23
+
24
+ # First we attempt to load the desired environment directly from the environment
25
+ # file. This is very fast and efficient compared to running through the entire
26
+ # CLI and selector. If you want feedback on which environment was used then
27
+ # insert the word 'use' after --create as this triggers verbose mode.
28
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
29
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
30
+ then
31
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
32
+ [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
33
+ \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
34
+ else
35
+ # If the environment file has not yet been created, use the RVM CLI to select.
36
+ rvm --create "$environment_id" || {
37
+ echo "Failed to create RVM environment '${environment_id}'."
38
+ return 1
39
+ }
40
+ fi
41
+
42
+ # If you use bundler, this might be useful to you:
43
+ # if [[ -s Gemfile ]] && {
44
+ # ! builtin command -v bundle >/dev/null ||
45
+ # builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
46
+ # }
47
+ # then
48
+ # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
49
+ # gem install bundler
50
+ # fi
51
+ # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
52
+ # then
53
+ # bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
54
+ # fi
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- geoff (0.1.1)
4
+ geoff (0.1.2)
5
5
  activesupport (~> 3.2.3)
6
6
  json
7
7
  neo4j
@@ -41,16 +41,18 @@ GEM
41
41
  rbx-require-relative (> 0.0.4)
42
42
  method_source (0.8)
43
43
  multi_json (1.3.6)
44
- neo4j (2.0.1-java)
44
+ neo4j (2.2.0-java)
45
45
  activemodel (>= 3.0.0, < 3.3)
46
- neo4j-wrapper (= 2.0.1)
46
+ neo4j-wrapper (= 2.2.0)
47
47
  orm_adapter (>= 0.0.3)
48
48
  railties (>= 3.0.0, < 3.3)
49
- neo4j-community (1.7.1-java)
50
- neo4j-core (2.0.1-java)
51
- neo4j-community (>= 1.7.0)
52
- neo4j-wrapper (2.0.1-java)
53
- neo4j-core (= 2.0.1)
49
+ neo4j-community (1.8.RC1-java)
50
+ neo4j-core (2.2.0-java)
51
+ neo4j-community (>= 1.8.M05, < 1.9)
52
+ neo4j-cypher (~> 1.0.0)
53
+ neo4j-cypher (1.0.0)
54
+ neo4j-wrapper (2.2.0-java)
55
+ neo4j-core (= 2.2.0)
54
56
  orm_adapter (0.4.0)
55
57
  pry (0.9.10)
56
58
  coderay (~> 1.0.5)
@@ -15,7 +15,7 @@ class ChildrenDsl
15
15
  @parent_rel_type = options[:type]
16
16
  @target = options[:target]
17
17
  @outer_geoff = options[:geoff]
18
-
18
+ @direction = options[:direction]
19
19
  @write_mode = false
20
20
 
21
21
  @node_dsls = {}
@@ -57,11 +57,13 @@ class ChildrenDsl
57
57
  end
58
58
 
59
59
  def rel_geoff node_dsl, properties
60
+ directions_ascii = ["<-", "-", "->"]
61
+ direction_array = @direction == :incoming ? directions_ascii.first(2) : directions_ascii.last(2)
60
62
  properties = properties.dup
61
63
  type = properties.delete :type
62
64
  properties.delete(:clone)
63
65
 
64
- "(#{parent_node_name})-[:#{type}]->(#{node_dsl.node_name})".tap do |r|
66
+ "(#{parent_node_name})#{direction_array.first}[:#{type}]#{direction_array.last}(#{node_dsl.node_name})".tap do |r|
65
67
  r << " #{properties.to_json}" if properties.any?
66
68
  end
67
69
  end
@@ -111,6 +111,16 @@ class NodeDsl
111
111
 
112
112
  private
113
113
 
114
+ def incoming type=nil, options={}, &block
115
+ options.merge!(direction: :incoming)
116
+ children type, options, &block
117
+ end
118
+
119
+ def outgoing type=nil, options={}, &block
120
+ options.merge!(direction: :outgoing)
121
+ children type, options, &block
122
+ end
123
+
114
124
  def children type=nil, options={}, &block
115
125
  options.merge!({
116
126
  parent_node_dsl: self,
@@ -118,7 +128,7 @@ class NodeDsl
118
128
  container: @container,
119
129
  target: @target
120
130
  })
121
-
131
+ options.merge!(direction: :outgoing) unless options.has_key? :direction
122
132
  @children_dsls << ChildrenDsl.new(options, &block)
123
133
  end
124
134
  end
data/lib/geoff/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Geoff
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -9,6 +9,42 @@ describe Geoff do
9
9
  class Table; include Neo4j::NodeMixin; end
10
10
 
11
11
  describe 'injecting builders' do
12
+ context 'using direction macros' do
13
+ before { stub_node_dsl_object_id }
14
+ let(:builder) do
15
+ Geoff(Branch) do
16
+ branch 'banana' do
17
+ incoming :inverts do
18
+ branch 'egg'
19
+ end
20
+ outgoing :reverts do
21
+ branch 'reverted_banana'
22
+ end
23
+
24
+ end
25
+ end
26
+ end
27
+
28
+ let(:expected_geoff) do
29
+ strip_whitespace <<-EOS
30
+ (ROOT)-[:Branch]->(Branch)
31
+ (banana) {"_classname":"Branch"}
32
+ (Branch)-[:all]->(banana)
33
+ (egg) {"_classname":"Branch"}
34
+ (Branch)-[:all]->(egg)
35
+ (banana)<-[:inverts]-(egg)
36
+ (reverted_banana) {"_classname":"Branch"}
37
+ (Branch)-[:all]->(reverted_banana)
38
+ (banana)-[:reverts]->(reverted_banana)
39
+ EOS
40
+ end
41
+ specify do
42
+ geoff = builder.to_geoff
43
+ geoff.should == expected_geoff
44
+ end
45
+
46
+ end
47
+
12
48
  context 'with object_id ignored' do
13
49
  before { stub_node_dsl_object_id }
14
50
 
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoff
3
3
  version: !ruby/object:Gem::Version
4
+ version: 0.1.2
4
5
  prerelease:
5
- version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - David Rouchy
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2012-10-30 00:00:00.000000000 Z
16
+ date: 2012-11-14 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: neo4j
@@ -21,13 +21,15 @@ dependencies:
21
21
  requirements:
22
22
  - - ! '>='
23
23
  - !ruby/object:Gem::Version
24
- version: '0'
24
+ version: !binary |-
25
+ MA==
25
26
  none: false
26
27
  requirement: !ruby/object:Gem::Requirement
27
28
  requirements:
28
29
  - - ! '>='
29
30
  - !ruby/object:Gem::Version
30
- version: '0'
31
+ version: !binary |-
32
+ MA==
31
33
  none: false
32
34
  prerelease: false
33
35
  type: :runtime
@@ -37,13 +39,15 @@ dependencies:
37
39
  requirements:
38
40
  - - ! '>='
39
41
  - !ruby/object:Gem::Version
40
- version: '0'
42
+ version: !binary |-
43
+ MA==
41
44
  none: false
42
45
  requirement: !ruby/object:Gem::Requirement
43
46
  requirements:
44
47
  - - ! '>='
45
48
  - !ruby/object:Gem::Version
46
- version: '0'
49
+ version: !binary |-
50
+ MA==
47
51
  none: false
48
52
  prerelease: false
49
53
  type: :development
@@ -69,13 +73,15 @@ dependencies:
69
73
  requirements:
70
74
  - - ! '>='
71
75
  - !ruby/object:Gem::Version
72
- version: '0'
76
+ version: !binary |-
77
+ MA==
73
78
  none: false
74
79
  requirement: !ruby/object:Gem::Requirement
75
80
  requirements:
76
81
  - - ! '>='
77
82
  - !ruby/object:Gem::Version
78
- version: '0'
83
+ version: !binary |-
84
+ MA==
79
85
  none: false
80
86
  prerelease: false
81
87
  type: :runtime
@@ -101,13 +107,15 @@ dependencies:
101
107
  requirements:
102
108
  - - ! '>='
103
109
  - !ruby/object:Gem::Version
104
- version: '0'
110
+ version: !binary |-
111
+ MA==
105
112
  none: false
106
113
  requirement: !ruby/object:Gem::Requirement
107
114
  requirements:
108
115
  - - ! '>='
109
116
  - !ruby/object:Gem::Version
110
- version: '0'
117
+ version: !binary |-
118
+ MA==
111
119
  none: false
112
120
  prerelease: false
113
121
  type: :development
@@ -117,13 +125,15 @@ dependencies:
117
125
  requirements:
118
126
  - - ! '>='
119
127
  - !ruby/object:Gem::Version
120
- version: '0'
128
+ version: !binary |-
129
+ MA==
121
130
  none: false
122
131
  requirement: !ruby/object:Gem::Requirement
123
132
  requirements:
124
133
  - - ! '>='
125
134
  - !ruby/object:Gem::Version
126
- version: '0'
135
+ version: !binary |-
136
+ MA==
127
137
  none: false
128
138
  prerelease: false
129
139
  type: :development
@@ -140,6 +150,7 @@ extra_rdoc_files: []
140
150
  files:
141
151
  - .gitignore
142
152
  - .rbenv-version
153
+ - .rspec
143
154
  - .rvmrc
144
155
  - Gemfile
145
156
  - Gemfile.lock
@@ -192,8 +203,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
192
203
  - !ruby/object:Gem::Version
193
204
  segments:
194
205
  - 0
206
+ version: !binary |-
207
+ MA==
195
208
  hash: 2
196
- version: '0'
197
209
  none: false
198
210
  required_rubygems_version: !ruby/object:Gem::Requirement
199
211
  requirements:
@@ -201,8 +213,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
213
  - !ruby/object:Gem::Version
202
214
  segments:
203
215
  - 0
216
+ version: !binary |-
217
+ MA==
204
218
  hash: 2
205
- version: '0'
206
219
  none: false
207
220
  requirements: []
208
221
  rubyforge_project:
@@ -219,4 +232,3 @@ test_files:
219
232
  - spec/node_dsl_spec.rb
220
233
  - spec/spec_helper.rb
221
234
  - spec/support/geof_matchers.rb
222
- ...