Visual Studio CordとGitHubを連携して詰んだ

パイセンがVisualStudioCordからGitHubから

ファイルをPushしてたのを見て俺もやりて〜と思った。

早速、VSとGitHubを連携した。

Git: git@github.com: Permission denied (publickey).  

> git pull --tags origin main

git@github.com: Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

エラーが出てきて、2時間も溶けてしまった(⌒▽⌒)

同じ過ちを繰り返さない戒めも込めて備忘録を記す

原因は

SSHの設定ができていなかった。

VSからCloneをしていなかった。

 

自分で工夫したこと

ターミナルから「ssh -T git@github.com」してみた。

 

SSHの設定は

https://docs.github.com/ja/authentication/connecting-to-github-with-ssh

VSとGitHubをcloneする方法

code.visualstudio.com

上のドキュメント通りに設定しても改善しない

Git: git@github.com: Permission denied (publickey). 

 

ターミナルでは

ssh -T git@github.comでローカルからgithubに疎通は問題ない

Hi gitaccount! You've successfully authenticated, but GitHub does not provide shell access.

 

今日一でよかった所は

VSのターミナル上で

ssh -T git@github.comのコマンド実行してみた。

 

VSとGithubの連携ができた。

 

振り返り

・プログラムを作る周辺技術を使いこなせる様になると上達できる気がする

・一つ一つの課題を解決すると大きな問題を解決できる。

・ドキュメントを読むと無駄な時間を使わないで、安心して問題を解決できる

・英語を読めるとドキュメントを早く読める、早く問題を解決できる。

be動詞も分からない人が英語の技術ドキュメントを読む

突然ですが、英語のドキュメントが読めるようになりたいw

be動詞も分からない人が英語を読めるようにするために、

考えた事とか英語の教材ついて、つらつらと書いていく。

 

「独学エンジニア」でプログラミングの学習をしている。

レッスン2の課題が「Visual studio codeの公式ドキュメントを読もう」なのだ。

 

プログラミングの上達には公式ドキュメントを読む、

英語を使うのは避けられないらしい。

ということで英語を読もうということになった。

 

しかし、be動詞も分からない。

という所からの勉強の出発だ。

 

教科書を引っ張りだしてきて、一ページ目からペラペラめくっても

ツマラナイので色々、楽しく勉強できそうな教材を探してみた

 

DVD

世界一わかりやすい英文法の授業

世界一わかりやすい中学英語の授業

世界一わかりやすい英単語の授業

世界一わかりやすい英会話の授業

世界一わかりやすい英作文の授業

etc

 

ゲーム

SWICH

ベティア ペラペラ英語アドベンチャー

3DS

ナナミと一緒に学ぼ!English上達のコツ

etc

 

マンガ

マンガでおさらい中学英語

マンガでおさらい中学英語 英文法マスター編

etc

 

今は①DVDを見る→②ゲームで実践

→③会社でドキュメントを見る→④寝る前に漫画で復習する

 

DVD、ゲーム、マンガの学習はとにかく勉強をしていて楽しい。

勉強のハードルを下げるは大事だ。ハードルを下げると学習が続く。

 

先ずは、目標は結果を出すことよりも勉強を続けることを目標にする

 

rubyとsinatraではじめるwebアプリケーション開発の教科書でパスが通せない問題

rubysinatraではじめるwebアプリケーション開発の教科書」

でWebアプリの作成を学習中です。

パスが通せなくなって困った時の対処法です。

ページ数でいうと42pです。

テキストエディタで~/.bash_profileというファイルを作り〜の辺りです。

まずわからないことだらけです。

テキストエディタ

/.bash_profileというファイル

ここでいうテキストエディタは38pでインストールした

emacsのことです。

.bash_profileはコマンドでスクリプトを操作できるようにすための

ファイルのことです。多分

.bash_profileファイルをemacsで作ってスクリプトを書けという

ことですね。多分

さてこの本にはそれ以外には具体的なことは何もかかれていません。

なので具体的な方法をここに書きます。

入力まち状態のコマンドに

emacs」と入力して実行します。

 

するとemacsが起動します。

 

今度は control +x、続いて fを投入

一番下が入力まち状態になるので、

そこに「.bash_profile」を入力して実行します。

 

emacsが編集可能状態になるので、

本書にあるシェルスクリプトを入力

 

入力が終わったら、control + x、続いてcを押して

emacsを終了します。

 

以上です。

もっと簡単にできる方法もあると思いますが、

これでUbuntuにrbenvのパスが通せました。

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Herokuにサンプルアプリをデプロイするまでの備忘録

 

Herokuにサンプルアプリをデプロイするまでの備忘録

 

サンプルプログラムをHerokuへデプロイ

デプロイ失敗、ターミナルから原因を調べる

エラーぽさそう「Precompiling assets failed.」な内容をググる

 

