moduleBundlerclassDslError<StandardError;endclassDsldefself.evaluate(gemfile)builder=newbuilder.instance_eval(File.read(gemfile.to_s),gemfile.to_s,1)builder.to_definitionenddefinitialize@source=nil@sources=[]@dependencies=[]@group=[:default]enddefgem(name,*args)options=Hash===args.last?args.pop:{}version=args.last||">= 0"ifgroup=options[:groups]||options[:group]options[:group]=groupend_deprecated_options(options)_normalize_options(name,version,options)@dependencies<<Dependency.new(name,version,options)enddefsource(source,options={})@source=casesourcewhen:gemcutter,:rubygems,:rubyforgethenSource::Rubygems.new("uri"=>"http://gemcutter.org")whenStringthenSource::Rubygems.new("uri"=>source)elsesourceendoptions[:prepend]?@sources.unshift(@source):@sources<<@sourceyieldifblock_given?@sourceensure@source=nilenddefpath(path,options={},source_options={},&blk)sourceSource::Path.new(_normalize_hash(options).merge("path"=>Pathname.new(path))),source_options,&blkenddefgit(uri,options={},source_options={},&blk)sourceSource::Git.new(_normalize_hash(options).merge("uri"=>uri)),source_options,&blkenddefto_definitionDefinition.new(@dependencies,@sources)enddefgroup(*args,&blk)old,@group=@group,argsyieldensure@group=oldend# Deprecated methodsdefself.deprecate(name,replacement=nil)define_method(name)do|*|message="'#{name}' has been removed from the Gemfile DSL, "ifreplacementmessage<<"and has been replaced with '#{replacement}'."elsemessage<<"and is no longer supported."endmessage<<"\nSee the README for more information on upgrading from Bundler 0.8."raiseDeprecatedMethod,messageendenddeprecate:only,:groupdeprecate:exceptdeprecate:disable_system_gemsdeprecate:disable_rubygemsdeprecate:clear_sourcesdeprecate:bundle_pathdeprecate:bin_pathprivatedef_version?(version)version&&Gem::Version.new(version)rescuefalseenddef_normalize_hash(opts)# Cannot modify a hash during an iteration in 1.9opts.keys.eachdo|k|nextifString===kv=opts[k]opts.delete(k)opts[k.to_s]=vendoptsenddef_normalize_options(name,version,opts)_normalize_hash(opts)invalid_keys=opts.keys-%w(group git path name branch ref tag require)ifinvalid_keys.any?plural=invalid_keys.size>1message="You passed #{invalid_keys.map{|k|':'+k}.join(",")} "ifpluralmessage<<"as options for gem '#{name}', but they are invalid."elsemessage<<"as an option for gem '#{name}', but it is invalid."endraiseInvalidOption,messageendgroup=opts.delete("group")||@group# Normalize git and path options["git","path"].eachdo|type|ifparam=opts[type]options=_version?(version)?opts.merge("name"=>name,"version"=>version):opts.dupsource=send(type,param,options,:prepend=>true)opts["source"]=sourceendendopts["source"]||=@sourceopts["group"]=groupenddef_deprecated_options(options)ifoptions.include?(:require_as)raiseDeprecatedOption,"Please replace :require_as with :require"elsifoptions.include?(:vendored_at)raiseDeprecatedOption,"Please replace :vendored_at with :path"elsifoptions.include?(:only)raiseDeprecatedOption,"Please replace :only with :group"elsifoptions.include?(:except)raiseDeprecatedOption,"The :except option is no longer supported"endendendend