Skip to content

Instantly share code, notes, and snippets.

@katsumata-ryo
Last active August 26, 2018 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save katsumata-ryo/463d5333c1e6c89e3cdee13a869b82bb to your computer and use it in GitHub Desktop.
Save katsumata-ryo/463d5333c1e6c89e3cdee13a869b82bb to your computer and use it in GitHub Desktop.
25PM: 2018-08-27
$ rails new <NAME>
### Gemfile のアップデート
# Gemfile
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.5.1'
gem 'rails', '~> 5.2.1'
gem 'pg'
gem 'puma', '~> 3.11'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
gem 'bootsnap', '>= 1.1.0', require: false
# html css js
gem 'haml'
gem 'haml-rails'
gem 'sass-rails', '~> 5.0'
gem 'underscore-rails'
# authentication
gem 'sorcery'
# etc
gem 'draper'
group :development, :test do
gem 'byebug'
gem 'pry-rails' # rails console(もしくは、rails c)でirbの代わりにpryを使われる
gem 'pry-doc' # methodを表示
gem 'pry-byebug' # デバッグを実施(Ruby 2.0以降で動作する)
gem 'pry-stack_explorer' # スタックをたどれる
gem 'railroady'
end
group :development do
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'better_errors'
gem 'binding_of_caller'
end
group :test do
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
gem 'chromedriver-helper'
gem "rspec"
gem "rspec_junit_formatter", '0.2.2'
gem "rspec-rails"
gem "rspec-request_describer"
gem 'simplecov', require: false
end
# ----
$ bundle install
### db設定
# config/database.yml
default: &default
adapter: postgresql
encoding: unicode
pool: 5
username: <USER_NAME>
host: localhost
development:
<<: *default
database: <SERVICENAME>_development
test:
<<: *default
database: <SERVICENAME>_test
production:
<<: *default
database: <SERVICENAME>_production
# データベースの作成と初期セットアップ
$ rake db:create
Created database 'twofivepm_development' # 自分で設定したDB名
Created database 'twofivepm_test' # 自分で設定したDB名
$ rake db:migrate
### erbからhamlへ
$ be rake haml:erb2haml
--------------------------------------------------------------------------------
Generating HAML for app/views/layouts/application.html.erb...
Generating HAML for app/views/layouts/mailer.html.erb...
Generating HAML for app/views/layouts/mailer.text.erb...
--------------------------------------------------------------------------------
HAML generated for the following files:
app/views/layouts/application.html.erb
app/views/layouts/mailer.html.erb
app/views/layouts/mailer.text.erb
--------------------------------------------------------------------------------
Would you like to delete the original .erb files? (This is not recommended unless you are under version control.) (y/n)
y
Deleting original .erb files.
--------------------------------------------------------------------------------
Task complete!
No .erb files found. Task will now exit.
### とりあえず起動確認
$ bundle install rails s
# => http://localhost:3000 でrailsの初期ページが表示されるのを確認
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment