Reference: https://guides.rubyonrails.org/getting_started.html#installing-ruby
brew install ruby
ruby -v
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
brew install rbenv
gem install rails
rbenv rehash
rails -v
Rails 6.0.3.4
https://guides.rubyonrails.org/getting_started.html#installing-node-js-and-yarn
node -v
v12.19.0
yarn -v
1.22.10
https://guides.rubyonrails.org/getting_started.html#installing-sqlite3
sqlite3 --version
3.28.0
rails new instautomation
cd instautomation
Webpacker requires Node.js >= 8.16.0 and you are using 8.15.0
Please upgrade Node.js https://nodejs.org/en/download/
Do:
nvm install 12
nvm use 12
rails server
- Open: 127.0.0.1:3000
Webpacker configuration file not found /Users/elizabethflores/dev/instautomation-test/instautomation/config/webpacker.yml. Please run rails webpacker:install Error: No such file or directory @ rb_sysopen - /Users/elizabethflores/dev/instautomation-test/instautomation/config/webpacker.yml (RuntimeError)
Run:
rails webpacker:install
Yarn not installed. Please download and install Yarn from https://yarnpkg.com/lang/en/docs/install/
brew install yarn
yarn install
rails test
Will see:
/Users/elizabethflores/dev/instautomation-test/instautomation/db/schema.rb doesn't exist yet. Run `rails db:migrate` to create it, then try again. If you do not intend to use a database, you should instead alter /Users/elizabethflores/dev/instautomation-test/instautomation/config/application.rb to limit the frameworks that will be loaded.
-
Run:
rails db:migrate
-
Run tests again:
rails test
Running via Spring preloader in process 73961
Run options: --seed 26301
# Running:
Finished in 0.124719s, 0.0000 runs/s, 0.0000 assertions/s.
0 runs, 0 assertions, 0 failures, 0 errors, 0 skips
- Run tests with verbose:
rails test -v
Running via Spring preloader in process 32757
Run options: -v --seed 26094
# Running:
PhotosControllerTest#test_should_get_index = 0.13 s = .
Finished in 0.170620s, 5.8610 runs/s, 5.8610 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
Based on: https://guides.railsgirls.com/heroku
brew install heroku/brew/heroku
bundle config set without 'production'
heroku create [APP_NAME]
heroku buildpacks:set heroku/ruby
git push heroku main
Need to connect the repository in Heroku.
- Go to: https://dashboard.heroku.com/apps/instautomation-test-1/deploy/github
- Click on Connect to GitHub
- Authorize Heroku App
- Choose the repository you want to deploy
- Enable Automatic Deployments
- Clone repository:
git clone ...
- cd
repository
ruby -v
rails -v
rails db:migrate
rails test
rails server
- Open: http://127.0.0.1:3000
- Go to: https://dashboard.heroku.com/new-app
- Select an app name
- Select a region
- Select the app you created
- Go to the Deploy Tab and Select GitHub: https://dashboard.heroku.com/apps/powerful-ridge-83474/deploy/github
- Click on Connect to GitHub
- This will redirect you to GitHub where you need to authorize the Heroku App
- Back in Heroku, enter the GitHub repository name
- Click on Search
- You will see the repository name:
ely-saucelabs/instautomation-test
- Click on Connect
- Choose the
main
branch
- Select the app you created
- Go to the Deploy Tab and on the Add this app to a pipeline, select Choose a pipeline -> Create new pipeline, e.g. instautomation-deployment
- Choose a stage to add this app to and select production (we won't have a staging / uat: user acceptance testing environment in this case)
- Click on Create pipeline
- On the pipeline page, we will enable the Review Apps feature.
- Click on Connect to GitHub
- In Search for a repository to connect to, select the repository name:
instautomation-test
- Click on Search
- You will see the repository name:
ely-saucelabs/instautomation-test
- Click on Connect
- In Review apps, click on Enable
- Select Create new review apps for new pull requests automatically
- Select Destroy stale review apps automatically (you can leave the default 5 days)
- Choose a region that is closer to you :)
- Click on Enable Review Apps