安装问题:bundle exec rails g locomotive:install

时间:2014-06-04 03:26:12

标签: ruby-on-rails ruby mongodb locomotivecms

在环顾四周的时候,我遇到过很多类似问题的帖子,但是没有人真的解决了这个问题。该修复程序确保您指定rails new的版本。

在确定我指定了哪个版本的rails之前。运行命令bundle exec rails g locomotive:install给了我所有类型的错误消息。

$bundle exec rails g locomotive:install

Usage:
rails new APP_PATH [options]

Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice

我正在做的另一个错误:

 rails (= 3.2.17) ruby depends on
      railties (= 3.2.17) ruby depends on
        rdoc (~> 3.4) ruby

    sdoc (~> 0.4.0) ruby depends on
      rdoc (4.0.0)

以下是终端的副本。万一有人陷入同一陷阱。

    -SVE1411EGXB:~/code$ cd brand/
    -SVE1411EGXB:~/code/brand$ ls
    - SVE1411EGXB:~/code/brand$ rails _3.2.17_ new active  --skip-active-record --skip-test- unit --skip-javascript --skip-bundle
      create  
      create  README.rdoc
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/assets/images/rails.png
      create  app/assets/javascripts/application.js
      create  app/assets/stylesheets/application.css
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/mailers
      create  app/models
      create  app/views/layouts/application.html.erb
      create  app/mailers/.gitkeep
      create  app/models/.gitkeep
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/secret_token.rb
      create  config/initializers/session_store.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  db
      create  db/seeds.rb
      create  doc
      create  doc/README_FOR_APP
      create  lib
      create  lib/tasks
      create  lib/tasks/.gitkeep
      create  lib/assets
      create  lib/assets/.gitkeep
      create  log
      create  log/.gitkeep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/favicon.ico
      create  public/index.html
      create  public/robots.txt
      create  script
      create  script/rails
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/javascripts
      create  vendor/assets/javascripts/.gitkeep
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.gitkeep
      create  vendor/plugins
      create  vendor/plugins/.gitkeep
-SVE1411EGXB:~/code/brand$ ls
active
-SVE1411EGXB:~/code/brand$ cd active/
-SVE1411EGXB:~/code/brand/active$ subl Gemfile 
-SVE1411EGXB:~/code/brand/active$ bundle install
Fetching gem metadata from https://rubygems.org/........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.0.4
Using RedCloth 4.2.9
Using i18n 0.6.9
`
`
`

Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
-SVE1411EGXB:~/code/brand/active$ bundle exec rails g locomotive:install
Digest::Digest is deprecated; use Digest
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
WARNING: unable to load the content types, 
Problem:
  No configuration could be found for a session named 'default'.
Summary:
  When attempting to create the new session, Mongoid could not find a session configuration for the name: 'default'. This is necessary in order to know the host, port, and options needed to connect.
Resolution:
  Double check your mongoid.yml to make sure under the sessions key that a configuration exists for 'default'. If you have set the configuration programatically, ensure that 'default' exists in the configuration hash.
      create  config/initializers/locomotive.rb
      create  config/initializers/carrierwave.rb
      create  config/initializers/dragonfly.rb
      create  config/mongoid.yml
       route  
  mount Locomotive::Engine => '/locomotive', as: 'locomotive' # you can change the value of the path, by default set to "/locomotive"

      remove  public/index.html
===============================================================================

The Locomotive Engine has been correctly installed in your Rails application.

  1. Edit the main config files:

    - config/initializers/locomotive.rb
    - config/initializers/carrierwave.rb
    - config/initializers/dragonfly.rb
    - config/mongoid.yml
    - config/devise.yml
    - config/routes.rb

  2. Launch the server

    > bundle exec unicorn_rails

  3. Open your browser

    > open localhost:8080

  4. Follow the installation wizard steps

  5. Enjoy !

这是Gemfile:

source 'https://rubygems.org'

gem 'locomotive_cms', '~> 2.4.1', :require => 'locomotive/engine'
gem 'rails', '3.2.17'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'



# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'compass-rails',  '~> 1.1.3'
  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end



# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
 gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

1 个答案:

答案 0 :(得分:1)

  

$ bundle exec rails g locomotive:install

必须从rails目录中调用

。所以对于机车:

rails _3.2.17_ new myapp --skip-active-record --skip-test-unit --skip-javascript --skip-bundle
cd myapp
bundle
bundle exec rails g locomotive:install

然后按照说明编辑配置文件。

mongoid.yml生成器缺少默认值:& defaults条目。应该是:

defaults: &defaults
  sessions:
    default:
      database: myapp_prod
      username: name
      password: pass
      hosts:
        - host:port
  options:
    identity_map_enabled: true

development:
  sessions:
    default:
      database: myapp_dev
      username: name
      password: pass
      hosts:
        - host:port
  options:
    identity_map_enabled: true

test:
  sessions:
    default:
      database: myapp_test
      username: name
      password: pass
      hosts:
        - host:port
  options:
    identity_map_enabled: true

production:
  sessions:
    default:
      database: myapp_prod
      username: name
      password: pass
      hosts:
        - host:port
  options:
    identity_map_enabled: true

机车在开发中使用独角兽: bundle exec unicorn_rails启动服务器

祝你好运!