Skip to content

Commit

Permalink
added railtie to autoload tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
maxdemarzi committed Nov 2, 2011
1 parent 066ed4f commit 752924a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
17 changes: 9 additions & 8 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,9 @@ in order to access the functionality.

==== Rails

Just add gem 'neography' to your Gemfile and run bundle install
Just add gem 'neography' to your Gemfile and run bundle install.

=== Tasks

In your Rakefile or "lib/tasks/neography.rake", add:

require 'neography/tasks'

It will add the following rake tasks to your project:
The following tasks will be available to you:

rake neo4j:install # Install Neo4j to the neo4j directory under your project
rake neo4j:start # Start Neo4j
Expand All @@ -59,6 +53,13 @@ It will add the following rake tasks to your project:
Windows users will need to run in a command prompt with Administrative Privileges
in order to install Neo4j as a Service.

If you are not using Rails, then add:

require 'neography/tasks'

to your Rakefile to have access to these tasks.


=== Documentation

@neo = Neography::Rest.new({:protocol => 'http://',
Expand Down
2 changes: 2 additions & 0 deletions lib/neography.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@ def find_and_require_user_defined_code
require 'neography/node'
require 'neography/relationship'

require 'neography/railtie' if defined? Rails

find_and_require_user_defined_code

8 changes: 8 additions & 0 deletions lib/neography/railtie.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'rails'

class Railtie < Rails::Railtie

rake_tasks do
load "neography/tasks.rb"
end
end
2 changes: 1 addition & 1 deletion lib/neography/tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
if %x[reg query "HKU\\S-1-5-19"].size > 0
%x[neo4j/bin/Neo4j.bat restart]
else
puts "You do not have administrative rights to stop the Neo4j Service"
puts "You do not have administrative rights to restart the Neo4j Service"
end
else
%x[neo4j/bin/neo4j restart]
Expand Down

0 comments on commit 752924a

Please sign in to comment.