Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting started with rails 6: how to start a blank new rails 6 application

I want to rebuild one of my old rails apps using the latest rails version available at github/rails/rails

How do I start off with the "rails new ...." ?

like image 932
american-ninja-warrior Avatar asked Dec 24 '22 04:12

american-ninja-warrior


1 Answers

It seems this can be as easy as this:

$ mkdir example
$ cd example
$ echo "source 'https://rubygems.org'" >> Gemfile
$ echo "gem 'rails', git: 'https://github.com/rails/rails.git'" >> Gemfile
$ bundle install
Fetching https://github.com/rails/rails.git
Fetching gem metadata from https://rubygems.org/.............
Resolving dependencies...
Using rake 12.3.1

$ bundle exec rails new . --dev --force
       exist
      create  README.md
      create  Rakefile
      create  .ruby-version
      create  config.ru
      create  .gitignore
       force  Gemfile
         run  git init from "."

$ bundle exec rails server -d
=> Booting Puma
=> Rails 6.0.0.alpha application starting in development
=> Run `rails server --help` for more startup options

UPDATE (2020): It turns out, the stable branch has nearly all the goodies found in the HEAD, but actually usable in production. So since then, I've modified the solution and nowadays I use these steps:

##
# Install edge rails
#
cd /tmp
git clone -b 6-0-stable --single-branch https://github.com/rails/rails
cd /tmp/rails
LATEST_COMMIT=$(git rev-parse --short HEAD) 
bundle update --bundler
bundle install
cd /tmp/rails/railties/exe
bundle exec rails --version
bundle exec rails new /tmp/your-app-name --dev --database=postgresql --force
cd /tmp/your-app-name
bundle exec rails --version # verify
# Without this, you'll get the error: The path does not exist.
cd /tmp/your-app-name
s1='gem .rails.,.*'
s2="gem 'rails', git: 'https:\/\/github.com\/rails\/rails.git', ref: '$LATEST_COMMIT'"
perl -pi.bak -e "s/$s1/$s2/" Gemfile
bundle install
like image 141
american-ninja-warrior Avatar answered Mar 09 '23 00:03

american-ninja-warrior