こちらの記事でエラーの見方を教えて頂く

qiita.com

 

どうも原因は「Precompiling assets failed.」ではなく

 

ここが原因だとわかる「rake aborted!

ArgumentError: wrong number of arguments (given 3, expected 2)」

 

ググってみたら、引数の数が違うエラーらしいが

実際はHerokuでサポートのRubyバージョンとサンプルプログラムのバージョンがことらしい。

qiita.com

 

しかし、サンプルプログラムのRubyのバージョンを変更できないので

どうすれば解決できるのか更にググる

 

こちらの記事で教えて頂いた方法で無事にデプロイができた。

qiita.com

 

GemfileにあるRubyバージョンの行を削除して

Herokuにデプロイできた。

 

せっかくなので、こちらの記事で教えてもらった方法で

Basic認証もかけておいた。

qiita.com

 

3年くらい前にHerokuデプロイに挫折したことがあるので、

サンプルアプリとはいえ、デプロイできたのは本当に嬉しい。

 

今回はサンプルのプログラムだったが、いつか

自分で作ったアプリをデプロイしたい。

 

bundleのインストールで卍で詰んだ話

デプロイを練習しているenoです。

 

教材は「個人開発のための Webサービス公開マニュアル」です。

個人開発のための Webサービス公開マニュアル

 

Ruby on Railsのサンプルプログラム「shuwasystem-rails-heroku」をローカル環境で起動しようとしました。

 

Bundlerのパッケージをインストールするところで

卍で詰みました。死にました。

 

Bundlerのパッケージがインストールできない!!

 

コマンドを実行

bundle install

 

エラー?警告?

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`.

Fetching gem metadata from https://rubygems.org/..........

Your bundle is locked to mimemagic (0.3.3), but that version could not be found

in any of the sources listed in your Gemfile. If you haven't changed sources,

that means the author of mimemagic (0.3.3) has removed it. You'll need to update

your bundle to a version other than mimemagic (0.3.3) that hasn't been removed

in order to install.

user@MacBookPro shuwasystem-rails-heroku % bin/rails db:migrate

Could not find rake-12.3.3 in any of the sources

Run `bundle install` to install missing gems.

 

翻訳したり、ググったり、rbenv、rubyをバージョンアップしてみるも...何も変わらず( ;´Д`)

 

そして、下記の神記事で前進!!

qiita.com

 

サンプルプログラムの「gemfile」の

tzinfo-data行を編集

「gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]」をコメントアウト

 

コマンドを実行

 「bundle update」

 

一発でBundleのインストールではできず。。。

「Fetching gem metadata from https://rubygems.org/...........

Fetching gem metadata from https://rubygems.org/.

Resolving dependencies....

Fetching rake 13.0.6 (was 12.3.3)

Installing rake 13.0.6 (was 12.3.3)

Using concurrent-ruby 1.1.10 (was 1.1.5)

Using i18n 1.10.0 (was 1.6.0)

Fetching minitest 5.15.0 (was 5.11.3)

Installing minitest 5.15.0 (was 5.11.3)

Using thread_safe 0.3.6

Using tzinfo 1.2.9 (was 1.2.5)

Fetching activesupport 5.2.7.1 (was 5.2.3)

Installing activesupport 5.2.7.1 (was 5.2.3)

Using builder 3.2.4 (was 3.2.3)

Using erubi 1.10.0 (was 1.8.0)

Fetching mini_portile2 2.8.0 (was 2.4.0)

Installing mini_portile2 2.8.0 (was 2.4.0)

Using racc 1.6.0

Using nokogiri 1.13.5 (x86_64-darwin) (was 1.10.5)

Using rails-dom-testing 2.0.3

Using crass 1.0.6 (was 1.0.5)

Using loofah 2.17.0 (was 2.3.1)

Using rails-html-sanitizer 1.4.2 (was 1.0.4)

Fetching actionview 5.2.7.1 (was 5.2.3)

Installing actionview 5.2.7.1 (was 5.2.3)

Using rack 2.2.3 (was 2.0.7)

Using rack-test 1.1.0

Fetching actionpack 5.2.7.1 (was 5.2.3)

Installing actionpack 5.2.7.1 (was 5.2.3)

Using nio4r 2.5.8 (was 2.4.0)

Using websocket-extensions 0.1.5 (was 0.1.4)

Using websocket-driver 0.7.5 (was 0.7.1)

Fetching actioncable 5.2.7.1 (was 5.2.3)

Installing actioncable 5.2.7.1 (was 5.2.3)

Using globalid 1.0.0 (was 0.4.2)

Fetching activejob 5.2.7.1 (was 5.2.3)

Installing activejob 5.2.7.1 (was 5.2.3)

Using mini_mime 1.1.2 (was 1.0.2)

Using mail 2.7.1

