【転職190】本日やった事と感想+GithubとHerokuの使い方に慣れよう。

本日のタスク

【終わったタスク】1/5(火)

◆勉強


・railsチュートリアル(1.5~)すべて完了。

◆運動

無し。

◆その他


・ダイエットブログ更新。

・1/6の予定を決める。

・転職ブログ更新。

スポンサーリンク

【感想】

今日もドットインストールの続きを実施。

githubの使い方からHerokuへのデプロイの流れがまだ覚えきれていないものの、慣れが必要な部分なのでチュートリアルをやる間で覚えられるようにしたい。

以下メモとして残しておきたいと思います。

 

1/5

昨日からrailrailsチュートリアルを開始。githubでバージョン管理をして、Herokuへデプロイまで完了。演習で特定の変更をした後に、変更内容をHerokuにも反映させる手順で一旦分からなくなったものの、ようやくここで流れが理解できました。

application.rrbのファイルを変更したので、”git push heroku (master←省略可)を実行ましたが、ブラウザ上で確認しても反映していません。

すべて最新とのメッセージががが。

ubuntu:~/environment/hello_app (master) $ git push heroku ← 

Everything up-to-date

ubuntu:~/environment/hello_app (master) $ git push heroku master

Everything up-to-date

ubuntu:~/environment/hello_app (master) $ git push heroku master

Everything up-to-date

ubuntu:~/environment/hello_app (master) $

ブランチの状態を確認。

ubuntu:~/environment/hello_app (master) $ git branch

* master

ステータスを確認。

ubuntu:~/environment/hello_app (master) $ git status

On branch master

Your branch is ahead of ‘origin/master’ by 1 commit.

(use “git push” to publish your local commits)

Changes not staged for commit:

(use “git add <file>…” to update what will be committed)

(use “git checkout — <file>…” to discard changes in working directory)

modified: config/routes.rb

no changes added to commit (use “git add” and/or “git commit -a”)

ここでrailsチュートリアルにもどって再度変更した後の流れを確認。

“git checkout -b ~何をするかを書く(今回はmodify-application.rb)~でブランチを切る。

(トピックブランチを作るとも言う)

ubuntu:~/environment/hello_app (master) $ git checkout -b modify-application.rb

M config/routes.rb

Switched to a new branch ‘modify-application.rb’

次に”git branch”で現在選択されているブランチを確認。

下記の状態だとmastemasterではなく、branchで切った”modify-application.rb”が選択されいます。

ubuntu:~/environment/hello_app (modify-application.rb) $ git branch

master

* modify-application.rb 

この段階でコードを変更する。

ubuntu:~/environment/hello_app (modify-application.rb) $ git status

On branch modify-application.rb

Changes not staged for commit:

(use “git add <file>…” to update what will be committed)

(use “git checkout — <file>…” to discard changes in working directory)

modified: config/routes.rb

no changes added to commit (use “git add” and/or “git commit -a”)

次に変更(Improve=改良)した旨をメッセージにしてコミットします。

ubuntu:~/environment/hello_app (modify-application.rb) $ git commit -a -m “Improve the application.rb”

[modify-application.rb 02a03d3] Improve the application.rb

1 file changed, 1 insertion(+), 1 deletion(-)

マスターブランチに切り替える。

ubuntu:~/environment/hello_app (modify-application.rb) $ git checkout master

Switched to branch ‘master’

Your branch is ahead of ‘origin/master’ by 1 commit.

(use “git push” to publish your local commits)

↑上記翻訳

(ブランチ「マスター」に切り替えました

あなたのブランチは ‘origin/master’ よりも 1 コミット進んでいます。

(ローカルのコミットを公開するには “git push” を使用します))

変更した内容をマージ(併合)する。

ubuntu:~/environment/hello_app (master) $ git merge modify-application.rb

Updating 2928320..02a03d3

Fast-forward

config/routes.rb | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)

次にトピックブランチを削除します。

ubuntu:~/environment/hello_app (master) $ git branch -d modify-application.rb

Deleted branch modify-application.rb (was 02a03d3).

次にプッシュを実行。

(24時間経過しているとgithugithubIDとのIDとパスワードを聞かれます)

