Rails 命令在可安装引擎根目录中不起作用

发布于 2025-01-08 20:19:15 字数 3014 浏览 0 评论 0原文

关于可安装在轨道上的发动机的问题。首先这些是我正在使用的版本;

$ rails -v
  Rails 3.2.1
$ ruby -v
  ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]

我用这个创建可安装引擎:

$ rails plugin new testEngine --mountable
  create  
  create  README.rdoc
  create  Rakefile
  create  testEngine.gtestEnginepec
  create  MIT-LICENSE
  create  .gitignore
  create  Gemfile
  create  app
  create  app/controllers/testEngine/application_controller.rb
  create  app/helpers/testEngine/application_helper.rb
  create  app/mailers
  create  app/models
  create  app/views/layouts/testEngine/application.html.erb
  create  app/assets/images/testEngine
  create  app/assets/images/testEngine/.gitkeep
  create  config/routes.rb
  create  lib/testEngine.rb
  create  lib/tasks/testEngine_tasks.rake
  create  lib/testEngine/version.rb
  create  lib/testEngine/engine.rb
  create  app/assets/stylesheets/testEngine/application.css
  create  app/assets/javascripts/testEngine/application.js
  create  script
  create  script/rails
  create  test/test_helper.rb
  create  test/testEngine_test.rb
  append  Rakefile
  create  test/integration/navigation_test.rb
  vendor_app  test/dummy

  run  bundle install
  Fetching source index for http://rubygtestEngine.org/
  Using rake (0.9.2.2) 
  Using i18n (0.6.0) 
  Using multi_json (1.1.0) 
  Using activesupport (3.2.1) 
  Using builder (3.0.0) 
  Using activemodel (3.2.1) 
  Using erubis (2.7.0) 
  Using journey (1.0.3) 
  Using rack (1.4.1) 
  Using rack-cache (1.1) 
  Using rack-test (0.6.1) 
  Using hike (1.2.1) 
  Using tilt (1.3.3) 
  Using sprockets (2.1.2) 
  Using actionpack (3.2.1) 
  Using mime-types (1.17.2) 
  Using polyglot (0.3.3) 
  Using treetop (1.4.10) 
  Using mail (2.4.1) 
  Using actionmailer (3.2.1) 
  Using arel (3.0.2) 
  Using tzinfo (0.3.31) 
  Using activerecord (3.2.1) 
  Using activeresource (3.2.1) 
  Using bundler (1.0.22) 
  Using rack-ssl (1.3.2) 
  Using json (1.6.5) 
  Using rdoc (3.12) 
  Using thor (0.14.6) 
  Using railties (3.2.1) 
  Using rails (3.2.1) 
  Using testEngine (0.0.1) from source at /private/var/www/html/development/projects/testEngine
  Using jquery-rails (2.0.0) 
  Using sqlite3 (1.3.5) 
  Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

当我在引擎根目录(而不是虚拟应用程序)中使用rails命令时,我收到以下错误:

$ rails -v
script/rails:7:in `require': no such file to load -- rails/all (LoadError)
from script/rails:7

这是我在script/rails中的rails文件:

$ cat script/rails 
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.

ENGINE_ROOT = File.expand_path('../..', __FILE__)
ENGINE_PATH = File.expand_path('../../lib/ems/engine', __FILE__)

require 'rails/all'
require 'rails/engine/commands'

该错误表明问题源于两个导轨包括在底部。我能做些什么来解决这个问题吗?如果无法使用 Rails,我将无法使用 Rails 命令提供的任何工具,例如脚手架等。

我们将不胜感激,如果您需要更多信息,请告诉我。

Question regarding mountable engines on rails. First of all these are the versions I am using;

$ rails -v
  Rails 3.2.1
$ ruby -v
  ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]

I create the mountable engine with this:

$ rails plugin new testEngine --mountable
  create  
  create  README.rdoc
  create  Rakefile
  create  testEngine.gtestEnginepec
  create  MIT-LICENSE
  create  .gitignore
  create  Gemfile
  create  app
  create  app/controllers/testEngine/application_controller.rb
  create  app/helpers/testEngine/application_helper.rb
  create  app/mailers
  create  app/models
  create  app/views/layouts/testEngine/application.html.erb
  create  app/assets/images/testEngine
  create  app/assets/images/testEngine/.gitkeep
  create  config/routes.rb
  create  lib/testEngine.rb
  create  lib/tasks/testEngine_tasks.rake
  create  lib/testEngine/version.rb
  create  lib/testEngine/engine.rb
  create  app/assets/stylesheets/testEngine/application.css
  create  app/assets/javascripts/testEngine/application.js
  create  script
  create  script/rails
  create  test/test_helper.rb
  create  test/testEngine_test.rb
  append  Rakefile
  create  test/integration/navigation_test.rb
  vendor_app  test/dummy

  run  bundle install
  Fetching source index for http://rubygtestEngine.org/
  Using rake (0.9.2.2) 
  Using i18n (0.6.0) 
  Using multi_json (1.1.0) 
  Using activesupport (3.2.1) 
  Using builder (3.0.0) 
  Using activemodel (3.2.1) 
  Using erubis (2.7.0) 
  Using journey (1.0.3) 
  Using rack (1.4.1) 
  Using rack-cache (1.1) 
  Using rack-test (0.6.1) 
  Using hike (1.2.1) 
  Using tilt (1.3.3) 
  Using sprockets (2.1.2) 
  Using actionpack (3.2.1) 
  Using mime-types (1.17.2) 
  Using polyglot (0.3.3) 
  Using treetop (1.4.10) 
  Using mail (2.4.1) 
  Using actionmailer (3.2.1) 
  Using arel (3.0.2) 
  Using tzinfo (0.3.31) 
  Using activerecord (3.2.1) 
  Using activeresource (3.2.1) 
  Using bundler (1.0.22) 
  Using rack-ssl (1.3.2) 
  Using json (1.6.5) 
  Using rdoc (3.12) 
  Using thor (0.14.6) 
  Using railties (3.2.1) 
  Using rails (3.2.1) 
  Using testEngine (0.0.1) from source at /private/var/www/html/development/projects/testEngine
  Using jquery-rails (2.0.0) 
  Using sqlite3 (1.3.5) 
  Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

when I use the rails command within the engine root (not in the dummyapp) I receive the following error:

$ rails -v
script/rails:7:in `require': no such file to load -- rails/all (LoadError)
from script/rails:7

this is my rails file in script/rails:

$ cat script/rails 
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.

ENGINE_ROOT = File.expand_path('../..', __FILE__)
ENGINE_PATH = File.expand_path('../../lib/ems/engine', __FILE__)

require 'rails/all'
require 'rails/engine/commands'

The error indicates that the problem stems from the two rails includes at the bottom. Is there anything I can do to fix this? Without the ability to use rails I'm unable to make use of any of the tools the rails command gives me such as scaffolding etc.

Any help is appreciated, and should you need any more information please let me know.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

铜锣湾横着走 2025-01-15 20:19:15

试试这个:

script/rails console

或者:

bundle exec rails console

Try this:

script/rails console

Or:

bundle exec rails console
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文