Fetching actionmailer 5.2.7.1 (was 5.2.3)

Installing actionmailer 5.2.7.1 (was 5.2.3)

Fetching activemodel 5.2.7.1 (was 5.2.3)

Installing activemodel 5.2.7.1 (was 5.2.3)

Using arel 9.0.0

Fetching activerecord 5.2.7.1 (was 5.2.3)

Installing activerecord 5.2.7.1 (was 5.2.3)

Using marcel 1.0.2 (was 0.3.3)

Fetching activestorage 5.2.7.1 (was 5.2.3)

Installing activestorage 5.2.7.1 (was 5.2.3)

Fetching public_suffix 4.0.7 (was 3.1.1)

Installing public_suffix 4.0.7 (was 3.1.1)

Fetching addressable 2.8.0 (was 2.6.0)

Installing addressable 2.8.0 (was 2.6.0)

Fetching io-like 0.3.1 (was 0.3.0)

Installing io-like 0.3.1 (was 0.3.0)

Fetching archive-zip 0.12.0

Installing archive-zip 0.12.0

Fetching bindex 0.8.1

Installing bindex 0.8.1 with native extensions

Fetching msgpack 1.5.1 (was 1.3.0)

Installing msgpack 1.5.1 (was 1.3.0) with native extensions

Fetching bootsnap 1.11.1 (was 1.4.4)

Installing bootsnap 1.11.1 (was 1.4.4) with native extensions

Using bundler 1.17.2

Fetching byebug 11.1.3 (was 11.0.1)

Installing byebug 11.1.3 (was 11.0.1) with native extensions

Fetching matrix 0.4.2

Installing matrix 0.4.2

Fetching regexp_parser 2.3.1 (was 1.6.0)

Installing regexp_parser 2.3.1 (was 1.6.0)

Fetching xpath 3.2.0

Installing xpath 3.2.0

Fetching capybara 3.36.0 (was 3.27.0)

Installing capybara 3.36.0 (was 3.27.0)

Fetching childprocess 4.1.0 (was 1.0.1)

Installing childprocess 4.1.0 (was 1.0.1)

Fetching chromedriver-helper 2.1.1

Installing chromedriver-helper 2.1.1

Fetching coffee-script-source 1.12.2

Installing coffee-script-source 1.12.2

Fetching execjs 2.8.1 (was 2.7.0)

Installing execjs 2.8.1 (was 2.7.0)

Fetching coffee-script 2.4.1

Installing coffee-script 2.4.1

Using method_source 1.0.0 (was 0.9.2)

Using thor 1.2.1 (was 0.20.3)

Fetching railties 5.2.7.1 (was 5.2.3)

Installing railties 5.2.7.1 (was 5.2.3)

Fetching coffee-rails 4.2.2

Installing coffee-rails 4.2.2

Fetching ffi 1.15.5 (was 1.11.1)

Installing ffi 1.15.5 (was 1.11.1) with native extensions

Fetching jbuilder 2.11.5 (was 2.9.1)

Installing jbuilder 2.11.5 (was 2.9.1)

Fetching rb-fsevent 0.11.1 (was 0.10.3)

Installing rb-fsevent 0.11.1 (was 0.10.3)

Fetching rb-inotify 0.10.1 (was 0.10.0)

Installing rb-inotify 0.10.1 (was 0.10.0)

Fetching ruby_dep 1.5.0

Installing ruby_dep 1.5.0

Fetching listen 3.1.5

Installing listen 3.1.5

Fetching pg 1.3.5 (was 1.1.4)

Installing pg 1.3.5 (was 1.1.4) with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

 

current directory:

/Users/user/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/pg-1.3.5/ext

/Users/user/.rbenv/versions/2.6.3/bin/ruby -I

/Users/user/.rbenv/versions/2.6.3/lib/ruby/2.6.0 -r

./siteconf20220508-96894-kfb3k0.rb extconf.rb

Calling libpq with GVL unlocked

checking for pg_config... no

checking for libpq per pkg-config... no

Using libpq from 

checking for libpq-fe.h... no

Can't find the 'libpq-fe.h header

*****************************************************************************

 

Unable to find PostgreSQL client library.

 

Please install libpq or postgresql client package like so:

  brew install libpq

 

or try again with:

  gem install pg -- --with-pg-config=/path/to/pg_config

 

or set library paths manually with:

gem install pg -- --with-pg-include=/path/to/libpq-fe.h/

--with-pg-lib=/path/to/libpq.so/

 

*** extconf.rb failed ***

Could not create Makefile due to some reason, probably lack of necessary

libraries and/or headers.  Check the mkmf.log file for more details.  You may

need configuration options.

 

Provided configuration options:

--with-opt-dir

--without-opt-dir

--with-opt-include

--without-opt-include=${opt-dir}/include

