Chris Mague %!s(int64=7) %!d(string=hai) anos
achega
84e953accb
Modificáronse 10 ficheiros con 97 adicións e 0 borrados
  1. 3 0
      .gitignore
  2. 1 0
      .ruby-gemset
  3. 1 0
      .ruby-version
  4. 11 0
      Gemfile
  5. 7 0
      Rakefile
  6. 20 0
      Readme.md
  7. 4 0
      accounts.yaml.example
  8. 6 0
      lib/neoinfra.rb
  9. 31 0
      lib/neoinfra/accounts.rb
  10. 13 0
      models/accounts.rb

+ 3 - 0
.gitignore

@@ -0,0 +1,3 @@
+Gemfile.lock
+accounts.yaml
+data/*

+ 1 - 0
.ruby-gemset

@@ -0,0 +1 @@
+fog

+ 1 - 0
.ruby-version

@@ -0,0 +1 @@
+ruby-2.3.3

+ 11 - 0
Gemfile

@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+source 'http://rubygems.org'
+
+gem 'fog'
+gem 'neo4j', '7.2.0'
+gem 'rubytree'
+
+group :development do
+  gem 'rubocop', require: false
+end

+ 7 - 0
Rakefile

@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+require 'rubocop/rake_task'
+
+RuboCop::RakeTask.new(:rubocop) do |t|
+  t.options = ['--display-cop-names']
+end

+ 20 - 0
Readme.md

@@ -0,0 +1,20 @@
+# neo-infra
+
+## Running
+
+Download and run the APOC Docker image of Neo4j
+
+```
+mkdir plugins
+pushd plugins
+wget https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/3.1.3.7/apoc-3.1.3.7-all.jar
+popd
+
+docker run --rm \
+    --publish=7474:7474 --publish=7687:7687 \
+    --volume=$HOME/tmp/neo4j/data:/data \
+    --volume=$HOME/tmp/neo4j/logs:/logs \
+    --volume=$PWD/plugins:/plugins \
+    -e NEO4J_AUTH='none' \
+    neo4j:3.1.4
+```

+ 4 - 0
accounts.yaml.example

@@ -0,0 +1,4 @@
+---
+- :name: account1
+  :key: YYYYYYYYYYYYYYY
+  :secret: ZZZZZZZZZZZZzzzzzzzzzzzzzz

+ 6 - 0
lib/neoinfra.rb

@@ -0,0 +1,6 @@
+# frozen_string_literal: true
+
+# The supplies all of the various neoinfra info
+module NeoInfra
+  require 'neoinfra/accounts'
+end

+ 31 - 0
lib/neoinfra/accounts.rb

@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+require 'yaml'
+require 'fog'
+require 'neo4j'
+
+# NeoInfra Account information
+module NeoInfra
+  models_dir = File.join(
+    File.dirname(File.expand_path(__FILE__)), '..', 'models'
+  )
+
+  $LOAD_PATH.unshift(models_dir) unless
+    $LOAD_PATH.include?(models_dir) || $LOAD_PATH.include?(models_dir)
+
+  # Provide informations about the accounts available
+  class Accounts
+    attr_reader :accounts
+
+    def initialize
+      @accounts = YAML.load_file(
+        File.join(File.dirname(File.expand_path(__FILE__)),
+                  '..', '..', 'accounts.yaml')
+      )
+    end
+
+    def list
+      accounts
+    end
+  end
+end

+ 13 - 0
models/accounts.rb

@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+require 'neo4j'
+
+# Provide Neo4J Model for aws accounts
+class AwsAccount
+  include Neo4j::ActiveNode
+  property :name, constraint: :unique
+  property :account_id, constraint: :unique
+  # We get the md5 since so we can search if we only know the creds
+  property :key_md5
+  property :secret_md5
+end