RoR Question: Where's script/server? - ruby-on-rails

I'm following Head First Ruby, and found out that the server file inside the script folder of my first project is missing. I followed this Ubuntu installation tutorial (sorry, Spanish link, still should be easy to follow the commands) and I guess some files/packages are missing. How I can get them?
antonio#antonio-desktop:~/Documents/tickets$ ruby script/server
ruby: No such file or directory -- script/server (LoadError)
antonio#antonio-desktop:~/Documents/tickets$ ls
app config.ru doc lib public README test vendor
config db Gemfile log Rakefile script tmp
antonio#antonio-desktop:~/Documents/tickets$ cd script
antonio#antonio-desktop:~/Documents/tickets/script$ ls
rails

If you're running Rails 3, it's now:
./script/rails server
All of the separate rails scripts in the scripts directory run through the single ./script/rails dispatcher now. This works for the console and other things you may be looking for as well (ie: ./script/rails console).

Related

basic ROR app working in terminal but not in netbeans [duplicate]

When I'm trying to launch Rails console on netbeans 7.4 after I create project I get /home/mati/.rvm/rubies/ruby-2.1.0/bin/ruby: No such file or directory -- script/rails (LoadError) , but this file exists. I was looking here Rails on Netbeans: Uncaught exception: no such file to load -- script/server or script/console but it didn't really help. Is there something else I could try?
Create a symbolic link as below on terminal:
ln -s ./bin ./script
This is because in Rails 4 script directory has been moved to bin.

How to run a Ruby project

First of all I am not Ruby developer, hence my hopefully really simple question.
I inherited a project with the following folder structure:
Capfile
Gemfile
Rakefile
app
config.ru
config
db
doc
lib
public
script
spec
vendor
My question is:
how to run this project in local environment? I'm running MAC OS X and have Ruby and Apache installed
from the folder structure, are you able to identify framework/frameworks this project is utilising?
Thanks for you help!
Marcin
Maybe it's a Ruby on Rails project. Try these lines in the console in the project folder:
gem install bundler
bundle
rake db:create && rake db:migrate
rails s
These commands will start Rails server at localhost:3000. This project requires DB to be installed. (DB type depends on Gemfile content). Also you should check if config/database.yml file is present.
Old question, but I would open up the Gemfile and see which framework is being used. It is often the first gem in the list.

"rails server" command is not getting recognized

I am new to rails and am following the tutorial posted on the ROR website. Everything is working fine until I try and load up my rails application on the localhost. Every time enter $ rails server I get a long list of possible commands and functions. When I check my localhost:3000 and 127.0.0.1:3000, nothing seems to be connected.
Upon digging deeper, I have tried almost everything everyone else has tried. I am running the command in the same path as my new rails application. Furthermore, when I enter in nonsense after the $ rails command I get the same list of possible commands and functions. So I get the feeling that rails is not recognizing the server command.
Here are my versions:
Ruby 1.9.3 p374
Rails 3.2.11
Why isn't the server command recognized?
First of all you have to move to the project directory and install bundle with the following command:
bundle install
Then start the server:
rails server
I had the same problem. rails server or simply rails s only works when you are in the right directory.
Type pwd (present working directory) to see where you currently are.
Type cd and the rest of the direction to the correct directory.
(for example, "cd workspace/learn-rails")
Type rails server or rails s.
Check http://localhost:3000.
Please exit from terminal and then restart the terminal.
Then check the directory path i.e just type pwd it will show the current directory path.
And if directory is correct on try again running command like bundle install & rails server
I think this should be work.

RVM environment variable

For my Ruby on Rails project I have to do a lot of stuff in the command line, like running rake tasks or running test specs. In my app I need to supply an environment variable to do this, e.g. ENCRYPTION_PASSWORD=bla rake db:test:prepare
What is a good way to add environment variables to RVM, so I don't have to use the variable every single time in the command line? Thanks!
In your applications folder you can place a .rvmrc file with the settings you need for your project. This file is read, when you change to this directory. E.g, I have a .rvmrc with this content:
rvm use ruby-1.9.2-p320
couchdb -b
When I enter the applications folder, rvm is firing a hook with parsing the file contents:
cd project/
Using /Users/andwen/.rvm/gems/ruby-1.9.2-p320
Running /Users/andwen/.rvm/hooks/after_use
Apache CouchDB is running as process 39539, time to relax.
Running /Users/andwen/.rvm/hooks/after_cd

how to run rails project after doing checkout using svn?

i have checked out a rails project into my svn repository.now i want to run that project on my local server.I entered rails server command to run it but i am getting an error that it cant find or read .yml file.what are the steps to be taken after one checks out some rails project in order to run it on local server.
cd into the directory containing the Gemfile and then do either rails s or bundle exec rails s. The error you are describing usually happens to me when I am not in the same dir as the Gemfile and Rails cannot find the database.yml file.

Resources