--with-opt-lib

--without-opt-lib=${opt-dir}/lib

--with-make-prog

--without-make-prog

--srcdir=.

--curdir

--ruby=/Users/user/.rbenv/versions/2.6.3/bin/$(RUBY_BASE_NAME)

--with-pg

--without-pg

--enable-gvl-unlock

--disable-gvl-unlock

--enable-windows-cross

--disable-windows-cross

--with-pg-config

--without-pg-config

--with-pg_config

--without-pg_config

--with-libpq-config

--without-libpq-config

--with-pkg-config

--without-pkg-config

--with-pg-dir

--without-pg-dir

--with-pg-include

--without-pg-include=${pg-dir}/include

--with-pg-lib

--without-pg-lib=${pg-dir}/lib

 

To see why this extension failed to compile, please check the mkmf.log which can

be found here:

 

/Users/user/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-20/2.6.0/pg-1.3.5/mkmf.log

 

extconf failed, exit code 1

 

Gem files will remain installed in

/Users/user/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/pg-1.3.5 for

inspection.

Results logged to

/Users/user/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-20/2.6.0/pg-1.3.5/gem_make.out

 

An error occurred while installing pg (1.3.5), and Bundler cannot

continue.

Make sure that `gem install pg -v '1.3.5' --source 'https://rubygems.org/'`

succeeds before bundling.

 

In Gemfile:

  pg

user@MacBookPro shuwasystem-rails-heroku % bundle install --without production

Fetching gem metadata from https://rubygems.org/..........

Your bundle is locked to mimemagic (0.3.3), but that version could not be found

in any of the sources listed in your Gemfile. If you haven't changed sources,

that means the author of mimemagic (0.3.3) has removed it. You'll need to update

your bundle to a version other than mimemagic (0.3.3) that hasn't been removed

in order to install.

user@MacBookPro shuwasystem-rails-heroku % bundle install --without production

Fetching gem metadata from https://rubygems.org/..........

Your bundle is locked to mimemagic (0.3.3), but that version could not be found

in any of the sources listed in your Gemfile. If you haven't changed sources,

that means the author of mimemagic (0.3.3) has removed it. You'll need to update

your bundle to a version other than mimemagic (0.3.3) that hasn't been removed

in order to install.

 

更にこちらの神記事のおかげで

インストール成功(つД`)ノ

qiita.com

 

コマンド実行

「bundle install --without production」

bundle update

 

Bundleのインストールができました。

「Bundle complete! 18 Gemfile dependencies, 80 gems now installed.

Gems in the group production were not installed.

Use `bundle info [gemname]` to see where a bundled gem is installed.」

 

やっとRailsのサンプルプログラムが動くようになりました!!

 

プログラミングと関係ない話ですが、

卍でプログラムが動いた時は嬉しいです(つД`)ノ

 

参考記事を公開して下さった方々には感謝!!

bundle installする際のtzinfo-dataのwarningがウザい - Qiita

【Rails】An error occurred while installing pg (1.1.4), and Bundler cannot continue.時の対処法 - Qiita

 

フレームワークは初見なんですが、

卍で検索ゲーですね(つД`)ノ

 

 

 

 

 

 

DAY1

DAY1、プログラミング学習の振り返り

 

各論

①なぜ、プログラミングを学習するのか

②学習教材

③勉強方法

④今日学習したこと

⑤明日学習すること

 

各論詳細

①なぜ、プログラミングを学習をするのか

→自分でサービスを作ってみたい(^_^;)

→何となく、プログラミングができると、

自分で考えて行動できるようになる気がする(^_^;)

 

②学習教材

→知識ゼロからのWebアプリ開発入門

→本が小さくてページ数が少なくて良いσ(^_^;)

→広く浅く学べる(^_^;)

 

③勉強方法

→書いてあるコードを手を動かして写径

→写径したコードは何時でも使いまわせる様に保存

→何を学習したか忘れない様に写径した章をKeepにメモ

→学習が終わったらKeepのメモをはてなにまとめる

 

④今日、学習したこと

AWSを登録

AWSアカウントを作成

→Cloud9を登録

→Cloud9にRailsをインストール

 

Rubyプログラムを実行

→putsメソッドを使う

→.rbファイルを作成

→putsメソッドを記述、.rbファイルを保存

→ターミナル、.rbを実行

 

・変数の使い方

→変数に文字列を代入

→変数に数値を代入

→変数の上書き

 

・配列とハッシュデータの使い方

→配列にデータを代入

→ハッシュを使ってデータを代入

 

・if文の使い方

→if文の使い方

→if〜else文の使い方

→if〜elseif文の使い方

 

⑤明日、勉強すること

irbの使い方

Ruby on Railsの概要

Ruby on Railsの実践

Railsのレイアウト構成

 

明日もがんばる(^_^;)