LoginSignup
4
8

More than 5 years have passed since last update.

Ruby on Rails gem辞典

Posted at

gemとは???

gemとはRubyのライブラリであり、自力で開発すれば一朝一夕にはいかない複雑な機能を他の開発者がパッケージ化したものである。さらに、Railsアプリケーション開発の際にも使用可能だ。例えば、ユーザー認証機能を自力で開発するとなれば、膨大な時間と開発コストを要し、精神が決壊してしまうだろう。さらに上司やクライアントに棒グラフやWEB巡回機能、Twitterとの連携機能を自力で作ってと言われたら毎晩ストレスで酩酊状態となること必至だ。gemとはいわばそういった車輪の再発明を防ぐためにある。gemの導入によってあなたのRailsプロジェクトにおける開発効率は飛躍的に高まるはずだ。

使用方法

使用方法は簡単だ。Railsアプリケーションを作成するとGemfileというファイルが作成される。Gemfileとは
bundlerというgemを管理するためのシステムに向けて作られたファイルのことである。最初からRails標準gemがインストールされているため、その下に

gem 'gem名'

などと記載してコマンドにて

bundle install

と打てば終了だ。gemそれぞれで取り扱い方法が異なるため、詳しくは参考文献を検索して頂きたい。

Gem辞典

管理、権限機能

==== Active Admin

簡単に管理画面のCRUD機能や権限管理機能を作ることができる

GitHub: https://github.com/activeadmin/activeadmin

==== Administrate

管理画面をシンプルに作ってくれる。カスタマイズしやすい

GitHub: https://github.com/thoughtbot/administrate

==== Pundit

認証システム。アクセス権を設定する権限管理の責務がモデル寄りに集約される

GitHub: https://github.com/varvet/pundit

==== Rails_admin

簡単に管理画面のCRUD機能や権限管理機能を作ることができる。カスタマイズはActive
Adminより難しい

GitHub: https://github.com/sferik/rails_admin

==== Rolify

Userの権限を管理したいときに使う

GitHub: https://github.com/RolifyCommunity/rolify

データベース、Active Record

==== Activerecord-import

DBに複数レコードを簡単に挿入することができる

GitHub: https://github.com/zdennis/activerecord-import

==== Activerecord-simple_index_name

active record標準のindex名をシンプルにしてくれるgem

GitHub: https://github.com/sue445/activerecord-simple_index_name

==== Annotate

データベーススキーマの情報をmodelの上部に見やすくコメントしてくれる

GitHub: https://github.com/ctran/annotate_models

==== Audited-activerecord

DBの変更を監査する

GitHub: https://github.com/collectiveidea/audited

==== Bullet

クエリがデータ数より多く発行されてしまうN+1問題を検知してくれる

GitHub: https://github.com/flyerhzm/bullet

==== Closure_tree

データベースで階層構造を実現する際に用いる

GitHub: https://github.com/ClosureTree/closure_tree

==== By_star

レコードをある期間内に絞り込んだり集計した情報を絞り込んだりすることが出来る

GitHub: https://github.com/radar/by_star

==== Database_rewinder

テストの際にデータベースのデータを綺麗に削除してくれる

GitHub: https://github.com/amatsuda/database_rewinder

==== Deep_cloneable

Active recordのオブジェクトをモデルに関連したモデルも含めてクローンしてくれる便利な
Gem

GitHub: https://github.com/moiristo/deep_cloneable

==== PaperTrail

モデルの更新や削除などの変更をログとしてデータに残してくれる

GitHub: https://github.com/paper-trail-gem/paper_trail

==== Paranoia

DBの論理削除を行う際に使うgem

GitHub: https://github.com/rubysherpas/paranoia

==== Ridgepole

DBのスキーマに変更を加える際、通常はmigrationファイルを作らなければいけないが、
ridgepoleを使うことによりスキーマファイルを直接いじって変更できる

GitHub: https://github.com/winebarrel/ridgepole

==== Seed_dump

DBに入っている実際のデータからseedファイルを生成したい場合に用いる

GitHub: https://github.com/rroblak/seed_dump

View

==== Acts-as-taggable-on

railsアプリケーション内でタグ付け機能を実装したいときに使う

GitHub: https://github.com/mbleigh/acts-as-taggable-on

==== Carrierwave

フォームなどで画像などのファイルアップロード機能を作ることができる

GitHub: https://github.com/carrierwaveuploader/carrierwave

==== I18n_generator

