diff options
author | Samuel E. Giddins <segiddins@segiddins.me> | 2015-03-18 23:01:47 -0700 |
---|---|---|
committer | Samuel E. Giddins <segiddins@segiddins.me> | 2015-03-18 23:01:47 -0700 |
commit | 508ec7441dfa0740c2d44fe851fd2279961aee4f (patch) | |
tree | f9000aab453958595347a5f5c9bd7920549a506c | |
parent | edefb43b6532dda1dbf3050b859bc91b5ad9f67f (diff) | |
download | bundler-508ec7441dfa0740c2d44fe851fd2279961aee4f.tar.gz |
[Inline] Add YARD comments to gemfile
-rw-r--r-- | lib/bundler/inline.rb | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb index 427ee619ab..b38a925df2 100644 --- a/lib/bundler/inline.rb +++ b/lib/bundler/inline.rb @@ -1,4 +1,33 @@ -def gemfile(install = false, &blk) +# Allows for declaring a Gemfile inline in a ruby script, optionally installing +# any gems that aren't already installed on the user's system. +# +# @note Every gem that is specified in this 'Gemfile' will be `require`d, as if +# the user had manually called `Bundler.require`. To avoid a requested gem +# being automatically required, add the `:require => false` option to the +# `gem` dependency declaration. +# +# @param install [Boolean] whether gems that aren't already installed on the +# user's system should be installed. +# Defaults to `false`. +# +# @param gemfile [Proc] a block that is evaluated as a `Gemfile`. +# +# @example Using an inline Gemfile +# +# #!/usr/bin/env ruby +# +# require 'bundler/inline' +# +# gemfile do +# source 'https://rubygems.org' +# gem 'json', require: false +# gem 'nap', require: 'rest' +# gem 'cocoapods', '~> 0.34.1' +# end +# +# puts Pod::VERSION => "0.34.4" +# +def gemfile(install = false, &gemfile) require 'bundler' old_root = Bundler.method(:root) def Bundler.root @@ -7,7 +36,7 @@ def gemfile(install = false, &blk) ENV['BUNDLE_GEMFILE'] ||= 'Gemfile' builder = Bundler::Dsl.new - builder.instance_eval(&blk) + builder.instance_eval(&gemfile) definition = builder.to_definition(nil, true) def definition.lock(file); end definition.validate_ruby! |