0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

railsアプリの始め+チュートリアル1章

Last updated at Posted at 2019-07-09

これからのrailsチュートリアルの記事は、チュートリアル2週目の方やある程度基礎は覚えた人向けに、
爆速でチュートリアルを終わらせるためのものになります。

簡単な解説とコードのみでチュートリアルを終わらせることができますので、
ほぼコピペをしながら復習ができるというものになっています。(私がそういう物があれば良いと思ったので自分で作ってる)
※ちなみに私は1週目はテスト無しでとりあえず仕組みだけ覚えて、2週目からテストともう一度仕組みを覚える事を前提でやっている

では、やっていきましょうー!


※環境構築等はご自身で行ってください。リポジトリの作成から始めます。

手順
githubでリポジトリを作成する。
URLをコピーして
ubuntuで

ubuntu
git clone git@github.com~~~~~~
cd (クローンしたリポジトリ
rails _5.1.6_ new .

必要なGemを追加

Gemfile

gem 'rails',        '5.1.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.1.5'
  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',                 '5.10.3'
  gem 'minitest-reporters',       '1.1.14'
  gem 'guard',                    '2.13.0'
  gem 'guard-minitest',           '2.4.4'
end

# Windows環境ではtzinfo-dataというgemを含める必要があります
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

追加後、bundle installする

ubuntu
bundle install

# 怒られた場合,以下の順番で
bundle update
bundle install

herokuを使えるようにgemfileに

Gemfile
group :production do
  gem 'pg', '0.20.0'
end

を追加して

ubuntu
bundle install --without production

これは本番環境でのみ適用させるためのオプション

herokuのセットアップ

ubuntu
git add -A
git commit -m "heroku setup"
heroku --version
heroku login --interactive
heroku keys:add
heroku create
git push heroku master


# 名前を変えたい場合(URLに表示される所)
heroku rename ○○○
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?