Viewの表示言語を切り替えるためのlocaleファイルを生成する

GitHub: https://github.com/rulefinancial/i18n_generator

==== Simple_form

実装が簡単でシンプルにフォームを作ることができる

GitHub: https://github.com/plataformatec/simple_form

==== Lightbox2

手軽に画像の拡大表示(モーダル)やスライドショー機能を作ることが出来る

GitHub: https://github.com/gavinkflam/lightbox2-rails

==== Paperclip

フォームなどで画像などのファイルアップロード機能を作ることができる。Carrierwaveより
もシンプル

GitHub: https://github.com/thoughtbot/paperclip

==== PgSearch

Formなどで検索機能を簡単に実装できる

GitHub: https://github.com/Casecommons/pg_search

==== Ranked-model

Viewのデータの並び順をドラッグアンドドロップで変更できる機能を実装したい場合に用い

GitHub: https://github.com/mixonic/ranked-model

==== Ransack

検索APIの導入。検索フォームを簡単に実装することができる

GitHub: https://github.com/activerecord-hackery/ransack

==== RMagick

Railsで画像を加工する際に便利

GitHub: https://github.com/rmagick

==== Slim

Rails標準HTMLテンプレートエンジンERBに変わり記述がシンプルなslimテンプレートを使う
ことができる

GitHub: https://github.com/slim-template/slim-rails

==== Wicked PDF

HTMLをPDFファイルとして生成することができる。実装が簡単

GitHub: https://github.com/mileszs/wicked_pdf

デバッグ

==== Airbrake

エラーの詳細情報を管理できたり、メールを送ってくれる

GitHub: https://github.com/airbrake/airbrake

==== Better_errors

railsのエラー画面をよりリッチにし、開発効率を上げるためのgem

GitHub: https://github.com/BetterErrors/better_errors

==== Binding_of_caller

better_errorsで導入したエラー画面にirbを追加できる。エラー画面でコードを変更するこ
ともできる

GitHub: https://github.com/banister/binding_of_caller

==== Byebug(デフォルト)

デバッグ用の標準gem。ソースコードにbyebugと書くことでシェルを起動し、byebugと書
いたところで処理が止まる

GitHub: https://github.com/deivid-rodriguez/byebug

==== Exception Notification

Railsで発生したエラーをメールに送ってくれる。また、slack APIなどを用いてチャットに
エラーを送ることも可能

GitHub: https://github.com/smartinez87/exception_notification

==== Pre-commit

Git commitをする前に、デバッグに使うコードや規約違反のコードがあったらコミットを中止
する

GitHub: https://github.com/pre-commit/pre-commit

==== Pry-byebug

Pryでデバッグするときに使う。ソースコードにbinding.pryと書くことでシェルを起動し、書
いたところで処理が止まる

GitHub: https://github.com/deivid-rodriguez/pry-byebug

==== Quiet Assets

開発環境のログからstylesheetsなどのassetsを除外してくれる

GitHub: https://github.com/evrone/quiet_assets

外部システム連携

==== Google-analytics

RailsでGoogle Analyticsを利用したいときに使う

GitHub: https://github.com/bgarret/google-analytics-rails

==== Google_drive

RubyからGoogle DriveのOAuth認証を通ってspreadsheet へアクセスできる

GitHub: https://github.com/gimite/google-drive-ruby

==== Slack-notifier

Railsアプリケーション内でSlack APIを使用してメッセージなどを送る際に用いる

GitHub: https://github.com/stevenosloan/slack-notifier

==== ThinReports

PDF形式の帳票を生成する帳票開発用のソフトウェアをアプリケーションに取り込める

GitHub: https://github.com/thinreports

クローリング、スクレイピング

==== Anemone

Webクローラーフレームワーク。指定したサイトを巡回してくれる

GitHub: https://github.com/chriskite/anemone

==== Mechanize

Webページにアクセスするなどのスクレイピングをしてくれるgem

GitHub: https://github.com/sparklemotion/mechanize

==== Nokogiri

Webスクレイピング用のgemでhtml、xmlファイルを解析し特定のデータを抽出できる

GitHub: https://github.com/sparklemotion/nokogiri

認証機能

==== Authlogic

Deviseよりシンプルな認証機能作成gem

GitHub: https://github.com/binarylogic/authlogic

==== Devise

ログイン認証機能を簡単に実装できる

GitHub: https://github.com/plataformatec/devise

==== Omniauth

ログイン認証をtwitterやfacebookで行うことが出来る

GitHub: https://github.com/omniauth/omniauth

==== Sorcery

ログイン認証機能用のgemでDeviseよりもカスタマイズ性に富む

GitHub: https://github.com/Sorcery/sorcery

API機能

==== Apipie

APIドキュメントを生成するツール

GitHub: https://github.com/Apipie/apipie-rails

==== Autodoc

APIテスト実装時にAPIドキュメントを生成してくれる

GitHub: https://github.com/r7kamura/autodoc

==== Grape

RESTfulなAPIが簡単に作成できる

GitHub: https://github.com/ruby-grape/grape

CSS、JS

==== Chart-js

棒グラフやレーダーチャートなどを実装する際に使用する

GitHub: https://github.com/coderbydesign/chart-js-rails

==== Chartkick

Javascriptにてグラフ描画機能を生成。実装が簡単

GitHub: https://github.com/ankane/chartkick

==== Gon

Railsからjavascriptにデータを渡したいときに重宝する

GitHub: https://github.com/gazay/gon

コンソール

==== Awesome Print

コンソールの出力データに色とインデントをつけて見やすくすることが出来る

GitHub: https://github.com/awesome-print/awesome_print

==== Hirb

Railsコンソールにてモデルデータを見ようとすると通常は配列形式だが、hirbを使うことに
より表形式で出力できる

GitHub: https://github.com/cldwalker/hirb

==== Pry

irbの代わりとなるRubyist必須の開発コンソール。コマンドが使える

GitHub: https://github.com/pry/pry

セキュリティ

==== Brakeman

セキュリティに重点を置いてソースコードの静的解析をしてくれる

GitHub: https://github.com/presidentbeef/brakeman

==== Rack Attack

同一IPから大量アクセス、DDoS攻撃などを防いだり、特定のIPアドレスのみ通過を許可するなどのセキュリティ面に対して有効なgem

GitHub: https://github.com/kickstarter/rack-attack

==== Rack SSL Enforcer

強制的にSSL通信をさせる

GitHub: https://github.com/tobmatth/rack-ssl-enforcer

==== Secure Headers

XSS脆弱性などを妨げるためのセキュリティ用ヘッダをまとめて適用するためのgem

GitHub: https://github.com/twitter/secure_headers

Gemfile

==== Bundle_outdated

Gemfileの中のgemで新しいバージョンが存在するものを表示してくれる

GitHub: https://github.com/scoop/bundle_outdated

==== Bundler-audit

Gemfile内の脆弱性を含むgemを検知してくれる

GitHub: https://github.com/rubysec/bundler-audit

デプロイ

==== Capistrano

Railsアプリケーションをデプロイする際に使うgem

GitHub: https://github.com/capistrano/capistrano

テスト

==== Cucumber

日本語で記述できるテスティングフレームワークの一種

GitHub: https://github.com/cucumber/cucumber-rails

==== Email-spec

railsでメール送信周りのテストを記述したい場合に使う

GitHub: https://github.com/email-spec/email-spec

==== Factory_bot

テスト用にActiveRecordのModelを手軽に生成できる

GitHub: https://github.com/thoughtbot/factory_bot

==== Faker

テストデータをより一般的な形で生成してくれる。生成可能データはURLや氏名、住所な
ど多岐にわたる

GitHub: https://github.com/stympy/faker

==== Letter Opener

メール送信がされた際にメール送信の代わりにブラウザでメールを閲覧することができる。
メール送信テストが易しくなる

GitHub: https://github.com/ryanb/letter_opener

==== Mailcatcher

メール送信テストの際に、開発用SMTPサーバー経由でメールをチェックすることができる
gem。Webサーバーが一緒に立ち上がり1080番ポートにてメールを確認できる

GitHub: https://github.com/sj26/mailcatcher

==== Parallel_tests

テストを並列で分散実行させるgem

GitHub: https://github.com/grosser/parallel_tests

==== RSpec

テスト用ドメイン特化言語RSpecを書くためのgem

GitHub: https://github.com/rspec/rspec-rails

==== RSpec-retry

不安定なテストをリトライさせるためのgem

GitHub: https://github.com/NoRedInk/rspec-retry

==== Simplecov

RSpecで書いたコード全体のうち、テストのカバレッジを可視化してくれる

GitHub: https://github.com/colszowka/simplecov

==== Spork

RSpecの実行時間を早くしてくれる

GitHub: https://github.com/sporkrb/spork-rails

==== VCR