ubuntu:~/environment/hello_app (master) $ git push

Username for ‘https://github.com/hoge/hello_app.git’: hoge

Password for ‘https://hoge@github.com/hoge/hello_app.git’:

Counting objects: 8, done.

Compressing objects: 100% (8/8), done.

Writing objects: 100% (8/8), 1.06 KiB | 542.00 KiB/s, done.

Total 8 (delta 5), reused 0 (delta 0)

remote: Resolving deltas: 100% (5/5), completed with 4 local objects.

To https://github.com/hoge/hello_app.git

417e670..02a03d3 master -> master

ここまで来たら、ようやくHerokuへデプロイします。

ubuntu:~/environment/hello_app (master) $ git push heroku

Counting objects: 4, done.

Compressing objects: 100% (4/4), done.

Writing objects: 100% (4/4), 391 bytes | 391.00 KiB/s, done.

Total 4 (delta 2), reused 0 (delta 0)

remote: Compressing source files… done.

remote: Building source:

remote:

remote: —–> Ruby app detected

remote: —–> Installing bundler 1.17.3

remote: —–> Removing BUNDLED WITH version in the Gemfile.lock

remote: —–> Compiling Ruby/Rails

remote: —–> Using Ruby version: ruby-2.6.6

remote: —–> Installing dependencies using bundler 1.17.3

remote: Running: BUNDLE_WITHOUT=’development:test’ BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=1 bundle install -j4

remote: The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock –add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.

remote: Using rake 12.3.3

remote: Using concurrent-ruby 1.1.7

remote: Using i18n 1.8.7

remote: Using minitest 5.14.2

remote: Using thread_safe 0.3.6

remote: Using tzinfo 1.2.9

remote: Using zeitwerk 2.4.2

remote: Using activesupport 6.0.3

remote: Using builder 3.2.4

remote: Using erubi 1.10.0

remote: Using mini_portile2 2.5.0

remote: Using racc 1.5.2

remote: Using nokogiri 1.11.0 (x86_64-linux)

remote: Using rails-dom-testing 2.0.3

remote: Using crass 1.0.6

remote: Using loofah 2.8.0

remote: Using rails-html-sanitizer 1.3.0

remote: Using actionview 6.0.3

remote: Using rack 2.2.3

remote: Using rack-test 1.1.0

remote: Using actionpack 6.0.3

remote: Using nio4r 2.5.4

remote: Using websocket-extensions 0.1.5

remote: Using websocket-driver 0.7.3

remote: Using actioncable 6.0.3

remote: Using globalid 0.4.2

remote: Using activejob 6.0.3

remote: Using activemodel 6.0.3

remote: Using activerecord 6.0.3

remote: Using mimemagic 0.3.5

remote: Using marcel 0.3.3

remote: Using activestorage 6.0.3

remote: Using mini_mime 1.0.2

remote: Using mail 2.7.1

remote: Using actionmailbox 6.0.3

remote: Using actionmailer 6.0.3

remote: Using actiontext 6.0.3

remote: Using msgpack 1.3.3

remote: Using bootsnap 1.4.5

remote: Using bundler 1.17.3

remote: Using ffi 1.14.2

remote: Using jbuilder 2.9.1

remote: Using method_source 1.0.0

remote: Using pg 1.1.4

remote: Using puma 4.3.6

remote: Using rack-proxy 0.6.5

remote: Using thor 1.0.1

remote: Using railties 6.0.3

remote: Using sprockets 3.7.2

remote: Using sprockets-rails 3.2.2

remote: Using rails 6.0.3

remote: Using rb-fsevent 0.10.4

remote: Using rb-inotify 0.10.1

remote: Using sass-listen 4.0.0

remote: Using sass 3.7.4

remote: Using tilt 2.0.10

remote: Using sass-rails 5.1.0

remote: Using turbolinks-source 5.2.0

remote: Using turbolinks 5.2.0

remote: Using webpacker 4.0.7

remote: Bundle complete! 18 Gemfile dependencies, 60 gems now installed.

remote: Gems in the groups development and test were not installed.

remote: Bundled gems are installed into `./vendor/bundle`

remote: Bundle completed (0.44s)

remote: Cleaning up the bundler cache.

