neptune-local 0.1.0 → 0.2.0

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: 4030c25e48ac46de42e661538237d3201d89e874ab744218d71afaeceaea46aa
4
- data.tar.gz: 2b74a8e7ccb230ff7fb999461f2e9c542ce17ca60b53f8c864055f31fe76d4cb
3
+ metadata.gz: bfa7bc5f6413cc41910fd210f0259d861bd23bbb6637854137176a135fbe3668
4
+ data.tar.gz: 263ceee62f2689023abb88fb3d21a1f7bc23b185bbb7a1e8ed4f2adb6bec8756
5
5
  SHA512:
6
- metadata.gz: 79efc1df7d5b3414a455c7ccfaddacb35cfa2c7f834bdf2aa42991c5fd871409a6bba1671a883e48f2a755852e570830daaf25b1f28198c74dd3cd3ffd3611ef
7
- data.tar.gz: e6a0d771accb3b69eae3573c1e364de8b893bd271c3f010a8de60accb07bb6c46f0ed47d71f8e1e5b7ef9265886e72c0c86ff56788f3df6a3d96e0b8c1b5ce38
6
+ metadata.gz: 0c673334a4ae3661625dbef67418d78594b2e48c340f269ed2b003dac1e56a732d8ae3286dc8f86a1d99030011a29881768351cc5f7f089418d151c77f54028f
7
+ data.tar.gz: f0cfd87c28f9ae89cf9a06f23cea694c9a3ffeda45fc12a8220364f139c374b9bea8a824c450aec501017b660a2830e87dfcee68065e403de4cbe027bf308976
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Neptune::Local
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/neptune/local`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Wraps installation and usage of the Apache Tinkerpop Gremlin Server version 3.3.2 (upon which AWS Neptune is based).
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
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
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
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
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
41
+ ```
32
42
 
33
43
  ## Contributing
34
44
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/neptune-local.
45
+ Bug reports and pull requests are welcome on GitHub at https://github.com/garymacindoe/neptune-local.
36
46
 
37
47
  ## License
38
48
 
@@ -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
- def self.start
8
- Dir.chdir(GREMLIN_SERVER_DIR) do
9
- system 'bin/gremlin-server.sh start'
10
- end
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
- def self.stop
14
- Dir.chdir(GREMLIN_SERVER_DIR) do
15
- system 'bin/gremlin-server.sh stop'
16
- end
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
@@ -1,5 +1,5 @@
1
1
  module Neptune
2
2
  module Local
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  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.1.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-06-28 00:00:00.000000000 Z
11
+ date: 2018-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler