Skip to content

Instantly share code, notes, and snippets.

@Codcore
Created August 30, 2018 17:32
Show Gist options
  • Save Codcore/f2aee8b0c314862c0b19b49438ff8976 to your computer and use it in GitHub Desktop.
Save Codcore/f2aee8b0c314862c0b19b49438ff8976 to your computer and use it in GitHub Desktop.
Bundler internals
2.5.1 :002 > require 'bundler'
2.5.1 :005 > definition = Bundler::Definition.build("Gemfile", nil, nil)
=> #<Bundler::Definition:0x000055ad3a1f8c08 @unlocking_bundler=nil, @unlocking=false, @dependencies=[<Bundler::Dependency type=:runtime name="bundler-whatsup" requirements=">= 0">, <Bundler::Dependency type=:development name="bundler" requirements="~> 1.16">, <Bundler::Dependency type=:development name="rake" requirements="~> 10.0">, <Bundler::Dependency type=:development name="rspec" requirements="~> 3.0">, <Bundler::Dependency type=:development name="cucumber" requirements=">= 0">, <Bundler::Dependency type=:development name="aruba" requirements=">= 0">, <Bundler::Dependency type=:development name="simplecov" requirements=">= 0">, <Bundler::Dependency type=:development name="json" requirements=">= 0">], @sources=#<Bundler::SourceList:0x000055ad3a1b39c8 @path_sources=[#<Bundler::Source::Gemspec:0x47101246656020 source at `.`>], @git_sources=[], @plugin_sources=[], @global_rubygems_source=nil, @rubygems_aggregate=#<Bundler::Source::Rubygems:0x47101246282900 rubygems repository https://rubygems.org/ or installed locally>, @rubygems_sources=[], @metadata_source=#<Bundler::Source::Metadata:0x47101246281000 the local ruby installation>>, @unlock={:gems=>[], :sources=>[], :ruby=>false}, @optional_groups=[], @remote=false, @specs=nil, @ruby_version=nil, @gemfiles=[#<Pathname:/home/rails/projects/bundler-whatsup/Gemfile>], @lockfile=nil, @lockfile_contents="", @locked_bundler_version=nil, @locked_ruby_version=nil, @locked_specs_incomplete_for_platform=false, @platforms=["ruby"], @locked_gems=nil, @locked_deps={}, @locked_specs=#<Bundler::SpecSet:0x000055ad3a1f8aa0 @specs=[], @sorted=[], @lookup={"bundler"=>[]}>, @locked_sources=[], @locked_platforms=[], @new_platform=true, @path_changes=true, @source_changes=true, @gem_version_promoter=#<Bundler::GemVersionPromoter:0x000055ad3a289910 @level=:major, @strict=false, @locked_specs=#<Bundler::SpecSet:0x000055ad3a1f8aa0 @specs=[], @sorted=[], @lookup={"bundler"=>[]}>, @unlock_gems=[], @sort_versions={}>, @dependency_changes=true, @local_changes=false, @requires={"bundler-whatsup"=>["bundler-whatsup"], "bundler"=>["bundler"], "rake"=>["rake"], "rspec"=>["rspec"], "cucumber"=>["cucumber"], "aruba"=>["aruba"], "simplecov"=>["simplecov"], "json"=>["json"]}>
2.5.1 :006 > runtime = Bundler::Runtime.new("./projects/bundler-whatsup/", definition)
=> #<Bundler::Runtime:0x000055ad3a346588 @root="./projects/bundler-whatsup/", @definition=#<Bundler::Definition:0x000055ad3a1f8c08 @unlocking_bundler=nil, @unlocking=false, @dependencies=[<Bundler::Dependency type=:runtime name="bundler-whatsup" requirements=">= 0">, <Bundler::Dependency type=:development name="bundler" requirements="~> 1.16">, <Bundler::Dependency type=:development name="rake" requirements="~> 10.0">, <Bundler::Dependency type=:development name="rspec" requirements="~> 3.0">, <Bundler::Dependency type=:development name="cucumber" requirements=">= 0">, <Bundler::Dependency type=:development name="aruba" requirements=">= 0">, <Bundler::Dependency type=:development name="simplecov" requirements=">= 0">, <Bundler::Dependency type=:development name="json" requirements=">= 0">], @sources=#<Bundler::SourceList:0x000055ad3a1b39c8 @path_sources=[#<Bundler::Source::Gemspec:0x47101246656020 source at `.`>], @git_sources=[], @plugin_sources=[], @global_rubygems_source=nil, @rubygems_aggregate=#<Bundler::Source::Rubygems:0x47101246282900 rubygems repository https://rubygems.org/ or installed locally>, @rubygems_sources=[], @metadata_source=#<Bundler::Source::Metadata:0x47101246281000 the local ruby installation>>, @unlock={:gems=>[], :sources=>[], :ruby=>false}, @optional_groups=[], @remote=false, @specs=nil, @ruby_version=nil, @gemfiles=[#<Pathname:/home/rails/projects/bundler-whatsup/Gemfile>], @lockfile=nil, @lockfile_contents="", @locked_bundler_version=nil, @locked_ruby_version=nil, @locked_specs_incomplete_for_platform=false, @platforms=["ruby"], @locked_gems=nil, @locked_deps={}, @locked_specs=#<Bundler::SpecSet:0x000055ad3a1f8aa0 @specs=[], @sorted=[], @lookup={"bundler"=>[]}>, @locked_sources=[], @locked_platforms=[], @new_platform=true, @path_changes=true, @source_changes=true, @gem_version_promoter=#<Bundler::GemVersionPromoter:0x000055ad3a289910 @level=:major, @strict=false, @locked_specs=#<Bundler::SpecSet:0x000055ad3a1f8aa0 @specs=[], @sorted=[], @lookup={"bundler"=>[]}>, @unlock_gems=[], @sort_versions={}>, @dependency_changes=true, @local_changes=false, @requires={"bundler-whatsup"=>["bundler-whatsup"], "bundler"=>["bundler"], "rake"=>["rake"], "rspec"=>["rspec"], "cucumber"=>["cucumber"], "aruba"=>["aruba"], "simplecov"=>["simplecov"], "json"=>["json"]}>>
2.5.1 :007 > runtime.dependencies.each do |dep|
2.5.1 :008 > p dep
2.5.1 :009?> puts "\n"
2.5.1 :010?> end
<Bundler::Dependency type=:runtime name="bundler-whatsup" requirements=">= 0">
<Bundler::Dependency type=:development name="bundler" requirements="~> 1.16">
<Bundler::Dependency type=:development name="rake" requirements="~> 10.0">
<Bundler::Dependency type=:development name="rspec" requirements="~> 3.0">
<Bundler::Dependency type=:development name="cucumber" requirements=">= 0">
<Bundler::Dependency type=:development name="aruba" requirements=">= 0">
<Bundler::Dependency type=:development name="simplecov" requirements=">= 0">
<Bundler::Dependency type=:development name="json" requirements=">= 0">
=> [<Bundler::Dependency type=:runtime name="bundler-whatsup" requirements=">= 0">, <Bundler::Dependency type=:development name="bundler" requirements="~> 1.16">, <Bundler::Dependency type=:development name="rake" requirements="~> 10.0">, <Bundler::Dependency type=:development name="rspec" requirements="~> 3.0">, <Bundler::Dependency type=:development name="cucumber" requirements=">= 0">, <Bundler::Dependency type=:development name="aruba" requirements=">= 0">, <Bundler::Dependency type=:development name="simplecov" requirements=">= 0">, <Bundler::Dependency type=:development name="json" requirements=">= 0">]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment