Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
Conflicts:
	lib/neo4j/shared/persistence.rb
	spec/shared_examples/destroyable_model.rb
  • Loading branch information
dpisarewski committed Jan 9, 2015
2 parents 98759c5 + c11d958 commit 57e6c6b
Show file tree
Hide file tree
Showing 140 changed files with 2,263 additions and 1,768 deletions.
9 changes: 9 additions & 0 deletions .pullreview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
rules:
ignore:
- assignment_in_conditional
- extra_blank_line_detected
- prefer_ruby_19_new_lambda_syntax
- shadowing_outer_local_variable
- space_inside_closing_curly_brace_missing
- space_inside_opening_curly_brace_missing
72 changes: 72 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
inherit_from: .rubocop_todo.yml



#---------------------------
# Style configuration
#---------------------------

# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/HashSyntax:
Enabled: true
EnforcedStyle: ruby19

# Cop supports --auto-correct.
Style/SpaceInsideHashLiteralBraces:
Enabled: true
EnforcedStyle: no_space

# I think this one is broken...
Style/FileName:
Enabled: false

#---------------------------
# Don't intend to fix these:
#---------------------------

# Cop supports --auto-correct.
# Reason: Double spaces can be useful for grouping code
Style/EmptyLines:
Enabled: false

# Cop supports --auto-correct.
# Reason: I have very big opinions on this one. See:
# https:/bbatsov/ruby-style-guide/issues/329
# https:/bbatsov/ruby-style-guide/pull/325
Style/NegatedIf:
Enabled: false

# Cop supports --auto-correct.
# Reason: I'm fine either way on this, but could maybe be convinced that this should be enforced
Style/Not:
Enabled: false

# Cop supports --auto-correct.
# Reason: I'm fine with this
Style/PerlBackrefs:
Enabled: false

# Configuration parameters: Methods.
# Reason: We should be able to specify full variable names, even if it's only one line
Style/SingleLineBlockParams:
Enabled: false

# Reason: Switched `extend self` to `module_function` in id_property.rb but that caused errors
Style/ModuleFunction:
Enabled: false

# Configuration parameters: AllowSafeAssignment.
# Reason: I'm a proud user of assignment in conditionals.
Lint/AssignmentInCondition:
Enabled: false

# Reason: Fine with any sort of lambda syntax
Style/Lambda:
Enabled: false

# Reason: I'm proud to be part of the double negative Ruby tradition
Style/DoubleNegation:
Enabled: false


57 changes: 57 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# This configuration was generated by `rubocop --auto-gen-config`
# on 2014-12-28 12:03:39 +0100 using RuboCop version 0.28.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 2
Lint/HandleExceptions:
Enabled: false

# Offense count: 17
Metrics/AbcSize:
Max: 35

# Offense count: 2
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 268

# Offense count: 5
Metrics/CyclomaticComplexity:
Max: 8

# Offense count: 739
# Configuration parameters: AllowURI, URISchemes.
Metrics/LineLength:
Max: 216

# Offense count: 22
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 45

# Offense count: 26
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassAndModuleChildren:
Enabled: false

# Offense count: 3
Style/ClassVars:
Enabled: false

# Offense count: 155
Style/Documentation:
Enabled: false

# Offense count: 13
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Enabled: false

# Offense count: 84
# Cop supports --auto-correct.
Style/RedundantSelf:
Enabled: false

10 changes: 7 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
script: "export CODECLIMATE_REPO_TOKEN=04853df625409de0a0f4e9126aee11bbee3428c81c20c27df6e6ab5c60bff2c8 && export JRUBY_OPTS='-X+O -J-Djruby.launch.inproc=false' && bundle exec rake neo4j:install['community-2.2.0-M01'] neo4j:start default --trace"
script:
- "bundle exec rubocop"
- "export CODECLIMATE_REPO_TOKEN=04853df625409de0a0f4e9126aee11bbee3428c81c20c27df6e6ab5c60bff2c8 && export JRUBY_OPTS='-X+O -J-Djruby.launch.inproc=false' && bundle exec rake neo4j:install['community-2.2.0-M01'] neo4j:start default --trace"
language: ruby
rvm:
- 2.1.5
- jruby-19mode
- 2.2.0
- 1.9.3
- jruby-1.7.16
# - jruby-19mode
22 changes: 6 additions & 16 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,14 @@ source 'http://rubygems.org'

gemspec

#gem 'neo4j-core', github: 'neo4jrb/neo4j-core', branch: 'master'
#gem 'neo4j-core', git: 'https:/neo4jrb/neo4j-core'
#gem 'orm_adapter', :path => '../orm_adapter'

gem 'coveralls', require: false


group 'development' do
gem 'pry'
gem 'os' # for neo4j-server rake task
gem 'rake'
gem 'yard'
end
gem 'neo4j-core', github: 'neo4jrb/neo4j-core', branch: 'master'
# gem 'neo4j-core', path: '../neo4j-core'

group 'test' do
gem 'coveralls', require: false
gem 'simplecov', require: false
gem 'simplecov-html', require: false
gem "rspec", '~> 2.0'
gem "its"
gem "test-unit"
gem 'rspec', '~> 2.0'
gem 'its'
gem 'test-unit'
end
35 changes: 28 additions & 7 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
# A sample Guardfile
# More info at https:/guard/guard#readme

guard 'rspec', :version => 2, :cli => '--tag focus' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
## Uncomment and set this to only include directories you want to watch
# directories %w(app lib config test spec feature)

watch(%r{^spec/.+_spec\.rb$})
## Uncomment to clear the screen before every task
# clearing :on

watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch(%r{^spec/fixtures/(.+)\.rb$}) { "spec" }
## Guard internally checks for changes in the Guardfile and exits.
## If you want Guard to automatically start up again, run guard in a
## shell loop, e.g.:
##
## $ while bundle exec guard; do echo "Restarting Guard..."; done
##
## Note: if you are using the `directories` clause above and you are not
## watching the project directory ('.'), the you will want to move the Guardfile
## to a watched dir and symlink it back, e.g.
#
# $ mkdir config
# $ mv Guardfile config/
# $ ln -s config/Guardfile .
#
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"

guard :rubocop, cli: '--auto-correct --display-cop-names' do
watch(/.+\.rb$/)
watch(/(?:.+\/)?\.rubocop.*\.yml$/) { |m| File.dirname(m[0]) }
end

