neo4j 6.1.5 → 6.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e354c8febb1d9184fa43cce76cd330c41c6dbd8
4
- data.tar.gz: afd33c3f4996017fac26e3315e023627a2664591
3
+ metadata.gz: 638962213a8d5eab5d30064bc56b0c1144bf0a29
4
+ data.tar.gz: b4e1666949e6f065a38d653e413cc0ead3eadecd
5
5
  SHA512:
6
- metadata.gz: 6f69ced8cf20c80e1ec7220eecf27f63eaa6b95f6f74e9bd1940ae7fc93c5de4ca53ce8af463d19185866efab1570e1ee12a90dff447b986449243d723b56e50
7
- data.tar.gz: c430069c05842ada0082e3f9d1be20981660901bd50844b276ee6363cdb2f2f89ab35bb732ee808c24a3a48cd5c51fd119dd79b7a02626fa81d956dcc92ac983
6
+ metadata.gz: 29faddc490ad08ae876f80856158496c7daa5b53f648ffca5cacff13f4c687e64f9049d4c6aa44503b4e71956daaaab97b92c75696497a7213c1f8f3cad8d3b6
7
+ data.tar.gz: 652d119b06f5df0e563e890d6c71fa1b5b6467e6d710fb7df9b37ee6372fe8811a1e75f2b923008f9c57541d2eb1c891e02ce14dbccf67e8c85b9e754b984082
data/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.
3
3
  This file should follow the standards specified on [http://keepachangelog.com/]
4
4
  This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [6.1.6] - 2016-02-03
7
+
8
+ ### Added
9
+
10
+ - `wait_for_connection` configuration variable allows you to tell the gem to wait for up to 60 seconds for Neo4j to be available. This is useful in environments such as Docker Compose
11
+
6
12
  ## [6.1.5] - 2016-01-28
7
13
 
8
14
  ### Fixed
data/lib/neo4j/railtie.rb CHANGED
@@ -77,23 +77,44 @@ module Neo4j
77
77
  session.start
78
78
  end
79
79
 
80
- def open_neo4j_session(options)
80
+ def open_neo4j_session(options, wait_for_connection = false)
81
81
  type, name, default, path = options.values_at(:type, :name, :default, :path)
82
82
 
83
83
  if !java_platform? && type == :embedded_db
84
84
  fail "Tried to start embedded Neo4j db without using JRuby (got #{RUBY_PLATFORM}), please run `rvm jruby`"
85
85
  end
86
86
 
87
- session = if options.key?(:name)
88
- Neo4j::Session.open_named(type, name, default, path)
89
- else
90
- Neo4j::Session.open(type, path, options[:options])
91
- end
87
+ session = wait_for_value(wait_for_connection) do
88
+ if options.key?(:name)
89
+ Neo4j::Session.open_named(type, name, default, path)
90
+ else
91
+ Neo4j::Session.open(type, path, options[:options])
92
+ end
93
+ end
92
94
 
93
95
  start_embedded_session(session) if type == :embedded_db
94
96
  end
95
97
  end
96
98
 
99
+ def wait_for_value(wait)
100
+ session = nil
101
+ Timeout.timeout(60) do
102
+ until session
103
+ begin
104
+ if session = yield
105
+ puts
106
+ return session
107
+ end
108
+ rescue Faraday::ConnectionFailed => e
109
+ raise e if !wait
110
+
111
+ putc '.'
112
+ sleep(1)
113
+ end
114
+ end
115
+ end
116
+ end
117
+
97
118
  def register_neo4j_cypher_logging
98
119
  return if @neo4j_cypher_logging_registered
99
120
 
@@ -120,7 +141,7 @@ module Neo4j
120
141
  Neo4j::Railtie.setup_default_session(cfg)
121
142
 
122
143
  cfg.sessions.each do |session_opts|
123
- Neo4j::Railtie.open_neo4j_session(session_opts)
144
+ Neo4j::Railtie.open_neo4j_session(session_opts, cfg.wait_for_connection)
124
145
  end
125
146
  Neo4j::Config.configuration.merge!(cfg.to_hash)
126
147
 
data/lib/neo4j/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = '6.1.5'
2
+ VERSION = '6.1.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.5
4
+ version: 6.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Ronge, Brian Underwood, Chris Grigg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-28 00:00:00.000000000 Z
11
+ date: 2016-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: orm_adapter