4
$ rails server

用法:rails new APP_PATH [选项]

Options:
  -r, [--ruby=PATH]              # Path to the Ruby binary of your choice
                                 # Default: /home/bikram/.rvm/rubies/ruby-1.9.3-p448/bin/ruby

  -b, [--builder=BUILDER]        # Path to a application builder (can be a filesystem path or URL)
  -m, [--template=TEMPLATE]      # Path to an application template (can be a filesystem path or URL)
      [--skip-gemfile]           # Don't create a Gemfile
      [--skip-bundle]            # Don't run bundle install
  -G, [--skip-git]               # Skip Git ignores and keeps
  -O, [--skip-active-record]     # Skip Active Record files
  -S, [--skip-sprockets]         # Skip Sprockets files
  -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] # 跳过 JavaScript 文件 [--dev] # 设置应用程序,让 Gemfile 指向 Rails checkout [--edge] # 设置应用程序,让 Gemfile 指向 Rails 存储库 -T, [--skip-test -unit] # 跳过测试::Unit 文件 [--old-style-hash] # 强制在 Ruby >= 1.9 上使用旧式哈希 (:foo => 'bar')

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

Rails options:
  -h, [--help]     # Show this help message and quit
  -v, [--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.

它像这样生成,但不是 Rails 本地服务器。其他版本是:

  • 导轨 3.2.14
  • ruby 1.9.3p448(2013-06-27 修订版 41675)[i686-linux]
  • 宝石 2.1.9
  • rvm 1.23.9(稳定)

我的宝石文件是:

source 'https://rubygems.org'

gem 'rails', '3.2.14'

group :development, :test do
  gem 'sqlite3', '1.3.5'
  gem 'rspec-rails', '2.11.0'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '3.2.5'
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier', '1.2.3'
end

gem 'jquery-rails', '2.0.2'

group :test do
  gem 'capybara', '1.1.2'
end

group :production do
  gem 'pg', '0.12.2'
end
4

2 回答 2

3

这是当您尝试在没有 Rails 应用程序的文件夹中启动 Rails 服务器时生成的默认消息。

在启动服务器之前,您需要运行rails new <appname>appname 是您所在的文件夹。

如果它是 Rails 应用程序,那么您可能会丢失一些关键文件,服务器命令使用这些文件来确定它是否是 Rails 应用程序。

于 2013-10-19T14:50:20.457 回答
2

我猜你是rails server在不在 Rails 应用程序的(根目录)中运行命令。

切换到 Rails 项目目录,然后重试。

于 2013-10-19T14:48:38.550 回答