Entering Rails Commands in Terminal, Help Returns

When I enter:

$ rails server 

I get these returned commands and rails commands:

 Usage: rails new APP_PATH [options] Options: [--edge] # Setup the application with Gemfile pointing to Rails repository [--dev] # Setup the application with Gemfile pointing to your Rails checkout -G, [--skip-git] # Skip Git ignores and keeps -m, [--template=TEMPLATE] # Path to an application template (can be a filesystem path or URL) -b, [--builder=BUILDER] # Path to a application builder (can be a filesystem path or URL) [--old-style-hash] # Force using old style hash (:foo => 'bar') on Ruby >= 1.9 [--skip-gemfile] # Don't create a Gemfile -d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc) # Default: sqlite3 -O, [--skip-active-record] # Skip Active Record files [--skip-bundle] # Don't run bundle install -T, [--skip-test-unit] # Skip Test::Unit files -S, [--skip-sprockets] # Skip Sprockets files -j, [--javascript=JAVASCRIPT] # Preconfigure for selected JavaScript library # Default: jquery -J, [--skip-javascript] # Skip JavaScript files -r, [--ruby=PATH] # Path to the Ruby binary of your choice # Default: /usr/bin/ruby1.8 Runtime options: -s, [--skip] # Skip files that already exist -f, [--force] # Overwrite files that already exist -p, [--pretend] # Run but do not make any changes -q, [--quiet] # Supress status output 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. 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. 

Why doesn’t it start the server? For me, this seems to be the helpDoc rails or some of them. Similarly also:

 $ rails generate 

Is there anything I can do to get these commands to start correctly ...

I am using Rails version 3.1.3 on Ubuntu.

BTW: I enter them from the myapp ie directory

 chuckles@....... :~/Blog/new$ 

I started to start the server:

 $ script/server 

from / new /

+4
source share
5 answers

I had this problem. It turns out I created a gemset for use with my application, and then when I switched to the application folder in the terminal, it returned to the default gemset, which did not support my application.

You can check which gemset you are using by doing

 rvm gemset list 

Therefore, inside my application folder, I switched to the corresponding gemset using.

 rvm gemset use [your gemset name] 

Then

 bundle install 

to update gem files.

After that, everything worked.

+3
source

If you have a "script / server", then you probably have a rails 2.x application, not 3.x. Make sure that ( rails -v ) you run rails 3.xx, instead of 2.x.

EDIT:

I was probably not clear enough. From the information provided, I see:

  • you have 3.x gem rails and it shows that you are helping the screen because it cannot find the Rails 3.x application.
  • You have an application created by rails 2.x gem (you have a script/server script and you can verify that your application is for old rails by looking at the config/environment.rb file).

This combination will not work. You need to do something with this. If you need this old application, you can remove the 3.x gem rails and install 2.x verison. It would be even better if you could transfer this application to work with the supplier (then you do not need to remove the 3.x gem rails), but if this is not possible, you can take a look at rvm gemsets .

What I do when I need to run an old application:

  • rvm use ree - if my application uses Ruby Enterprise Edition on the server, otherwise rvm use [ruby version here] , depending on the version
  • rvm gemset create [application name here] - make gemset specific to this application
  • rvm alias create [application name here] ree@ [gemset name here] - so I can quickly get back to this gemset
  • rvm use [alias name here] - to switch to the ruby-gemset application combination
  • install all the gems needed for the application (ask other developers which versions you should use and how to install them

Then when I get back to developing this application:

  • rvm use [alias name here]
  • ./script/server - launch the application

You also need to find a tutorial and documentation for Rails 2.x if you want to develop this version.

+2
source

You can run these commands only from the existing rails project folder. Check the bottom of the output where it gives you an example of a command to create the skeleton structure of a rails project.

Alternatively, run this tutorial http://guides.rubyonrails.org/getting_started.html

+1
source

To run these commands, you need to be inside the rails project directory. First create a new project:

 rails new myapp 

then you can move it and start the server or other commands.

 cd myapp rails server 
0
source

Check the bin directory in the root directory of the rails application, I deleted it and this caused a problem for me. Create a bin directory and copy these files at a minimum.

rake stratification

from any other rails project.

0
source

Source: https://habr.com/ru/post/1384512/


All Articles