Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
[Inline] Add YARD comments to gemfile
Browse files Browse the repository at this point in the history
  • Loading branch information
segiddins committed Mar 19, 2015
1 parent edefb43 commit 508ec74
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions lib/bundler/inline.rb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -7,7 +36,7 @@ def Bundler.root
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!
Expand Down

0 comments on commit 508ec74

Please sign in to comment.