[RUBY] Rails tutorial memorandum 1

environment

macOS Catalina 10.15.5 Rails 6.0.3

I'll write a Rails tutorial and a lot of it. The tutorial is compliant with the 6th edition because I want to get used to Github.

1.5.1 Setting up and deploying Heroku

List 1.18

Gemfile


source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gem 'rails',      '6.0.3'
gem 'puma',       '4.3.4'
gem 'sass-rails', '5.1.0'
gem 'webpacker',  '4.0.7'
gem 'turbolinks', '5.2.0'
gem 'jbuilder',   '2.9.1'
gem 'bootsnap',   '1.4.5', require: false

group :development, :test do
  gem 'sqlite3', '1.4.1'
  gem 'byebug',  '11.0.1', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  gem 'web-console',           '4.0.1'
  gem 'listen',                '3.1.5'
  gem 'spring',                '2.1.0'
  gem 'spring-watcher-listen', '2.0.1'
end

group :test do
  gem 'capybara',           '3.28.0'
  gem 'selenium-webdriver', '3.142.4'
  gem 'webdrivers',         '4.1.2'
end

group :production do
  gem 'pg', '1.1.4'
end

Change the description as above and execute $ bundle install --without production.

However, the following error occurred.

You have requested:
  spring = 2.1.0

The bundle currently has spring locked at 2.1.1.
Try running `bundle update spring`

If you are updating multiple gems in your Gemfile at once,
try passing them all to `bundle update`

I bundled update spring according to the error, This time an error about puma in the gemlist.

An error occurred while installing puma (4.3.4), and Bundler cannot continue.
Make sure that `gem install puma -v '4.3.4' --source 'https://rubygems.org/'` succeeds before
bundling.

Run % gem install puma -v 4.3.4.

Fetching puma-4.3.4.gem
Building native extensions. This could take a while...
ERROR:  Error installing puma:
	ERROR: Failed to build gem native extension.

    current directory: /Users/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/puma-4.3.4/ext/puma_http11
/Users/user/.rbenv/versions/2.7.0/bin/ruby -I /Users/user/.rbenv/versions/2.7.0/lib/ruby/2.7.0 -r ./siteconf20200913-23274-ktgz78.rb extconf.rb
checking for BIO_read() in -lcrypto... yes
checking for SSL_CTX_new() in -lssl... yes
checking for openssl/bio.h... yes
checking for DTLS_method() in openssl/ssl.h... yes
checking for TLS_server_method() in openssl/ssl.h... yes
checking for SSL_CTX_set_min_proto_version in openssl/ssl.h... yes
creating Makefile

current directory: /Users/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/puma-4.3.4/ext/puma_http11
make "DESTDIR=" clean

current directory: /Users/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/puma-4.3.4/ext/puma_http11
make "DESTDIR="
compiling http11_parser.c
ext/puma_http11/http11_parser.c:44:18: warning: unused variable 'puma_parser_en_main' [-Wunused-const-variable]
static const int puma_parser_en_main = 1;
                 ^
1 warning generated.
compiling io_buffer.c
compiling mini_ssl.c
mini_ssl.c:145:7: warning: unused variable 'min' [-Wunused-variable]
  int min, ssl_options;
      ^
mini_ssl.c:299:40: warning: function 'raise_error' could be declared with attribute 'noreturn' [-Wmissing-noreturn]
void raise_error(SSL* ssl, int result) {
                                       ^
2 warnings generated.
compiling puma_http11.c
puma_http11.c:203:22: error: implicitly declaring library function 'isspace' with type 'int (int)' [-Werror,-Wimplicit-function-declaration]
  while (vlen > 0 && isspace(value[vlen - 1])) vlen--;
                     ^
puma_http11.c:203:22: note: include the header <ctype.h> or explicitly provide a declaration for 'isspace'
1 error generated.
make: *** [puma_http11.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/puma-4.3.4 for inspection.
Results logged to /Users/user/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/extensions/x86_64-darwin-19/2.7.0/puma-4.3.4/gem_make.out

I did $ bundle install again, but the following loop. Even in $ gem list, it is puma 4.3.4.

As a result of various investigations, refer to the following article. https://qiita.com/aiandrox/items/9389696ebc3cc6d3422e

It seems that it was supported by puma 4.3.6, so changed the Gemfile.

Gemfile


gem 'puma',       '4.3.6'

After $ bundle update $ bundle install passed without any problem.

Recommended Posts

Rails tutorial memorandum 1
Rails tutorial memorandum 2
Rails Tutorial Memorandum (Chapter 3, 3.1)
Rails Tutorial Memorandum (Chapter 3, 3.3.2)
rails tutorial
Rails memorandum
rails tutorial
rails tutorial
rails tutorial
rails tutorial
rails tutorial
rails tutorial
Rails Tutorial Records and Memorandum # 0
rails tutorial Chapter 6
Rails tutorial test
rails tutorial Chapter 1
rails tutorial Chapter 7
rails tutorial Chapter 5
rails tutorial Chapter 10
rails tutorial Chapter 9
rails tutorial Chapter 8
Start Rails Tutorial
[Beginner] Rails Tutorial
Rails Tutorial Chapter 5 Notes
Rails Tutorial Chapter 10 Notes
Rails Tutorial Chapter 3 Notes
Rails Tutorial cheat sheet
Rails Tutorial Chapter 3 Learning
Rails version upgrade memorandum 5.0 → 5.1
[Rails] Learning with Rails tutorial
Rails Tutorial Chapter 4 Notes
Rails Tutorial Chapter 4 Learning
Rails Tutorial Chapter 1 Learning
Rails Tutorial Chapter 2 Learning
Rails Tutorial Chapter 8 Notes
rails tutorial fighting notes Ⅲ
Cloud9 is out of memory: Rails tutorial memorandum
[Rails tutorial] A memorandum of "Chapter 11 Account Activation"
11.1 AccountActivations Resources: Rails Tutorial Notes-Chapter 11
memorandum
Rails Tutorial (4th Edition) Summary
[Rails Tutorial Chapter 4] Rails-flavored Ruby
[Rails] Rails version upgrade error memorandum
[Rails] Implementation of tutorial function
memorandum
Ruby on Rails Basic Memorandum
Memorandum [Rails] User authentication Devise
[Rails Struggle/Rails Tutorial] Summary of Rails Tutorial Chapter 2
Piped together grep ?: Rails Tutorial Notes--Chapter 8
[Rails Tutorial Chapter 5] Create a layout
rails tutorial chapter 10 summary (for self-learning)
Chewing Rails Tutorial [Chapter 2 Toy Application]
Rails Tutorial (4th Edition) Memo Chapter 6
[Rails g.error]
Rails Tutorial 6th Edition Learning Summary Chapter 10
Rails basics
Rails Review 1
Rails API
Rails migration
Rails Tutorial 6th Edition Learning Summary Chapter 4
[Rails] first_or_initialize