rails server只打印命令用法

时间:2013-10-19 14:42:29

标签: ruby-on-rails rvm

$ rails server
  

使用方法:         rails new APP_PATH [options]

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)                                        #默认值:sqlite3         -j,[ - javascript = JAVASCRIPT]#预配置所选JavaScript库                                        #Define:jquery         -J,[--skip-javascript] #Skip JavaScript文件             [--dev]#使用指向Rails结帐的Gemfile设置应用程序             [--edge]#使用指向Rails存储库的Gemfile设置应用程序         -T,[--skip-test-unit] #Skip Test ::单元文件             [--old-style-hash]#强制使用Ruby上的旧样式哈希(:foo =>'bar')> = 1.9

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本地服务器。其他版本是:

  • Rails 3.2.14
  • ruby​​ 1.9.3p448(2013-06-27修订版41675)[i686-linux]
  • gem 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

2 个答案:

答案 0 :(得分:3)

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

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

如果它是Rails应用程序,那么您可能会遗漏一些服务器命令用来确定它是否是Rails应用程序的密钥文件。

答案 1 :(得分:2)

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

转到Rails项目目录,然后重试。