How do I install Ruby on Rails on Windows Operating System? I am new to Ruby on Rails.
Complete Installation process and set environment on windows and set git configuration:
step 1:
Download links:
A. ruby on rails: visit http://railsinstaller.org/en
and download
B. nodejs: visit
https://nodejs.org/download/ and download
run and install railsinstaller.exe
2.run and install node.exe (optional)
step 2: set environment path:
a. go: my computer > properties
b. Then Advanced system settings
c. Then Environment Variables
d. Then Edit (here you need to edit path)
e. add C:\nodejs; to path
Test:
1. Restart your pc (optional)
2. open your terminal (Git Bash or cmd )
3. type & hit enter:
ruby -v
rails -v
git --version
node -v
if you see the versions that means everything ok.
You can Set git configuration:
$ git config --global user.name "your github username"
$ git config --global user.email email#example.com
if you want to set github ssh you can see
Generating SSH keys
if you want to install mysql and gem 'mysql2' see here
if you want to install postgresql and gem 'pg' see here
Related
I am trying to deploy a Rails 6 app on AWS via Elastic Beanstalk.
When I run eb deploy, it fails.
When I look at the logs, I see this message
2020/06/03 14:19:51.457403 [ERROR] rbenv: version `2.7.0' is not installed (set by /var/app/staging/.ruby-version)
2020/06/03 14:19:51.457439 [ERROR] An error occurred during execution of command [app-deploy] - [stage ruby application]. Stop running the command. Error: install dependencies in Gemfile failed with error Command /bin/sh -c bundle config set --local deployment true failed with error exit status 1. Stderr:rbenv: version `2.7.0' is not installed (set by /var/app/staging/.ruby-version)
However, when I eb ssh and run ruby -v I see that I am running ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
So I updated my Gemfile and .ruby-version to ruby 2.7.1 to match my AWS environment.
When I cd /var/app/staging
and cat .ruby-version
I get 2.7.1
So why is this deploy failing? I am not requiring ruby 2.7.0 anywhere in my project.
I've made sure to git push, so I know my Gemfile is pushed my to repo.
I am going crazy trying to get this Rails App deployed.
What worked for me is to create a zip file in the root directory of your app:
zip ../rails-default.zip -r * .[^.]
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ruby-rails-tutorial.html
I think you can set up ruby and make it as default based on your requirement.
Just set up some config file in .ebextensions and set instructions to install ruby version you require and make it default.
e.g.
Create file in .ebextensions 00_ruby_install.config
Add content which will install ruby
files:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/09_ruby_install.sh" :
mode: "000775"
owner: root
group: users
content: |
#!/usr/bin/env bash
... Add ruby install instructions here ...
there is a .ruby-version file in the root of your directory that states a different ruby version, like in your case it would be ruby-2.7.0, just change it to ruby-2.7.1 or whatever is in your Gemfile.
I have downloaded Ruby, and installed the rails gem, then I attempt to run rails new my-project and all I get is this:
c:\Projects>rails new my-project
create
create README.md
create Rakefile
create .ruby-version
create config.ru
create .gitignore
create Gemfile
run git init from "."
When I open the my-project folder that rails created for me what I find in it is only:
.gitignore
.ruby-version
config.ru
Gemfile
Rakefile
README.md
and nothing else.
This is not what I got when testing this at home, and it's not what any guide says I should get. I have exactly zero folders generated by rails, it's nowhere near what I need to start development. I don't think I'm missing any installations. Here are the versions of ruby and of rails:
c:\Projects>ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x64-mingw32]
c:\Projects>rails -v
Rails 6.0.2
IIRC I installed Ruby using the Windows Ruby Installer at rubyinstaller.org, the latest version with Devkit, then I simply ran gem install rails to get Rails.
The only thing I can think of is that my user does not have admin privileges in this computer, but when I try to Google if this is a requirement, all Google gives me is how to implement admin stuff in my app.
Try appending --skip-git to your rails new command. This will get you going in the short term.
Alternatively (and probably the better option in the long run), install git. The official Git documentation install instructions can be found here: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
I have the same issue. Thanks to Scott Schupbach answer I realize that I didn't Install git, because I was working in a fresh ubuntu 19.10 installation.
So for anyone with the same issue, just install git.
In Ubuntu (or other Debian-based Linux distribution) just type:
sudo apt install git
On Mac (using Homebrew):
brew install git
For Windows, non-Debian Linux systems, and alternative Mac installer options, see the official Git installation documentation: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
And that's all.
Best Regards!!
uninstall rails
delete the project folder
install git with sudo - "sudo apt install git"
reinstall rails - "gem install rails"
create the project folder again and do the cd command to be in the new folder
Run the command again- "rails new [project name]"
Facing this issue as git was not installed on system.
Try to run below command to install git
sudo apt install git
And then create a new rails project with rails command
rails new myApp
It will create complete folder structure for you
I am provisioning an install of a node that uses some ruby gems. In order to get the gems on my corporate network I usually add 'http://rubygems.org'.
I am using Docker compose and wand to use
gem source --add http://rubygems.org, but I noticed it asks me interactively [yn].
How can I avoid the interaction, similar to apt-get install -yqq?
You can specify the gem source in ~/.gemrc file, without the interaction with the gem source command.
$> echo -e '--- \nsources:\n- http://rubygems.org/' >> ~/.gemrc
That command will generate next file:
---
sources:
- http://rubygems.org/
Which will be used by rubygems package.
Rubygems documentation
I've created Ruby on Rails app using Rails Composer and I want to use it with Gitlab CI (v5.0.1 on OS X 10.9.4) with Gitlab CI Runner also on OS X 10.9.4.
What I should use as build steps? I started with:
. ~/.bash_profile
rvm use ruby-2.1.2#myapp
bundle install
rspec spec
I used .bash_profile because rvm doesn't work without it. Is there better way?
I found that some files are not in Git (like database.yml and application.yml). What is the best way to add them back or how to setup them in Gitlab CI?
EDIT:
I've added back default database.yml as database.example.yml. Now, I use these build steps:
. ~/.bash_profile
cp config/application.example.yml config/application.yml
cp config/database.example.yml config/database.yml
rvm use ruby-2.1.2#myapp
bundle install
rspec spec
I need to run an application built in ruby on rails. I have installed ruby 1.9.2, rails 3.2.1, gem 1.8.15, Netbeans 6.8, glassfish v3, jdk6u30 and mysql but still, I can't get it run.
How do I install ruby on rails on WindowsXP?
I have to code on Windows at work and deploy to Linux and this is what I use
Ruby installer
Ruby Dev Kit
Install Rubygems
Open a Ruby command prompt for the next steps
gem install bundler
bundle install mysql
bundle install rails
Go to the directory you want to house your rails apps (e.g. cd \rails_source)
rails new (inserting the app name you want)
Once that is done, cd into the directory
Edit Gemfile to ask for gem 'mysql'
cd Config
edit Database.yaml to look for mysql db
cd ..
create a db for your mysql instance called _development
Go back to rails command line
bundle exec rails g scaffold (like blog_entry)
bundle exec rake db:migrate
bundle exec rake routes
Look for your desired route in the output
bundle exec rails s
Open a browser
Go to http://localhot:3000/
You should see a plain app
You can also check out Rails for Zombies which is a visual tutorial. It is not windows oriented but it helps fill in the gaps
I think its a quite simple to install ROR with mysql database on windows.
Follow the below instruction
Install Mysql Server 5.6 from [http://dev.mysql.com/downloads/mysql/] , use 32bit for XP and 64Bit for W7.
Go to mysql/bin folder under Program Files and copy and set the path in environment variable.Open command propmt and type mysql in order to check if mysql is installed correctly.
If still problem with Mysql, open run and type services.msc and check for MySQL service is started or not if not start manually.
Download ruby2.0.0, devkit 64-32 from http://rubyinstaller.org/downloads/
Download mysql connector from [http://dev.mysql.com/downloads/connector/c/] and make sure the version should be "(mysql-connector-c-noinstall-6.0.2-win32.zip)", you will find in "Looking for previous GA versions?".
Install ruby in C folder and select add path to executable while installing in first/second prompt.
Create folder devkit and extract devkit into it.
Extract mysql connector in C folder.
Open command Prompt and type ruby -v in order to check if ruby is installed, if not check ruby/bin path have to be added in environment variable.
Go to devkit folder, where you have extracted devkit, open command prompt and type ruby dk.rb init and then ruby dk.rb install.
Now we go through test, follow the instruction is given in test installation section in https://github.com/oneclick/rubyinstaller/wiki/Development-Kit and check with command starts with gem and ruby.
Create directory called dev and go inside it and type command gem install rails.
rails new app -d mysql2
Run command "bundle config build.mysql2 --no-ri --no-rdoc -- --with-mysql-dir=c:\mysql-connector[select what folder name is there for mysql connector]".
bundle install.
If still problem is exist, delete app folder and repeat command rails new app -d mysql2 again.
Go to app folder and use command rails server to start services. Check in browser with localhost:3000.
To create DB, use rake db:create in app folder.
Hope it helps.