14
15

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.

*.gemspecで追加した依存gemのrequireをGemfileで指定する

Last updated at Posted at 2012-03-16
  • Bundlerは*.gemspecで定義された依存gemを読み込むことができる
  • gemの中にはgem名とrequireするときの名前が違うものがある
  • Gemfileでrequireするときの別名を指定することができる

*.gemspecで定義した依存gemを読み込むときの別名をGemfileで指定することができます。

*.gemspec
Gem::Specification.new do |s|
  # ...
  s.add_development_dependency "activemodel"
  # ...
end
Gemfile
source :rubygems
gemspec # load from *.gemspec

group :development do
  # *.gemspecでdevelopment dependencyとして定義されたgemは
  # Bundlerの:development groupに属する
  gem 'activemodel', require: 'active_model'
end

*.gemspecで適切に依存gemをグループ分けするとたいへんべんりでよいです。

14
15
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
14
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?