devise-activegraph 3.0.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/.gitignore +33 -0
  4. data/.rdebugrc +1 -0
  5. data/.travis.yml +40 -0
  6. data/CHANGELOG.md +42 -0
  7. data/Gemfile +41 -0
  8. data/LICENSE +20 -0
  9. data/README.md +113 -0
  10. data/Rakefile +35 -0
  11. data/Vagrantfile +22 -0
  12. data/devise-activegraph.gemspec +27 -0
  13. data/lib/devise-activegraph.rb +23 -0
  14. data/lib/devise/active_graph/version.rb +5 -0
  15. data/lib/devise/orm/active_graph.rb +6 -0
  16. data/lib/devise/orm/active_graph/counter_increment.rb +15 -0
  17. data/lib/devise/orm/active_graph/hook.rb +15 -0
  18. data/lib/generators/active_graph.rb +4 -0
  19. data/lib/generators/active_graph/devise_generator.rb +92 -0
  20. data/lib/generators/active_graph/templates/migration.rb.erb +10 -0
  21. data/provisioning/roles/common/tasks/main.yml +13 -0
  22. data/provisioning/roles/java/README.md +30 -0
  23. data/provisioning/roles/java/files/.gitkeep +0 -0
  24. data/provisioning/roles/java/files/webupd8.key.asc +13 -0
  25. data/provisioning/roles/java/handlers/.gitkeep +0 -0
  26. data/provisioning/roles/java/tasks/.gitkeep +0 -0
  27. data/provisioning/roles/java/tasks/main.yml +6 -0
  28. data/provisioning/roles/java/tasks/openjdk.yml +6 -0
  29. data/provisioning/roles/java/tasks/oracle.yml +12 -0
  30. data/provisioning/roles/java/tasks/webupd8.yml +13 -0
  31. data/provisioning/roles/java/templates/.gitkeep +0 -0
  32. data/provisioning/roles/java/vars/.gitkeep +0 -0
  33. data/provisioning/roles/java/vars/main.yml +2 -0
  34. data/provisioning/roles/neo4j/files/neo4j-server.properties +20 -0
  35. data/provisioning/roles/neo4j/files/neo4j.conf +6 -0
  36. data/provisioning/roles/neo4j/tasks/main.yml +45 -0
  37. data/provisioning/roles/neo4j/vars/main.yml +1 -0
  38. data/provisioning/vagrant.yml +17 -0
  39. data/test/generators/active_graph/devise_generator_test.rb +25 -0
  40. data/test/orm/active_graph.rb +52 -0
  41. data/test/overrides/authenticatable_test.rb +15 -0
  42. data/test/overrides/confirmable_test.rb +37 -0
  43. data/test/overrides/database_authenticatable_test.rb +20 -0
  44. data/test/overrides/devise_helper_test.rb +12 -0
  45. data/test/overrides/email_changed_test.rb +9 -0
  46. data/test/overrides/integration_test.rb +22 -0
  47. data/test/overrides/mapping_test.rb +11 -0
  48. data/test/overrides/trackable_test.rb +6 -0
  49. data/test/rails_app/app/active_graph/admin.rb +43 -0
  50. data/test/rails_app/app/active_graph/user.rb +57 -0
  51. data/test/rails_app/app/active_graph/user_on_engine.rb +45 -0
  52. data/test/rails_app/app/active_graph/user_on_main_app.rb +46 -0
  53. data/test/rails_app/app/active_graph/user_without_email.rb +32 -0
  54. data/test/rails_app/config/application.rb +32 -0
  55. data/test/rails_app/config/environment.rb +5 -0
  56. data/test/test_helper.rb +42 -0
  57. metadata +215 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 939b327fb9cca45455d386a9ae7dbdbd1fc308f4a09ed37ba59303763bd533f8
