diff --git a/README.rdoc b/README.rdoc index 520d6f0..aaaa34b 100644 --- a/README.rdoc +++ b/README.rdoc @@ -43,7 +43,10 @@ Just add gem 'neography' to your Gemfile and run bundle install. The following tasks will be available to you: - rake neo4j:install # Install Neo4j to the neo4j directory under your project + rake neo4j:install # Install Neo4j to the neo4j directory under your project + rake neo4j:install[community,1.6.M01] # Install Neo4j Community edition, version 1.6.M01 + rake neo4j:install[advanced,1.5] # Install Neo4j Advanced edition, version 1.5 + rake neo4j:install[enterprise,1.5] # Install Neo4j Enterprise edition, version 1.5 rake neo4j:start # Start Neo4j rake neo4j:stop # Stop Neo4j rake neo4j:restart # Restart Neo4j diff --git a/lib/neography/tasks.rb b/lib/neography/tasks.rb index 02c929a..dd8d357 100644 --- a/lib/neography/tasks.rb +++ b/lib/neography/tasks.rb @@ -3,15 +3,16 @@ namespace :neo4j do desc "Install Neo4j" - task :install do - puts 'Installing Neo4j...' + task :install, :edition, :version do |t, args| + args.with_defaults(:edition => "community", :version => "1.6.M01") + puts "Installing Neo4j-#{args[:edition]}-#{args[:version]}" if OS::Underlying.windows? # Download Neo4j unless File.exist?('neo4j.zip') df = File.open('neo4j.zip', 'wb') begin - df << HTTParty.get("http://dist.neo4j.org/neo4j-community-1.5-windows.zip") + df << HTTParty.get("http://dist.neo4j.org/neo4j-#{args[:edition]}-#{args[:version]}-windows.zip") ensure df.close() end @@ -30,7 +31,7 @@ end end end - FileUtils.mv "neo4j-community-1.5", "neo4j" + FileUtils.mv "neo4j-#{args[:edition]}-#{args[:version]}", "neo4j" end # Install if running with Admin Privileges @@ -40,10 +41,10 @@ end else - %x[wget http://dist.neo4j.org/neo4j-community-1.5-unix.tar.gz] - %x[tar -xvzf neo4j-community-1.5-unix.tar.gz] - %x[mv neo4j-community-1.5 neo4j] - %x[rm neo4j-community-1.5-unix.tar.gz] + %x[wget http://dist.neo4j.org/neo4j-#{args[:edition]}-#{args[:version]}-unix.tar.gz] + %x[tar -xvzf neo4j-#{args[:edition]}-#{args[:version]}-unix.tar.gz] + %x[mv neo4j-#{args[:edition]}-#{args[:version]} neo4j] + %x[rm neo4j-#{args[:edition]}-#{args[:version]}-unix.tar.gz] puts "Neo4j Installed in to neo4j directory." end puts "Type 'rake neo4j:start' to start it"