From 764a146e6e5628197a9948409aa284a9f1fd0f66 Mon Sep 17 00:00:00 2001 From: Max De Marzi Date: Mon, 31 Oct 2011 16:50:42 -0500 Subject: [PATCH] adding tasks --- .project | 12 ++++++++++ CONTRIBUTORS | 7 +++++- README.rdoc | 21 +++++++++++++++++- Rakefile | 5 ++++- lib/neography/tasks.rb | 50 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 92 insertions(+), 3 deletions(-) create mode 100644 .project create mode 100644 lib/neography/tasks.rb diff --git a/.project b/.project new file mode 100644 index 0000000..b809fb3 --- /dev/null +++ b/.project @@ -0,0 +1,12 @@ + + + neography + + + + + + + com.aptana.ruby.core.rubynature + + diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 6ee8b02..17e5206 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -4,4 +4,9 @@ Maintainer: Contributors: * Peter Neubauer * Ian Dees -* Phuong CAO \ No newline at end of file +* Phuong CAO +* Carlo Alberto Degli Atti +* Stephen Becker IV +* Thomas Baum +* Maximilian Schulz +* Hesham Amiri \ No newline at end of file diff --git a/README.rdoc b/README.rdoc index 9fb6345..9997506 100644 --- a/README.rdoc +++ b/README.rdoc @@ -4,7 +4,12 @@ Neography is a thin Ruby wrapper to the Neo4j Rest API, for more information: * {Getting Started with Neo4j Server}[http://wiki.neo4j.org/content/Getting_Started_with_Neo4j_Server] * {Neo4j Rest API Reference}[http://components.neo4j.org/neo4j-server/milestone/rest.html] -If you want to the full power of Neo4j, you will want to use JRuby and the excellent Neo4j.rb gem at https://github.com/andreasronge/neo4j +If you want to the full power of Neo4j, you will want to use JRuby and the excellent Neo4j.rb gem at https://github.com/andreasronge/neo4j by Andreas Ronge + +A complement to Neography is the Neology Gem at https://github.com/lordkada/neology by Carlo Alberto Degli Atti + +An alternative is the Architect4r Gem at https://github.com/namxam/architect4r by Maximilian Schulz + === Installation @@ -37,6 +42,20 @@ in order to access the functionality. 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: + + rake neo4j:install # Install Neo4j to the neo4j directory under your project + rake neo4j:start # Start Neo4j + rake neo4j:stop # Stop Neo4j + rake neo4j:restart # Restart Neo4j + rake neo4j:reset_yes_i_am_sure # Wipe your Neo4j Database + === Documentation @neo = Neography::Rest.new({:protocol => 'http://', diff --git a/Rakefile b/Rakefile index 14d2579..58a4eb0 100644 --- a/Rakefile +++ b/Rakefile @@ -8,4 +8,7 @@ RSpec::Core::RakeTask.new(:spec) do |t| t.pattern = "spec/integration/*_spec.rb" end -task :default => :spec \ No newline at end of file +desc "Run Tests" +task :default => :spec + + diff --git a/lib/neography/tasks.rb b/lib/neography/tasks.rb new file mode 100644 index 0000000..d87b123 --- /dev/null +++ b/lib/neography/tasks.rb @@ -0,0 +1,50 @@ +# borrowed from architect4r + +namespace :neo4j do + desc "Install Neo4j" + task :install do + puts 'Installing Neo4j...' + %x[wget http://dist.neo4j.org/neo4j-community-1.5.M02-unix.tar.gz] + %x[tar -xvzf neo4j-community-1.5.M02-unix.tar.gz] + %x[mv neo4j-community-1.5.M02 neo4j] + %x[rm neo4j-community-1.5.M02-unix.tar.gz] + puts "Neo4j Installed in to neo4j directory." + puts "Type 'rake neo4j:start' to start it" + end + + desc "Start the Neo4j Server" + task :start do + puts "Starting Neo4j..." + %x[neo4j/bin/neo4j start] + end + + desc "Stop the Neo4j Server" + task :stop do + puts "Stopping Neo4j..." + %x[neo4j/bin/neo4j stop] + end + + desc "Restart the Neo4j Server" + task :restart do + puts "Restarting Neo4j..." + %x[neo4j/bin/neo4j restart] + end + + desc "Reset the Neo4j Server" + task :reset_yes_i_am_sure do + # Stop the server + %x[neo4j/bin/neo4j stop] + + # Reset the database + FileUtils.rm_rf("neo4j/data/graph.db") + FileUtils.mkdir("neo4j/data/graph.db") + + # Remove log files + FileUtils.rm_rf("neo4j/data/log") + FileUtils.mkdir("neo4j/data/log") + + # Start the server + %x[neo4j/bin/neo4j start] + end + +end \ No newline at end of file