4
+ data.tar.gz: 21b43d15c3c9a1454779353197a721d83f854e283cb0dcc41c5622ddcc39d531
5
+ SHA512:
6
+ metadata.gz: 39bebd543bb7d2db1e77feebf4fdbc4ab0695bc4d2ca9267511c7779a78fd1b5ec6b6116b2c5f35098038a2140c8f4c4518dd61401342442dd63aab0b6f2e045
7
+ data.tar.gz: 0e7f7f7db9d194c2528aab339b5d6a1ac3cb139a31df1c2f7ba8734064ee9e36e03b7b96efe3dfbe638949e262aa1168a224fb571f52220ac471d165c53c36b1
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,33 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ # RVM
17
+ .rvmrc
18
+
19
+ ## PROJECT::GENERAL
20
+ coverage
21
+ rdoc
22
+ pkg
23
+ vendor
24
+
25
+ ## PROJECT::SPECIFIC
26
+ tmp
27
+ db
28
+ test/rails_app/log
29
+
30
+ ## NETBEANS
31
+ nbproject
32
+
33
+ .vagrant
data/.rdebugrc ADDED
@@ -0,0 +1 @@
1
+ set autolist on
data/.travis.yml ADDED
@@ -0,0 +1,40 @@
1
+ ---
2
+ dist: xenial
3
+
4
+ before_script:
5
+ - mkdir ../devise
6
+ - git clone https://github.com/heartcombo/devise.git ../devise
7
+ - "travis_retry bundle exec rake neo4j:install[$NEO4J_VERSION] --trace"
8
+ - "bundle exec rake neo4j:config[development,7474] --trace"
9
+ - "if [ -f ./db/neo4j/development/conf/neo4j-wrapper.conf ]; then WRAPPER=-wrapper; fi"
10
+ - "echo 'dbms.memory.pagecache.size=600m' >> ./db/neo4j/development/conf/neo4j.conf"
11
+ - "echo 'dbms.memory.heap.max_size=600m' >> ./db/neo4j/development/conf/neo4j$WRAPPER.conf"
12
+ - "echo 'dbms.memory.heap.initial_size=600m' >> ./db/neo4j/development/conf/neo4j$WRAPPER.conf"
13
+ - "bundle exec rake neo4j:start --trace"
14
+ - wget https://github.com/neo4j-drivers/seabolt/releases/download/v1.7.4/seabolt-1.7.4-Linux-ubuntu-16.04.deb
15
+ - sudo dpkg -i seabolt-1.7.4-Linux-ubuntu-16.04.deb
16
+ - "while [ $((curl localhost:7474/ > /dev/null 2>&1); echo $?) -ne 0 ]; do sleep 1; done"
17
+ script:
18
+ - "travis_retry bundle exec rake default --trace"
19
+ language: ruby
20
+ cache: bundler
21
+ jdk: openjdk11
22
+ rvm:
23
+ - 2.7.0
24
+ - jruby-9.2.8.0
25
+ - jruby-9.2.10.0
26
+ - jruby-9.2.11.0
27
+ env:
28
+ global:
29
+ - JRUBY_OPTS="--debug -J-Xmx1280m -Xcompile.invokedynamic=false -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -Xcompile.mode=OFF"
30
+ - NEO4J_URL="bolt://localhost:7472"
31
+ matrix:
32
+ - NEO4J_VERSION=enterprise-3.5.14
33
+ - NEO4J_VERSION=enterprise-4.0.0
34
+ matrix:
35
+ include:
36
+ # Testing older versions of ActiveModel
37
+ - rvm: 2.5.7
38
+ jdk: openjdk8
39
+ env: NEO4J_VERSION=community-3.4.17 ACTIVE_MODEL_VERSION=5.2.3
40
+
data/CHANGELOG.md ADDED
@@ -0,0 +1,42 @@
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
3
+ This file should follow the standards specified on [http://keepachangelog.com/]
4
+ This project adheres to [Semantic Versioning](http://semver.org/).
5
+
6
+ ## [3.0.0.alpha.1]
7
+
8
+ ###
9
+
10
+ - Moving from devise-neo4j to devise-activegraph.
11
+
12
+ ## [2.1.1] - 12-23-2016
13
+
14
+ ### Fixed
15
+
16
+ - Migration generated as part of devise user was not rendering as an ERB template (see #28)
17
+
18
+ ## [2.1.0] - 12-23-2016
19
+
20
+ ### Fixed
21
+
22
+ - Various problems with the model generator with newer version of Neo4j (see #28)
23
+
24
+ ## [2.0.2] - 11-29-2015
25
+
26
+ ### Fixed
27
+
28
+ - Rakefile error in versions < 6.0.0
29
+
30
+ ## [2.0.1] - 11-24-2015
31
+
32
+ ### Fixed
33
+
34
+ - Added missing `remember_token` property
35
+
36
+ ## [2.0.0]
37
+
38
+ - Point gemfile at the neo4jrb repos now that all specs are passing.
39
+
40
+ ## [2.0.0.alpha.1]
41
+
42
+ - Support for Neo4j.rb 3.0!
data/Gemfile ADDED
@@ -0,0 +1,41 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem "rails", ">= 4.2.3"
6
+ gem "omniauth"
7
+ gem "omniauth-oauth2"
8
+ gem "rdoc"
9
+
10
+ gem 'activegraph'
11
+ gem "devise"
12
+
13
+ group :test do
14
+ gem "omniauth-facebook"
15
+ gem "omniauth-openid", "~> 1.0.1"
16
+ gem "webrat", "0.7.2", :require => false
17
+ gem "mocha", :require => false
18
+ gem 'rails-controller-testing'
19
+ gem 'neo4j-rake_tasks'
20
+ gem 'neo4j-ruby-driver'
21
+ gem "timecop"
22
+ gem 'pry'
23
+ gem 'rake'
24
+ platforms :mri_18 do
25
+ gem "ruby-debug", ">= 0.10.3"
26
+ end
27
+ end
28
+
29
+ platforms :jruby do
30
+ gem "jruby-openssl"
31
+ end
32
+
33
+ platforms :ruby do
34
+ gem "sqlite3"
35
+
36
+ group :mongoid do
37
+ gem "mongo"
38
+ gem "mongoid"
39
+ gem "bson_ext", "~> 1.3.0"
40
+ end
41
+ end
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Ben Jackson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,113 @@
1
+ # Devise-ActiveGraph [![Build Status](https://secure.travis-ci.org/neo4jrb/devise-neo4j.png?branch=master)](http://travis-ci.org/neo4jrb/devise-neo4j)
2
+
3
+ A gem for ActiveGraph integration with the Devise authentication framework.
4
+
5
+ ActiveGraph: https://github.com/neo4jrb/activegraph Devise:
6
+ https://github.com/plataformatec/devise
7
+
8
+ ## Usage
9
+
10
+ ### Installation
11
+
12
+ Add the activegraph and devise-activegraph gems to your Gemfile:
13
+
14
+ gem "activegraph"
15
+ gem "devise-activegraph"
16
+
17
+ Run the bundle install command:
18
+
19
+ bundle install
20
+
21
+ Then run the Devise install generator and optionally update or create a
22
+ devise-neo4j model:
23
+
24
+ rails g devise:install --orm=active_graph
25
+ # Make sure the model file is created ahead of time!
26
+ rails g neo4j:active_graph MODEL # (Where MODEL is something like User)
27
+
28
+ Add the Devise route to your config/routes.rb:
29
+
30
+ devise_for :users
31
+
32
+ Now the model is set up like a default Devise model, meaning you can do things
33
+ like adding a `before_action` in a controller to restrict access to logged-in
34
+ users only:
35
+
36
+ before_action :authenticate_<your model name>!
37
+
38
+ ## Example App
39
+
40
+ You can see a very simple app that demonstrates Neo4j and devise here:
41
+
42
+ gem install rails
43
+ rails new myapp -m http://neo4jrb.io/neo4j/rails.rb -O
44
+ cd myapp
45
+
46
+ # Add the gem to your Gemfile, then run bundle:
47
+ gem 'devise-activegraph'
48
+ bundle
49
+
50
+ rails generate devise:install --orm=active_graph
51
+
52
+ # Install the database unless you already have a Neo4j database, or use JRuby Embedded Neo4j db
53
+ rake neo4j:install[community-2.2.2] # check which one is the latest
54
+ rake neo4j:start
55
+
56
+ rails g neo4j:devise User
57
+
58
+ # Add to your config/routes.rb:
59
+ devise_for :users
60
+ root :to => "secrets#show"
61
+
62
+ # Generate a controller for the protected content
63
+ rails g controller secrets show
64
+
65
+ # In app/controllers/secrets_controller.rb add:
66
+ before_action :authenticate_user!
67
+
68
+ # In app/views/secrets/show.html.erb add:
69
+ <p>Shhhh... this page is only visible to logged-in users!</p>
70
+ <%= link_to "Log out", destroy_user_session_path, method: :delete %>
71
+
72
+ # Start the application and visit http://localhost:3000/users/sign_up
73
+ rails s
74
+
75
+ ## Developing
76
+
77
+ ### For JRuby
78
+
79
+ JRUby neo4j has an embedded server as part of the gem, so nothing else is
80
+ needed to get set up and running.
81
+
82
+ ### For Ruby
83
+
84
+ There is a Vagrant setup that installs neo4j so that you can easily get
85
+ started:
86
+
87
+ $ vagrant up
88
+
89
+ The neo4j web interface is forward to port 7474 on your local machine:
90
+ [http://localhost:7474](http://localhost:7474).
91
+
92
+ ## Note on testing
93
+
94
+ To run all test, checkout devise repository in same directory as devise-activegraph and simply type `rake` If you want to run a specific Devise test
95
+ (see the devise github repository) set the DEVISE_TEST_PATH.
96
+
97
+ Example: ``` rake DEVISE_TEST_PATH=integration/confirmable_test.rb ```
98
+
99
+ ## Note on Patches/Pull Requests
100
+
101
+ * Fork the project.
102
+ * Make your feature addition or bug fix.
103
+ * Add tests for it. This is important so I don't break it in a future
104
+ version unintentionally.
105
+ * Commit, do not mess with rakefile, version, or history. (if you want to
106
+ have your own version, that is fine but bump version in a commit by itself
107
+ I can ignore when I pull)
108
+ * Send me a pull request. Bonus points for topic branches.
109
+
110
+
111
+ ## Copyright
112
+
113
+ Copyright (c) 2011 Ben Jackson. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,35 @@
1
+ # encoding: UTF-8
2
+ require "bundler/gem_tasks"
3
+ require 'rake/testtask'
4
+ require 'rdoc/task'
5
+ begin
6
+ require 'neo4j/rake_tasks'
7
+ rescue LoadError
8
+ load 'neo4j/tasks/neo4j_server.rake'
9
+ end
10
+
11
+ ENV['DEVISE_ORM'] = 'active_graph'
12
+ ENV['DEVISE_PATH'] = File.join(File.dirname(__FILE__), '../devise')
13
+ desc 'Run tests for devise-neo4j.'
14
+ Rake::TestTask.new(:test) do |test|
15
+ unless File.exist?(ENV['DEVISE_PATH'])
16
+ puts "Specify the path to devise (e.g. rake DEVISE_PATH=/path/to/devise) or include it in your gem bundle. Not found at #{ENV['DEVISE_PATH']}"
17
+ exit
18
+ end
19
+ test.libs << 'lib'
20
+ test.libs << 'test'
21
+ test.libs << "#{ENV['DEVISE_PATH']}/lib"
22
+ test.libs << "#{ENV['DEVISE_PATH']}/test"
23
+
24
+ if devise_test_path = ENV['DEVISE_TEST_PATH']
25
+ test.test_files = FileList["#{ENV['DEVISE_PATH']}/test/#{devise_test_path}"]
26
+ else
27
+ test.test_files = FileList["#{ENV['DEVISE_PATH']}/test/**/*_test.rb"] + FileList['test/**/*_test.rb']
28
+ end
29
+ #test.test_files = ['test/generators/neo4j/devise_generator_test.rb']
30
+ #test.test_files = ['test/overrides/authenticatable_test.rb']
31
+ #test.verbose = true
32
+ test.warning = false
33
+ end
34
+
35
+ task :default => [:test]
data/Vagrantfile ADDED
@@ -0,0 +1,22 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5
+ VAGRANTFILE_API_VERSION = "2"
6
+
7
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8
+ # Every Vagrant virtual environment requires a box to build off of.
9
+ config.vm.box = "precise64"
10
+
11
+ # The url from where the 'config.vm.box' box will be fetched if it
12
+ # doesn't already exist on the user's system.
13
+ config.vm.box_url = "http://files.vagrantup.com/precise64.box"
14
+
15
+ config.vm.network :forwarded_port, host: 7474, guest: 80 # neo4j
16
+ config.vm.hostname = "devise-neo4j.develop"
17
+
18
+ config.vm.provision "ansible" do |ansible|
19
+ ansible.playbook = "provisioning/vagrant.yml"
20
+ # ansible.verbose = "vvvv"
21
+ end
22
+ end
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "devise/active_graph/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "devise-activegraph"
7
+ s.version = Devise::ActiveGraph::VERSION
8
+
9
+ s.authors = ["Ben Jackson", "Bobby Calderwood"]
10
+ s.email = ["ben@lissomsolutions.com"]
11
+ s.homepage = "http://github.com/benjackson/devise-neo4j"
12
+ s.summary = %q{Devise ORM for ActiveGraph}
13
+ s.description = %q{ActiveGraph integration with the Devise authentication framework}
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- test/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.add_dependency("warden", ">= 1.2.1")
21
+ s.add_dependency("orm_adapter", "~> 0.5.0")
22
+ s.add_dependency("bcrypt", ">= 3.0")
23
+ s.add_dependency("railties", ">= 4.2")
24
+ s.add_dependency("activegraph", ">= 10.0.0.pre.beta.2")
25
+ s.add_dependency("devise", ">= 3.5.2")
26
+ s.add_dependency("zeitwerk")
27
+ end
@@ -0,0 +1,23 @@
1
+ # Workaround for missing zeitwerk support in jruby-9.2.8.0
2
+ if RUBY_PLATFORM.match?(/java/)
3
+ module Devise
4
+ module Orm
5
+ end
6
+ module ActiveGraph
7
+ end
8
+ end
9
+ end
10
+ # End workaround
11
+
12
+
13
+ require 'devise'
14
+ require 'active_graph'
15
+ require "zeitwerk"
16
+ loader = Zeitwerk::Loader.for_gem
17
+ loader.inflector.inflect "version" => "VERSION"
18
+ loader.ignore(File.expand_path('devise-activegraph.rb', __dir__))
19
+ loader.ignore(File.expand_path('./generators', __dir__))
20
+ loader.setup
21
+ loader.eager_load
22
+ ActiveGraph::Node::ClassMethods.include Devise::Models
23
+ ActiveGraph::Node::ClassMethods.include Devise::Orm::ActiveGraph::CounterIncrement
@@ -0,0 +1,5 @@
1
+ module Devise
2
+ module ActiveGraph
3
+ VERSION = "3.0.0.alpha.1"
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ module Devise
2
+ module Orm
3
+ module ActiveGraph
4
+ end
5
+ end
6
+ end