Gemfile指定没有依赖项

时间:2014-10-13 02:12:17

标签: ruby-on-rails ruby ruby-on-rails-4 solr gem

我试图安装太阳黑子宝石。当我第一次尝试在添加宝石后捆绑安装时,我第一次收到了以下消息:

$ bundle install
The Gemfile specifies no dependencies
Resolving dependencies...
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

我忽略了该消息并继续安装过程。但指南告诉我输入的命令没有用:

$ rails generate sunspot_rails:install
Usage:
  rails new APP_PATH [options]

Options:
  -r, [--ruby=PATH]                                      # Path to the Ruby binary of your choice
                                                         # Default: /home/zoltan/.rvm/rubies/ruby-2.0.0-p0/bin/ruby
  -m, [--template=TEMPLATE]                              # Path to some application template (can be a filesystem path or URL)
      [--skip-gemfile], [--no-skip-gemfile]              # Don't create a Gemfile
  -B, [--skip-bundle], [--no-skip-bundle]                # Don't run bundle install
  -G, [--skip-git], [--no-skip-git]                      # Skip .gitignore file
      [--skip-keeps], [--no-skip-keeps]                  # Skip source control .keep files
  -O, [--skip-active-record], [--no-skip-active-record]  # Skip Active Record files
  -V, [--skip-action-view], [--no-skip-action-view]      # Skip Action View files
  -S, [--skip-sprockets], [--no-skip-sprockets]          # Skip Sprockets files
      [--skip-spring], [--no-skip-spring]                # Don't install Spring application preloader
  -d, [--database=DATABASE]                              # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
                                                         # Default: sqlite3
  -j, [--javascript=JAVASCRIPT]                          # Preconfigure for selected JavaScript library
                                                     # Default: jquery
  -J, [--skip-javascript], [--no-skip-javascript]        # Skip JavaScript files
      [--dev], [--no-dev]                                # Setup the application with Gemfile pointing to your Rails checkout
      [--edge], [--no-edge]                              # Setup the application with Gemfile pointing to Rails repository
  -T, [--skip-test-unit], [--no-skip-test-unit]          # Skip Test::Unit files
      [--rc=RC]                                          # Path to file containing extra configuration options for rails command
      [--no-rc], [--no-no-rc]                            # Skip loading of extra configuration options from .railsrc file

Runtime options:
  -f, [--force]                    # Overwrite files that already exist
  -p, [--pretend], [--no-pretend]  # Run but do not make any changes
  -q, [--quiet], [--no-quiet]      # Suppress status output
  -s, [--skip], [--no-skip]        # Skip files that already exist

Rails options:
  -h, [--help], [--no-help]        # Show this help message and quit
  -v, [--version], [--no-version]  # Show Rails version number and quit

Description:
    The 'rails new' command creates a new Rails application with a default
    directory structure and configuration at the path you specify.

    You can specify extra command-line arguments to be used every time
    'rails new' runs in the .railsrc configuration file in your home directory.

    Note that the arguments specified in the .railsrc file don't affect the
    defaults values shown above in this help message.

Example:
    rails new ~/Code/Ruby/weblog

    This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
    See the README in the newly created application to get going.

之后:

$ bundle exec rake sunspot:solr:start
/home/zoltan/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.6.2/lib/bundler    /rubygems_integration.rb:252:in `block in replace_gem': rake is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
    from /home/zoltan/.rvm/gems/ruby-2.0.0-p0/bin/rake:22:in `<main>'
    from /home/zoltan/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `eval'
    from /home/zoltan/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `<main>'

初始Gemfile消息是否与这些错误有关?

这是我的Gemfile:

source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0

gem 'rails', '4.0.10'
gem 'bootstrap-sass', '~> 2.3.2.0'
gem 'sprockets', '~> 2.12'
gem 'sunspot_rails'
gem 'sunspot_solr'

group :development, :test do
  gem 'web-console'
  gem 'pry'
  gem 'sqlite3', '~> 1.3.8'
  gem 'rspec-rails', '~> 2.13.1'
end

group :test do
  gem 'selenium-webdriver', '~> 2.35.1'
  gem 'capybara', '~> 2.1.0'
end

gem 'sass-rails', '~> 5.0.0.beta1'
gem 'uglifier', '~> 2.1.1'
gem 'coffee-rails', '~> 4.0.1'
gem 'jquery-rails', '~> 3.0.4'
gem 'turbolinks', '~> 1.1.1'
gem 'jbuilder', '~> 1.0.2'

group :doc do
  gem 'sdoc', '~> 0.3.20', require: false
end

group :production do
  gem 'pg', '~> 0.15.1'
  gem 'rails_12factor', '~> 0.0.2'
end

gem "paperclip", :git => "git://github.com/thoughtbot/paperclip.git"

1 个答案:

答案 0 :(得分:3)

当您运行bundle install时,看起来您当前不在包含Gemfile的目录中。在运行bundle install

之前,请务必将CD刻录到Gemfile所在的目录