shell terminal: fetched the project from Github and stored in sample_app_heroku_2
$ cd ~* Showing Github remote origin for push and fetch
$ git clone https://github.com/jimmy2046/sample_app.git sample_app_heroku_2
$ cd sample_app_heroku_2
$ git remote show origin
* remote origin
Fetch URL: https://github.com/jimmy2046/sample_app.git
Push URL: https://github.com/jimmy2046/sample_app.git
IMPORTANT
* Change Git remote push and fetch locations to: sample_app_heroku_2.git
$ git remote set-url origin https://github.com/jimmy2046/sample_app_heroku_2.git
* Git show origin
$ git remote show origin
* remote origin
Fetch URL: https://github.com/jimmy2046/sample_app_heroku_2.git
Push URL: https://github.com/jimmy2046/sample_app_heroku_2.git
HEAD branch: (unknown)
Remote branches:
refs/remotes/origin/master stale (use 'git remote prune' to remove)
refs/remotes/origin/static-pages stale (use 'git remote prune' to remove)
Local branch configured for 'git pull':
master merges with remote master
* Git show remote location:
$ git remote -v
origin https://github.com/jimmy2046/sample_app_heroku_2.git (fetch)
origin https://github.com/jimmy2046/sample_app_heroku_2.git (push)
* Git push to Github:
$ git push -u origin master
Username for 'https://github.com': jimmy2046
Password for 'https://jimmy2046@github.com':
Counting objects: 541, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (303/303), done.
Writing objects: 100% (541/541), 6.88 MiB | 728.00 KiB/s, done.
Total 541 (delta 205), reused 541 (delta 205)
remote: Resolving deltas: 100% (205/205), done.
To https://github.com/jimmy2046/sample_app_heroku_2.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
* Bracket -> Change directory to -> sample_app_heroku_2
shell terminal
$ bundle install
$ rails db:migrate
$ rails db:seed
$ rails test
$ rails s -b 0.0.0.0 -p 3000
Firefox: http://localhost:3000/
$ git checkout -b attempt-heroku-deploy
sample_app_heroku_2/app/views/static_pages/home.html.erb
<h1>Welcome to the Jimmy App</h1>
sample_app_heroku_2/app/views/layouts/_header.html.erb
<%= link_to "jimmy app", root_path, id: "logo" %>
sample_app_heroku_2/db/seeds.rb
User.create!(name: "Example User",
email: "example@railstutorial.org",
password: "secret",
password_confirmation: "secret",
admin: true,
activated: true,
activated_at: Time.zone.now)
shell terminal
$ rails db:migrate:reset
$ rails db:seed
sample_app_heroku_2/Gemfile
source 'https://rubygems.org'
gem 'rails', '5.1.2'
# bcrypt for password encription
gem 'bcrypt', '3.1.11'
# faker for creating sample users for testing
gem 'faker', '1.7.3'
# For Images
gem 'carrierwave', '1.1.0'
gem 'mini_magick', '4.7.0'
gem 'fog', '1.40.0'
# For pagination
gem 'will_paginate', '3.1.5'
gem 'bootstrap-will_paginate', '1.0.0'
# Use Bookstrap
gem 'bootstrap-sass', '3.3.6'
gem 'puma', '3.9.1'
gem 'sass-rails', '5.0.6'
gem 'uglifier', '3.2.0'
gem 'coffee-rails', '4.2.2'
gem 'jquery-rails', '4.3.1'
gem 'turbolinks', '5.0.1'
gem 'jbuilder', '2.7.0'
group :development, :test do
gem 'sqlite3', '1.3.13'
gem 'byebug', '9.0.6', platform: :mri
end
group :development do
gem 'web-console', '3.5.1'
gem 'listen', '3.0.8'
gem 'spring', '2.0.2'
gem 'spring-watcher-listen', '2.0.1'
end
group :test do
gem 'rails-controller-testing', '1.0.2'
gem 'minitest-reporters', '1.1.14'
gem 'guard', '2.13.0'
gem 'guard-minitest', '2.4.4'
end
group :production do
gem 'pg', '0.18.4'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
shell terminal
$ bundle install
$ bundle update
$ rails test
restart server
Ctrl + C
$ rails s -b 0.0.0.0 -p 3000
shell terminal for Github
$ rails test
$ git add -A
$ git commit -m "Ch2 Changed Gemfile for heroku"
$ git checkout master
$ git merge attempt-heroku-deploy
$ git remote -v
$ git push
shell terminal for heroku
$ heroku create
Creating app... done, ⬢ warm-ravine-91766
https://warm-ravine-91766.herokuapp.com/ | https://git.heroku.com/warm-ravine-91766.git
$ git push heroku master
$ heroku open
Firefox: https://warm-ravine-91766.herokuapp.com/
$ heroku logs* The log of Ch 3:
$ git log
commit 614bdc6e9c49d6e73b2c2c96865461e9455d38cf
Author: jimmy2046 <jimmychong_st@yahoo.com>
Date: Sun Apr 23 15:12:01 2017 -0700
Finish static pages
$ git checkout -b old-state 614bdc6e9
Firefox: http://localhost:3000/
sample_app_heroku_2/Gemfile
source 'https://rubygems.org'
gem 'rails', '5.1.2'
gem 'puma', '3.9.1'
gem 'sass-rails', '5.0.6'
gem 'uglifier', '3.2.0'
gem 'coffee-rails', '4.2.2'
gem 'jquery-rails', '4.3.1'
gem 'turbolinks', '5.0.1'
gem 'jbuilder', '2.7.0'
group :development, :test do
gem 'sqlite3', '1.3.13'
gem 'byebug', '9.0.6', platform: :mri
end
group :development do
gem 'web-console', '3.5.1'
gem 'listen', '3.0.8'
gem 'spring', '2.0.2'
gem 'spring-watcher-listen', '2.0.1'
end
group :test do
gem 'rails-controller-testing', '1.0.2'
gem 'minitest-reporters', '1.1.14'
gem 'guard', '2.13.0'
gem 'guard-minitest', '2.4.4'
end
group :production do
gem 'pg', '0.18.4'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
shell terminal
$ cd sample_app_heroku_2
$ bundle update
$ bundle install --without production
$ bundle update
$ rails test
$ git commit -m "Ch3-Update-Gemfile-for-Heroku"
$ git branch
attempt-heroku-deploy
ch7-add-puma
master
* old-state
use-ch-3-Gemfile
$ git push old-state
$ git push heroku old-state
$ git branch
attempt-heroku-deploy
ch7-add-puma
master
* old-state
use-ch-3-Gemfile
$ git checkout master
$ git merge old-state
$ git status* I had to disregard the master branch and replace with the "old-state" branch.
$ git add -A
$ git commit -m "Ch3 Updated Gemfile v2"
$ git checkout old-state
$ git merge master --strategy=ours
$ git checkout master
$ git remote -v
heroku https://git.heroku.com/warm-ravine-91766.git (fetch)
heroku https://git.heroku.com/warm-ravine-91766.git (push)
origin https://github.com/jimmy2046/sample_app_heroku_2.git (fetch)
origin https://github.com/jimmy2046/sample_app_heroku_2.git (push)
$ git push
$ git branch
$ git merge old-state
$ git push
$ rails test
$ git push heroku
$ git logFirefox: http://localhost:3000/
commit 0d158c0c37e61f494edfa92d206552d22fe6d9d7
Author: jimmy2046 <jimmychong_st@yahoo.com>
Date: Wed May 10 18:12:07 2017 -0700
Finish layout and routes
$ git checkout -b ch5-old-state 0d158c0c3
$ rails test
sample_app_heroku_2/Gemfile
source 'https://rubygems.org'
gem 'rails', '5.1.2'
gem 'bootstrap-sass', '3.3.7'
gem 'puma', '3.9.1'
gem 'sass-rails', '5.0.6'
gem 'uglifier', '3.2.0'
gem 'coffee-rails', '4.2.2'
gem 'jquery-rails', '4.3.1'
gem 'turbolinks', '5.0.1'
gem 'jbuilder', '2.7.0'
group :development, :test do
gem 'sqlite3', '1.3.13'
gem 'byebug', '9.0.6', platform: :mri
end
group :development do
gem 'web-console', '3.5.1'
gem 'listen', '3.0.8'
gem 'spring', '2.0.2'
gem 'spring-watcher-listen', '2.0.1'
end
group :test do
gem 'rails-controller-testing', '1.0.2'
gem 'minitest-reporters', '1.1.14'
gem 'guard', '2.13.0'
gem 'guard-minitest', '2.4.4'
end
group :production do
gem 'pg', '0.18.4'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
$ bundle update
$ git status
$ git add -A
$ git commit -m "Ch5 Updated Gemfile for Heroku"
$ git branch
attempt-heroku-deploy
* ch5-old-state
ch7-add-puma
master
old-state
use-ch-3-Gemfile
$ git merge -s ours master
$ git checkout master
$ git merge ch5-old-state
$ rails test
$ git push
$ git push heroku
=============================================
Ch 6:
$ git log
commit 3a0c190033fc6aef7316fdb0bc37ac7f05c21190
Author: jimmy2046 <jimmychong_st@yahoo.com>
Date: Sun May 14 19:37:25 2017 -0700
Make a basic User model (including secure passwords)
$ git checkout -b ch6-old-state 3a0c19003
sample_app_heroku_2/Gemfile
gem 'bcrypt', '3.1.11'
$ bundle update
$ git status
$ git add -A
$ git commit -m "Ch6 Updated Gemfile for Heroku"
$ git branch
* ch6-old-state
master
$ git merge -s ours master
$ git checkout master
$ git merge ch6-old-state
$ rails test
$ git push
$ rails test
$ git push heroku
$ heroku run rails db:migrate
=============================================
Ch 7:
$ git log* I updated Gemfile in Brackets and saved the file
commit 5ab58709367a7ad82bbb0852e301b081d255bc9c
Author: jimmy2046 <jimmychong_st@yahoo.com>
Date: Wed May 24 17:45:19 2017 -0700
Finish user signup
$ git checkout -b ch7-old-state 5ab587093
$ bundle update
$ rails test
config/environments/production.rb
config.force_ssl = true
Procfile
web: bundle exec puma -C config/puma.rb
$ rails test
$ git status
$ rails test
$ git add -A
$ git commit -m "Ch7 Updated Gemfile for Heroku"
$ git merge -s ours master
$ git checkout master
$ git branch
$ git merge ch7-old-state
$ bundle update
$ rails test
$ git push
$ git push heroku
$ heroku run rails db:migrate
=============================================
Ch 10:
$ git log
commit 3aa04f3052aef91541aa7aef8378e156f557dc37
Author: jimmy2046 <jimmychong_st@yahoo.com>
Date: Sat Jul 15 18:36:22 2017 -0700
Finish user edit, update, index, and destroy actions
$ git checkout -b ch10-old-state 3aa04f305
* I updated: Gemfile, puma.rb, and production.rb files.
$ git status
$ git add -A
$ git commit -m "Chapter 10 Updated Gemfile for Heroku"
$ git merge -s ours master
$ git checkout master
$ git branch
$ git merge ch10-old-state
$ git push
$ rails test
$ git push heroku
$ heroku pg:reset DATABASE
$ heroku run rails db:migrate
$ heroku run rails db:seed
$ heroku restart
* As of time of writing, the production version had completed chapter 10 of Michael Hartl's book. The hosting URL on Heroku is:
https://warm-ravine-91766.herokuapp.com/
* The screen shot of production version on Heroku was:
References:
Change name of folder when cloning from github?
https://stackoverflow.com/questions/8570636/change-name-of-folder-when-cloning-from-github
How to replace master branch in git, entirely, from another branch? [duplicate]
https://stackoverflow.com/questions/2862590/how-to-replace-master-branch-in-git-entirely-from-another-branch
Make the current git branch a master branch
https://stackoverflow.com/questions/2763006/make-the-current-git-branch-a-master-branch
How can I determine the URL that a local Git repository was originally cloned from?
https://stackoverflow.com/questions/4089430/how-can-i-determine-the-url-that-a-local-git-repository-was-originally-cloned-fr
Changing a remote's URL
https://help.github.com/articles/changing-a-remote-s-url/
Change the URI (URL) for a remote Git repository
https://stackoverflow.com/questions/2432764/change-the-uri-url-for-a-remote-git-repository
2.5 Git Basics - Working with Remotes
https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes
No comments:
Post a Comment