過去のテストで作ったHTTPリクエストを記録して、その後保存したものをレスポンスとして
返す。特に外部APIを用いたテストの時に便利

GitHub: https://github.com/vcr/vcr

非同期処理

==== Delayed_job_active_record

Railsにてバックグラウンドで非同期処理を行う際に使うgem

GitHub: https://github.com/collectiveidea/delayed_job_active_record

==== Nprogress

Turbolinksでのページ遷移時にプログレスバーを表示させる

GitHub: https://github.com/caarlos0-graveyard/nprogress-rails

==== Sidekiq

非同期処理を実装する際に用いる

GitHub: https://github.com/mperham/sidekiq

Presenter

==== Draper

Model,View間のプレゼンテーション層で使うgem。viewからロジックを無くしたい時など
に使うと保守性が高まる

GitHub: https://github.com/drapergem/draper

Routes

==== Friendly_id

URLをフレンドリーなものに変えてくれる。例えば、
https://sample.com/users/3
https://sample.com/users/tom-daven に変えてくれる

GitHub: https://github.com/norman/friendly_id

データ加工

==== GeoCoder

住所の文字列から緯度経度を導きだしたり、逆に緯度経度から住所を割り出したりできる
gem。Google Mapsと連携して使うと便利

GitHub: https://github.com/homelight/ruby-geocoder

==== Holiday_jp

日本の祝日データを取得する際に用いる

GitHub: https://github.com/holiday-jp/holiday_jp-ruby

==== Money

複数の通貨を扱う時の金額計算や通貨変換に便利

GitHub: https://github.com/RubyMoney/money-rails

==== Rinku

Rails内でURL文字列に自動でリンクをつけてくれる

GitHub: https://github.com/vmg/rinku

==== Timecop

時間を操作することができる。特にテストを行う際に便利

GitHub: https://github.com/travisjeffery/timecop

ソースコード解析

==== Did_you_mean

変数名やクラス名を間違えた際に、正しい名前をサジェストしてくれる

GitHub: https://github.com/yuki24/did_you_mean

==== Peek / peek-rblineprof

ソースコードの1行1行の実行時間を測定してくれる

GitHub: https://github.com/peek/peek-rblineprof

==== RuboCop

ソースコードを解析してくれる。コーディングルールに準拠させることが出来るため、特に
チーム開発の際に役立つ

GitHub: https://github.com/rubocop-hq/rubocop

==== Onkcop

RuboCopを設定するためのgem

GitHub: https://github.com/onk/onkcop

==== Rufo

Rubyフォーマッターであり、設定が容易で高速に動作してくれる

GitHub: https://github.com/ruby-formatter/rufo

==== RubyCritic

ソースコードの問題箇所を解析してくれる

GitHub: https://github.com/whitesmith/rubycritic

ブラウザ

==== Rack-dev-mark

Railsで本番環境と開発環境を一目で把握するためのgem。ブラウザで視覚的に表示して
くれる

GitHub: https://github.com/dtaniwaki/rack-dev-mark

==== Rack-mini-profiler

Webサーバーを起動するとブラウザの左上に処理時間などの詳細な情報を表示してくれ

GitHub: https://github.com/MiniProfiler/rack-mini-profiler

==== Rails Panel

chromeのデベロッパーツールにてRailsアプリに関する情報を確認できる拡張機能を提供
する

GitHub: https://github.com/dejan/rails_panel

==== Turnout

Railsアプリを簡単にメンテナンスモードに入れることが出来る

GitHub: https://github.com/biola/turnout

==== Web-console(デフォルト)

ブラウザ上でコンソールを開くことが出来る

GitHub: https://github.com/rails/web-console

==== Xray

ブラウザ上で要素がどこのViewから来ているのか可視化出来る

GitHub: https://github.com/brentd/xray-rails

メール

==== Premailer

HTMLメールにCSSを当て込むことが出来る

GitHub: https://github.com/fphilipe/premailer-rails

==== Roadie

RailsでHTMLメールを生成する際に使う

GitHub: https://github.com/Mange/roadie

その他

==== Houston

RailsアプリからiOSにプッシュ通知を送りたいときに使うgem

GitHub: https://github.com/nomad/houston

==== Retryable

リクエストが失敗した際、リトライの繰り返しや例外処理などを簡単に記述できる

GitHub: https://github.com/nfedyashev/retryable

==== Whenever

Rakeタスクなどのスケジュールを定時実行処理する際に必要なgem

GitHub: https://github.com/javan/whenever

4
8
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
4
8