-
Notifications
You must be signed in to change notification settings - Fork 0
5.2.1 パッケージ管理ツールの使い方
k2works edited this page Apr 9, 2016
·
1 revision
gem コマンド名 オプション コマンド引数
$ gem list -r mechanize
$ gem help commands
$ gem help list
$ gem install mechanize
$ gem list
$ gem search mechanize --remote
$ gem query -r --name-matches="^active*"
$ gem list mechanize
$ gem update mechanize
$ gem uninstall mechanize
$ touch .gemrc
$ echo "gem: --no-rdoc --no-ri # インストール時にrdoc,riを生成しない" >> .gemrc
$ echo ":verbose: true # 詳細メッセージの表示" >> .gemrc
$ cat .gemrc
$ gem install mechanize
$ gem install mechanize -v '2.2.1'
$ gem list mechanize
$ gem cleanup -d mechanize
$ gem list mechanize
$ gem cleanup mechanize
$ gem list mechanize
$ gem uninstall mechanize
$ cd ..
$ mkdir sandbox
$ cd sandbox
$ bundle init
Gemfile
# A sample Gemfile
source "https://rubygems.org"
gem "tapp"
$ bundle install
$ gem list
$ cat Gemfile.lock
$ bundle update
$ gem unistall tapp
$ bundle install --path vendor/bundle
$ ls vendor/bundle/ruby/2.2.0/gems/
$ gem list tapp
$ tapp
$ bundle exec tapp
test.rb
self.tapp
$ ruby test.rb
test.rb
require 'bundler'
Bundler.require
self.tapp
$ bundle list
$ bundle check
$ bundle show
$ bundle outdated
$ export EDITOR=emacs
$ bundle open tapp
$ bundle console
$ bundle console
2.2.0 :001 > "string".tapp
"string"
=> "string"
2.2.0 :002 > exit
Gemfile
source "https://rubygems.org"
gem "sinatra"
group :development do
gem 'awesome_print'
end
group :test do
gem 'rspec'
end
$ bundle install
$ bundle list
bundleの設定は.bundle/config
を使う
$ cat .bundle/config
---
BUNDLE_PATH: vendor/bundle
BUNDLE_DISABLE_SHARED_GEMS: '1'
複数グループに跨って使用したい場合の記述
group :development, :test do
gem 'pry'
end
Gemfile
# A sample Gemfile
source "https://rubygems.org"
gem "tapp"
$ rm -rf vendor
$ rm -rf ./bundler
$ bundle install --path vendor/bundle --binstubs
$ ls bin/
tapp* thor*
$ ./bin/tapp
$ cd ..
$ rm -rf sandbox
$ cd workspace/