remote: The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock –add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.

remote: —–> Installing node-v12.16.2-linux-x64

remote: —–> Installing yarn-v1.22.4

remote: —–> Detecting rake tasks

remote: —–> Preparing app for Rails asset pipeline

remote: Running: rake assets:precompile

remote: yarn install v1.22.4

remote: [1/4] Resolving packages…

remote: [2/4] Fetching packages…

remote: info fsevents@2.1.3: The platform “linux” is incompatible with this module.

remote: info “fsevents@2.1.3” is an optional dependency and failed compatibility check. Excluding it from installation.

remote: info fsevents@1.2.13: The platform “linux” is incompatible with this module.

remote: info “fsevents@1.2.13” is an optional dependency and failed compatibility check. Excluding it from installation.

remote: [3/4] Linking dependencies…

remote: warning ” > webpack-dev-server@3.11.1″ has unmet peer dependency “webpack@^4.0.0 || ^5.0.0”.

remote: warning “webpack-dev-server > webpack-dev-middleware@3.7.3” has unmet peer dependency “webpack@^4.0.0 || ^5.0.0”.

remote: [4/4] Building fresh packages…

remote: Done in 26.06s.

remote: Compiling…

remote: Compiled all packs in /tmp/build_1ccbf99f/public/packs

remote: Hash: f1dde7956ce56a814f28

remote: Version: webpack 4.44.2

remote: Time: 5736ms

remote: Built at: 01/05/2021 1:21:00 PM

remote: Asset Size Chunks Chunk Names

remote: js/application-1a4310e423af5baaf2ff.js 69.3 KiB 0 [emitted] [immutable] application

remote: js/application-1a4310e423af5baaf2ff.js.br 15.3 KiB [emitted]

remote: js/application-1a4310e423af5baaf2ff.js.gz 17.7 KiB [emitted]

remote: js/application-1a4310e423af5baaf2ff.js.map 205 KiB 0 [emitted] [dev] application

remote: js/application-1a4310e423af5baaf2ff.js.map.br 44 KiB [emitted]

remote: js/application-1a4310e423af5baaf2ff.js.map.gz 51 KiB [emitted]

remote: manifest.json 364 bytes [emitted]

remote: manifest.json.br 128 bytes [emitted]

remote: manifest.json.gz 142 bytes [emitted]

remote: Entrypoint application = js/application-1a4310e423af5baaf2ff.js js/application-1a4310e423af5baaf2ff.js.map

remote: [0] (webpack)/buildin/module.js 552 bytes {0} [built]

remote: [1] ./app/javascript/packs/application.js 742 bytes {0} [built]

remote: [5] ./app/javascript/channels/index.js 205 bytes {0} [built]

remote: [6] ./app/javascript/channels sync _channel\.js$ 160 bytes {0} [built]

remote: + 3 hidden modules

remote:

remote: Asset precompilation completed (36.52s)

remote: Cleaning assets

remote: Running: rake assets:clean

remote: —–> Detecting rails configuration

remote:

remote: ###### WARNING:

remote:

remote: You have not declared a Ruby version in your Gemfile.

remote:

remote: To declare a Ruby version add this line to your Gemfile:

remote:

remote: “`

remote: ruby “2.6.6”

remote: “`

remote:

remote: For more information see:

remote: https://devcenter.heroku.com/articles/ruby-versions

remote:

remote: ###### WARNING:

remote:

remote: No Procfile detected, using the default web server.

remote: We recommend explicitly declaring how to boot your server process via a Procfile.

remote: https://devcenter.heroku.com/articles/ruby-default-web-server

remote:

remote:

remote: —–> Discovering process types

remote: Procfile declares types -> (none)

remote: Default types for buildpack -> console, rake, web

remote:

remote: —–> Compressing…

remote: Done: 63.8M

remote: —–> Launching…

remote: Released v7

remote: https://secure-hollows-36224.herokuapp.com/ deployed to Heroku

remote:

remote: Verifying deploy… done.

To https://git.heroku.com/secure-hollows-36224.git

2928320..02a03d3 master -> master

ubuntu:~/environment/hello_app (master) $

ここまでくるとHeroku上のファイルも変更されました。