zoukankan      html  css  js  c++  java
  • 找不到rails console命令

      部署新服务器之后发现,服务器上没有console命令了

    root@i-1lb6pxls:/home/ubuntu/campo/current# bundle exec rails c
    Usage:
      rails new APP_PATH [options]
    
    Options:
      -r, [--ruby=PATH]                                      # Path to the Ruby binary of your choice
                                                             # Default: /usr/local/rvm/rubies/ruby-2.0.0-p643/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.

    看了一下文件发现bin目录有个软链接,

    root@i-1lb6pxls:/home/ubuntu/campo/current# ls -al
    total 136
    drwxr-xr-x 12 root root  4096 Aug 24 18:12 .
    drwxr-xr-x  7 root root  4096 Aug 24 18:12 ..
    drwxrwxr-x 10 root root  4096 Aug 18 16:23 app
    -rw-r--r--  1 root root 26401 Aug 24 18:12 assets_manifest_backup
    lrwxrwxrwx  1 root root    29 Aug 24 18:12 bin -> /home/ubuntu/campo/shared/bin
    drwxrwxr-x  2 root root  4096 Aug 24 18:12 .bundle
    -rw-rw-r--  1 root root   386 Aug 18 16:23 Capfile
    -rw-rw-r--  1 root root   337 Aug 18 16:23 CHANGELOG.md
    drwxrwxr-x  5 root root  4096 Aug 24 18:12 config
    -rw-rw-r--  1 root root   154 Aug 18 16:23 config.ru
    drwxrwxr-x  3 root root  4096 Aug 18 16:23 db
    -rw-rw-r--  1 root root  2988 Aug 18 16:23 Gemfile
    -rw-rw-r--  1 root root  9758 Aug 18 16:23 Gemfile.lock
    -rw-rw-r--  1 root root   727 Aug 18 16:23 .gitignore
    -rw-rw-r--  1 root root   459 Aug 18 16:23 Guardfile
    drwxrwxr-x  4 root root  4096 Aug 18 16:23 lib
    -rw-rw-r--  1 root root  1128 Aug 18 16:23 LICENSE.md
    lrwxrwxrwx  1 root root    29 Aug 24 18:12 log -> /home/ubuntu/campo/shared/log
    drwxrwxr-x  2 root root  4096 Aug 24 18:12 public
    -rw-rw-r--  1 root root   249 Aug 18 16:23 Rakefile
    -rw-rw-r--  1 root root   258 Aug 18 16:23 README.md
    -rw-rw-r--  1 root root    11 Aug 18 16:23 .ruby-version
    drwxrwxr-x  2 root root  4096 Aug 18 16:23 script
    drwxrwxr-x 11 root root  4096 Aug 18 16:23 test
    drwxr-xr-x  2 root root  4096 Aug 24 18:12 tmp
    -rw-rw-r--  1 root root   438 Aug 18 16:23 .travis.yml
    -rw-rw-r--  1 root root   615 Aug 18 16:23 Vagrantfile
    drwxrwxr-x  3 root root  4096 Aug 24 18:12 vendor

    先删除了链接

    # rm bin

    然后再新建个文件夹重新生成一下目录的内容就ok啦

    root@i-1lb6pxls:/home/ubuntu/campo/current# mkdir bin
    root@i-1lb6pxls:/home/ubuntu/campo/current# rake rails:update:bin
           exist  bin
          create  bin/bundle
          create  bin/rails
          create  bin/rake

    如果记不清rake命令了可以查一下

    root@i-1lb6pxls:/home/ubuntu/campo/current# rake -T
    rake about                              # List versions of all Rails frameworks and the environment
    rake assets:clean[keep]                 # Remove old compiled assets
    rake assets:clobber                     # Remove compiled assets
    rake assets:environment                 # Load asset compile environment
    rake assets:precompile                  # Compile all the assets named in config.assets.precompile
    rake cache_digests:dependencies         # Lookup first-level dependencies for TEMPLATE (like messages/show or comments/_comment.html)
    rake cache_digests:nested_dependencies  # Lookup nested dependencies for TEMPLATE (like messages/show or comments/_comment.html)
    rake db:create                          # Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:create:...
    rake db:drop                            # Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:drop:all ...
    rake db:fixtures:load                   # Load fixtures into the current environment's database
    rake db:migrate                         # Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)
    rake db:migrate:status                  # Display status of migrations
    rake db:populate                        # Fill database with sample data
    rake db:rollback                        # Rolls the schema back to the previous version (specify steps w/ STEP=n)
    rake db:schema:cache:clear              # Clear a db/schema_cache.dump file
    rake db:schema:cache:dump               # Create a db/schema_cache.dump file
    rake db:schema:dump                     # Create a db/schema.rb file that is portable against any DB supported by AR
    rake db:schema:load                     # Load a schema.rb file into the database
    rake db:seed                            # Load the seed data from db/seeds.rb
    rake db:send_invitations                # send_invitations_to_all
    rake db:setup                           # Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the ...
    rake db:structure:dump                  # Dump the database structure to db/structure.sql
    rake db:version                         # Retrieves the current schema version number
    rake doc:app                            # Generate docs for the app -- also available doc:rails, doc:guides (options: TEMPLATE=/rdoc-template.rb,...
    rake elasticsearch:import:all           # Import all indices from `app/models` (or use DIR environment variable)
    rake elasticsearch:import:model         # Import data from your model (pass name as CLASS environment variable)
    rake log:clear                          # Truncates all *.log files in log/ to zero bytes (specify which logs with LOGS=test,development)
    rake middleware                         # Prints out your Rack middleware stack
    rake notes                              # Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)
    rake notes:custom                       # Enumerate a custom annotation, specify with ANNOTATION=CUSTOM
    rake rails:template                     # Applies the template supplied by LOCATION=(/path/to/template) or URL
    rake rails:update                       # Update configs and some other initially generated files (or use just update:configs or update:bin)
    rake rails_admin:install                # Install rails_admin
    rake rails_admin:prepare_ci_env         # CI env for Travis
    rake rails_admin:uninstall              # Uninstall rails_admin
    rake resque:failures:sort               # Sort the 'failed' queue for the redis_multi_queue failure backend
    rake resque:work                        # Start a Resque worker
    rake resque:workers                     # Start multiple Resque workers
    rake routes                             # Print out all defined routes in match order, with names
    rake secret                             # Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie ...
    rake stats                              # Report code statistics (KLOCs, etc) from the application
    rake test                               # Runs test:units, test:functionals, test:generators, test:integration together
    rake test:all                           # Run tests quickly by merging all types and not resetting db
    rake test:all:db                        # Run tests quickly, but also reset db
    rake time:zones:all                     # Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET paramete...
    rake tmp:clear                          # Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tmp:so...
    rake tmp:create                         # Creates tmp directories for sessions, cache, sockets, and pids

    接下来就可以运行console啦

    RAILS_ENV=staging bundle exec rails c
  • 相关阅读:
    各种算法七
    各种算法六
    使用URLConnection调用axis1.4开发的webservice
    JDBC结果集rs.next()注意事项
    URLConnection调用接口
    axis1.4开发webservice客户端(快速入门)-基于jdk1.4
    axis1.4开发webservice服务端(快速入门)-基于jdk1.4
    FMDB数据库的简单实用
    Xcode5 取消项目ARC,或者单个类ARC切换
    用CornerStone配置SVN,HTTP及svn简单使用说明
  • 原文地址:https://www.cnblogs.com/iwangzheng/p/4757890.html
Copyright © 2011-2022 走看看