neptune-local 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -9
- data/lib/neptune/local/server.rb +49 -8
- data/lib/neptune/local/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfa7bc5f6413cc41910fd210f0259d861bd23bbb6637854137176a135fbe3668
|
4
|
+
data.tar.gz: 263ceee62f2689023abb88fb3d21a1f7bc23b185bbb7a1e8ed4f2adb6bec8756
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c673334a4ae3661625dbef67418d78594b2e48c340f269ed2b003dac1e56a732d8ae3286dc8f86a1d99030011a29881768351cc5f7f089418d151c77f54028f
|
7
|
+
data.tar.gz: f0cfd87c28f9ae89cf9a06f23cea694c9a3ffeda45fc12a8220364f139c374b9bea8a824c450aec501017b660a2830e87dfcee68065e403de4cbe027bf308976
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Neptune::Local
|
2
2
|
|
3
|
-
|
3
|
+
Wraps installation and usage of the Apache Tinkerpop Gremlin Server version 3.3.2 (upon which AWS Neptune is based).
|
4
4
|
|
5
|
-
|
5
|
+
Inspired by the [Dynamodb::Local](https://github.com/jhuckabee/dynamodb-local) gem for DynamoDB.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -22,17 +22,27 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
```ruby
|
26
|
+
irb(main):001:0> require 'neptune/local'
|
27
|
+
=> true
|
28
|
+
irb(main):002:0> neptune = Neptune::Local::Server.new
|
29
|
+
=> #<Neptune::Local::Server:0x00007fa7cb05d0a0 @debug=nil, @gremlin_home=nil, @gremlin_yaml=nil, @log_dir=nil, @pid_dir=nil, @runas=nil, @java_home=nil, @java_options=nil>
|
30
|
+
irb(main):003:0> neptune.start
|
31
|
+
Server started 4085.
|
32
|
+
=> nil
|
33
|
+
irb(main):004:0> neptune.restart
|
34
|
+
Server stopped [4085]
|
35
|
+
Server started 4114.
|
36
|
+
=> nil
|
37
|
+
irb(main):005:0> neptune.stop
|
38
|
+
Server stopped [4114]
|
39
|
+
=> nil
|
30
40
|
|
31
|
-
|
41
|
+
```
|
32
42
|
|
33
43
|
## Contributing
|
34
44
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
45
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/garymacindoe/neptune-local.
|
36
46
|
|
37
47
|
## License
|
38
48
|
|
data/lib/neptune/local/server.rb
CHANGED
@@ -4,16 +4,57 @@ module Neptune
|
|
4
4
|
|
5
5
|
GREMLIN_SERVER_DIR = File.join(File.dirname(__FILE__), 'ext/apache-tinkerpop-gremlin-server-3.3.2')
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
attr_reader :debug, :gremlin_home, :gremlin_yaml, :log_dir, :pid_dir, :runas, :java_home, :java_options
|
8
|
+
|
9
|
+
def initialize(debug = nil,
|
10
|
+
gremlin_home = nil,
|
11
|
+
gremlin_yaml = nil,
|
12
|
+
log_dir = nil,
|
13
|
+
pid_dir = nil,
|
14
|
+
runas = nil,
|
15
|
+
java_home = nil,
|
16
|
+
java_options = nil)
|
17
|
+
@debug = debug
|
18
|
+
@gremlin_home = gremlin_home
|
19
|
+
@gremlin_yaml = gremlin_yaml
|
20
|
+
@log_dir = log_dir
|
21
|
+
@pid_dir = pid_dir
|
22
|
+
@runas = runas
|
23
|
+
@java_home = java_home
|
24
|
+
@java_options = java_options
|
25
|
+
end
|
26
|
+
|
27
|
+
def start
|
28
|
+
pid = Process.spawn(to_env, 'bin/gremlin-server.sh', 'start', :chdir => GREMLIN_SERVER_DIR)
|
29
|
+
Process.wait(pid)
|
30
|
+
raise "Starting the gremlin server returned non-zero exit status: #{$?.exitstatus}" unless $?.success?
|
31
|
+
end
|
32
|
+
|
33
|
+
def stop
|
34
|
+
pid = Process.spawn(to_env, 'bin/gremlin-server.sh', 'stop', :chdir => GREMLIN_SERVER_DIR)
|
35
|
+
Process.wait pid
|
36
|
+
raise "Stopping the gremlin server returned non-zero exit status: #{$?.exitstatus}" unless $?.success?
|
37
|
+
end
|
38
|
+
|
39
|
+
def restart
|
40
|
+
pid = Process.spawn(to_env, 'bin/gremlin-server.sh', 'restart', :chdir => GREMLIN_SERVER_DIR)
|
41
|
+
Process.wait pid
|
42
|
+
raise "Restarting the gremlin server returned non-zero exit status: #{$?.exitstatus}" unless $?.success?
|
11
43
|
end
|
12
44
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
45
|
+
private
|
46
|
+
|
47
|
+
def to_env
|
48
|
+
{
|
49
|
+
'DEBUG' => @debug,
|
50
|
+
'GREMLIN_HOME' => @gremlin_home,
|
51
|
+
'GREMLIN_YAML' => @gremlin_yaml,
|
52
|
+
'LOG_DIR' => @log_dir,
|
53
|
+
'PID_DIR' => @pid_dir,
|
54
|
+
'RUNAS' => @runas,
|
55
|
+
'JAVA_HOME' => @java_home,
|
56
|
+
'JAVA_OPTIONS' => @java_options
|
57
|
+
}
|
17
58
|
end
|
18
59
|
|
19
60
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neptune-local
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gary Macindoe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|