LoginSignup
8
8

More than 5 years have passed since last update.

rubyのGemfileとbundlerの使い方メモ

Posted at

rubyで作っているツールを配布しようと思ったんだけど、依存しているgemとか配布するためにGemfileなるものを使わないといけなかったので、そのメモ。

proxy経由でbundlerインストール。

$ gem install bundler --http-proxy=http://***:**

使いたいツールのディレクトリにいって、bundle initで初期テンプレートをつくる。

$ cd /usr/local/path/to/splunk-manager
$ bundle init
Writing new Gemfile to /usr/local/path/to/splunk-manager/Gemfile

Gemfileに必要なgemを記入(今回はversion指定しない)

$ vi Gemfile

# A sample Gemfile
source "https://rubygems.org"
gem 'splunk-sdk-ruby'
gem 'sqlite3'

# gem "rails"

proxyを指定してbundle install

$ export http_proxy=http://***:***
$ bundle install
Fetching gem metadata from https://rubygems.org/..........

入っていることを確認

$ gem list

*** LOCAL GEMS ***

bundler (1.6.3)
minitest (1.6.0)
rake (10.3.2, 0.8.7)
rdoc (2.5.8)
splunk-sdk-ruby (1.0.3)
sqlite3 (1.3.9)

このGemfileをgitに上げとけば良いのか

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