所以我跟随这段视频https://www.youtube.com/watch?v=bDjbqRL9HcM我来到了一个应该使用rake任务的部分然后发生了这样的事情:
blog$ rake neo4j:install[community-2.1.5] --trace
rake aborted!
Don't know how to build task 'neo4j:install'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/task_manager.rb:62:in `[]'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/application.rb:149:in `invoke_task'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/application.rb:106:in `each'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/application.rb:106:in `block in top_level'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/application.rb:115:in `run_with_threads'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/application.rb:100:in `top_level'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/application.rb:78:in `block in run'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/home/james/.rvm/gems/ruby-2.1.3/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/home/james/.rvm/gems/ruby-2.1.3/bin/rake:23:in `load'
/home/james/.rvm/gems/ruby-2.1.3/bin/rake:23:in `<main>'
/home/james/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `eval'
/home/james/.rvm/gems/ruby-2.1.3/bin/ruby_executable_hooks:15:in `<main>'
我在Ubuntu 14.04上试过这个。我已经安装了rvm.io.我有什么建议可以解决这个问题吗?
答案 0 :(得分:0)
我尝试将以下内容放入RakeFile中,这是在我运行rails new时创建的:require 'neo4j/tasks/neo4j_server'
- 它似乎通过提供以下输出来实现:
/blog$ rake neo4j:install[community-2.1.5]
Installing Neo4j-community-2.1.5 environment: development Neo4j Installed in to neo4j directory
我将以下内容添加到application.rb:require 'neo4j/railtie'
- 我现在可以使用rails generate scaffold User name:string email:string
我不知道为什么会这样。也许你可以给出一个很好的解释?
答案 1 :(得分:0)
如果您希望项目中包含所有neo4j rake任务,请将此代码添加到您的Rakefile中:
require 'neo4j/rake_tasks'
这是因为gem neo4j-rake_tasks会自动添加neo4j gem,但你仍然需要将它包含在你的Rakefile中。
之后:耙-T 你应该看到:
rake neo4j:change_password # Neo4j 2.2: Change connection password
rake neo4j:config[environment,port] # Configure Server, e.g
rake neo4j:disable_auth[environment] # Neo4j 2.2: Disable Auth
rake neo4j:enable_auth[environment] # Neo4j 2.2: Enable Auth
rake neo4j:info[environment] # Get info the Neo4j Server
rake neo4j:install[edition,environment] # Install Neo4j with auth disabled in v2.2+
rake neo4j:migrate[task_name,subtask] # Run a script against the database to perform system-wide changes
rake neo4j:reset_yes_i_am_sure[environment] # Reset the Neo4j Server
rake neo4j:restart[environment] # Restart the Neo4j Server
rake neo4j:start[environment] # Start the Neo4j Server
rake neo4j:start_no_wait[environment] # Start the Neo4j Server asynchronously
rake neo4j:stop[environment] # Stop the Neo4j Server