guard :rspec, cmd: 'bundle exec rspec' do
watch(/^spec\/.+_spec\.rb$/)
watch(/^lib\/(.+)\.rb/) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { 'spec' }
end
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Welcome to Neo4j.rb
[![Build Status](https://secure.travis-ci.org/neo4jrb/neo4j.png?branch=master)](http://travis-ci.org/neo4jrb/neo4j) [![Coverage Status](https://coveralls.io/repos/neo4jrb/neo4j/badge.png?branch=master)](https://coveralls.io/r/neo4jrb/neo4j?branch=master) [![Code Climate](https://codeclimate.com/github/neo4jrb/neo4j.png)](https://codeclimate.com/github/andreasronge/neo4j)
[![Build Status](https://secure.travis-ci.org/neo4jrb/neo4j.png?branch=master)](http://travis-ci.org/neo4jrb/neo4j) [![Coverage Status](https://coveralls.io/repos/neo4jrb/neo4j/badge.png?branch=master)](https://coveralls.io/r/neo4jrb/neo4j?branch=master) [![Code Climate](https://codeclimate.com/github/neo4jrb/neo4j.png)](https://codeclimate.com/github/neo4jrb/neo4j) [![PullReview stats](https://www.pullreview.com/github/neo4jrb/neo4j/badges/master.svg?)](https://www.pullreview.com/github/neo4jrb/neo4j/reviews/master)

Neo4j.rb is an Active Model compliant Ruby/JRuby wrapper for [the Neo4j graph database](http://www.neo4j.org/). It uses the [neo4j-core](https:/neo4jrb/neo4j-core) and [active_attr](https:/cgriego/active_attr) gems.

For a general overview see our website: http://neo4jrb.io/

Winner of a 2014 Graphie for "Best Community Contribution" at Neo4j's [Graph Connect](http://graphconnect.com) conference!
![2014 Graphie](http://i.imgur.com/CkOoTTYm.jpg)

Expand All @@ -12,6 +14,7 @@ The master branch of this repo now holds stable builds of the v4 version of the

## Modern (3.X) Documentation

* [Website](http://neo4jrb.io/) (for an introduction)
* [Wiki](https:/neo4jrb/neo4j/wiki/Neo4j.rb-v3-Introduction)

## Legacy (2.x) Documentation
Expand All @@ -34,7 +37,7 @@ The master branch of this repo now holds stable builds of the v4 version of the

## Contributing

Pull request with high test coverage and good [code climate](https://codeclimate.com/github/andreasronge/neo4j) values will be accepted faster.
Pull request with high test coverage and good [code climate](https://codeclimate.com/github/neo4jrb/neo4j) values will be accepted faster.


## License
Expand Down
13 changes: 6 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
require 'rake'
require "bundler/gem_tasks"
require 'bundler/gem_tasks'
require 'neo4j-core'
load 'neo4j/tasks/neo4j_server.rake'
load 'neo4j/tasks/migration.rake'

desc "Generate YARD documentation"
desc 'Generate YARD documentation'
task 'yard' do
abort("can't generate YARD") unless system('yardoc - README.md')
end

desc "Run neo4j.rb specs"
desc 'Run neo4j.rb specs'
task 'spec' do
success = system('rspec spec')
abort("RSpec neo4j failed") unless success
abort('RSpec neo4j failed') unless success
end

require 'rake/testtask'
Expand All @@ -25,11 +25,10 @@ end
desc 'Generate coverage report'
task 'coverage' do
ENV['COVERAGE'] = 'true'
rm_rf "coverage/"
rm_rf 'coverage/'
task = Rake::Task['spec']
task.reenable
task.invoke
end

task :default => ['spec']

task default: ['spec']
12 changes: 6 additions & 6 deletions bin/neo4j-jars
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ It copies all jar files which has been required (neo4j-community, neo4j-advanced
Usage: neo4j-jars <community|advanced|enterprise>
TEXT
exit
exit
end

if ARGV.include?('community')
Expand All @@ -20,14 +20,14 @@ elsif ARGV.include?('advanced')
elsif ARGV.include?('enterprise')
require 'neo4j-enterprise' # not really needed
else
puts "Expected community, advanced, enterprise"
exit -1
puts 'Expected community, advanced, enterprise'
exit(-1)
end

lib_dir = File.join(Dir.pwd, 'lib')
raise "Expected a lib folder where to copy the jars file, mkdir #{lib_dir}? " unless File.exist?(lib_dir)
fail "Expected a lib folder where to copy the jars file, mkdir #{lib_dir}? " unless File.exist?(lib_dir)

files = $CLASSPATH.find_all{|x| x =~ /\.jar$/}.collect{|y| y.sub('file:', '')}
files.each {|file| FileUtils.cp(file, lib_dir)}
files = $CLASSPATH.find_all { |x| x =~ /\.jar$/ }.collect { |y| y.sub('file:', '') }
files.each { |file| FileUtils.cp(file, lib_dir) }

puts "copied #{files.size} files to #{lib_dir}"
2 changes: 1 addition & 1 deletion example/blog/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.2'

gem "string-urlize" # for making the title the primary key and work as an URL, see Neo4j.rb id_property
gem 'string-urlize' # for making the title the primary key and work as an URL, see Neo4j.rb id_property

# Use sqlite3 as the database for Active Record
# gem 'sqlite3' - ronge
Expand Down
1 change: 0 additions & 1 deletion example/blog/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
require File.expand_path('../config/application', __FILE__)

Blog::Application.load_tasks

23 changes: 12 additions & 11 deletions example/blog/app/controllers/comments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,18 @@ def destroy
end

private
# Use callbacks to share common setup or constraints between actions.
def set_comment
@comment = Comment.find(params[:id])
end

def set_post
@post = Post.find(params[:post_id])
end
# Use callbacks to share common setup or constraints between actions.
def set_comment
@comment = Comment.find(params[:id])
end

# Never trust parameters from the scary internet, only allow the white list through.
def comment_params
params[:comment]
end
def set_post
@post = Post.find(params[:post_id])
end

# Never trust parameters from the scary internet, only allow the white list through.
def comment_params
params[:comment]
end
end
17 changes: 9 additions & 8 deletions example/blog/app/controllers/posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ def destroy
end

private
# Use callbacks to share common setup or constraints between actions.
def set_post
@post = Post.find(params[:id])
end

# Never trust parameters from the scary internet, only allow the white list through.
def post_params
params[:post]
end
# Use callbacks to share common setup or constraints between actions.
def set_post
@post = Post.find(params[:id])
end

# Never trust parameters from the scary internet, only allow the white list through.
def post_params
params[:post]
end
end
1 change: 0 additions & 1 deletion example/blog/app/models/comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ class Comment

# or if PostComment is not needed
# has_one :in, :post

end
Loading

0 comments on commit 57e6c6b

Please sign in to comment.