简体   繁体   中英

Installation issue on: bundle exec rails g locomotive:install

I came across many posts of similar issues while looking around, but non of them really solved the problem. The fix was making sure that you specify the version of rails new .

prior to making sure that I specified which version of rails . running the command bundle exec rails g locomotive:install was giving me all kind of error messages .

$bundle exec rails g locomotive:install

Usage:
rails new APP_PATH [options]

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

another error i was geting :

 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)

Below is a copy of the terminal. In case someone fallin the same trap.

    -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 !

and here is the 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'

$bundle exec rails g locomotive:install

must be invoked from a rails directory. So for locomotive:

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

then edit your config files as instructed.

The mongoid.yml generator is missing the defaults: &defaults entry. Should be:

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

Locomotive uses unicorn in development: bundle exec unicorn_rails to launch the server

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM