bundler-1.11.2/0000755000004100000410000000000012652443364013270 5ustar www-datawww-databundler-1.11.2/exe/0000755000004100000410000000000012652443364014051 5ustar www-datawww-databundler-1.11.2/exe/bundler0000755000004100000410000000112212652443364015426 0ustar www-datawww-data#!/usr/bin/env ruby # Exit cleanly from an early interrupt Signal.trap("INT") { exit 1 } require "bundler" # Check if an older version of bundler is installed $LOAD_PATH.each do |path| next unless path =~ %r{/bundler-0\.(\d+)} && $1.to_i < 9 err = "Looks like you have a version of bundler that's older than 0.9.\n" err << "Please remove your old versions.\n" err << "An easy way to do this is by running `gem cleanup bundler`." abort(err) end require "bundler/friendly_errors" Bundler.with_friendly_errors do require "bundler/cli" Bundler::CLI.start(ARGV, :debug => true) end bundler-1.11.2/exe/bundle0000755000004100000410000000112212652443364015244 0ustar www-datawww-data#!/usr/bin/env ruby # Exit cleanly from an early interrupt Signal.trap("INT") { exit 1 } require "bundler" # Check if an older version of bundler is installed $LOAD_PATH.each do |path| next unless path =~ %r{/bundler-0\.(\d+)} && $1.to_i < 9 err = "Looks like you have a version of bundler that's older than 0.9.\n" err << "Please remove your old versions.\n" err << "An easy way to do this is by running `gem cleanup bundler`." abort(err) end require "bundler/friendly_errors" Bundler.with_friendly_errors do require "bundler/cli" Bundler::CLI.start(ARGV, :debug => true) end bundler-1.11.2/exe/bundle_ruby0000755000004100000410000000262012652443364016311 0ustar www-datawww-data#!/usr/bin/env ruby Signal.trap("INT") { exit 1 } require "bundler/ruby_version" require "bundler/ruby_dsl" require "bundler/shared_helpers" module Bundler class GemfileError < RuntimeError; end class GemfileEvalError < GemfileError; end class Dsl include RubyDsl attr_accessor :ruby_version def initialize @ruby_version = nil end def eval_gemfile(gemfile, contents = nil) contents ||= File.open(gemfile, "rb", &:read) instance_eval(contents, gemfile.to_s, 1) rescue SyntaxError => e bt = e.message.split("\n")[1..-1] raise GemfileError, ["Gemfile syntax error:", *bt].join("\n") rescue ScriptError, RegexpError, NameError, ArgumentError => e e.backtrace[0] = "#{e.backtrace[0]}: #{e.message} (#{e.class})" STDERR.puts e.backtrace.join("\n ") raise GemfileError, "There was an error in your Gemfile," \ " and Bundler cannot continue." end def source(source, options = {}) end def gem(name, *args) end def group(*args, &blk) end end end STDERR.puts "Warning: bundle_ruby will be deprecated in Bundler 2.0.0." dsl = Bundler::Dsl.new begin dsl.eval_gemfile(Bundler::SharedHelpers.default_gemfile) ruby_version = dsl.ruby_version if ruby_version puts ruby_version else puts "No ruby version specified" end rescue Bundler::GemfileError => e puts e.message exit(-1) end bundler-1.11.2/Rakefile0000644000004100000410000002230712652443364014741 0ustar www-datawww-data# -*- encoding: utf-8 -*- $:.unshift File.expand_path("../lib", __FILE__) require "shellwords" require "benchmark" RUBYGEMS_REPO = File.expand_path("tmp/rubygems") BUNDLER_SPEC = Gem::Specification.load("bundler.gemspec") def safe_task(&block) yield true rescue false end # Benchmark task execution module Rake class Task alias_method :real_invoke, :invoke def invoke(*args) time = Benchmark.measure(@name) do real_invoke(*args) end puts "#{@name} ran for #{time}" end end end namespace :spec do desc "Ensure spec dependencies are installed" task :deps do deps = Hash[BUNDLER_SPEC.development_dependencies.map do |d| [d.name, d.requirement.to_s] end] deps["rubocop"] ||= "= 0.35.1" if RUBY_VERSION >= "1.9.3" # can't go in the gemspec because of the ruby version requirement # JRuby can't build ronn or rdiscount, so we skip that if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby" deps.delete("ronn") deps.delete("rdiscount") end deps.sort_by {|name, _| name }.each do |name, version| sh %(#{Gem.ruby} -S gem list -i "^#{name}$" -v "#{version}" || ) + %(#{Gem.ruby} -S gem install #{name} -v "#{version}" --no-ri --no-rdoc) end # Download and install gems used inside tests $LOAD_PATH.unshift("./spec") require "support/rubygems_ext" Spec::Rubygems.setup end namespace :travis do task :deps do # Give the travis user a name so that git won't fatally error system "sudo sed -i 's/1000::/1000:Travis:/g' /etc/passwd" # Strip secure_path so that RVM paths transmit through sudo -E system "sudo sed -i '/secure_path/d' /etc/sudoers" # Install groff so ronn can generate man/help pages sh "sudo apt-get install groff-base -y" # Install graphviz so that the viz specs can run sh "sudo apt-get install graphviz -y 2>&1 | tail -n 2" if RUBY_VERSION < "1.9" # Downgrade Rubygems on 1.8 so Ronn can be required # https://github.com/rubygems/rubygems/issues/784 sh "gem update --system 2.1.11" else # Downgrade Rubygems so RSpec 3 can be installed # https://github.com/rubygems/rubygems/issues/813 sh "gem update --system 2.2.0" end # Install the other gem deps, etc. Rake::Task["spec:deps"].invoke end end end begin rspec = BUNDLER_SPEC.development_dependencies.find {|d| d.name == "rspec" } gem "rspec", rspec.requirement.to_s require "rspec/core/rake_task" desc "Run specs" RSpec::Core::RakeTask.new task :spec => "man:build" if RUBY_VERSION >= "1.9.3" # can't go in the gemspec because of the ruby version requirement gem "rubocop", "= 0.35.1" require "rubocop/rake_task" RuboCop::RakeTask.new end namespace :spec do task :clean do rm_rf "tmp" end desc "Run the real-world spec suite (requires internet)" task :realworld => %w(set_realworld spec) task :set_realworld do ENV["BUNDLER_REALWORLD_TESTS"] = "1" end desc "Run the spec suite with the sudo tests" task :sudo => %w(set_sudo spec clean_sudo) task :set_sudo do ENV["BUNDLER_SUDO_TESTS"] = "1" end task :clean_sudo do puts "Cleaning up sudo test files..." system "sudo rm -rf #{File.expand_path("../tmp/sudo_gem_home", __FILE__)}" end # Rubygems specs by version namespace :rubygems do rubyopt = ENV["RUBYOPT"] # When editing this list, also edit .travis.yml! branches = %w(master) releases = %w(v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.29 v2.0.14 v2.1.11 v2.2.5 v2.4.8 v2.5.0) (branches + releases).each do |rg| desc "Run specs with Rubygems #{rg}" RSpec::Core::RakeTask.new(rg) do |t| t.rspec_opts = %w(--format documentation --color) t.ruby_opts = %w(-w) end # Create tasks like spec:rubygems:v1.8.3:sudo to run the sudo specs namespace rg do task :sudo => ["set_sudo", rg, "clean_sudo"] task :realworld => ["set_realworld", rg] end task "clone_rubygems_#{rg}" do unless File.directory?(RUBYGEMS_REPO) system("git clone https://github.com/rubygems/rubygems.git tmp/rubygems") end hash = nil Dir.chdir(RUBYGEMS_REPO) do system("git remote update") if rg == "master" system("git checkout origin/master") else system("git checkout #{rg}") || raise("Unknown Rubygems ref #{rg}") end hash = `git rev-parse HEAD`.chomp end puts "Checked out rubygems '#{rg}' at #{hash}" ENV["RUBYOPT"] = "-I#{File.expand_path("tmp/rubygems/lib")} #{rubyopt}" puts "RUBYOPT=#{ENV["RUBYOPT"]}" end task rg => ["man:build", "clone_rubygems_#{rg}"] task "rubygems:all" => rg end desc "Run specs under a Rubygems checkout (set RG=path)" RSpec::Core::RakeTask.new("co") do |t| t.rspec_opts = %w(--format documentation --color) t.ruby_opts = %w(-w) end task "setup_co" do rg = File.expand_path ENV["RG"] puts "Running specs against Rubygems in #{rg}..." ENV["RUBYOPT"] = "-I#{rg} #{rubyopt}" end task "co" => "setup_co" task "rubygems:all" => "co" end desc "Run the tests on Travis CI against a rubygem version (using ENV['RGV'])" task :travis do rg = ENV["RGV"] || raise("Rubygems version is required on Travis!") if RUBY_VERSION > "1.9.3" puts "\n\e[1;33m[Travis CI] Running bundler linter\e[m\n\n" Rake::Task["rubocop"].invoke end puts "\n\e[1;33m[Travis CI] Running bundler specs against rubygems #{rg}\e[m\n\n" specs = safe_task { Rake::Task["spec:rubygems:#{rg}"].invoke } Rake::Task["spec:rubygems:#{rg}"].reenable puts "\n\e[1;33m[Travis CI] Running bundler sudo specs against rubygems #{rg}\e[m\n\n" sudos = system("sudo -E rake spec:rubygems:#{rg}:sudo") # clean up by chowning the newly root-owned tmp directory back to the travis user system("sudo chown -R #{ENV["USER"]} #{File.join(File.dirname(__FILE__), "tmp")}") Rake::Task["spec:rubygems:#{rg}"].reenable puts "\n\e[1;33m[Travis CI] Running bundler real world specs against rubygems #{rg}\e[m\n\n" realworld = safe_task { Rake::Task["spec:rubygems:#{rg}:realworld"].invoke } { "specs" => specs, "sudo" => sudos, "realworld" => realworld }.each do |name, passed| if passed puts "\e[0;32m[Travis CI] #{name} passed\e[m" else puts "\e[0;31m[Travis CI] #{name} failed\e[m" end end unless specs && sudos && realworld raise "Spec run failed, please review the log for more information" end end end rescue LoadError task :spec do abort "Run `rake spec:deps` to be able to run the specs" end task :rubocop do abort "Run `rake spec:deps` to be able to run rubocop" end end begin require "ronn" namespace :man do directory "lib/bundler/man" sources = Dir["man/*.ronn"].map {|f| File.basename(f, ".ronn") } sources.map do |basename| ronn = "man/#{basename}.ronn" roff = "lib/bundler/man/#{basename}" file roff => ["lib/bundler/man", ronn] do sh "#{Gem.ruby} -S ronn --roff --pipe #{ronn} > #{roff}" end file "#{roff}.txt" => roff do sh "groff -Wall -mtty-char -mandoc -Tascii #{roff} | col -b > #{roff}.txt" end task :build_all_pages => "#{roff}.txt" end task :clean do leftovers = Dir["lib/bundler/man/*"].reject do |f| basename = File.basename(f).sub(/\.(txt|ronn)/, "") sources.include?(basename) end rm leftovers if leftovers.any? end desc "Build the man pages" task :build => ["man:clean", "man:build_all_pages"] desc "Remove all built man pages" task :clobber do rm_rf "lib/bundler/man" end task(:require) {} end rescue LoadError namespace :man do task(:require) { abort "Install the ronn gem to be able to release!" } task(:build) { warn "Install the ronn gem to build the help pages" } end end begin require "automatiek" Automatiek::RakeTask.new("molinillo") do |lib| lib.download = { :github => "https://github.com/CocoaPods/Molinillo" } lib.namespace = "Molinillo" lib.prefix = "Bundler" lib.vendor_lib = "lib/bundler/vendor/molinillo" end Automatiek::RakeTask.new("thor") do |lib| lib.download = { :github => "https://github.com/erikhuda/thor" } lib.namespace = "Thor" lib.prefix = "Bundler" lib.vendor_lib = "lib/bundler/vendor/thor" end rescue LoadError namespace :vendor do task(:molinillo) { abort "Install the automatiek gem to be able to vendor gems." } task(:thor) { abort "Install the automatiek gem to be able to vendor gems." } end end desc "Update vendored SSL certs to match the certs vendored by Rubygems" task :update_certs => "spec:rubygems:clone_rubygems_master" do require "bundler/ssl_certs/certificate_manager" Bundler::SSLCerts::CertificateManager.update_from!(RUBYGEMS_REPO) end require "bundler/gem_tasks" task :build => ["man:build"] task :release => ["man:require", "man:build"] task :default => :spec bundler-1.11.2/bin/0000755000004100000410000000000012652443364014040 5ustar www-datawww-databundler-1.11.2/bin/rubocop0000755000004100000410000000043112652443364015435 0ustar www-datawww-data#!/usr/bin/env ruby require "rubygems" bundler_spec = Gem::Specification.load(File.expand_path("../../bundler.gemspec", __FILE__)) bundler_spec.dependencies.each do |dep| gem dep.name, dep.requirement.to_s end gem "rubocop", "= 0.35.1" load Gem.bin_path("rubocop", "rubocop") bundler-1.11.2/bin/rake0000755000004100000410000000052312652443364014710 0ustar www-datawww-data#!/usr/bin/env ruby require "rubygems" bundler_spec = Gem::Specification.load(File.expand_path("../../bundler.gemspec", __FILE__)) bundler_spec.dependencies.each do |dep| begin gem dep.name, dep.requirement.to_s rescue Gem::LoadError => e $stderr.puts "#{e.message} (#{e.class})" end end load Gem.bin_path("rake", "rake") bundler-1.11.2/bin/rspec0000755000004100000410000000040012652443364015074 0ustar www-datawww-data#!/usr/bin/env ruby require "rubygems" bundler_spec = Gem::Specification.load(File.expand_path("../../bundler.gemspec", __FILE__)) bundler_spec.dependencies.each do |dep| gem dep.name, dep.requirement.to_s end load Gem.bin_path("rspec-core", "rspec") bundler-1.11.2/.rubocop_todo.yml0000644000004100000410000000555712652443364016603 0ustar www-datawww-data# This configuration was generated by # `rubocop --auto-gen-config` # on 2015-11-21 00:03:12 -0600 using RuboCop version 0.35.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. # Offense count: 4 Lint/Eval: Exclude: - 'lib/bundler.rb' - 'lib/bundler/endpoint_specification.rb' - 'spec/support/streams.rb' # Offense count: 5 Lint/HandleExceptions: Exclude: - 'lib/bundler/fetcher/dependency.rb' - 'lib/bundler/installer.rb' - 'lib/bundler/psyched_yaml.rb' - 'lib/bundler/vendored_persistent.rb' # Offense count: 1 Lint/NestedMethodDefinition: Exclude: - 'lib/bundler/graph.rb' # Offense count: 5 Lint/RescueException: Exclude: - 'lib/bundler/cli.rb' - 'lib/bundler/dsl.rb' - 'lib/bundler/friendly_errors.rb' - 'lib/bundler/rubygems_integration.rb' - 'lib/bundler/worker.rb' # Offense count: 7 Lint/UselessAssignment: Exclude: - 'lib/bundler/graph.rb' - 'lib/bundler/index.rb' - 'lib/bundler/installer.rb' # Offense count: 1031 # Configuration parameters: AllowURI, URISchemes. Metrics/LineLength: Max: 207 # Offense count: 2 # Configuration parameters: CountKeywordArgs. Metrics/ParameterLists: Max: 6 # Offense count: 50 Metrics/PerceivedComplexity: Max: 54 # Offense count: 1 Style/AccessorMethodName: Exclude: - 'lib/bundler/source/git.rb' # Offense count: 3 Style/CaseEquality: Exclude: - 'lib/bundler/dsl.rb' - 'lib/bundler/match_platform.rb' - 'lib/bundler/rubygems_ext.rb' # Offense count: 22 # Configuration parameters: EnforcedStyle, SupportedStyles. Style/ClassAndModuleChildren: Enabled: false # Offense count: 119 # Configuration parameters: Exclude. Style/Documentation: Enabled: false # Offense count: 1 # Configuration parameters: Exclude. Style/FileName: Exclude: - 'lib/bundler/templates/Executable' # Offense count: 4 # Configuration parameters: AllowedVariables. Style/GlobalVars: Exclude: - 'lib/bundler/cli.rb' - 'spec/spec_helper.rb' - 'spec/support/helpers.rb' # Offense count: 32 # Configuration parameters: MinBodyLength. Style/GuardClause: Enabled: false # Offense count: 2 Style/ModuleFunction: Exclude: - 'lib/bundler/shared_helpers.rb' - 'spec/support/path.rb' # Offense count: 8 # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist. Style/PredicateName: Exclude: - 'lib/bundler/definition.rb' - 'lib/bundler/installer/parallel_installer.rb' - 'lib/bundler/settings.rb' - 'lib/bundler/source/git.rb' - 'lib/bundler/source/git/git_proxy.rb' - 'lib/bundler/source/path.rb' # Offense count: 7 # Configuration parameters: EnforcedStyle, SupportedStyles. Style/RaiseArgs: Enabled: false bundler-1.11.2/DEVELOPMENT.md0000644000004100000410000002233312652443364015377 0ustar www-datawww-dataGreat to have you here! Here are a few ways you can help out with [Bundler](http://github.com/bundler/bundler). # Where should I start? You can start learning about Bundler by reading [the documentation](http://bundler.io). If you want, you can also read a (lengthy) explanation of [why Bundler exists and what it does](http://bundler.io/rationale.html). You can also check out discussions about Bundler on the [Bundler mailing list](https://groups.google.com/group/ruby-bundler) and in the [Bundler IRC channel](http://webchat.freenode.net/?channels=%23bundler), which is #bundler on Freenode. Please note that this project is released with a contributor [code of conduct](http://bundler.io/conduct.html). By participating in this project you agree to abide by its terms. ## Your first commits If you’re interested in contributing to Bundler, that’s awesome! We’d love your help. If you have any questions after reading this page, please feel free to contact either [@indirect](http://github.com/indirect) or [@hone](http://github.com/hone). They are both happy to provide help working through your first bugfix or thinking through the problem you’re trying to resolve. ## How you can help We track [small bugs](https://github.com/bundler/bundler/issues?labels=small&state=open) and [small features](https://github.com/bundler/bundler-features/issues?labels=small&state=open) so that anyone who wants to help can start with something that's not too overwhelming. We also keep a [list of things anyone can help with, any time](https://github.com/bundler/bundler/blob/master/CONTRIBUTING.md#contributing). If nothing on those lists looks good, talk to us, and we'll figure out what you can help with. We can absolutely use your help, no matter what level of programming skill you have at the moment. # Development setup Bundler doesn't use a Gemfile to list development dependencies, because when we tried it we couldn't tell if we were awake or it was just another level of dreams. To work on Bundler, you'll probably want to do a couple of things. 1. Install Bundler's development dependencies $ rake spec:deps 2. Run the test suite, to make sure things are working $ rake spec 3. Set up a shell alias to run Bundler from your clone, e.g. a Bash alias: $ alias dbundle='ruby -I /path/to/bundler/lib /path/to/bundler/exe/bundle' With that set up, you can test changes you've made to Bundler by running `dbundle`, without interfering with the regular `bundle` command. # Bug triage Triage is the work of processing tickets that have been opened into actionable issues, feature requests, or bug reports. That includes verifying bugs, categorizing the ticket, and ensuring there's enough information to reproduce the bug for anyone who wants to try to fix it. We've created an [issues guide](https://github.com/bundler/bundler/blob/master/ISSUES.md) to walk Bundler users through the process of troubleshooting issues and reporting bugs. If you'd like to help, awesome! You can [report a new bug](https://github.com/bundler/bundler/issues/new) or browse our [existing open tickets](https://github.com/bundler/bundler/issues). Not every ticket will point to a bug in Bundler's code, but open tickets usually mean that there is something we could improve to help that user. Sometimes that means writing additional documentation, sometimes that means making error messages clearer, and sometimes that means explaining to a user that they need to install git to use git gems. When you're looking at a ticket, here are the main questions to ask: * Can I reproduce this bug myself? * Are the steps to reproduce clearly stated in the ticket? * Which versions of Bundler (1.1.x, 1.2.x, git, etc.) manifest this bug? * Which operating systems (OS X, Windows, Ubuntu, CentOS, etc.) manifest this bug? * Which rubies (MRI, JRuby, Rubinius, etc.) and which versions (1.8.7, 1.9.3, etc.) have this bug? If you can't reproduce an issue, chances are good that the bug has been fixed (hurrah!). That's a good time to post to the ticket explaining what you did and how it worked. If you can reproduce an issue, you're well on your way to fixing it. :) Fixing issues is similar to adding new features: 1. Discuss the fix on the existing issue. Coordinating with everyone else saves duplicate work and serves as a great way to get suggestions and ideas if you need any. 2. Base your commits on the correct branch. Bugfixes for 1.x versions of Bundler should be based on the matching 1-x-stable branch. 3. Commit the code and at least one test covering your changes to a named branch in your fork. 4. Put a line in the [CHANGELOG](https://github.com/bundler/bundler/blob/master/CHANGELOG.md) summarizing your changes under the next release under the “Bugfixes” heading. 5. Send us a [pull request](https://help.github.com/articles/using-pull-requests) from your bugfix branch. Finally, the ticket may be a duplicate of another older ticket. If you notice a ticket is a duplicate, simply comment on the ticket noting the original ticket’s number. For example, you could say “This is a duplicate of issue #42, and can be closed”. # Adding new features If you would like to add a new feature to Bundler, please follow these steps: 1. [Create an issue](https://github.com/bundler/bundler-features/issues/new) in the bundler-features repo to discuss your feature. 2. Base your commits on the master branch, since we follow [SemVer](http://semver.org) and don't add new features to old releases. 3. Commit the code and at least one test covering your changes to a feature branch in your fork. 4. Put a line in the [CHANGELOG](https://github.com/bundler/bundler/blob/master/CHANGELOG.md) summarizing your changes under the next release under the "Features" heading. 5. Send us a [pull request](https://help.github.com/articles/using-pull-requests) from your feature branch. If you don't hear back immediately, don’t get discouraged! We all have day jobs, but we respond to most tickets within a day or two. # Beta testing Early releases require heavy testing, especially across various system setups. We :heart: testers, and are big fans of anyone who can run `gem install bundler --pre` and try out upcoming releases in their development and staging environments. There may not always be prereleases or beta versions of Bundler. The Bundler team will tweet from the [@bundlerio account](http://twitter.com/bundlerio) when a prerelease or beta version becomes available. You are also always welcome to try checking out master and building a gem yourself if you want to try out the latest changes. # Translations We don't currently have any translations, but please reach out to us if you would like to help get this going. # Documentation Code needs explanation, and sometimes those who know the code well have trouble explaining it to someone just getting into it. Because of that, we welcome documentation suggestions and patches from everyone, especially if they are brand new to using Bundler. Bundler has two main sources of documentation: the built-in help (including usage information and man pages) and the [Bundler documentation site](http://bundler.io). If you’d like to submit a patch to the man pages, follow the steps for adding a feature above. All of the man pages are located in the `man` directory. Just use the “Documentation” heading when you describe what you did in the changelog. If you have a suggestion or proposed change for [bundler.io](http://bundler.io), please open an issue or send a pull request to the [bundler-site](https://github.com/bundler/bundler-site) repository. # Community Community is an important part of all we do. If you’d like to be part of the Bundler community, you can jump right in and start helping make Bundler better for everyone who uses it. It would be tremendously helpful to have more people answering questions about Bundler (and often simply about Rubygems or Ruby itself) in our [issue tracker](https://github.com/bundler/bundler/issues) or on [Stack Overflow](http://stackoverflow.com/questions/tagged/bundler). Additional documentation and explanation is always helpful, too. If you have any suggestions for the Bundler website [bundler.io](http://bundler.io), we would absolutely love it if you opened an issue or pull request on the [bundler-site](https://github.com/bundler/bundler-site) repository. Finally, sharing your experiences and discoveries by writing them up is a valuable way to help others who have similar problems or experiences in the future. You can write a blog post, create an example and commit it to Github, take screenshots, or make videos. Examples of how Bundler is used help everyone, and we’ve discovered that people already use it in ways that we never imagined when we were writing it. If you’re still not sure what to write about, there are also several projects doing interesting things based on Bundler. They could probably use publicity too. If you let someone on the core team know you wrote about Bundler, we will add your post to the list of Bundler resources on the Github project wiki. Finally, participate carefully in the all contributors to the Bundler project must agree to the contributor [code of conduct](http://bundler.io/conduct.html). By participating in this project you agree to abide by its terms. bundler-1.11.2/.rspec0000644000004100000410000000005212652443364014402 0ustar www-datawww-data--format documentation --color --warnings bundler-1.11.2/CODE_OF_CONDUCT.md0000644000004100000410000000670012652443364016072 0ustar www-datawww-data# Bundler Code of Conduct The Bundler project strongly values contributors from anywhere, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, physical appearance, body size, race, ethnicity, age, religion, or nationality. As a result, the Bundler team has agreed to and enforces this code of conduct in order to provide a harassment-free experience for everyone who participates in the development of Bundler. ### Summary Harassment in code and discussion or violation of physical boundaries is completely unacceptable anywhere in the Bundler project’s codebases, issue trackers, chat rooms, mailing lists, meetups, and any other events. Violators will be warned and then blocked or banned by the core team at or before the 3rd violation. ### In detail Harassment includes offensive verbal comments related to level of experience, gender, gender identity and expression, sexual orientation, disability, physical appearance, body size, race, ethnicity, age, religion, nationality, the use of sexualized language or imagery, deliberate intimidation, stalking, sustained disruption, and unwelcome sexual attention. Individuals asked to stop any harassing behavior are expected to comply immediately. Maintainers, including the core team, are also subject to the anti-harassment policy. If anyone engages in abusive, harassing, or otherwise unacceptable behavior, including maintainers, we may take appropriate action, up to and including warning the offender, deletion of comments, removal from the project’s codebase and communication systems, and escalation to Github support. If you are being harassed, notice that someone else is being harassed, or have any other concerns, please contact a member of [the core team](http://bundler.io/contributors.html) or [email the core team](mailto:team@bundler.io) immediately. We expect everyone to follow these rules anywhere in the Bundler project’s codebases, issue trackers, IRC channel, group chat, and mailing lists. This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Finally, don't forget that it is human to make mistakes! We all do. Let’s work together to help each other, resolve issues, and learn from the mistakes that we will all inevitably make from time to time. ### Thanks Thanks to the [JSConf Code of Conduct](http://jsconf.com/codeofconduct.html) and [Fedora Code of Conduct](http://fedoraproject.org/code-of-conduct) for inspiration and ideas. Additional thanks to [Contributor Covenant](http://contributor-covenant.org) for the [default code of conduct](https://github.com/bundler/bundler/blob/master/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt) included in generated gems. ### License

To the extent possible under law, The Bundler Team has waived all copyright and related or neighboring rights to the Bundler Code of Conduct. This work is published from the United States.

CC0

bundler-1.11.2/LICENSE.md0000644000004100000410000000213612652443364014676 0ustar www-datawww-dataPortions copyright (c) 2010 Andre Arko Portions copyright (c) 2009 Engine Yard MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. bundler-1.11.2/.travis.yml0000644000004100000410000000476512652443364015415 0ustar www-datawww-datalanguage: ruby script: rake spec:travis before_script: travis_retry rake spec:travis:deps branches: only: - master - auto - /.+-stable$/ notifications: email: # andre - secure: "bCcvqJT7YrBawtkXXwHhT+jOFth7r2Qv/30PkkbhQxk6Jb3xambjCOJ3U6vJ\ngYmiL50exi5lUp3oc3SEbHN5t2CrZqOZDQ6o7P8EAmB5c0oH2RrYaFOkI5Gt\nul/jGH/96A9sj0aMwG7JfdMSfhqj1DUKAm2PnnbXPL853VfmT24=" # terence - secure: "MQ8eA5Jb8YzEpAo58DRGfVJklAPcEbAulpBZnTxp0am6ldneDtJHbQk21w6R\nj5GsDHlzr/lMp/GHIimtUZ7rLohfND8fj/W7fs1Dkd4eN02/ERt98x3pHlqv\nvZgSnZ39uVYv+OcphraE24QaRaGWLhWZAMYQTVe/Yz50NyG8g1U=" slack: on_success: change on_failure: always rooms: - secure: JxBi7DDJGkIF/7f/FSN/HUHpvV4EKfQccZHTPd1b2pNJn3GXo6u+tNVbAw2WjxYzPyPQI3ZcYBCU9SEXp/i7VmG8uMzh8Kyildw+miSKYKVb90uYqcsXWzbxwyNBgJLvyDkzST45H5lgnyAicee3WkFes/WDZikIajbH7ztdb04= rvm: - 2.2 - 2.1 - 2.0.0 - 1.9.3 - 1.8.7 # Rubygems versions MUST be available as rake tasks # see Rakefile:66 for the list of possible RGV values env: # We need to know if changes to rubygems will break bundler on release - RGV=master # Test the latest rubygems release with all of our supported rubies - RGV=v2.5.0 - RGV=v2.4.8 matrix: include: # Ruby 2.2, Rubygems 2.4.5 and up (included by RGV above) # Ruby 2.1, Rubygems 2.2.2 and up - rvm: 2.1 env: RGV=v2.2.5 # Ruby 2.0.0, Rubygems 2.0.0 and up - rvm: 2.0.0 env: RGV=v2.2.5 - rvm: 2.0.0 env: RGV=v2.1.11 - rvm: 2.0.0 env: RGV=v2.0.14 # Ruby 1.9.3, Rubygems 1.5.3 and up - rvm: 1.9.3 env: RGV=v2.2.5 - rvm: 1.9.3 env: RGV=v2.1.11 - rvm: 1.9.3 env: RGV=v2.0.14 - rvm: 1.9.3 env: RGV=v1.8.29 - rvm: 1.9.3 env: RGV=v1.7.2 - rvm: 1.9.3 env: RGV=v1.6.2 - rvm: 1.9.3 env: RGV=v1.5.3 # Ruby 1.8.7, Rubygems 1.3.6 and up - rvm: 1.8.7 env: RGV=v2.2.5 - rvm: 1.8.7 env: RGV=v2.0.14 - rvm: 1.8.7 env: RGV=v1.8.29 - rvm: 1.8.7 env: RGV=v1.7.2 - rvm: 1.8.7 env: RGV=v1.6.2 - rvm: 1.8.7 env: RGV=v1.5.3 - rvm: 1.8.7 env: RGV=v1.4.2 - rvm: 1.8.7 env: RGV=v1.3.7 - rvm: 1.8.7 env: RGV=v1.3.6 # ALLOWED FAILURES # For no apparent reason, this often goes over the Travis limit - rvm: 1.8.7 env: RGV=v2.1.11 # Ruby-head (we want to know how we're doing, but not fail the build) - rvm: ruby-head env: RGV=master allow_failures: - rvm: 1.8.7 env: RGV=v2.1.11 - rvm: ruby-head bundler-1.11.2/lib/0000755000004100000410000000000012652443364014036 5ustar www-datawww-databundler-1.11.2/lib/bundler/0000755000004100000410000000000012652443364015471 5ustar www-datawww-databundler-1.11.2/lib/bundler/similarity_detector.rb0000644000004100000410000000347112652443364022102 0ustar www-datawww-datamodule Bundler class SimilarityDetector SimilarityScore = Struct.new(:string, :distance) # initialize with an array of words to be matched against def initialize(corpus) @corpus = corpus end # return an array of words similar to 'word' from the corpus def similar_words(word, limit = 3) words_by_similarity = @corpus.map {|w| SimilarityScore.new(w, levenshtein_distance(word, w)) } words_by_similarity.select {|s| s.distance <= limit }.sort_by(&:distance).map(&:string) end # return the result of 'similar_words', concatenated into a list # (eg "a, b, or c") def similar_word_list(word, limit = 3) words = similar_words(word, limit) if words.length == 1 words[0] elsif words.length > 1 [words[0..-2].join(", "), words[-1]].join(" or ") end end protected # http://www.informit.com/articles/article.aspx?p=683059&seqNum=36 def levenshtein_distance(this, that, ins = 2, del = 2, sub = 1) # ins, del, sub are weighted costs return nil if this.nil? return nil if that.nil? dm = [] # distance matrix # Initialize first row values dm[0] = (0..this.length).collect {|i| i * ins } fill = [0] * (this.length - 1) # Initialize first column values (1..that.length).each do |i| dm[i] = [i * del, fill.flatten] end # populate matrix (1..that.length).each do |i| (1..this.length).each do |j| # critical comparison dm[i][j] = [ dm[i - 1][j - 1] + (this[j - 1] == that[i - 1] ? 0 : sub), dm[i][j - 1] + ins, dm[i - 1][j] + del ].min end end # The last value in matrix is the Levenshtein distance between the strings dm[that.length][this.length] end end end bundler-1.11.2/lib/bundler/vendored_thor.rb0000644000004100000410000000015212652443364020656 0ustar www-datawww-datamodule Bundler; end require "bundler/vendor/thor/lib/thor" require "bundler/vendor/thor/lib/thor/actions" bundler-1.11.2/lib/bundler/remote_specification.rb0000644000004100000410000000471212652443364022215 0ustar www-datawww-datarequire "uri" require "rubygems/spec_fetcher" module Bundler # Represents a lazily loaded gem specification, where the full specification # is on the source server in rubygems' "quick" index. The proxy object is to # be seeded with what we're given from the source's abbreviated index - the # full specification will only be fetched when necessary. class RemoteSpecification include MatchPlatform include Comparable attr_reader :name, :version, :platform attr_accessor :source, :remote def initialize(name, version, platform, spec_fetcher) @name = name @version = version @platform = platform @spec_fetcher = spec_fetcher end # Needed before installs, since the arch matters then and quick # specs don't bother to include the arch in the platform string def fetch_platform @platform = _remote_specification.platform end def full_name if platform == Gem::Platform::RUBY || platform.nil? "#{@name}-#{@version}" else "#{@name}-#{@version}-#{platform}" end end # Compare this specification against another object. Using sort_obj # is compatible with Gem::Specification and other Bundler or RubyGems # objects. Otherwise, use the default Object comparison. def <=>(other) if other.respond_to?(:sort_obj) sort_obj <=> other.sort_obj else super end end # Because Rubyforge cannot be trusted to provide valid specifications # once the remote gem is downloaded, the backend specification will # be swapped out. def __swap__(spec) @_remote_specification = spec end # Create a delegate used for sorting. This strategy is copied from # RubyGems 2.23 and ensures that Bundler's specifications can be # compared and sorted with RubyGems' own specifications. # # @see #<=> # @see Gem::Specification#sort_obj # # @return [Array] an object you can use to compare and sort this # specification against other specifications def sort_obj [@name, @version, @platform == Gem::Platform::RUBY ? -1 : 1] end private def _remote_specification @_remote_specification ||= @spec_fetcher.fetch_spec([@name, @version, @platform]) end def method_missing(method, *args, &blk) if Gem::Specification.new.respond_to?(method) _remote_specification.send(method, *args, &blk) else super end end end end bundler-1.11.2/lib/bundler/source.rb0000644000004100000410000000145612652443364017324 0ustar www-datawww-datamodule Bundler class Source autoload :Rubygems, "bundler/source/rubygems" autoload :Path, "bundler/source/path" autoload :Git, "bundler/source/git" attr_accessor :dependency_names def unmet_deps specs.unmet_dependency_names end def version_message(spec) message = "#{spec.name} #{spec.version}" if Bundler.locked_gems locked_spec = Bundler.locked_gems.specs.find {|s| s.name == spec.name } locked_spec_version = locked_spec.version if locked_spec if locked_spec_version && spec.version != locked_spec_version message << " (was #{locked_spec_version})" end end message end def can_lock?(spec) spec.source == self end def include?(other) other == self end end end bundler-1.11.2/lib/bundler/ruby_dsl.rb0000644000004100000410000000114212652443364017637 0ustar www-datawww-datamodule Bundler module RubyDsl def ruby(ruby_version, options = {}) raise GemfileError, "Please define :engine_version" if options[:engine] && options[:engine_version].nil? raise GemfileError, "Please define :engine" if options[:engine_version] && options[:engine].nil? raise GemfileEvalError, "ruby_version must match the :engine_version for MRI" if options[:engine] == "ruby" && options[:engine_version] && ruby_version != options[:engine_version] @ruby_version = RubyVersion.new(ruby_version, options[:patchlevel], options[:engine], options[:engine_version]) end end end bundler-1.11.2/lib/bundler/index.rb0000644000004100000410000001174212652443364017132 0ustar www-datawww-datarequire "set" module Bundler class Index include Enumerable def self.build i = new yield i i end attr_reader :specs, :all_specs, :sources protected :specs, :all_specs RUBY = "ruby".freeze NULL = "\0".freeze def initialize @sources = [] @cache = {} @specs = Hash.new {|h, k| h[k] = {} } @all_specs = Hash.new {|h, k| h[k] = [] } end def initialize_copy(o) super @sources = @sources.dup @cache = {} @specs = Hash.new {|h, k| h[k] = {} } @all_specs = Hash.new {|h, k| h[k] = [] } o.specs.each do |name, hash| @specs[name] = hash.dup end o.all_specs.each do |name, array| @all_specs[name] = array.dup end end def inspect "#<#{self.class}:0x#{object_id} sources=#{sources.map(&:inspect)} specs.size=#{specs.size}>" end def empty? each { return false } true end def search_all(name) all_matches = @all_specs[name] + local_search(name) @sources.each do |source| all_matches.concat(source.search_all(name)) end all_matches end # Search this index's specs, and any source indexes that this index knows # about, returning all of the results. def search(query, base = nil) results = local_search(query, base) seen = Set.new(results.map {|spec| [spec.name, spec.version, spec.platform] }) @sources.each do |source| source.search(query, base).each do |spec| lookup = [spec.name, spec.version, spec.platform] unless seen.include?(lookup) results << spec seen << lookup end end end results.sort_by {|s| [s.version, s.platform.to_s == RUBY ? NULL : s.platform.to_s] } end def local_search(query, base = nil) case query when Gem::Specification, RemoteSpecification, LazySpecification, EndpointSpecification then search_by_spec(query) when String then specs_by_name(query) when Gem::Dependency then search_by_dependency(query, base) when DepProxy then search_by_dependency(query.dep, base) else raise "You can't search for a #{query.inspect}." end end alias_method :[], :search def <<(spec) @specs[spec.name]["#{spec.version}-#{spec.platform}"] = spec spec end def each(&blk) specs.values.each do |spec_sets| spec_sets.values.each(&blk) end end # returns a list of the dependencies def unmet_dependency_names names = dependency_names names.delete_if {|n| n == "bundler" } names.select {|n| search(n).empty? } end def dependency_names names = [] each {|s| names.push(*s.dependencies.map(&:name)) } names.uniq end def use(other, override_dupes = false) return unless other other.each do |s| if (dupes = search_by_spec(s)) && dupes.any? @all_specs[s.name] = [s] + dupes next unless override_dupes self << s end self << s end self end def size @sources.inject(@specs.size) do |size, source| size += source.size end end def ==(other) all? do |spec| other_spec = other[spec].first other_spec && (spec.dependencies & other_spec.dependencies).empty? && spec.source == other_spec.source end end def add_source(index) if index.is_a?(Index) @sources << index @sources.uniq! # need to use uniq! here instead of checking for the item before adding else raise ArgumentError, "Source must be an index, not #{index.class}" end end private def specs_by_name(name) @specs[name].values end def search_by_dependency(dependency, base = nil) @cache[base || false] ||= {} @cache[base || false][dependency] ||= begin specs = specs_by_name(dependency.name) + (base || []) found = specs.select do |spec| if base # allow all platforms when searching from a lockfile dependency.matches_spec?(spec) else dependency.matches_spec?(spec) && Gem::Platform.match(spec.platform) end end wants_prerelease = dependency.requirement.prerelease? only_prerelease = specs.all? {|spec| spec.version.prerelease? } unless wants_prerelease || only_prerelease found.reject! {|spec| spec.version.prerelease? } end found end end def search_by_spec(spec) spec = @specs[spec.name]["#{spec.version}-#{spec.platform}"] spec ? [spec] : [] end if RUBY_VERSION < "1.9" def same_version?(a, b) regex = /^(.*?)(?:\.0)*$/ a.to_s[regex, 1] == b.to_s[regex, 1] end else def same_version?(a, b) a == b end end def spec_satisfies_dependency?(spec, dep) return false unless dep.name == spec.name dep.requirement.satisfied_by?(spec.version) end end end bundler-1.11.2/lib/bundler/match_platform.rb0000644000004100000410000000041712652443364021020 0ustar www-datawww-datarequire "bundler/gem_helpers" module Bundler module MatchPlatform include GemHelpers def match_platform(p) Gem::Platform::RUBY == platform || platform.nil? || p == platform || generic(Gem::Platform.new(platform)) === p end end end bundler-1.11.2/lib/bundler/lockfile_parser.rb0000644000004100000410000001441612652443364021170 0ustar www-datawww-datarequire "strscan" # Some versions of the Bundler 1.1 RC series introduced corrupted # lockfiles. There were two major problems: # # * multiple copies of the same GIT section appeared in the lockfile # * when this happened, those sections got multiple copies of gems # in those sections. # # As a result, Bundler 1.1 contains code that fixes the earlier # corruption. We will remove this fix-up code in Bundler 1.2. module Bundler class LockfileParser attr_reader :sources, :dependencies, :specs, :platforms, :bundler_version BUNDLED = "BUNDLED WITH" DEPENDENCIES = "DEPENDENCIES" PLATFORMS = "PLATFORMS" GIT = "GIT" GEM = "GEM" PATH = "PATH" SPECS = " specs:" OPTIONS = /^ ([a-z]+): (.*)$/i SOURCE = [GIT, GEM, PATH] def initialize(lockfile) @platforms = [] @sources = [] @dependencies = [] @state = nil @specs = {} @rubygems_aggregate = Source::Rubygems.new if lockfile.match(/<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|/) raise LockfileError, "Your #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} contains merge conflicts.\n" \ "Run `git checkout HEAD -- #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}` first to get a clean lock." end lockfile.split(/(?:\r?\n)+/).each do |line| if SOURCE.include?(line) @state = :source parse_source(line) elsif line == DEPENDENCIES @state = :dependency elsif line == PLATFORMS @state = :platform elsif line == BUNDLED @state = :bundled_with elsif line =~ /^[^\s]/ @state = nil elsif @state send("parse_#{@state}", line) end end @sources << @rubygems_aggregate @specs = @specs.values warn_for_outdated_bundler_version rescue ArgumentError => e Bundler.ui.debug(e) raise LockfileError, "Your lockfile is unreadable. Run `rm #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}` " \ "and then `bundle install` to generate a new lockfile." end def warn_for_outdated_bundler_version return unless bundler_version prerelease_text = bundler_version.prerelease? ? " --pre" : "" current_version = Gem::Version.create(Bundler::VERSION) case current_version.segments.first <=> bundler_version.segments.first when -1 raise LockfileError, "You must use Bundler #{bundler_version.segments.first} or greater with this lockfile." when 0 if current_version < bundler_version Bundler.ui.warn "Warning: the running version of Bundler is older " \ "than the version that created the lockfile. We suggest you " \ "upgrade to the latest version of Bundler by running `gem " \ "install bundler#{prerelease_text}`.\n" end end end private TYPES = { GIT => Bundler::Source::Git, GEM => Bundler::Source::Rubygems, PATH => Bundler::Source::Path, } def parse_source(line) case line when GIT, GEM, PATH @current_source = nil @opts = {} @type = line when SPECS case @type when PATH @current_source = TYPES[@type].from_lock(@opts) @sources << @current_source when GIT @current_source = TYPES[@type].from_lock(@opts) # Strip out duplicate GIT sections if @sources.include?(@current_source) @current_source = @sources.find {|s| s == @current_source } else @sources << @current_source end when GEM Array(@opts["remote"]).each do |url| @rubygems_aggregate.add_remote(url) end @current_source = @rubygems_aggregate end when OPTIONS value = $2 value = true if value == "true" value = false if value == "false" key = $1 if @opts[key] @opts[key] = Array(@opts[key]) @opts[key] << value else @opts[key] = value end else parse_spec(line) end end NAME_VERSION = '(?! )(.*?)(?: \(([^-]*)(?:-(.*))?\))?' NAME_VERSION_2 = /^ {2}#{NAME_VERSION}(!)?$/ NAME_VERSION_4 = /^ {4}#{NAME_VERSION}$/ NAME_VERSION_6 = /^ {6}#{NAME_VERSION}$/ def parse_dependency(line) if line =~ NAME_VERSION_2 name = $1 version = $2 pinned = $4 version = version.split(",").map(&:strip) if version dep = Bundler::Dependency.new(name, version) if pinned && dep.name != "bundler" spec = @specs.find {|_, v| v.name == dep.name } dep.source = spec.last.source if spec # Path sources need to know what the default name / version # to use in the case that there are no gemspecs present. A fake # gemspec is created based on the version set on the dependency # TODO: Use the version from the spec instead of from the dependency if version && version.size == 1 && version.first =~ /^\s*= (.+)\s*$/ && dep.source.is_a?(Bundler::Source::Path) dep.source.name = name dep.source.version = $1 end end @dependencies << dep end end def parse_spec(line) if line =~ NAME_VERSION_4 name = $1 version = Gem::Version.new($2) platform = $3 ? Gem::Platform.new($3) : Gem::Platform::RUBY @current_spec = LazySpecification.new(name, version, platform) @current_spec.source = @current_source # Avoid introducing multiple copies of the same spec (caused by # duplicate GIT sections) @specs[@current_spec.identifier] ||= @current_spec elsif line =~ NAME_VERSION_6 name = $1 version = $2 version = version.split(",").map(&:strip) if version dep = Gem::Dependency.new(name, version) @current_spec.dependencies << dep end end def parse_platform(line) @platforms << Gem::Platform.new($1) if line =~ /^ (.*)$/ end def parse_bundled_with(line) line = line.strip if Gem::Version.correct?(line) @bundler_version = Gem::Version.create(line) end end end end bundler-1.11.2/lib/bundler/rubygems_ext.rb0000644000004100000410000001101712652443364020533 0ustar www-datawww-datarequire "pathname" if defined?(Gem::QuickLoader) # Gem Prelude makes me a sad panda :'( Gem::QuickLoader.load_full_rubygems_library end require "rubygems" require "rubygems/specification" require "bundler/match_platform" module Gem @loaded_stacks = Hash.new {|h, k| h[k] = [] } class Specification attr_accessor :remote, :location, :relative_loaded_from remove_method :source if instance_methods(false).include?(:source) attr_accessor :source alias_method :rg_full_gem_path, :full_gem_path alias_method :rg_loaded_from, :loaded_from def full_gem_path if source.respond_to?(:path) Pathname.new(loaded_from).dirname.expand_path(Bundler.root).to_s.untaint else rg_full_gem_path end end def loaded_from if relative_loaded_from source.path.join(relative_loaded_from).to_s else rg_loaded_from end end def load_paths return full_require_paths if respond_to?(:full_require_paths) require_paths.map do |require_path| if require_path.include?(full_gem_path) require_path else File.join(full_gem_path, require_path) end end end if method_defined?(:extension_dir) alias_method :rg_extension_dir, :extension_dir def extension_dir @extension_dir ||= if source.respond_to?(:extension_dir_name) File.expand_path(File.join(extensions_dir, source.extension_dir_name)) else rg_extension_dir end end end # RubyGems 1.8+ used only. methods = instance_methods(false) gem_dir = methods.first.is_a?(String) ? "gem_dir" : :gem_dir remove_method :gem_dir if methods.include?(gem_dir) def gem_dir full_gem_path end def groups @groups ||= [] end def git_version return unless loaded_from && source.is_a?(Bundler::Source::Git) " #{source.revision[0..6]}" end def to_gemfile(path = nil) gemfile = "source 'https://rubygems.org'\n" gemfile << dependencies_to_gemfile(nondevelopment_dependencies) unless development_dependencies.empty? gemfile << "\n" gemfile << dependencies_to_gemfile(development_dependencies, :development) end gemfile end def nondevelopment_dependencies dependencies - development_dependencies end private def dependencies_to_gemfile(dependencies, group = nil) gemfile = "" if dependencies.any? gemfile << "group :#{group} do\n" if group dependencies.each do |dependency| gemfile << " " if group gemfile << %(gem "#{dependency.name}") req = dependency.requirements_list.first gemfile << %(, "#{req}") if req gemfile << "\n" end gemfile << "end\n" if group end gemfile end end class Dependency attr_accessor :source, :groups alias_method :eql?, :== def encode_with(coder) to_yaml_properties.each do |ivar| coder[ivar.to_s.sub(/^@/, "")] = instance_variable_get(ivar) end end def to_yaml_properties instance_variables.reject {|p| ["@source", "@groups"].include?(p.to_s) } end def to_lock out = " #{name}" unless requirement == Gem::Requirement.default reqs = requirement.requirements.map {|o, v| "#{o} #{v}" }.sort.reverse out << " (#{reqs.join(", ")})" end out end # Backport of performance enhancement added to Rubygems 1.4 def matches_spec?(spec) # name can be a Regexp, so use === return false unless name === spec.name return true if requirement.none? requirement.satisfied_by?(spec.version) end unless allocate.respond_to?(:matches_spec?) end class Requirement # Backport of performance enhancement added to Rubygems 1.4 def none? @none ||= (to_s == ">= 0") end unless allocate.respond_to?(:none?) end class Platform JAVA = Gem::Platform.new("java") unless defined?(JAVA) MSWIN = Gem::Platform.new("mswin32") unless defined?(MSWIN) MSWIN64 = Gem::Platform.new("mswin64") unless defined?(MSWIN64) MINGW = Gem::Platform.new("x86-mingw32") unless defined?(MINGW) X64_MINGW = Gem::Platform.new("x64-mingw32") unless defined?(X64_MINGW) undef_method :hash if method_defined? :hash def hash @cpu.hash ^ @os.hash ^ @version.hash end undef_method :eql? if method_defined? :eql? alias_method :eql?, :== end end module Gem class Specification include ::Bundler::MatchPlatform end end bundler-1.11.2/lib/bundler/fetcher/0000755000004100000410000000000012652443364017111 5ustar www-datawww-databundler-1.11.2/lib/bundler/fetcher/index.rb0000644000004100000410000000150712652443364020550 0ustar www-datawww-datarequire "bundler/fetcher/base" require "rubygems/remote_fetcher" module Bundler class Fetcher class Index < Base def specs(_gem_names) Bundler.rubygems.fetch_all_remote_specs(remote) rescue Gem::RemoteFetcher::FetchError, OpenSSL::SSL::SSLError, Net::HTTPFatalError => e case e.message when /certificate verify failed/ raise CertificateFailureError.new(display_uri) when /401/ raise AuthenticationRequiredError, remote_uri when /403/ if remote_uri.userinfo raise BadAuthenticationError, remote_uri else raise AuthenticationRequiredError, remote_uri end else Bundler.ui.trace e raise HTTPError, "Could not fetch specs from #{display_uri}" end end end end end bundler-1.11.2/lib/bundler/fetcher/dependency.rb0000644000004100000410000000575012652443364021563 0ustar www-datawww-datarequire "bundler/fetcher/base" require "cgi" module Bundler class Fetcher class Dependency < Base def api_available? downloader.fetch(dependency_api_uri) rescue NetworkDownError => e raise HTTPError, e.message rescue AuthenticationRequiredError # We got a 401 from the server. Just fail. raise rescue HTTPError end def api_fetcher? true end def specs(gem_names, full_dependency_list = [], last_spec_list = []) query_list = gem_names - full_dependency_list # only display the message on the first run if Bundler.ui.debug? Bundler.ui.debug "Query List: #{query_list.inspect}" else Bundler.ui.info ".", false end return { remote_uri => last_spec_list } if query_list.empty? remote_specs = Bundler::Retry.new("dependency api", AUTH_ERRORS).attempts do dependency_specs(query_list) end spec_list, deps_list = remote_specs returned_gems = spec_list.map(&:first).uniq specs(deps_list, full_dependency_list + returned_gems, spec_list + last_spec_list) rescue HTTPError, MarshalError, GemspecError Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over Bundler.ui.debug "could not fetch from the dependency API, trying the full index" return nil end def dependency_specs(gem_names) Bundler.ui.debug "Query Gemcutter Dependency Endpoint API: #{gem_names.join(",")}" gem_list = [] deps_list = [] gem_names.each_slice(Source::Rubygems::API_REQUEST_SIZE) do |names| marshalled_deps = downloader.fetch dependency_api_uri(names) gem_list += Bundler.load_marshal(marshalled_deps) end spec_list = gem_list.map do |s| dependencies = s[:dependencies].map do |name, requirement| dep = well_formed_dependency(name, requirement.split(", ")) deps_list << dep.name dep end [s[:name], Gem::Version.new(s[:number]), s[:platform], dependencies] end [spec_list, deps_list.uniq] end def dependency_api_uri(gem_names = []) uri = fetch_uri + "api/v1/dependencies" uri.query = "gems=#{CGI.escape(gem_names.join(","))}" if gem_names.any? uri end def well_formed_dependency(name, *requirements) Gem::Dependency.new(name, *requirements) rescue ArgumentError => e illformed = 'Ill-formed requirement ["#= redirect_limit response = request(uri) Bundler.ui.debug("HTTP #{response.code} #{response.message}") case response when Net::HTTPRedirection new_uri = URI.parse(response["location"]) if new_uri.host == uri.host new_uri.user = uri.user new_uri.password = uri.password end fetch(new_uri, counter + 1) when Net::HTTPSuccess response.body when Net::HTTPRequestEntityTooLarge raise FallbackError, response.body when Net::HTTPUnauthorized raise AuthenticationRequiredError, uri.host else raise HTTPError, "#{response.class}: #{response.body}" end end def request(uri) Bundler.ui.debug "HTTP GET #{uri}" req = Net::HTTP::Get.new uri.request_uri if uri.user user = CGI.unescape(uri.user) password = uri.password ? CGI.unescape(uri.password) : nil req.basic_auth(user, password) end connection.request(uri, req) rescue OpenSSL::SSL::SSLError raise CertificateFailureError.new(uri) rescue *HTTP_ERRORS => e Bundler.ui.trace e case e.message when /host down:/, /getaddrinfo: nodename nor servname provided/ raise NetworkDownError, "Could not reach host #{uri.host}. Check your network " \ "connection and try again." else raise HTTPError, "Network error while fetching #{uri}" end end end end end bundler-1.11.2/lib/bundler/fetcher/base.rb0000644000004100000410000000142112652443364020346 0ustar www-datawww-datamodule Bundler class Fetcher class Base attr_reader :downloader attr_reader :display_uri attr_reader :remote def initialize(downloader, remote, display_uri) raise "Abstract class" if self.class == Base @downloader = downloader @remote = remote @display_uri = display_uri end def remote_uri @remote.uri end def fetch_uri @fetch_uri ||= begin if remote_uri.host == "rubygems.org" uri = remote_uri.dup uri.host = "bundler.rubygems.org" uri else remote_uri end end end def api_available? api_fetcher? end def api_fetcher? false end end end end bundler-1.11.2/lib/bundler/lazy_specification.rb0000644000004100000410000000362312652443364021701 0ustar www-datawww-datarequire "uri" require "rubygems/spec_fetcher" require "bundler/match_platform" module Bundler class LazySpecification include MatchPlatform attr_reader :name, :version, :dependencies, :platform attr_accessor :source, :remote def initialize(name, version, platform, source = nil) @name = name @version = version @dependencies = [] @platform = platform @source = source @specification = nil end def full_name if platform == Gem::Platform::RUBY || platform.nil? "#{@name}-#{@version}" else "#{@name}-#{@version}-#{platform}" end end def ==(other) identifier == other.identifier end def satisfies?(dependency) @name == dependency.name && dependency.requirement.satisfied_by?(Gem::Version.new(@version)) end def to_lock if platform == Gem::Platform::RUBY || platform.nil? out = " #{name} (#{version})\n" else out = " #{name} (#{version}-#{platform})\n" end dependencies.sort_by(&:to_s).uniq.each do |dep| next if dep.type == :development out << " #{dep.to_lock}\n" end out end def __materialize__ @specification = source.specs.search(Gem::Dependency.new(name, version)).last end def respond_to?(*args) super || @specification ? @specification.respond_to?(*args) : nil end def to_s @__to_s ||= "#{name} (#{version})" end def identifier @__identifier ||= [name, version, source, platform, dependencies].hash end private def to_ary nil end def method_missing(method, *args, &blk) raise "LazySpecification has not been materialized yet (calling :#{method} #{args.inspect})" unless @specification return super unless respond_to?(method) @specification.send(method, *args, &blk) end end end bundler-1.11.2/lib/bundler/gem_tasks.rb0000644000004100000410000000015212652443364017771 0ustar www-datawww-datarequire "rake/clean" CLOBBER.include "pkg" require "bundler/gem_helper" Bundler::GemHelper.install_tasks bundler-1.11.2/lib/bundler/vendor/0000755000004100000410000000000012652443364016766 5ustar www-datawww-databundler-1.11.2/lib/bundler/vendor/molinillo/0000755000004100000410000000000012652443364020764 5ustar www-datawww-databundler-1.11.2/lib/bundler/vendor/molinillo/lib/0000755000004100000410000000000012652443364021532 5ustar www-datawww-databundler-1.11.2/lib/bundler/vendor/molinillo/lib/molinillo/0000755000004100000410000000000012652443364023530 5ustar www-datawww-databundler-1.11.2/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb0000644000004100000410000000466112652443364025400 0ustar www-datawww-datamodule Bundler::Molinillo # An error that occurred during the resolution process class ResolverError < StandardError; end # An error caused by searching for a dependency that is completely unknown, # i.e. has no versions available whatsoever. class NoSuchDependencyError < ResolverError # @return [Object] the dependency that could not be found attr_accessor :dependency # @return [Array] the specifications that depended upon {#dependency} attr_accessor :required_by # @param [Object] dependency @see {#dependency} # @param [Array] required_by @see {#required_by} def initialize(dependency, required_by = []) @dependency = dependency @required_by = required_by super() end def message sources = required_by.map { |r| "`#{r}`" }.join(' and ') message = "Unable to find a specification for `#{dependency}`" message << " depended upon by #{sources}" unless sources.empty? message end end # An error caused by attempting to fulfil a dependency that was circular # # @note This exception will be thrown iff a {Vertex} is added to a # {DependencyGraph} that has a {DependencyGraph::Vertex#path_to?} an # existing {DependencyGraph::Vertex} class CircularDependencyError < ResolverError # [Set] the dependencies responsible for causing the error attr_reader :dependencies # @param [Array] nodes the nodes in the dependency # that caused the error def initialize(nodes) super "There is a circular dependency between #{nodes.map(&:name).join(' and ')}" @dependencies = nodes.map(&:payload).to_set end end # An error caused by conflicts in version class VersionConflict < ResolverError # @return [{String => Resolution::Conflict}] the conflicts that caused # resolution to fail attr_reader :conflicts # @param [{String => Resolution::Conflict}] conflicts see {#conflicts} def initialize(conflicts) pairs = [] conflicts.values.flatten.map(&:requirements).flatten.each do |conflicting| conflicting.each do |source, conflict_requirements| conflict_requirements.each do |c| pairs << [c, source] end end end super "Unable to satisfy the following requirements:\n\n" \ "#{pairs.map { |r, d| "- `#{r}` required by `#{d}`" }.join("\n")}" @conflicts = conflicts end end end bundler-1.11.2/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb0000644000004100000410000000303612652443364025720 0ustar www-datawww-datarequire 'bundler/vendor/molinillo/lib/molinillo/dependency_graph' module Bundler::Molinillo # This class encapsulates a dependency resolver. # The resolver is responsible for determining which set of dependencies to # activate, with feedback from the the {#specification_provider} # # class Resolver require 'bundler/vendor/molinillo/lib/molinillo/resolution' # @return [SpecificationProvider] the specification provider used # in the resolution process attr_reader :specification_provider # @return [UI] the UI module used to communicate back to the user # during the resolution process attr_reader :resolver_ui # @param [SpecificationProvider] specification_provider # see {#specification_provider} # @param [UI] resolver_ui # see {#resolver_ui} def initialize(specification_provider, resolver_ui) @specification_provider = specification_provider @resolver_ui = resolver_ui end # Resolves the requested dependencies into a {DependencyGraph}, # locking to the base dependency graph (if specified) # @param [Array] requested an array of 'requested' dependencies that the # {#specification_provider} can understand # @param [DependencyGraph,nil] base the base dependency graph to which # dependencies should be 'locked' def resolve(requested, base = DependencyGraph.new) Resolution.new(specification_provider, resolver_ui, requested, base). resolve end end end bundler-1.11.2/lib/bundler/vendor/molinillo/lib/molinillo/modules/0000755000004100000410000000000012652443364025200 5ustar www-datawww-databundler-1.11.2/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb0000644000004100000410000000311612652443364026143 0ustar www-datawww-datamodule Bundler::Molinillo # Conveys information about the resolution process to a user. module UI # The {IO} object that should be used to print output. `STDOUT`, by default. # # @return [IO] def output STDOUT end # Called roughly every {#progress_rate}, this method should convey progress # to the user. # # @return [void] def indicate_progress output.print '.' unless debug? end # How often progress should be conveyed to the user via # {#indicate_progress}, in seconds. A third of a second, by default. # # @return [Float] def progress_rate 0.33 end # Called before resolution begins. # # @return [void] def before_resolution output.print 'Resolving dependencies...' end # Called after resolution ends (either successfully or with an error). # By default, prints a newline. # # @return [void] def after_resolution output.puts end # Conveys debug information to the user. # # @param [Integer] depth the current depth of the resolution process. # @return [void] def debug(depth = 0) if debug? debug_info = yield debug_info = debug_info.inspect unless debug_info.is_a?(String) output.puts debug_info.split("\n").map { |s| ' ' * depth + s } end end # Whether or not debug messages should be printed. # By default, whether or not the `MOLINILLO_DEBUG` environment variable is # set. # # @return [Boolean] def debug? @debug_mode ||= ENV['MOLINILLO_DEBUG'] end end end bundler-1.11.2/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb0000644000004100000410000000724112652443364032263 0ustar www-datawww-datamodule Bundler::Molinillo # Provides information about specifcations and dependencies to the resolver, # allowing the {Resolver} class to remain generic while still providing power # and flexibility. # # This module contains the methods that users of Bundler::Molinillo must to implement, # using knowledge of their own model classes. module SpecificationProvider # Search for the specifications that match the given dependency. # The specifications in the returned array will be considered in reverse # order, so the latest version ought to be last. # @note This method should be 'pure', i.e. the return value should depend # only on the `dependency` parameter. # # @param [Object] dependency # @return [Array] the specifications that satisfy the given # `dependency`. def search_for(dependency) [] end # Returns the dependencies of `specification`. # @note This method should be 'pure', i.e. the return value should depend # only on the `specification` parameter. # # @param [Object] specification # @return [Array] the dependencies that are required by the given # `specification`. def dependencies_for(specification) [] end # Determines whether the given `requirement` is satisfied by the given # `spec`, in the context of the current `activated` dependency graph. # # @param [Object] requirement # @param [DependencyGraph] activated the current dependency graph in the # resolution process. # @param [Object] spec # @return [Boolean] whether `requirement` is satisfied by `spec` in the # context of the current `activated` dependency graph. def requirement_satisfied_by?(requirement, activated, spec) true end # Returns the name for the given `dependency`. # @note This method should be 'pure', i.e. the return value should depend # only on the `dependency` parameter. # # @param [Object] dependency # @return [String] the name for the given `dependency`. def name_for(dependency) dependency.to_s end # @return [String] the name of the source of explicit dependencies, i.e. # those passed to {Resolver#resolve} directly. def name_for_explicit_dependency_source 'user-specified dependency' end # @return [String] the name of the source of 'locked' dependencies, i.e. # those passed to {Resolver#resolve} directly as the `base` def name_for_locking_dependency_source 'Lockfile' end # Sort dependencies so that the ones that are easiest to resolve are first. # Easiest to resolve is (usually) defined by: # 1) Is this dependency already activated? # 2) How relaxed are the requirements? # 3) Are there any conflicts for this dependency? # 4) How many possibilities are there to satisfy this dependency? # # @param [Array] dependencies # @param [DependencyGraph] activated the current dependency graph in the # resolution process. # @param [{String => Array}] conflicts # @return [Array] a sorted copy of `dependencies`. def sort_dependencies(dependencies, activated, conflicts) dependencies.sort_by do |dependency| name = name_for(dependency) [ activated.vertex_named(name).payload ? 0 : 1, conflicts[name] ? 0 : 1, ] end end # Returns whether this dependency, which has no possible matching # specifications, can safely be ignored. # # @param [Object] dependency # @return [Boolean] whether this dependency can safely be skipped. def allow_missing?(dependency) false end end end bundler-1.11.2/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb0000644000004100000410000004105512652443364026265 0ustar www-datawww-datamodule Bundler::Molinillo class Resolver # A specific resolution from a given {Resolver} class Resolution # A conflict that the resolution process encountered # @attr [Object] requirement the requirement that immediately led to the conflict # @attr [{String,Nil=>[Object]}] requirements the requirements that caused the conflict # @attr [Object, nil] existing the existing spec that was in conflict with # the {#possibility} # @attr [Object] possibility the spec that was unable to be activated due # to a conflict # @attr [Object] locked_requirement the relevant locking requirement. # @attr [Array>] requirement_trees the different requirement # trees that led to every requirement for the conflicting name. # @attr [{String=>Object}] activated_by_name the already-activated specs. Conflict = Struct.new( :requirement, :requirements, :existing, :possibility, :locked_requirement, :requirement_trees, :activated_by_name ) # @return [SpecificationProvider] the provider that knows about # dependencies, requirements, specifications, versions, etc. attr_reader :specification_provider # @return [UI] the UI that knows how to communicate feedback about the # resolution process back to the user attr_reader :resolver_ui # @return [DependencyGraph] the base dependency graph to which # dependencies should be 'locked' attr_reader :base # @return [Array] the dependencies that were explicitly required attr_reader :original_requested # @param [SpecificationProvider] specification_provider # see {#specification_provider} # @param [UI] resolver_ui see {#resolver_ui} # @param [Array] requested see {#original_requested} # @param [DependencyGraph] base see {#base} def initialize(specification_provider, resolver_ui, requested, base) @specification_provider = specification_provider @resolver_ui = resolver_ui @original_requested = requested @base = base @states = [] @iteration_counter = 0 end # Resolves the {#original_requested} dependencies into a full dependency # graph # @raise [ResolverError] if successful resolution is impossible # @return [DependencyGraph] the dependency graph of successfully resolved # dependencies def resolve start_resolution while state break unless state.requirements.any? || state.requirement indicate_progress if state.respond_to?(:pop_possibility_state) # DependencyState debug(depth) { "Creating possibility state for #{requirement} (#{possibilities.count} remaining)" } state.pop_possibility_state.tap { |s| states.push(s) if s } end process_topmost_state end activated.freeze ensure end_resolution end # @return [Integer] the number of resolver iterations in between calls to # {#resolver_ui}'s {UI#indicate_progress} method attr_accessor :iteration_rate private :iteration_rate # @return [Time] the time at which resolution began attr_accessor :started_at private :started_at # @return [Array] the stack of states for the resolution attr_accessor :states private :states private # Sets up the resolution process # @return [void] def start_resolution @started_at = Time.now handle_missing_or_push_dependency_state(initial_state) debug { "Starting resolution (#{@started_at})" } resolver_ui.before_resolution end # Ends the resolution process # @return [void] def end_resolution resolver_ui.after_resolution debug do "Finished resolution (#{@iteration_counter} steps) " \ "(Took #{(ended_at = Time.now) - @started_at} seconds) (#{ended_at})" end debug { 'Unactivated: ' + Hash[activated.vertices.reject { |_n, v| v.payload }].keys.join(', ') } if state debug { 'Activated: ' + Hash[activated.vertices.select { |_n, v| v.payload }].keys.join(', ') } if state end require 'bundler/vendor/molinillo/lib/molinillo/state' require 'bundler/vendor/molinillo/lib/molinillo/modules/specification_provider' ResolutionState.new.members.each do |member| define_method member do |*args, &block| current_state = state || ResolutionState.empty current_state.send(member, *args, &block) end end SpecificationProvider.instance_methods(false).each do |instance_method| define_method instance_method do |*args, &block| begin specification_provider.send(instance_method, *args, &block) rescue NoSuchDependencyError => error if state vertex = activated.vertex_named(name_for error.dependency) error.required_by += vertex.incoming_edges.map { |e| e.origin.name } error.required_by << name_for_explicit_dependency_source unless vertex.explicit_requirements.empty? end raise end end end # Processes the topmost available {RequirementState} on the stack # @return [void] def process_topmost_state if possibility attempt_to_activate else create_conflict if state.is_a? PossibilityState unwind_for_conflict until possibility && state.is_a?(DependencyState) end end # @return [Object] the current possibility that the resolution is trying # to activate def possibility possibilities.last end # @return [RequirementState] the current state the resolution is # operating upon def state states.last end # Creates the initial state for the resolution, based upon the # {#requested} dependencies # @return [DependencyState] the initial state for the resolution def initial_state graph = DependencyGraph.new.tap do |dg| original_requested.each { |r| dg.add_vertex(name_for(r), nil, true).tap { |v| v.explicit_requirements << r } } end requirements = sort_dependencies(original_requested, graph, {}) initial_requirement = requirements.shift DependencyState.new( initial_requirement && name_for(initial_requirement), requirements, graph, initial_requirement, initial_requirement && search_for(initial_requirement), 0, {} ) end # Unwinds the states stack because a conflict has been encountered # @return [void] def unwind_for_conflict debug(depth) { "Unwinding for conflict: #{requirement}" } conflicts.tap do |c| states.slice!((state_index_for_unwind + 1)..-1) raise VersionConflict.new(c) unless state state.conflicts = c end end # @return [Integer] The index to which the resolution should unwind in the # case of conflict. def state_index_for_unwind current_requirement = requirement existing_requirement = requirement_for_existing_name(name) until current_requirement.nil? current_state = find_state_for(current_requirement) return states.index(current_state) if state_any?(current_state) current_requirement = parent_of(current_requirement) end until existing_requirement.nil? existing_state = find_state_for(existing_requirement) return states.index(existing_state) if state_any?(existing_state) existing_requirement = parent_of(existing_requirement) end -1 end # @return [Object] the requirement that led to `requirement` being added # to the list of requirements. def parent_of(requirement) return nil unless requirement seen = false state = states.reverse_each.find do |s| seen ||= s.requirement == requirement || s.requirements.include?(requirement) seen && s.requirement != requirement && !s.requirements.include?(requirement) end state && state.requirement end # @return [Object] the requirement that led to a version of a possibility # with the given name being activated. def requirement_for_existing_name(name) return nil unless activated.vertex_named(name).payload states.reverse_each.find { |s| !s.activated.vertex_named(name).payload }.requirement end # @return [ResolutionState] the state whose `requirement` is the given # `requirement`. def find_state_for(requirement) return nil unless requirement states.reverse_each.find { |i| requirement == i.requirement && i.is_a?(DependencyState) } end # @return [Boolean] whether or not the given state has any possibilities # left. def state_any?(state) state && state.possibilities.any? end # @return [Conflict] a {Conflict} that reflects the failure to activate # the {#possibility} in conjunction with the current {#state} def create_conflict vertex = activated.vertex_named(name) requirements = { name_for_explicit_dependency_source => vertex.explicit_requirements, name_for_locking_dependency_source => Array(locked_requirement_named(name)), } vertex.incoming_edges.each { |edge| (requirements[edge.origin.payload] ||= []).unshift(edge.requirement) } conflicts[name] = Conflict.new( requirement, Hash[requirements.select { |_, r| !r.empty? }], vertex.payload, possibility, locked_requirement_named(name), requirement_trees, Hash[activated.map { |v| [v.name, v.payload] }.select(&:last)] ) end # @return [Array>] The different requirement # trees that led to every requirement for the current spec. def requirement_trees vertex = activated.vertex_named(name) vertex.requirements.map { |r| requirement_tree_for(r) } end # @return [Array] the list of requirements that led to # `requirement` being required. def requirement_tree_for(requirement) tree = [] while requirement tree.unshift(requirement) requirement = parent_of(requirement) end tree end # Indicates progress roughly once every second # @return [void] def indicate_progress @iteration_counter += 1 @progress_rate ||= resolver_ui.progress_rate if iteration_rate.nil? if Time.now - started_at >= @progress_rate self.iteration_rate = @iteration_counter end end if iteration_rate && (@iteration_counter % iteration_rate) == 0 resolver_ui.indicate_progress end end # Calls the {#resolver_ui}'s {UI#debug} method # @param [Integer] depth the depth of the {#states} stack # @param [Proc] block a block that yields a {#to_s} # @return [void] def debug(depth = 0, &block) resolver_ui.debug(depth, &block) end # Attempts to activate the current {#possibility} # @return [void] def attempt_to_activate debug(depth) { 'Attempting to activate ' + possibility.to_s } existing_node = activated.vertex_named(name) if existing_node.payload debug(depth) { "Found existing spec (#{existing_node.payload})" } attempt_to_activate_existing_spec(existing_node) else attempt_to_activate_new_spec end end # Attempts to activate the current {#possibility} (given that it has # already been activated) # @return [void] def attempt_to_activate_existing_spec(existing_node) existing_spec = existing_node.payload if requirement_satisfied_by?(requirement, activated, existing_spec) new_requirements = requirements.dup push_state_for_requirements(new_requirements, false) else return if attempt_to_swap_possibility create_conflict debug(depth) { "Unsatisfied by existing spec (#{existing_node.payload})" } unwind_for_conflict end end # Attempts to swp the current {#possibility} with the already-activated # spec with the given name # @return [Boolean] Whether the possibility was swapped into {#activated} def attempt_to_swap_possibility swapped = activated.dup swapped.vertex_named(name).payload = possibility return unless swapped.vertex_named(name).requirements. all? { |r| requirement_satisfied_by?(r, swapped, possibility) } attempt_to_activate_new_spec end # Attempts to activate the current {#possibility} (given that it hasn't # already been activated) # @return [void] def attempt_to_activate_new_spec satisfied = begin locked_requirement = locked_requirement_named(name) requested_spec_satisfied = requirement_satisfied_by?(requirement, activated, possibility) locked_spec_satisfied = !locked_requirement || requirement_satisfied_by?(locked_requirement, activated, possibility) debug(depth) { 'Unsatisfied by requested spec' } unless requested_spec_satisfied debug(depth) { 'Unsatisfied by locked spec' } unless locked_spec_satisfied requested_spec_satisfied && locked_spec_satisfied end if satisfied activate_spec else create_conflict unwind_for_conflict end end # @param [String] requirement_name the spec name to search for # @return [Object] the locked spec named `requirement_name`, if one # is found on {#base} def locked_requirement_named(requirement_name) vertex = base.vertex_named(requirement_name) vertex && vertex.payload end # Add the current {#possibility} to the dependency graph of the current # {#state} # @return [void] def activate_spec conflicts.delete(name) debug(depth) { 'Activated ' + name + ' at ' + possibility.to_s } vertex = activated.vertex_named(name) vertex.payload = possibility require_nested_dependencies_for(possibility) end # Requires the dependencies that the recently activated spec has # @param [Object] activated_spec the specification that has just been # activated # @return [void] def require_nested_dependencies_for(activated_spec) nested_dependencies = dependencies_for(activated_spec) debug(depth) { "Requiring nested dependencies (#{nested_dependencies.map(&:to_s).join(', ')})" } nested_dependencies.each { |d| activated.add_child_vertex(name_for(d), nil, [name_for(activated_spec)], d) } push_state_for_requirements(requirements + nested_dependencies, nested_dependencies.size > 0) end # Pushes a new {DependencyState} that encapsulates both existing and new # requirements # @param [Array] new_requirements # @return [void] def push_state_for_requirements(new_requirements, requires_sort = true, new_activated = activated.dup) new_requirements = sort_dependencies(new_requirements.uniq, new_activated, conflicts) if requires_sort new_requirement = new_requirements.shift new_name = new_requirement ? name_for(new_requirement) : '' possibilities = new_requirement ? search_for(new_requirement) : [] handle_missing_or_push_dependency_state DependencyState.new( new_name, new_requirements, new_activated, new_requirement, possibilities, depth, conflicts.dup ) end # Pushes a new {DependencyState}. # If the {#specification_provider} says to # {SpecificationProvider#allow_missing?} that particular requirement, and # there are no possibilities for that requirement, then `state` is not # pushed, and the node in {#activated} is removed, and we continue # resolving the remaining requirements. # @param [DependencyState] state # @return [void] def handle_missing_or_push_dependency_state(state) if state.requirement && state.possibilities.empty? && allow_missing?(state.requirement) state.activated.detach_vertex_named(state.name) push_state_for_requirements(state.requirements.dup, false, state.activated) else states.push state end end end end end bundler-1.11.2/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb0000644000004100000410000002117312652443364027360 0ustar www-datawww-datarequire 'set' require 'tsort' module Bundler::Molinillo # A directed acyclic graph that is tuned to hold named dependencies class DependencyGraph include Enumerable # Enumerates through the vertices of the graph. # @return [Array] The graph's vertices. def each vertices.values.each { |v| yield v } end include TSort alias_method :tsort_each_node, :each def tsort_each_child(vertex, &block) vertex.successors.each(&block) end # Topologically sorts the given vertices. # @param [Enumerable] vertices the vertices to be sorted, which must # all belong to the same graph. # @return [Array] The sorted vertices. def self.tsort(vertices) TSort.tsort( lambda { |b| vertices.each(&b) }, lambda { |v, &b| (v.successors & vertices).each(&b) } ) end # A directed edge of a {DependencyGraph} # @attr [Vertex] origin The origin of the directed edge # @attr [Vertex] destination The destination of the directed edge # @attr [Object] requirement The requirement the directed edge represents Edge = Struct.new(:origin, :destination, :requirement) # @return [{String => Vertex}] the vertices of the dependency graph, keyed # by {Vertex#name} attr_reader :vertices def initialize @vertices = {} end # Initializes a copy of a {DependencyGraph}, ensuring that all {#vertices} # are properly copied. def initialize_copy(other) super @vertices = {} traverse = lambda do |new_v, old_v| return if new_v.outgoing_edges.size == old_v.outgoing_edges.size old_v.outgoing_edges.each do |edge| destination = add_vertex(edge.destination.name, edge.destination.payload) add_edge_no_circular(new_v, destination, edge.requirement) traverse.call(destination, edge.destination) end end other.vertices.each do |name, vertex| new_vertex = add_vertex(name, vertex.payload, vertex.root?) new_vertex.explicit_requirements.replace(vertex.explicit_requirements) traverse.call(new_vertex, vertex) end end # @return [String] a string suitable for debugging def inspect "#{self.class}:#{vertices.values.inspect}" end # @return [Boolean] whether the two dependency graphs are equal, determined # by a recursive traversal of each {#root_vertices} and its # {Vertex#successors} def ==(other) return false unless other vertices.each do |name, vertex| other_vertex = other.vertex_named(name) return false unless other_vertex return false unless other_vertex.successors.map(&:name).to_set == vertex.successors.map(&:name).to_set end end # @param [String] name # @param [Object] payload # @param [Array] parent_names # @param [Object] requirement the requirement that is requiring the child # @return [void] def add_child_vertex(name, payload, parent_names, requirement) vertex = add_vertex(name, payload) parent_names.each do |parent_name| unless parent_name vertex.root = true next end parent_node = vertex_named(parent_name) add_edge(parent_node, vertex, requirement) end vertex end # @param [String] name # @param [Object] payload # @return [Vertex] the vertex that was added to `self` def add_vertex(name, payload, root = false) vertex = vertices[name] ||= Vertex.new(name, payload) vertex.payload ||= payload vertex.root ||= root vertex end # Detaches the {#vertex_named} `name` {Vertex} from the graph, recursively # removing any non-root vertices that were orphaned in the process # @param [String] name # @return [void] def detach_vertex_named(name) return unless vertex = vertices.delete(name) vertex.outgoing_edges.each do |e| v = e.destination v.incoming_edges.delete(e) detach_vertex_named(v.name) unless v.root? || v.predecessors.any? end end # @param [String] name # @return [Vertex,nil] the vertex with the given name def vertex_named(name) vertices[name] end # @param [String] name # @return [Vertex,nil] the root vertex with the given name def root_vertex_named(name) vertex = vertex_named(name) vertex if vertex && vertex.root? end # Adds a new {Edge} to the dependency graph # @param [Vertex] origin # @param [Vertex] destination # @param [Object] requirement the requirement that this edge represents # @return [Edge] the added edge def add_edge(origin, destination, requirement) if destination.path_to?(origin) raise CircularDependencyError.new([origin, destination]) end add_edge_no_circular(origin, destination, requirement) end private def add_edge_no_circular(origin, destination, requirement) edge = Edge.new(origin, destination, requirement) origin.outgoing_edges << edge destination.incoming_edges << edge edge end # A vertex in a {DependencyGraph} that encapsulates a {#name} and a # {#payload} class Vertex # @return [String] the name of the vertex attr_accessor :name # @return [Object] the payload the vertex holds attr_accessor :payload # @return [Arrary] the explicit requirements that required # this vertex attr_reader :explicit_requirements # @return [Boolean] whether the vertex is considered a root vertex attr_accessor :root alias_method :root?, :root # @param [String] name see {#name} # @param [Object] payload see {#payload} def initialize(name, payload) @name = name @payload = payload @explicit_requirements = [] @outgoing_edges = [] @incoming_edges = [] end # @return [Array] all of the requirements that required # this vertex def requirements incoming_edges.map(&:requirement) + explicit_requirements end # @return [Array] the edges of {#graph} that have `self` as their # {Edge#origin} attr_accessor :outgoing_edges # @return [Array] the edges of {#graph} that have `self` as their # {Edge#destination} attr_accessor :incoming_edges # @return [Array] the vertices of {#graph} that have an edge with # `self` as their {Edge#destination} def predecessors incoming_edges.map(&:origin) end # @return [Array] the vertices of {#graph} where `self` is a # {#descendent?} def recursive_predecessors vertices = predecessors vertices += vertices.map(&:recursive_predecessors).flatten(1) vertices.uniq! vertices end # @return [Array] the vertices of {#graph} that have an edge with # `self` as their {Edge#origin} def successors outgoing_edges.map(&:destination) end # @return [Array] the vertices of {#graph} where `self` is an # {#ancestor?} def recursive_successors vertices = successors vertices += vertices.map(&:recursive_successors).flatten(1) vertices.uniq! vertices end # @return [String] a string suitable for debugging def inspect "#{self.class}:#{name}(#{payload.inspect})" end # @return [Boolean] whether the two vertices are equal, determined # by a recursive traversal of each {Vertex#successors} def ==(other) shallow_eql?(other) && successors.to_set == other.successors.to_set end # @return [Boolean] whether the two vertices are equal, determined # solely by {#name} and {#payload} equality def shallow_eql?(other) other && name == other.name && payload == other.payload end alias_method :eql?, :== # @return [Fixnum] a hash for the vertex based upon its {#name} def hash name.hash end # Is there a path from `self` to `other` following edges in the # dependency graph? # @return true iff there is a path following edges within this {#graph} def path_to?(other) equal?(other) || successors.any? { |v| v.path_to?(other) } end alias_method :descendent?, :path_to? # Is there a path from `other` to `self` following edges in the # dependency graph? # @return true iff there is a path following edges within this {#graph} def ancestor?(other) other.path_to?(self) end alias_method :is_reachable_from?, :ancestor? end end end bundler-1.11.2/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb0000644000004100000410000000006212652443364026463 0ustar www-datawww-datamodule Bundler::Molinillo VERSION = '0.4.0' end bundler-1.11.2/lib/bundler/vendor/molinillo/lib/molinillo/state.rb0000644000004100000410000000244712652443364025204 0ustar www-datawww-datamodule Bundler::Molinillo # A state that a {Resolution} can be in # @attr [String] name # @attr [Array] requirements # @attr [DependencyGraph] activated # @attr [Object] requirement # @attr [Object] possibility # @attr [Integer] depth # @attr [Set] conflicts ResolutionState = Struct.new( :name, :requirements, :activated, :requirement, :possibilities, :depth, :conflicts ) class ResolutionState # Returns an empty resolution state # @return [ResolutionState] an empty state def self.empty new(nil, [], DependencyGraph.new, nil, nil, 0, Set.new) end end # A state that encapsulates a set of {#requirements} with an {Array} of # possibilities class DependencyState < ResolutionState # Removes a possibility from `self` # @return [PossibilityState] a state with a single possibility, # the possibility that was removed from `self` def pop_possibility_state PossibilityState.new( name, requirements.dup, activated.dup, requirement, [possibilities.pop], depth + 1, conflicts.dup ) end end # A state that encapsulates a single possibility to fulfill the given # {#requirement} class PossibilityState < ResolutionState end end bundler-1.11.2/lib/bundler/vendor/molinillo/lib/molinillo.rb0000644000004100000410000000047412652443364024062 0ustar www-datawww-datarequire 'bundler/vendor/molinillo/lib/molinillo/gem_metadata' require 'bundler/vendor/molinillo/lib/molinillo/errors' require 'bundler/vendor/molinillo/lib/molinillo/resolver' require 'bundler/vendor/molinillo/lib/molinillo/modules/ui' require 'bundler/vendor/molinillo/lib/molinillo/modules/specification_provider' bundler-1.11.2/lib/bundler/vendor/net/0000755000004100000410000000000012652443364017554 5ustar www-datawww-databundler-1.11.2/lib/bundler/vendor/net/http/0000755000004100000410000000000012652443364020533 5ustar www-datawww-databundler-1.11.2/lib/bundler/vendor/net/http/persistent/0000755000004100000410000000000012652443364022733 5ustar www-datawww-databundler-1.11.2/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb0000644000004100000410000000776212652443364025300 0ustar www-datawww-data## # This Net::HTTP subclass adds SSL session reuse and Server Name Indication # (SNI) RFC 3546. # # DO NOT DEPEND UPON THIS CLASS # # This class is an implementation detail and is subject to change or removal # at any time. class Net::HTTP::Persistent::SSLReuse < Net::HTTP @is_proxy_class = false @proxy_addr = nil @proxy_port = nil @proxy_user = nil @proxy_pass = nil def initialize address, port = nil # :nodoc: super @ssl_session = nil end ## # From ruby trunk r33086 including http://redmine.ruby-lang.org/issues/5341 def connect # :nodoc: D "opening connection to #{conn_address()}..." s = timeout(@open_timeout) { TCPSocket.open(conn_address(), conn_port()) } D "opened" if use_ssl? ssl_parameters = Hash.new iv_list = instance_variables SSL_ATTRIBUTES.each do |name| ivname = "@#{name}".intern if iv_list.include?(ivname) and value = instance_variable_get(ivname) ssl_parameters[name] = value end end unless @ssl_context then @ssl_context = OpenSSL::SSL::SSLContext.new @ssl_context.set_params(ssl_parameters) end s = OpenSSL::SSL::SSLSocket.new(s, @ssl_context) s.sync_close = true end @socket = Net::BufferedIO.new(s) @socket.read_timeout = @read_timeout @socket.continue_timeout = @continue_timeout if @socket.respond_to? :continue_timeout @socket.debug_output = @debug_output if use_ssl? begin if proxy? @socket.writeline sprintf('CONNECT %s:%s HTTP/%s', @address, @port, HTTPVersion) @socket.writeline "Host: #{@address}:#{@port}" if proxy_user credential = ["#{proxy_user}:#{proxy_pass}"].pack('m') credential.delete!("\r\n") @socket.writeline "Proxy-Authorization: Basic #{credential}" end @socket.writeline '' Net::HTTPResponse.read_new(@socket).value end s.session = @ssl_session if @ssl_session # Server Name Indication (SNI) RFC 3546 s.hostname = @address if s.respond_to? :hostname= timeout(@open_timeout) { s.connect } if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE s.post_connection_check(@address) end @ssl_session = s.session rescue => exception D "Conn close because of connect error #{exception}" @socket.close if @socket and not @socket.closed? raise exception end end on_connect end if RUBY_VERSION > '1.9' ## # From ruby_1_8_7 branch r29865 including a modified # http://redmine.ruby-lang.org/issues/5341 def connect # :nodoc: D "opening connection to #{conn_address()}..." s = timeout(@open_timeout) { TCPSocket.open(conn_address(), conn_port()) } D "opened" if use_ssl? unless @ssl_context.verify_mode warn "warning: peer certificate won't be verified in this SSL session" @ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE end s = OpenSSL::SSL::SSLSocket.new(s, @ssl_context) s.sync_close = true end @socket = Net::BufferedIO.new(s) @socket.read_timeout = @read_timeout @socket.debug_output = @debug_output if use_ssl? if proxy? @socket.writeline sprintf('CONNECT %s:%s HTTP/%s', @address, @port, HTTPVersion) @socket.writeline "Host: #{@address}:#{@port}" if proxy_user credential = ["#{proxy_user}:#{proxy_pass}"].pack('m') credential.delete!("\r\n") @socket.writeline "Proxy-Authorization: Basic #{credential}" end @socket.writeline '' Net::HTTPResponse.read_new(@socket).value end s.session = @ssl_session if @ssl_session s.connect if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE s.post_connection_check(@address) end @ssl_session = s.session end on_connect end if RUBY_VERSION < '1.9' private :connect end bundler-1.11.2/lib/bundler/vendor/net/http/persistent.rb0000644000004100000410000010066212652443364023265 0ustar www-datawww-datarequire 'net/http' begin require 'net/https' rescue LoadError # net/https or openssl end if RUBY_VERSION < '1.9' # but only for 1.8 require 'net/http/faster' require 'uri' require 'cgi' # for escaping begin require 'net/http/pipeline' rescue LoadError end autoload :OpenSSL, 'openssl' ## # Persistent connections for Net::HTTP # # Net::HTTP::Persistent maintains persistent connections across all the # servers you wish to talk to. For each host:port you communicate with a # single persistent connection is created. # # Multiple Net::HTTP::Persistent objects will share the same set of # connections. # # For each thread you start a new connection will be created. A # Net::HTTP::Persistent connection will not be shared across threads. # # You can shut down the HTTP connections when done by calling #shutdown. You # should name your Net::HTTP::Persistent object if you intend to call this # method. # # Example: # # require 'net/http/persistent' # # uri = URI 'http://example.com/awesome/web/service' # # http = Net::HTTP::Persistent.new 'my_app_name' # # # perform a GET # response = http.request uri # # # or # # get = Net::HTTP::Get.new uri.request_uri # response = http.request get # # # create a POST # post_uri = uri + 'create' # post = Net::HTTP::Post.new post_uri.path # post.set_form_data 'some' => 'cool data' # # # perform the POST, the URI is always required # response http.request post_uri, post # # Note that for GET, HEAD and other requests that do not have a body you want # to use URI#request_uri not URI#path. The request_uri contains the query # params which are sent in the body for other requests. # # == SSL # # SSL connections are automatically created depending upon the scheme of the # URI. SSL connections are automatically verified against the default # certificate store for your computer. You can override this by changing # verify_mode or by specifying an alternate cert_store. # # Here are the SSL settings, see the individual methods for documentation: # # #certificate :: This client's certificate # #ca_file :: The certificate-authority # #cert_store :: An SSL certificate store # #private_key :: The client's SSL private key # #reuse_ssl_sessions :: Reuse a previously opened SSL session for a new # connection # #ssl_version :: Which specific SSL version to use # #verify_callback :: For server certificate verification # #verify_mode :: How connections should be verified # # == Proxies # # A proxy can be set through #proxy= or at initialization time by providing a # second argument to ::new. The proxy may be the URI of the proxy server or # :ENV which will consult environment variables. # # See #proxy= and #proxy_from_env for details. # # == Headers # # Headers may be specified for use in every request. #headers are appended to # any headers on the request. #override_headers replace existing headers on # the request. # # The difference between the two can be seen in setting the User-Agent. Using # http.headers['User-Agent'] = 'MyUserAgent' will send "Ruby, # MyUserAgent" while http.override_headers['User-Agent'] = # 'MyUserAgent' will send "MyUserAgent". # # == Tuning # # === Segregation # # By providing an application name to ::new you can separate your connections # from the connections of other applications. # # === Idle Timeout # # If a connection hasn't been used for this number of seconds it will automatically be # reset upon the next use to avoid attempting to send to a closed connection. # The default value is 5 seconds. nil means no timeout. Set through #idle_timeout. # # Reducing this value may help avoid the "too many connection resets" error # when sending non-idempotent requests while increasing this value will cause # fewer round-trips. # # === Read Timeout # # The amount of time allowed between reading two chunks from the socket. Set # through #read_timeout # # === Max Requests # # The number of requests that should be made before opening a new connection. # Typically many keep-alive capable servers tune this to 100 or less, so the # 101st request will fail with ECONNRESET. If unset (default), this value has no # effect, if set, connections will be reset on the request after max_requests. # # === Open Timeout # # The amount of time to wait for a connection to be opened. Set through # #open_timeout. # # === Socket Options # # Socket options may be set on newly-created connections. See #socket_options # for details. # # === Non-Idempotent Requests # # By default non-idempotent requests will not be retried per RFC 2616. By # setting retry_change_requests to true requests will automatically be retried # once. # # Only do this when you know that retrying a POST or other non-idempotent # request is safe for your application and will not create duplicate # resources. # # The recommended way to handle non-idempotent requests is the following: # # require 'net/http/persistent' # # uri = URI 'http://example.com/awesome/web/service' # post_uri = uri + 'create' # # http = Net::HTTP::Persistent.new 'my_app_name' # # post = Net::HTTP::Post.new post_uri.path # # ... fill in POST request # # begin # response = http.request post_uri, post # rescue Net::HTTP::Persistent::Error # # # POST failed, make a new request to verify the server did not process # # the request # exists_uri = uri + '...' # response = http.get exists_uri # # # Retry if it failed # retry if response.code == '404' # end # # The method of determining if the resource was created or not is unique to # the particular service you are using. Of course, you will want to add # protection from infinite looping. # # === Connection Termination # # If you are done using the Net::HTTP::Persistent instance you may shut down # all the connections in the current thread with #shutdown. This is not # recommended for normal use, it should only be used when it will be several # minutes before you make another HTTP request. # # If you are using multiple threads, call #shutdown in each thread when the # thread is done making requests. If you don't call shutdown, that's OK. # Ruby will automatically garbage collect and shutdown your HTTP connections # when the thread terminates. class Net::HTTP::Persistent ## # The beginning of Time EPOCH = Time.at 0 # :nodoc: ## # Is OpenSSL available? This test works with autoload HAVE_OPENSSL = defined? OpenSSL::SSL # :nodoc: ## # The version of Net::HTTP::Persistent you are using VERSION = '2.9.3' ## # Exceptions rescued for automatic retry on ruby 2.0.0. This overlaps with # the exception list for ruby 1.x. RETRIED_EXCEPTIONS = [ # :nodoc: (Net::ReadTimeout if Net.const_defined? :ReadTimeout), IOError, EOFError, Errno::ECONNRESET, Errno::ECONNABORTED, Errno::EPIPE, (OpenSSL::SSL::SSLError if HAVE_OPENSSL), Timeout::Error, ].compact ## # Error class for errors raised by Net::HTTP::Persistent. Various # SystemCallErrors are re-raised with a human-readable message under this # class. class Error < StandardError; end ## # Use this method to detect the idle timeout of the host at +uri+. The # value returned can be used to configure #idle_timeout. +max+ controls the # maximum idle timeout to detect. # # After # # Idle timeout detection is performed by creating a connection then # performing a HEAD request in a loop until the connection terminates # waiting one additional second per loop. # # NOTE: This may not work on ruby > 1.9. def self.detect_idle_timeout uri, max = 10 uri = URI uri unless uri.is_a?(URI::Generic) uri += '/' req = Net::HTTP::Head.new uri.request_uri http = new 'net-http-persistent detect_idle_timeout' connection = http.connection_for uri sleep_time = 0 loop do response = connection.request req $stderr.puts "HEAD #{uri} => #{response.code}" if $DEBUG unless response.is_a?(Net::HTTPOK) then raise Error, "bad response code #{response.code} detecting idle timeout" end break if sleep_time >= max sleep_time += 1 $stderr.puts "sleeping #{sleep_time}" if $DEBUG sleep sleep_time end rescue # ignore StandardErrors, we've probably found the idle timeout. ensure http.shutdown return sleep_time unless $! end ## # This client's OpenSSL::X509::Certificate attr_reader :certificate # For Net::HTTP parity alias cert certificate ## # An SSL certificate authority. Setting this will set verify_mode to # VERIFY_PEER. attr_reader :ca_file ## # An SSL certificate store. Setting this will override the default # certificate store. See verify_mode for more information. attr_reader :cert_store ## # Sends debug_output to this IO via Net::HTTP#set_debug_output. # # Never use this method in production code, it causes a serious security # hole. attr_accessor :debug_output ## # Current connection generation attr_reader :generation # :nodoc: ## # Where this instance's connections live in the thread local variables attr_reader :generation_key # :nodoc: ## # Headers that are added to every request using Net::HTTP#add_field attr_reader :headers ## # Maps host:port to an HTTP version. This allows us to enable version # specific features. attr_reader :http_versions ## # Maximum time an unused connection can remain idle before being # automatically closed. attr_accessor :idle_timeout ## # Maximum number of requests on a connection before it is considered expired # and automatically closed. attr_accessor :max_requests ## # The value sent in the Keep-Alive header. Defaults to 30. Not needed for # HTTP/1.1 servers. # # This may not work correctly for HTTP/1.0 servers # # This method may be removed in a future version as RFC 2616 does not # require this header. attr_accessor :keep_alive ## # A name for this connection. Allows you to keep your connections apart # from everybody else's. attr_reader :name ## # Seconds to wait until a connection is opened. See Net::HTTP#open_timeout attr_accessor :open_timeout ## # Headers that are added to every request using Net::HTTP#[]= attr_reader :override_headers ## # This client's SSL private key attr_reader :private_key # For Net::HTTP parity alias key private_key ## # The URL through which requests will be proxied attr_reader :proxy_uri ## # List of host suffixes which will not be proxied attr_reader :no_proxy ## # Seconds to wait until reading one block. See Net::HTTP#read_timeout attr_accessor :read_timeout ## # Where this instance's request counts live in the thread local variables attr_reader :request_key # :nodoc: ## # By default SSL sessions are reused to avoid extra SSL handshakes. Set # this to false if you have problems communicating with an HTTPS server # like: # # SSL_connect [...] read finished A: unexpected message (OpenSSL::SSL::SSLError) attr_accessor :reuse_ssl_sessions ## # An array of options for Socket#setsockopt. # # By default the TCP_NODELAY option is set on sockets. # # To set additional options append them to this array: # # http.socket_options << [Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, 1] attr_reader :socket_options ## # Current SSL connection generation attr_reader :ssl_generation # :nodoc: ## # Where this instance's SSL connections live in the thread local variables attr_reader :ssl_generation_key # :nodoc: ## # SSL version to use. # # By default, the version will be negotiated automatically between client # and server. Ruby 1.9 and newer only. attr_reader :ssl_version if RUBY_VERSION > '1.9' ## # Where this instance's last-use times live in the thread local variables attr_reader :timeout_key # :nodoc: ## # SSL verification callback. Used when ca_file is set. attr_reader :verify_callback ## # HTTPS verify mode. Defaults to OpenSSL::SSL::VERIFY_PEER which verifies # the server certificate. # # If no ca_file or cert_store is set the default system certificate store is # used. # # You can use +verify_mode+ to override any default values. attr_reader :verify_mode ## # Enable retries of non-idempotent requests that change data (e.g. POST # requests) when the server has disconnected. # # This will in the worst case lead to multiple requests with the same data, # but it may be useful for some applications. Take care when enabling # this option to ensure it is safe to POST or perform other non-idempotent # requests to the server. attr_accessor :retry_change_requests ## # Creates a new Net::HTTP::Persistent. # # Set +name+ to keep your connections apart from everybody else's. Not # required currently, but highly recommended. Your library name should be # good enough. This parameter will be required in a future version. # # +proxy+ may be set to a URI::HTTP or :ENV to pick up proxy options from # the environment. See proxy_from_env for details. # # In order to use a URI for the proxy you may need to do some extra work # beyond URI parsing if the proxy requires a password: # # proxy = URI 'http://proxy.example' # proxy.user = 'AzureDiamond' # proxy.password = 'hunter2' def initialize name = nil, proxy = nil @name = name @debug_output = nil @proxy_uri = nil @no_proxy = [] @headers = {} @override_headers = {} @http_versions = {} @keep_alive = 30 @open_timeout = nil @read_timeout = nil @idle_timeout = 5 @max_requests = nil @socket_options = [] @socket_options << [Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1] if Socket.const_defined? :TCP_NODELAY key = ['net_http_persistent', name].compact @generation_key = [key, 'generations' ].join('_').intern @ssl_generation_key = [key, 'ssl_generations'].join('_').intern @request_key = [key, 'requests' ].join('_').intern @timeout_key = [key, 'timeouts' ].join('_').intern @certificate = nil @ca_file = nil @private_key = nil @ssl_version = nil @verify_callback = nil @verify_mode = nil @cert_store = nil @generation = 0 # incremented when proxy URI changes @ssl_generation = 0 # incremented when SSL session variables change if HAVE_OPENSSL then @verify_mode = OpenSSL::SSL::VERIFY_PEER @reuse_ssl_sessions = OpenSSL::SSL.const_defined? :Session end @retry_change_requests = false @ruby_1 = RUBY_VERSION < '2' @retried_on_ruby_2 = !@ruby_1 self.proxy = proxy if proxy end ## # Sets this client's OpenSSL::X509::Certificate def certificate= certificate @certificate = certificate reconnect_ssl end # For Net::HTTP parity alias cert= certificate= ## # Sets the SSL certificate authority file. def ca_file= file @ca_file = file reconnect_ssl end ## # Overrides the default SSL certificate store used for verifying # connections. def cert_store= store @cert_store = store reconnect_ssl end ## # Finishes all connections on the given +thread+ that were created before # the given +generation+ in the threads +generation_key+ list. # # See #shutdown for a bunch of scary warning about misusing this method. def cleanup(generation, thread = Thread.current, generation_key = @generation_key) # :nodoc: timeouts = thread[@timeout_key] (0...generation).each do |old_generation| next unless thread[generation_key] conns = thread[generation_key].delete old_generation conns.each_value do |conn| finish conn, thread timeouts.delete conn.object_id if timeouts end if conns end end ## # Creates a new connection for +uri+ def connection_for uri Thread.current[@generation_key] ||= Hash.new { |h,k| h[k] = {} } Thread.current[@ssl_generation_key] ||= Hash.new { |h,k| h[k] = {} } Thread.current[@request_key] ||= Hash.new 0 Thread.current[@timeout_key] ||= Hash.new EPOCH use_ssl = uri.scheme.downcase == 'https' if use_ssl then raise Net::HTTP::Persistent::Error, 'OpenSSL is not available' unless HAVE_OPENSSL ssl_generation = @ssl_generation ssl_cleanup ssl_generation connections = Thread.current[@ssl_generation_key][ssl_generation] else generation = @generation cleanup generation connections = Thread.current[@generation_key][generation] end net_http_args = [uri.host, uri.port] connection_id = net_http_args.join ':' if @proxy_uri and not proxy_bypass? uri.host, uri.port then connection_id << @proxy_connection_id net_http_args.concat @proxy_args end connection = connections[connection_id] unless connection = connections[connection_id] then connections[connection_id] = http_class.new(*net_http_args) connection = connections[connection_id] ssl connection if use_ssl else reset connection if expired? connection end start connection unless connection.started? connection.read_timeout = @read_timeout if @read_timeout connection.keep_alive_timeout = @idle_timeout if @idle_timeout && connection.respond_to?(:keep_alive_timeout=) connection rescue Errno::ECONNREFUSED address = connection.proxy_address || connection.address port = connection.proxy_port || connection.port raise Error, "connection refused: #{address}:#{port}" rescue Errno::EHOSTDOWN address = connection.proxy_address || connection.address port = connection.proxy_port || connection.port raise Error, "host down: #{address}:#{port}" end ## # Returns an error message containing the number of requests performed on # this connection def error_message connection requests = Thread.current[@request_key][connection.object_id] - 1 # fixup last_use = Thread.current[@timeout_key][connection.object_id] age = Time.now - last_use "after #{requests} requests on #{connection.object_id}, " \ "last used #{age} seconds ago" end ## # URI::escape wrapper def escape str CGI.escape str if str end ## # URI::unescape wrapper def unescape str CGI.unescape str if str end ## # Returns true if the connection should be reset due to an idle timeout, or # maximum request count, false otherwise. def expired? connection requests = Thread.current[@request_key][connection.object_id] return true if @max_requests && requests >= @max_requests return false unless @idle_timeout return true if @idle_timeout.zero? last_used = Thread.current[@timeout_key][connection.object_id] Time.now - last_used > @idle_timeout end ## # Starts the Net::HTTP +connection+ def start connection connection.set_debug_output @debug_output if @debug_output connection.open_timeout = @open_timeout if @open_timeout connection.start socket = connection.instance_variable_get :@socket if socket then # for fakeweb @socket_options.each do |option| socket.io.setsockopt(*option) end end end ## # Finishes the Net::HTTP +connection+ def finish connection, thread = Thread.current if requests = thread[@request_key] then requests.delete connection.object_id end connection.finish rescue IOError end def http_class # :nodoc: if RUBY_VERSION > '2.0' then Net::HTTP elsif [:Artifice, :FakeWeb, :WebMock].any? { |klass| Object.const_defined?(klass) } or not @reuse_ssl_sessions then Net::HTTP else Net::HTTP::Persistent::SSLReuse end end ## # Returns the HTTP protocol version for +uri+ def http_version uri @http_versions["#{uri.host}:#{uri.port}"] end ## # Is +req+ idempotent according to RFC 2616? def idempotent? req case req when Net::HTTP::Delete, Net::HTTP::Get, Net::HTTP::Head, Net::HTTP::Options, Net::HTTP::Put, Net::HTTP::Trace then true end end ## # Is the request +req+ idempotent or is retry_change_requests allowed. # # If +retried_on_ruby_2+ is true, true will be returned if we are on ruby, # retry_change_requests is allowed and the request is not idempotent. def can_retry? req, retried_on_ruby_2 = false return @retry_change_requests && !idempotent?(req) if retried_on_ruby_2 @retry_change_requests || idempotent?(req) end if RUBY_VERSION > '1.9' then ## # Workaround for missing Net::HTTPHeader#connection_close? on Ruby 1.8 def connection_close? header header.connection_close? end ## # Workaround for missing Net::HTTPHeader#connection_keep_alive? on Ruby 1.8 def connection_keep_alive? header header.connection_keep_alive? end else ## # Workaround for missing Net::HTTPRequest#connection_close? on Ruby 1.8 def connection_close? header header['connection'] =~ /close/ or header['proxy-connection'] =~ /close/ end ## # Workaround for missing Net::HTTPRequest#connection_keep_alive? on Ruby # 1.8 def connection_keep_alive? header header['connection'] =~ /keep-alive/ or header['proxy-connection'] =~ /keep-alive/ end end ## # Deprecated in favor of #expired? def max_age # :nodoc: return Time.now + 1 unless @idle_timeout Time.now - @idle_timeout end ## # Adds "http://" to the String +uri+ if it is missing. def normalize_uri uri (uri =~ /^https?:/) ? uri : "http://#{uri}" end ## # Pipelines +requests+ to the HTTP server at +uri+ yielding responses if a # block is given. Returns all responses recieved. # # See # Net::HTTP::Pipeline[http://docs.seattlerb.org/net-http-pipeline/Net/HTTP/Pipeline.html] # for further details. # # Only if net-http-pipeline was required before # net-http-persistent #pipeline will be present. def pipeline uri, requests, &block # :yields: responses connection = connection_for uri connection.pipeline requests, &block end ## # Sets this client's SSL private key def private_key= key @private_key = key reconnect_ssl end # For Net::HTTP parity alias key= private_key= ## # Sets the proxy server. The +proxy+ may be the URI of the proxy server, # the symbol +:ENV+ which will read the proxy from the environment or nil to # disable use of a proxy. See #proxy_from_env for details on setting the # proxy from the environment. # # If the proxy URI is set after requests have been made, the next request # will shut-down and re-open all connections. # # The +no_proxy+ query parameter can be used to specify hosts which shouldn't # be reached via proxy; if set it should be a comma separated list of # hostname suffixes, optionally with +:port+ appended, for example # example.com,some.host:8080. def proxy= proxy @proxy_uri = case proxy when :ENV then proxy_from_env when URI::HTTP then proxy when nil then # ignore else raise ArgumentError, 'proxy must be :ENV or a URI::HTTP' end @no_proxy.clear if @proxy_uri then @proxy_args = [ @proxy_uri.host, @proxy_uri.port, unescape(@proxy_uri.user), unescape(@proxy_uri.password), ] @proxy_connection_id = [nil, *@proxy_args].join ':' if @proxy_uri.query then @no_proxy = CGI.parse(@proxy_uri.query)['no_proxy'].join(',').downcase.split(',').map { |x| x.strip }.reject { |x| x.empty? } end end reconnect reconnect_ssl end ## # Creates a URI for an HTTP proxy server from ENV variables. # # If +HTTP_PROXY+ is set a proxy will be returned. # # If +HTTP_PROXY_USER+ or +HTTP_PROXY_PASS+ are set the URI is given the # indicated user and password unless HTTP_PROXY contains either of these in # the URI. # # The +NO_PROXY+ ENV variable can be used to specify hosts which shouldn't # be reached via proxy; if set it should be a comma separated list of # hostname suffixes, optionally with +:port+ appended, for example # example.com,some.host:8080. When set to * no proxy will # be returned. # # For Windows users, lowercase ENV variables are preferred over uppercase ENV # variables. def proxy_from_env env_proxy = ENV['http_proxy'] || ENV['HTTP_PROXY'] return nil if env_proxy.nil? or env_proxy.empty? uri = URI normalize_uri env_proxy env_no_proxy = ENV['no_proxy'] || ENV['NO_PROXY'] # '*' is special case for always bypass return nil if env_no_proxy == '*' if env_no_proxy then uri.query = "no_proxy=#{escape(env_no_proxy)}" end unless uri.user or uri.password then uri.user = escape ENV['http_proxy_user'] || ENV['HTTP_PROXY_USER'] uri.password = escape ENV['http_proxy_pass'] || ENV['HTTP_PROXY_PASS'] end uri end ## # Returns true when proxy should by bypassed for host. def proxy_bypass? host, port host = host.downcase host_port = [host, port].join ':' @no_proxy.each do |name| return true if host[-name.length, name.length] == name or host_port[-name.length, name.length] == name end false end ## # Forces reconnection of HTTP connections. def reconnect @generation += 1 end ## # Forces reconnection of SSL connections. def reconnect_ssl @ssl_generation += 1 end ## # Finishes then restarts the Net::HTTP +connection+ def reset connection Thread.current[@request_key].delete connection.object_id Thread.current[@timeout_key].delete connection.object_id finish connection start connection rescue Errno::ECONNREFUSED e = Error.new "connection refused: #{connection.address}:#{connection.port}" e.set_backtrace $@ raise e rescue Errno::EHOSTDOWN e = Error.new "host down: #{connection.address}:#{connection.port}" e.set_backtrace $@ raise e end ## # Makes a request on +uri+. If +req+ is nil a Net::HTTP::Get is performed # against +uri+. # # If a block is passed #request behaves like Net::HTTP#request (the body of # the response will not have been read). # # +req+ must be a Net::HTTPRequest subclass (see Net::HTTP for a list). # # If there is an error and the request is idempotent according to RFC 2616 # it will be retried automatically. def request uri, req = nil, &block retried = false bad_response = false req = request_setup req || uri connection = connection_for uri connection_id = connection.object_id begin Thread.current[@request_key][connection_id] += 1 response = connection.request req, &block if connection_close?(req) or (response.http_version <= '1.0' and not connection_keep_alive?(response)) or connection_close?(response) then connection.finish end rescue Net::HTTPBadResponse => e message = error_message connection finish connection raise Error, "too many bad responses #{message}" if bad_response or not can_retry? req bad_response = true retry rescue *RETRIED_EXCEPTIONS => e # retried on ruby 2 request_failed e, req, connection if retried or not can_retry? req, @retried_on_ruby_2 reset connection retried = true retry rescue Errno::EINVAL, Errno::ETIMEDOUT => e # not retried on ruby 2 request_failed e, req, connection if retried or not can_retry? req reset connection retried = true retry rescue Exception => e finish connection raise ensure Thread.current[@timeout_key][connection_id] = Time.now end @http_versions["#{uri.host}:#{uri.port}"] ||= response.http_version response end ## # Raises an Error for +exception+ which resulted from attempting the request # +req+ on the +connection+. # # Finishes the +connection+. def request_failed exception, req, connection # :nodoc: due_to = "(due to #{exception.message} - #{exception.class})" message = "too many connection resets #{due_to} #{error_message connection}" finish connection raise Error, message, exception.backtrace end ## # Creates a GET request if +req_or_uri+ is a URI and adds headers to the # request. # # Returns the request. def request_setup req_or_uri # :nodoc: req = if req_or_uri.is_a?(URI) then Net::HTTP::Get.new req_or_uri.request_uri else req_or_uri end @headers.each do |pair| req.add_field(*pair) end @override_headers.each do |name, value| req[name] = value end unless req['Connection'] then req.add_field 'Connection', 'keep-alive' req.add_field 'Keep-Alive', @keep_alive end req end ## # Shuts down all connections for +thread+. # # Uses the current thread by default. # # If you've used Net::HTTP::Persistent across multiple threads you should # call this in each thread when you're done making HTTP requests. # # *NOTE*: Calling shutdown for another thread can be dangerous! # # If the thread is still using the connection it may cause an error! It is # best to call #shutdown in the thread at the appropriate time instead! def shutdown thread = Thread.current generation = reconnect cleanup generation, thread, @generation_key ssl_generation = reconnect_ssl cleanup ssl_generation, thread, @ssl_generation_key thread[@request_key] = nil thread[@timeout_key] = nil end ## # Shuts down all connections in all threads # # *NOTE*: THIS METHOD IS VERY DANGEROUS! # # Do not call this method if other threads are still using their # connections! Call #shutdown at the appropriate time instead! # # Use this method only as a last resort! def shutdown_in_all_threads Thread.list.each do |thread| shutdown thread end nil end ## # Enables SSL on +connection+ def ssl connection connection.use_ssl = true connection.ssl_version = @ssl_version if @ssl_version connection.verify_mode = @verify_mode if OpenSSL::SSL::VERIFY_PEER == OpenSSL::SSL::VERIFY_NONE and not Object.const_defined?(:I_KNOW_THAT_OPENSSL_VERIFY_PEER_EQUALS_VERIFY_NONE_IS_WRONG) then warn <<-WARNING !!!SECURITY WARNING!!! The SSL HTTP connection to: #{connection.address}:#{connection.port} !!!MAY NOT BE VERIFIED!!! On your platform your OpenSSL implementation is broken. There is no difference between the values of VERIFY_NONE and VERIFY_PEER. This means that attempting to verify the security of SSL connections may not work. This exposes you to man-in-the-middle exploits, snooping on the contents of your connection and other dangers to the security of your data. To disable this warning define the following constant at top-level in your application: I_KNOW_THAT_OPENSSL_VERIFY_PEER_EQUALS_VERIFY_NONE_IS_WRONG = nil WARNING end if @ca_file then connection.ca_file = @ca_file connection.verify_mode = OpenSSL::SSL::VERIFY_PEER connection.verify_callback = @verify_callback if @verify_callback end if @certificate and @private_key then connection.cert = @certificate connection.key = @private_key end connection.cert_store = if @cert_store then @cert_store else store = OpenSSL::X509::Store.new store.set_default_paths store end end ## # Finishes all connections that existed before the given SSL parameter # +generation+. def ssl_cleanup generation # :nodoc: cleanup generation, Thread.current, @ssl_generation_key end ## # SSL version to use def ssl_version= ssl_version @ssl_version = ssl_version reconnect_ssl end if RUBY_VERSION > '1.9' ## # Sets the HTTPS verify mode. Defaults to OpenSSL::SSL::VERIFY_PEER. # # Setting this to VERIFY_NONE is a VERY BAD IDEA and should NEVER be used. # Securely transfer the correct certificate and update the default # certificate store or set the ca file instead. def verify_mode= verify_mode @verify_mode = verify_mode reconnect_ssl end ## # SSL verification callback. def verify_callback= callback @verify_callback = callback reconnect_ssl end end require 'net/http/persistent/ssl_reuse' bundler-1.11.2/lib/bundler/vendor/net/http/faster.rb0000644000004100000410000000122412652443364022343 0ustar www-datawww-datarequire 'net/protocol' ## # Aaron Patterson's monkeypatch (accepted into 1.9.1) to fix Net::HTTP's speed # problems. # # http://gist.github.com/251244 class Net::BufferedIO #:nodoc: alias :old_rbuf_fill :rbuf_fill def rbuf_fill if @io.respond_to? :read_nonblock then begin @rbuf << @io.read_nonblock(65536) rescue Errno::EWOULDBLOCK, Errno::EAGAIN => e retry if IO.select [@io], nil, nil, @read_timeout raise Timeout::Error, e.message end else # SSL sockets do not have read_nonblock timeout @read_timeout do @rbuf << @io.sysread(65536) end end end end if RUBY_VERSION < '1.9' bundler-1.11.2/lib/bundler/vendor/thor/0000755000004100000410000000000012652443364017742 5ustar www-datawww-databundler-1.11.2/lib/bundler/vendor/thor/lib/0000755000004100000410000000000012652443364020510 5ustar www-datawww-databundler-1.11.2/lib/bundler/vendor/thor/lib/thor.rb0000644000004100000410000003617412652443364022024 0ustar www-datawww-datarequire "set" require "bundler/vendor/thor/lib/thor/base" class Bundler::Thor # rubocop:disable ClassLength class << self # Allows for custom "Command" package naming. # # === Parameters # name # options # def package_name(name, options = {}) @package_name = name.nil? || name == "" ? nil : name end # Sets the default command when thor is executed without an explicit command to be called. # # ==== Parameters # meth:: name of the default command # def default_command(meth = nil) if meth @default_command = meth == :none ? "help" : meth.to_s else @default_command ||= from_superclass(:default_command, "help") end end alias_method :default_task, :default_command # Registers another Bundler::Thor subclass as a command. # # ==== Parameters # klass:: Bundler::Thor subclass to register # command:: Subcommand name to use # usage:: Short usage for the subcommand # description:: Description for the subcommand def register(klass, subcommand_name, usage, description, options = {}) if klass <= Bundler::Thor::Group desc usage, description, options define_method(subcommand_name) { |*args| invoke(klass, args) } else desc usage, description, options subcommand subcommand_name, klass end end # Defines the usage and the description of the next command. # # ==== Parameters # usage # description # options # def desc(usage, description, options = {}) if options[:for] command = find_and_refresh_command(options[:for]) command.usage = usage if usage command.description = description if description else @usage, @desc, @hide = usage, description, options[:hide] || false end end # Defines the long description of the next command. # # ==== Parameters # long description # def long_desc(long_description, options = {}) if options[:for] command = find_and_refresh_command(options[:for]) command.long_description = long_description if long_description else @long_desc = long_description end end # Maps an input to a command. If you define: # # map "-T" => "list" # # Running: # # thor -T # # Will invoke the list command. # # ==== Parameters # Hash[String|Array => Symbol]:: Maps the string or the strings in the array to the given command. # def map(mappings = nil) @map ||= from_superclass(:map, {}) if mappings mappings.each do |key, value| if key.respond_to?(:each) key.each { |subkey| @map[subkey] = value } else @map[key] = value end end end @map end # Declares the options for the next command to be declared. # # ==== Parameters # Hash[Symbol => Object]:: The hash key is the name of the option and the value # is the type of the option. Can be :string, :array, :hash, :boolean, :numeric # or :required (string). If you give a value, the type of the value is used. # def method_options(options = nil) @method_options ||= {} build_options(options, @method_options) if options @method_options end alias_method :options, :method_options # Adds an option to the set of method options. If :for is given as option, # it allows you to change the options from a previous defined command. # # def previous_command # # magic # end # # method_option :foo => :bar, :for => :previous_command # # def next_command # # magic # end # # ==== Parameters # name:: The name of the argument. # options:: Described below. # # ==== Options # :desc - Description for the argument. # :required - If the argument is required or not. # :default - Default value for this argument. It cannot be required and have default values. # :aliases - Aliases for this option. # :type - The type of the argument, can be :string, :hash, :array, :numeric or :boolean. # :banner - String to show on usage notes. # :hide - If you want to hide this option from the help. # def method_option(name, options = {}) scope = if options[:for] find_and_refresh_command(options[:for]).options else method_options end build_option(name, options, scope) end alias_method :option, :method_option # Prints help information for the given command. # # ==== Parameters # shell # command_name # def command_help(shell, command_name) meth = normalize_command_name(command_name) command = all_commands[meth] handle_no_command_error(meth) unless command shell.say "Usage:" shell.say " #{banner(command)}" shell.say class_options_help(shell, nil => command.options.map { |_, o| o }) if command.long_description shell.say "Description:" shell.print_wrapped(command.long_description, :indent => 2) else shell.say command.description end end alias_method :task_help, :command_help # Prints help information for this class. # # ==== Parameters # shell # def help(shell, subcommand = false) list = printable_commands(true, subcommand) Bundler::Thor::Util.thor_classes_in(self).each do |klass| list += klass.printable_commands(false) end list.sort! { |a, b| a[0] <=> b[0] } if defined?(@package_name) && @package_name shell.say "#{@package_name} commands:" else shell.say "Commands:" end shell.print_table(list, :indent => 2, :truncate => true) shell.say class_options_help(shell) end # Returns commands ready to be printed. def printable_commands(all = true, subcommand = false) (all ? all_commands : commands).map do |_, command| next if command.hidden? item = [] item << banner(command, false, subcommand) item << (command.description ? "# #{command.description.gsub(/\s+/m, ' ')}" : "") item end.compact end alias_method :printable_tasks, :printable_commands def subcommands @subcommands ||= from_superclass(:subcommands, []) end alias_method :subtasks, :subcommands def subcommand_classes @subcommand_classes ||= {} end def subcommand(subcommand, subcommand_class) subcommands << subcommand.to_s subcommand_class.subcommand_help subcommand subcommand_classes[subcommand.to_s] = subcommand_class define_method(subcommand) do |*args| args, opts = Bundler::Thor::Arguments.split(args) args.unshift("help") if opts.include? "--help" or opts.include? "-h" invoke subcommand_class, args, opts, :invoked_via_subcommand => true, :class_options => options end end alias_method :subtask, :subcommand # Extend check unknown options to accept a hash of conditions. # # === Parameters # options: A hash containing :only and/or :except keys def check_unknown_options!(options = {}) @check_unknown_options ||= {} options.each do |key, value| if value @check_unknown_options[key] = Array(value) else @check_unknown_options.delete(key) end end @check_unknown_options end # Overwrite check_unknown_options? to take subcommands and options into account. def check_unknown_options?(config) #:nodoc: options = check_unknown_options return false unless options command = config[:current_command] return true unless command name = command.name if subcommands.include?(name) false elsif options[:except] !options[:except].include?(name.to_sym) elsif options[:only] options[:only].include?(name.to_sym) else true end end # Stop parsing of options as soon as an unknown option or a regular # argument is encountered. All remaining arguments are passed to the command. # This is useful if you have a command that can receive arbitrary additional # options, and where those additional options should not be handled by # Bundler::Thor. # # ==== Example # # To better understand how this is useful, let's consider a command that calls # an external command. A user may want to pass arbitrary options and # arguments to that command. The command itself also accepts some options, # which should be handled by Bundler::Thor. # # class_option "verbose", :type => :boolean # stop_on_unknown_option! :exec # check_unknown_options! :except => :exec # # desc "exec", "Run a shell command" # def exec(*args) # puts "diagnostic output" if options[:verbose] # Kernel.exec(*args) # end # # Here +exec+ can be called with +--verbose+ to get diagnostic output, # e.g.: # # $ thor exec --verbose echo foo # diagnostic output # foo # # But if +--verbose+ is given after +echo+, it is passed to +echo+ instead: # # $ thor exec echo --verbose foo # --verbose foo # # ==== Parameters # Symbol ...:: A list of commands that should be affected. def stop_on_unknown_option!(*command_names) stop_on_unknown_option.merge(command_names) end def stop_on_unknown_option?(command) #:nodoc: command && stop_on_unknown_option.include?(command.name.to_sym) end protected def stop_on_unknown_option #:nodoc: @stop_on_unknown_option ||= Set.new end # The method responsible for dispatching given the args. def dispatch(meth, given_args, given_opts, config) #:nodoc: # rubocop:disable MethodLength meth ||= retrieve_command_name(given_args) command = all_commands[normalize_command_name(meth)] if !command && config[:invoked_via_subcommand] # We're a subcommand and our first argument didn't match any of our # commands. So we put it back and call our default command. given_args.unshift(meth) command = all_commands[normalize_command_name(default_command)] end if command args, opts = Bundler::Thor::Options.split(given_args) if stop_on_unknown_option?(command) && !args.empty? # given_args starts with a non-option, so we treat everything as # ordinary arguments args.concat opts opts.clear end else args, opts = given_args, nil command = dynamic_command_class.new(meth) end opts = given_opts || opts || [] config.merge!(:current_command => command, :command_options => command.options) instance = new(args, opts, config) yield instance if block_given? args = instance.args trailing = args[Range.new(arguments.size, -1)] instance.invoke_command(command, trailing || []) end # The banner for this class. You can customize it if you are invoking the # thor class by another ways which is not the Bundler::Thor::Runner. It receives # the command that is going to be invoked and a boolean which indicates if # the namespace should be displayed as arguments. # def banner(command, namespace = nil, subcommand = false) "#{basename} #{command.formatted_usage(self, $thor_runner, subcommand)}" end def baseclass #:nodoc: Bundler::Thor end def dynamic_command_class #:nodoc: Bundler::Thor::DynamicCommand end def create_command(meth) #:nodoc: @usage ||= nil @desc ||= nil @long_desc ||= nil if @usage && @desc base_class = @hide ? Bundler::Thor::HiddenCommand : Bundler::Thor::Command commands[meth] = base_class.new(meth, @desc, @long_desc, @usage, method_options) @usage, @desc, @long_desc, @method_options, @hide = nil true elsif all_commands[meth] || meth == "method_missing" true else puts "[WARNING] Attempted to create command #{meth.inspect} without usage or description. " << "Call desc if you want this method to be available as command or declare it inside a " << "no_commands{} block. Invoked from #{caller[1].inspect}." false end end alias_method :create_task, :create_command def initialize_added #:nodoc: class_options.merge!(method_options) @method_options = nil end # Retrieve the command name from given args. def retrieve_command_name(args) #:nodoc: meth = args.first.to_s unless args.empty? if meth && (map[meth] || meth !~ /^\-/) args.shift else nil end end alias_method :retrieve_task_name, :retrieve_command_name # receives a (possibly nil) command name and returns a name that is in # the commands hash. In addition to normalizing aliases, this logic # will determine if a shortened command is an unambiguous substring of # a command or alias. # # +normalize_command_name+ also converts names like +animal-prison+ # into +animal_prison+. def normalize_command_name(meth) #:nodoc: return default_command.to_s.gsub("-", "_") unless meth possibilities = find_command_possibilities(meth) if possibilities.size > 1 fail AmbiguousTaskError, "Ambiguous command #{meth} matches [#{possibilities.join(', ')}]" elsif possibilities.size < 1 meth = meth || default_command elsif map[meth] meth = map[meth] else meth = possibilities.first end meth.to_s.gsub("-", "_") # treat foo-bar as foo_bar end alias_method :normalize_task_name, :normalize_command_name # this is the logic that takes the command name passed in by the user # and determines whether it is an unambiguous substrings of a command or # alias name. def find_command_possibilities(meth) len = meth.to_s.length possibilities = all_commands.merge(map).keys.select { |n| meth == n[0, len] }.sort unique_possibilities = possibilities.map { |k| map[k] || k }.uniq if possibilities.include?(meth) [meth] elsif unique_possibilities.size == 1 unique_possibilities else possibilities end end alias_method :find_task_possibilities, :find_command_possibilities def subcommand_help(cmd) desc "help [COMMAND]", "Describe subcommands or one specific subcommand" class_eval " def help(command = nil, subcommand = true); super; end " end alias_method :subtask_help, :subcommand_help end include Bundler::Thor::Base map HELP_MAPPINGS => :help desc "help [COMMAND]", "Describe available commands or one specific command" def help(command = nil, subcommand = false) if command if self.class.subcommands.include? command self.class.subcommand_classes[command].help(shell, true) else self.class.command_help(shell, command) end else self.class.help(shell, subcommand) end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/0000755000004100000410000000000012652443364021464 5ustar www-datawww-databundler-1.11.2/lib/bundler/vendor/thor/lib/thor/core_ext/0000755000004100000410000000000012652443364023274 5ustar www-datawww-databundler-1.11.2/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb0000644000004100000410000000341012652443364031473 0ustar www-datawww-dataclass Bundler::Thor module CoreExt #:nodoc: # A hash with indifferent access and magic predicates. # # hash = Bundler::Thor::CoreExt::HashWithIndifferentAccess.new 'foo' => 'bar', 'baz' => 'bee', 'force' => true # # hash[:foo] #=> 'bar' # hash['foo'] #=> 'bar' # hash.foo? #=> true # class HashWithIndifferentAccess < ::Hash #:nodoc: def initialize(hash = {}) super() hash.each do |key, value| self[convert_key(key)] = value end end def [](key) super(convert_key(key)) end def []=(key, value) super(convert_key(key), value) end def delete(key) super(convert_key(key)) end def values_at(*indices) indices.map { |key| self[convert_key(key)] } end def merge(other) dup.merge!(other) end def merge!(other) other.each do |key, value| self[convert_key(key)] = value end self end # Convert to a Hash with String keys. def to_hash Hash.new(default).merge!(self) end protected def convert_key(key) key.is_a?(Symbol) ? key.to_s : key end # Magic predicates. For instance: # # options.force? # => !!options['force'] # options.shebang # => "/usr/lib/local/ruby" # options.test_framework?(:rspec) # => options[:test_framework] == :rspec # def method_missing(method, *args, &block) method = method.to_s if method =~ /^(\w+)\?$/ if args.empty? !!self[$1] else self[$1] == args.first end else self[method] end end end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb0000644000004100000410000000430312652443364026250 0ustar www-datawww-dataclass Bundler::Thor module CoreExt #:nodoc: if RUBY_VERSION >= "1.9" class OrderedHash < ::Hash end else # This class is based on the Ruby 1.9 ordered hashes. # # It keeps the semantics and most of the efficiency of normal hashes # while also keeping track of the order in which elements were set. # class OrderedHash #:nodoc: include Enumerable Node = Struct.new(:key, :value, :next, :prev) def initialize @hash = {} end def [](key) @hash[key] && @hash[key].value end def []=(key, value) if node = @hash[key] # rubocop:disable AssignmentInCondition node.value = value else node = Node.new(key, value) if !defined?(@first) || @first.nil? @first = @last = node else node.prev = @last @last.next = node @last = node end end @hash[key] = node value end def delete(key) if node = @hash[key] # rubocop:disable AssignmentInCondition prev_node = node.prev next_node = node.next next_node.prev = prev_node if next_node prev_node.next = next_node if prev_node @first = next_node if @first == node @last = prev_node if @last == node value = node.value end @hash.delete(key) value end def keys map { |k, v| k } end def values map { |k, v| v } end def each return unless defined?(@first) && @first yield [@first.key, @first.value] node = @first yield [node.key, node.value] while node = node.next # rubocop:disable AssignmentInCondition self end def merge(other) hash = self.class.new each do |key, value| hash[key] = value end other.each do |key, value| hash[key] = value end hash end def empty? @hash.empty? end end end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb0000644000004100000410000000043312652443364026567 0ustar www-datawww-dataclass IO #:nodoc: class << self def binread(file, *args) fail ArgumentError, "wrong number of arguments (#{1 + args.size} for 1..3)" unless args.size < 3 File.open(file, "rb") do |f| f.read(*args) end end unless method_defined? :binread end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/actions/0000755000004100000410000000000012652443364023124 5ustar www-datawww-databundler-1.11.2/lib/bundler/vendor/thor/lib/thor/actions/directory.rb0000644000004100000410000001002012652443364025446 0ustar www-datawww-datarequire "bundler/vendor/thor/lib/thor/actions/empty_directory" class Bundler::Thor module Actions # Copies recursively the files from source directory to root directory. # If any of the files finishes with .tt, it's considered to be a template # and is placed in the destination without the extension .tt. If any # empty directory is found, it's copied and all .empty_directory files are # ignored. If any file name is wrapped within % signs, the text within # the % signs will be executed as a method and replaced with the returned # value. Let's suppose a doc directory with the following files: # # doc/ # components/.empty_directory # README # rdoc.rb.tt # %app_name%.rb # # When invoked as: # # directory "doc" # # It will create a doc directory in the destination with the following # files (assuming that the `app_name` method returns the value "blog"): # # doc/ # components/ # README # rdoc.rb # blog.rb # # Encoded path note: Since Bundler::Thor internals use Object#respond_to? to check if it can # expand %something%, this `something` should be a public method in the class calling # #directory. If a method is private, Bundler::Thor stack raises PrivateMethodEncodedError. # # ==== Parameters # source:: the relative path to the source root. # destination:: the relative path to the destination root. # config:: give :verbose => false to not log the status. # If :recursive => false, does not look for paths recursively. # If :mode => :preserve, preserve the file mode from the source. # If :exclude_pattern => /regexp/, prevents copying files that match that regexp. # # ==== Examples # # directory "doc" # directory "doc", "docs", :recursive => false # def directory(source, *args, &block) config = args.last.is_a?(Hash) ? args.pop : {} destination = args.first || source action Directory.new(self, source, destination || source, config, &block) end class Directory < EmptyDirectory #:nodoc: attr_reader :source def initialize(base, source, destination = nil, config = {}, &block) @source = File.expand_path(base.find_in_source_paths(source.to_s)) @block = block super(base, destination, {:recursive => true}.merge(config)) end def invoke! base.empty_directory given_destination, config execute! end def revoke! execute! end protected def execute! # rubocop:disable MethodLength lookup = Util.escape_globs(source) lookup = config[:recursive] ? File.join(lookup, "**") : lookup lookup = file_level_lookup(lookup) files(lookup).sort.each do |file_source| next if File.directory?(file_source) next if config[:exclude_pattern] && file_source.match(config[:exclude_pattern]) file_destination = File.join(given_destination, file_source.gsub(source, ".")) file_destination.gsub!("/./", "/") case file_source when /\.empty_directory$/ dirname = File.dirname(file_destination).gsub(/\/\.$/, "") next if dirname == given_destination base.empty_directory(dirname, config) when /#{TEMPLATE_EXTNAME}$/ base.template(file_source, file_destination[0..-4], config, &@block) else base.copy_file(file_source, file_destination, config, &@block) end end end if RUBY_VERSION < "2.0" def file_level_lookup(previous_lookup) File.join(previous_lookup, "{*,.[a-z]*}") end def files(lookup) Dir[lookup] end else def file_level_lookup(previous_lookup) File.join(previous_lookup, "*") end def files(lookup) Dir.glob(lookup, File::FNM_DOTMATCH) end end end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb0000644000004100000410000000605412652443364025720 0ustar www-datawww-datarequire "bundler/vendor/thor/lib/thor/actions/empty_directory" class Bundler::Thor module Actions # Create a new file relative to the destination root with the given data, # which is the return value of a block or a data string. # # ==== Parameters # destination:: the relative path to the destination root. # data:: the data to append to the file. # config:: give :verbose => false to not log the status. # # ==== Examples # # create_file "lib/fun_party.rb" do # hostname = ask("What is the virtual hostname I should use?") # "vhost.name = #{hostname}" # end # # create_file "config/apache.conf", "your apache config" # def create_file(destination, *args, &block) config = args.last.is_a?(Hash) ? args.pop : {} data = args.first action CreateFile.new(self, destination, block || data.to_s, config) end alias_method :add_file, :create_file # CreateFile is a subset of Template, which instead of rendering a file with # ERB, it gets the content from the user. # class CreateFile < EmptyDirectory #:nodoc: attr_reader :data def initialize(base, destination, data, config = {}) @data = data super(base, destination, config) end # Checks if the content of the file at the destination is identical to the rendered result. # # ==== Returns # Boolean:: true if it is identical, false otherwise. # def identical? exists? && File.binread(destination) == render end # Holds the content to be added to the file. # def render @render ||= if data.is_a?(Proc) data.call else data end end def invoke! invoke_with_conflict_check do FileUtils.mkdir_p(File.dirname(destination)) File.open(destination, "wb") { |f| f.write render } end given_destination end protected # Now on conflict we check if the file is identical or not. # def on_conflict_behavior(&block) if identical? say_status :identical, :blue else options = base.options.merge(config) force_or_skip_or_conflict(options[:force], options[:skip], &block) end end # If force is true, run the action, otherwise check if it's not being # skipped. If both are false, show the file_collision menu, if the menu # returns true, force it, otherwise skip. # def force_or_skip_or_conflict(force, skip, &block) if force say_status :force, :yellow block.call unless pretend? elsif skip say_status :skip, :yellow else say_status :conflict, :red force_or_skip_or_conflict(force_on_collision?, true, &block) end end # Shows the file collision menu to the user and gets the result. # def force_on_collision? base.shell.file_collision(destination) { render } end end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb0000644000004100000410000000345612652443364025741 0ustar www-datawww-datarequire "bundler/vendor/thor/lib/thor/actions/create_file" class Bundler::Thor module Actions # Create a new file relative to the destination root from the given source. # # ==== Parameters # destination:: the relative path to the destination root. # source:: the relative path to the source root. # config:: give :verbose => false to not log the status. # :: give :symbolic => false for hard link. # # ==== Examples # # create_link "config/apache.conf", "/etc/apache.conf" # def create_link(destination, *args, &block) config = args.last.is_a?(Hash) ? args.pop : {} source = args.first action CreateLink.new(self, destination, source, config) end alias_method :add_link, :create_link # CreateLink is a subset of CreateFile, which instead of taking a block of # data, just takes a source string from the user. # class CreateLink < CreateFile #:nodoc: attr_reader :data # Checks if the content of the file at the destination is identical to the rendered result. # # ==== Returns # Boolean:: true if it is identical, false otherwise. # def identical? exists? && File.identical?(render, destination) end def invoke! invoke_with_conflict_check do FileUtils.mkdir_p(File.dirname(destination)) # Create a symlink by default config[:symbolic] = true if config[:symbolic].nil? File.unlink(destination) if exists? if config[:symbolic] File.symlink(render, destination) else File.link(render, destination) end end given_destination end def exists? super || File.symlink?(destination) end end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb0000644000004100000410000002524612652443364027161 0ustar www-datawww-datarequire "erb" require "open-uri" class Bundler::Thor module Actions # Copies the file from the relative source to the relative destination. If # the destination is not given it's assumed to be equal to the source. # # ==== Parameters # source:: the relative path to the source root. # destination:: the relative path to the destination root. # config:: give :verbose => false to not log the status, and # :mode => :preserve, to preserve the file mode from the source. # # ==== Examples # # copy_file "README", "doc/README" # # copy_file "doc/README" # def copy_file(source, *args, &block) config = args.last.is_a?(Hash) ? args.pop : {} destination = args.first || source source = File.expand_path(find_in_source_paths(source.to_s)) create_file destination, nil, config do content = File.binread(source) content = block.call(content) if block content end if config[:mode] == :preserve mode = File.stat(source).mode chmod(destination, mode, config) end end # Links the file from the relative source to the relative destination. If # the destination is not given it's assumed to be equal to the source. # # ==== Parameters # source:: the relative path to the source root. # destination:: the relative path to the destination root. # config:: give :verbose => false to not log the status. # # ==== Examples # # link_file "README", "doc/README" # # link_file "doc/README" # def link_file(source, *args, &block) config = args.last.is_a?(Hash) ? args.pop : {} destination = args.first || source source = File.expand_path(find_in_source_paths(source.to_s)) create_link destination, source, config end # Gets the content at the given address and places it at the given relative # destination. If a block is given instead of destination, the content of # the url is yielded and used as location. # # ==== Parameters # source:: the address of the given content. # destination:: the relative path to the destination root. # config:: give :verbose => false to not log the status. # # ==== Examples # # get "http://gist.github.com/103208", "doc/README" # # get "http://gist.github.com/103208" do |content| # content.split("\n").first # end # def get(source, *args, &block) config = args.last.is_a?(Hash) ? args.pop : {} destination = args.first source = File.expand_path(find_in_source_paths(source.to_s)) unless source =~ %r{^https?\://} render = open(source) { |input| input.binmode.read } destination ||= if block_given? block.arity == 1 ? block.call(render) : block.call else File.basename(source) end create_file destination, render, config end # Gets an ERB template at the relative source, executes it and makes a copy # at the relative destination. If the destination is not given it's assumed # to be equal to the source removing .tt from the filename. # # ==== Parameters # source:: the relative path to the source root. # destination:: the relative path to the destination root. # config:: give :verbose => false to not log the status. # # ==== Examples # # template "README", "doc/README" # # template "doc/README" # def template(source, *args, &block) config = args.last.is_a?(Hash) ? args.pop : {} destination = args.first || source.sub(/#{TEMPLATE_EXTNAME}$/, "") source = File.expand_path(find_in_source_paths(source.to_s)) context = instance_eval("binding") create_file destination, nil, config do content = ERB.new(::File.binread(source), nil, "-", "@output_buffer").result(context) content = block.call(content) if block content end end # Changes the mode of the given file or directory. # # ==== Parameters # mode:: the file mode # path:: the name of the file to change mode # config:: give :verbose => false to not log the status. # # ==== Example # # chmod "script/server", 0755 # def chmod(path, mode, config = {}) return unless behavior == :invoke path = File.expand_path(path, destination_root) say_status :chmod, relative_to_original_destination_root(path), config.fetch(:verbose, true) FileUtils.chmod_R(mode, path) unless options[:pretend] end # Prepend text to a file. Since it depends on insert_into_file, it's reversible. # # ==== Parameters # path:: path of the file to be changed # data:: the data to prepend to the file, can be also given as a block. # config:: give :verbose => false to not log the status. # # ==== Example # # prepend_to_file 'config/environments/test.rb', 'config.gem "rspec"' # # prepend_to_file 'config/environments/test.rb' do # 'config.gem "rspec"' # end # def prepend_to_file(path, *args, &block) config = args.last.is_a?(Hash) ? args.pop : {} config.merge!(:after => /\A/) insert_into_file(path, *(args << config), &block) end alias_method :prepend_file, :prepend_to_file # Append text to a file. Since it depends on insert_into_file, it's reversible. # # ==== Parameters # path:: path of the file to be changed # data:: the data to append to the file, can be also given as a block. # config:: give :verbose => false to not log the status. # # ==== Example # # append_to_file 'config/environments/test.rb', 'config.gem "rspec"' # # append_to_file 'config/environments/test.rb' do # 'config.gem "rspec"' # end # def append_to_file(path, *args, &block) config = args.last.is_a?(Hash) ? args.pop : {} config.merge!(:before => /\z/) insert_into_file(path, *(args << config), &block) end alias_method :append_file, :append_to_file # Injects text right after the class definition. Since it depends on # insert_into_file, it's reversible. # # ==== Parameters # path:: path of the file to be changed # klass:: the class to be manipulated # data:: the data to append to the class, can be also given as a block. # config:: give :verbose => false to not log the status. # # ==== Examples # # inject_into_class "app/controllers/application_controller.rb", ApplicationController, " filter_parameter :password\n" # # inject_into_class "app/controllers/application_controller.rb", ApplicationController do # " filter_parameter :password\n" # end # def inject_into_class(path, klass, *args, &block) config = args.last.is_a?(Hash) ? args.pop : {} config.merge!(:after => /class #{klass}\n|class #{klass} .*\n/) insert_into_file(path, *(args << config), &block) end # Run a regular expression replacement on a file. # # ==== Parameters # path:: path of the file to be changed # flag:: the regexp or string to be replaced # replacement:: the replacement, can be also given as a block # config:: give :verbose => false to not log the status. # # ==== Example # # gsub_file 'app/controllers/application_controller.rb', /#\s*(filter_parameter_logging :password)/, '\1' # # gsub_file 'README', /rake/, :green do |match| # match << " no more. Use thor!" # end # def gsub_file(path, flag, *args, &block) return unless behavior == :invoke config = args.last.is_a?(Hash) ? args.pop : {} path = File.expand_path(path, destination_root) say_status :gsub, relative_to_original_destination_root(path), config.fetch(:verbose, true) unless options[:pretend] content = File.binread(path) content.gsub!(flag, *args, &block) File.open(path, "wb") { |file| file.write(content) } end end # Uncomment all lines matching a given regex. It will leave the space # which existed before the comment hash in tact but will remove any spacing # between the comment hash and the beginning of the line. # # ==== Parameters # path:: path of the file to be changed # flag:: the regexp or string used to decide which lines to uncomment # config:: give :verbose => false to not log the status. # # ==== Example # # uncomment_lines 'config/initializers/session_store.rb', /active_record/ # def uncomment_lines(path, flag, *args) flag = flag.respond_to?(:source) ? flag.source : flag gsub_file(path, /^(\s*)#[[:blank:]]*(.*#{flag})/, '\1\2', *args) end # Comment all lines matching a given regex. It will leave the space # which existed before the beginning of the line in tact and will insert # a single space after the comment hash. # # ==== Parameters # path:: path of the file to be changed # flag:: the regexp or string used to decide which lines to comment # config:: give :verbose => false to not log the status. # # ==== Example # # comment_lines 'config/initializers/session_store.rb', /cookie_store/ # def comment_lines(path, flag, *args) flag = flag.respond_to?(:source) ? flag.source : flag gsub_file(path, /^(\s*)([^#|\n]*#{flag})/, '\1# \2', *args) end # Removes a file at the given location. # # ==== Parameters # path:: path of the file to be changed # config:: give :verbose => false to not log the status. # # ==== Example # # remove_file 'README' # remove_file 'app/controllers/application_controller.rb' # def remove_file(path, config = {}) return unless behavior == :invoke path = File.expand_path(path, destination_root) say_status :remove, relative_to_original_destination_root(path), config.fetch(:verbose, true) ::FileUtils.rm_rf(path) if !options[:pretend] && File.exist?(path) end alias_method :remove_dir, :remove_file attr_accessor :output_buffer private :output_buffer, :output_buffer= private def concat(string) @output_buffer.concat(string) end def capture(*args, &block) with_output_buffer { block.call(*args) } end def with_output_buffer(buf = "") #:nodoc: self.output_buffer, old_buffer = buf, output_buffer yield output_buffer ensure self.output_buffer = old_buffer end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb0000644000004100000410000001006612652443364026676 0ustar www-datawww-dataclass Bundler::Thor module Actions # Creates an empty directory. # # ==== Parameters # destination:: the relative path to the destination root. # config:: give :verbose => false to not log the status. # # ==== Examples # # empty_directory "doc" # def empty_directory(destination, config = {}) action EmptyDirectory.new(self, destination, config) end # Class which holds create directory logic. This is the base class for # other actions like create_file and directory. # # This implementation is based in Templater actions, created by Jonas Nicklas # and Michael S. Klishin under MIT LICENSE. # class EmptyDirectory #:nodoc: attr_reader :base, :destination, :given_destination, :relative_destination, :config # Initializes given the source and destination. # # ==== Parameters # base:: A Bundler::Thor::Base instance # source:: Relative path to the source of this file # destination:: Relative path to the destination of this file # config:: give :verbose => false to not log the status. # def initialize(base, destination, config = {}) @base, @config = base, {:verbose => true}.merge(config) self.destination = destination end # Checks if the destination file already exists. # # ==== Returns # Boolean:: true if the file exists, false otherwise. # def exists? ::File.exist?(destination) end def invoke! invoke_with_conflict_check do ::FileUtils.mkdir_p(destination) end end def revoke! say_status :remove, :red ::FileUtils.rm_rf(destination) if !pretend? && exists? given_destination end protected # Shortcut for pretend. # def pretend? base.options[:pretend] end # Sets the absolute destination value from a relative destination value. # It also stores the given and relative destination. Let's suppose our # script is being executed on "dest", it sets the destination root to # "dest". The destination, given_destination and relative_destination # are related in the following way: # # inside "bar" do # empty_directory "baz" # end # # destination #=> dest/bar/baz # relative_destination #=> bar/baz # given_destination #=> baz # def destination=(destination) if destination @given_destination = convert_encoded_instructions(destination.to_s) @destination = ::File.expand_path(@given_destination, base.destination_root) @relative_destination = base.relative_to_original_destination_root(@destination) end end # Filenames in the encoded form are converted. If you have a file: # # %file_name%.rb # # It calls #file_name from the base and replaces %-string with the # return value (should be String) of #file_name: # # user.rb # # The method referenced can be either public or private. # def convert_encoded_instructions(filename) filename.gsub(/%(.*?)%/) do |initial_string| method = $1.strip base.respond_to?(method, true) ? base.send(method) : initial_string end end # Receives a hash of options and just execute the block if some # conditions are met. # def invoke_with_conflict_check(&block) if exists? on_conflict_behavior(&block) else say_status :create, :green block.call unless pretend? end destination end # What to do when the destination file already exists. # def on_conflict_behavior(&block) say_status :exist, :blue end # Shortcut to say_status shell method. # def say_status(status, color) base.shell.say_status status, relative_destination, color if config[:verbose] end end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb0000644000004100000410000000615012652443364026757 0ustar www-datawww-datarequire "bundler/vendor/thor/lib/thor/actions/empty_directory" class Bundler::Thor module Actions # Injects the given content into a file. Different from gsub_file, this # method is reversible. # # ==== Parameters # destination:: Relative path to the destination root # data:: Data to add to the file. Can be given as a block. # config:: give :verbose => false to not log the status and the flag # for injection (:after or :before) or :force => true for # insert two or more times the same content. # # ==== Examples # # insert_into_file "config/environment.rb", "config.gem :thor", :after => "Rails::Initializer.run do |config|\n" # # insert_into_file "config/environment.rb", :after => "Rails::Initializer.run do |config|\n" do # gems = ask "Which gems would you like to add?" # gems.split(" ").map{ |gem| " config.gem :#{gem}" }.join("\n") # end # def insert_into_file(destination, *args, &block) if block_given? data, config = block, args.shift else data, config = args.shift, args.shift end action InjectIntoFile.new(self, destination, data, config) end alias_method :inject_into_file, :insert_into_file class InjectIntoFile < EmptyDirectory #:nodoc: attr_reader :replacement, :flag, :behavior def initialize(base, destination, data, config) super(base, destination, {:verbose => true}.merge(config)) @behavior, @flag = if @config.key?(:after) [:after, @config.delete(:after)] else [:before, @config.delete(:before)] end @replacement = data.is_a?(Proc) ? data.call : data @flag = Regexp.escape(@flag) unless @flag.is_a?(Regexp) end def invoke! say_status :invoke content = if @behavior == :after '\0' + replacement else replacement + '\0' end replace!(/#{flag}/, content, config[:force]) end def revoke! say_status :revoke regexp = if @behavior == :after content = '\1\2' /(#{flag})(.*)(#{Regexp.escape(replacement)})/m else content = '\2\3' /(#{Regexp.escape(replacement)})(.*)(#{flag})/m end replace!(regexp, content, true) end protected def say_status(behavior) status = if behavior == :invoke if flag == /\A/ :prepend elsif flag == /\z/ :append else :insert end else :subtract end super(status, config[:verbose]) end # Adds the content to the file. # def replace!(regexp, string, force) unless base.options[:pretend] content = File.binread(destination) if force || !content.include?(replacement) content.gsub!(regexp, string) File.open(destination, "wb") { |file| file.write(content) } end end end end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/parser.rb0000644000004100000410000000033212652443364023303 0ustar www-datawww-datarequire "bundler/vendor/thor/lib/thor/parser/argument" require "bundler/vendor/thor/lib/thor/parser/arguments" require "bundler/vendor/thor/lib/thor/parser/option" require "bundler/vendor/thor/lib/thor/parser/options" bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/command.rb0000644000004100000410000001102712652443364023430 0ustar www-datawww-dataclass Bundler::Thor class Command < Struct.new(:name, :description, :long_description, :usage, :options) FILE_REGEXP = /^#{Regexp.escape(File.dirname(__FILE__))}/ def initialize(name, description, long_description, usage, options = nil) super(name.to_s, description, long_description, usage, options || {}) end def initialize_copy(other) #:nodoc: super(other) self.options = other.options.dup if other.options end def hidden? false end # By default, a command invokes a method in the thor class. You can change this # implementation to create custom commands. def run(instance, args = []) arity = nil if private_method?(instance) instance.class.handle_no_command_error(name) elsif public_method?(instance) arity = instance.method(name).arity instance.__send__(name, *args) elsif local_method?(instance, :method_missing) instance.__send__(:method_missing, name.to_sym, *args) else instance.class.handle_no_command_error(name) end rescue ArgumentError => e handle_argument_error?(instance, e, caller) ? instance.class.handle_argument_error(self, e, args, arity) : (raise e) rescue NoMethodError => e handle_no_method_error?(instance, e, caller) ? instance.class.handle_no_command_error(name) : (fail e) end # Returns the formatted usage by injecting given required arguments # and required options into the given usage. def formatted_usage(klass, namespace = true, subcommand = false) if namespace namespace = klass.namespace formatted = "#{namespace.gsub(/^(default)/, '')}:" end formatted = "#{klass.namespace.split(':').last} " if subcommand formatted ||= "" # Add usage with required arguments formatted << if klass && !klass.arguments.empty? usage.to_s.gsub(/^#{name}/) do |match| match << " " << klass.arguments.map { |a| a.usage }.compact.join(" ") end else usage.to_s end # Add required options formatted << " #{required_options}" # Strip and go! formatted.strip end protected def not_debugging?(instance) !(instance.class.respond_to?(:debugging) && instance.class.debugging) end def required_options @required_options ||= options.map { |_, o| o.usage if o.required? }.compact.sort.join(" ") end # Given a target, checks if this class name is a public method. def public_method?(instance) #:nodoc: !(instance.public_methods & [name.to_s, name.to_sym]).empty? end def private_method?(instance) !(instance.private_methods & [name.to_s, name.to_sym]).empty? end def local_method?(instance, name) methods = instance.public_methods(false) + instance.private_methods(false) + instance.protected_methods(false) !(methods & [name.to_s, name.to_sym]).empty? end def sans_backtrace(backtrace, caller) #:nodoc: saned = backtrace.reject { |frame| frame =~ FILE_REGEXP || (frame =~ /\.java:/ && RUBY_PLATFORM =~ /java/) || (frame =~ /^kernel\// && RUBY_ENGINE =~ /rbx/) } saned - caller end def handle_argument_error?(instance, error, caller) not_debugging?(instance) && (error.message =~ /wrong number of arguments/ || error.message =~ /given \d*, expected \d*/) && begin saned = sans_backtrace(error.backtrace, caller) # Ruby 1.9 always include the called method in the backtrace saned.empty? || (saned.size == 1 && RUBY_VERSION >= "1.9") end end def handle_no_method_error?(instance, error, caller) not_debugging?(instance) && error.message =~ /^undefined method `#{name}' for #{Regexp.escape(instance.to_s)}$/ end end Task = Command # rubocop:disable ConstantName # A command that is hidden in help messages but still invocable. class HiddenCommand < Command def hidden? true end end HiddenTask = HiddenCommand # rubocop:disable ConstantName # A dynamic command that handles method missing scenarios. class DynamicCommand < Command def initialize(name, options = nil) super(name.to_s, "A dynamically-generated command", name.to_s, name.to_s, options) end def run(instance, args = []) if (instance.methods & [name.to_s, name.to_sym]).empty? super else instance.class.handle_no_command_error(name) end end end DynamicTask = DynamicCommand # rubocop:disable ConstantName end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/parser/0000755000004100000410000000000012652443364022760 5ustar www-datawww-databundler-1.11.2/lib/bundler/vendor/thor/lib/thor/parser/options.rb0000644000004100000410000001352112652443364025002 0ustar www-datawww-dataclass Bundler::Thor class Options < Arguments #:nodoc: # rubocop:disable ClassLength LONG_RE = /^(--\w+(?:-\w+)*)$/ SHORT_RE = /^(-[a-z])$/i EQ_RE = /^(--\w+(?:-\w+)*|-[a-z])=(.*)$/i SHORT_SQ_RE = /^-([a-z]{2,})$/i # Allow either -x -v or -xv style for single char args SHORT_NUM = /^(-[a-z])#{NUMERIC}$/i OPTS_END = "--".freeze # Receives a hash and makes it switches. def self.to_switches(options) options.map do |key, value| case value when true "--#{key}" when Array "--#{key} #{value.map { |v| v.inspect }.join(' ')}" when Hash "--#{key} #{value.map { |k, v| "#{k}:#{v}" }.join(' ')}" when nil, false "" else "--#{key} #{value.inspect}" end end.join(" ") end # Takes a hash of Bundler::Thor::Option and a hash with defaults. # # If +stop_on_unknown+ is true, #parse will stop as soon as it encounters # an unknown option or a regular argument. def initialize(hash_options = {}, defaults = {}, stop_on_unknown = false) @stop_on_unknown = stop_on_unknown options = hash_options.values super(options) # Add defaults defaults.each do |key, value| @assigns[key.to_s] = value @non_assigned_required.delete(hash_options[key]) end @shorts, @switches, @extra = {}, {}, [] options.each do |option| @switches[option.switch_name] = option option.aliases.each do |short| name = short.to_s.sub(/^(?!\-)/, "-") @shorts[name] ||= option.switch_name end end end def remaining # rubocop:disable TrivialAccessors @extra end def peek return super unless @parsing_options result = super if result == OPTS_END shift @parsing_options = false super else result end end def parse(args) # rubocop:disable MethodLength @pile = args.dup @parsing_options = true while peek if parsing_options? match, is_switch = current_is_switch? shifted = shift if is_switch case shifted when SHORT_SQ_RE unshift($1.split("").map { |f| "-#{f}" }) next when EQ_RE, SHORT_NUM unshift($2) switch = $1 when LONG_RE, SHORT_RE switch = $1 end switch = normalize_switch(switch) option = switch_option(switch) @assigns[option.human_name] = parse_peek(switch, option) elsif @stop_on_unknown @parsing_options = false @extra << shifted @extra << shift while peek break elsif match @extra << shifted @extra << shift while peek && peek !~ /^-/ else @extra << shifted end else @extra << shift end end check_requirement! assigns = Bundler::Thor::CoreExt::HashWithIndifferentAccess.new(@assigns) assigns.freeze assigns end def check_unknown! # an unknown option starts with - or -- and has no more --'s afterward. unknown = @extra.select { |str| str =~ /^--?(?:(?!--).)*$/ } fail UnknownArgumentError, "Unknown switches '#{unknown.join(', ')}'" unless unknown.empty? end protected # Check if the current value in peek is a registered switch. # # Two booleans are returned. The first is true if the current value # starts with a hyphen; the second is true if it is a registered switch. def current_is_switch? case peek when LONG_RE, SHORT_RE, EQ_RE, SHORT_NUM [true, switch?($1)] when SHORT_SQ_RE [true, $1.split("").any? { |f| switch?("-#{f}") }] else [false, false] end end def current_is_switch_formatted? case peek when LONG_RE, SHORT_RE, EQ_RE, SHORT_NUM, SHORT_SQ_RE true else false end end def current_is_value? peek && (!parsing_options? || super) end def switch?(arg) switch_option(normalize_switch(arg)) end def switch_option(arg) if match = no_or_skip?(arg) # rubocop:disable AssignmentInCondition @switches[arg] || @switches["--#{match}"] else @switches[arg] end end # Check if the given argument is actually a shortcut. # def normalize_switch(arg) (@shorts[arg] || arg).tr("_", "-") end def parsing_options? peek @parsing_options end # Parse boolean values which can be given as --foo=true, --foo or --no-foo. # def parse_boolean(switch) if current_is_value? if ["true", "TRUE", "t", "T", true].include?(peek) shift true elsif ["false", "FALSE", "f", "F", false].include?(peek) shift false else true end else @switches.key?(switch) || !no_or_skip?(switch) end end # Parse the value at the peek analyzing if it requires an input or not. # def parse_peek(switch, option) if parsing_options? && (current_is_switch_formatted? || last?) if option.boolean? # No problem for boolean types elsif no_or_skip?(switch) return nil # User set value to nil elsif option.string? && !option.required? # Return the default if there is one, else the human name return option.lazy_default || option.default || option.human_name elsif option.lazy_default return option.lazy_default else fail MalformattedArgumentError, "No value provided for option '#{switch}'" end end @non_assigned_required.delete(option) send(:"parse_#{option.type}", switch) end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb0000644000004100000410000001047512652443364025321 0ustar www-datawww-dataclass Bundler::Thor class Arguments #:nodoc: # rubocop:disable ClassLength NUMERIC = /(\d*\.\d+|\d+)/ # Receives an array of args and returns two arrays, one with arguments # and one with switches. # def self.split(args) arguments = [] args.each do |item| break if item =~ /^-/ arguments << item end [arguments, args[Range.new(arguments.size, -1)]] end def self.parse(*args) to_parse = args.pop new(*args).parse(to_parse) end # Takes an array of Bundler::Thor::Argument objects. # def initialize(arguments = []) @assigns, @non_assigned_required = {}, [] @switches = arguments arguments.each do |argument| if !argument.default.nil? @assigns[argument.human_name] = argument.default elsif argument.required? @non_assigned_required << argument end end end def parse(args) @pile = args.dup @switches.each do |argument| break unless peek @non_assigned_required.delete(argument) @assigns[argument.human_name] = send(:"parse_#{argument.type}", argument.human_name) end check_requirement! @assigns end def remaining # rubocop:disable TrivialAccessors @pile end private def no_or_skip?(arg) arg =~ /^--(no|skip)-([-\w]+)$/ $2 end def last? @pile.empty? end def peek @pile.first end def shift @pile.shift end def unshift(arg) if arg.kind_of?(Array) @pile = arg + @pile else @pile.unshift(arg) end end def current_is_value? peek && peek.to_s !~ /^-/ end # Runs through the argument array getting strings that contains ":" and # mark it as a hash: # # [ "name:string", "age:integer" ] # # Becomes: # # { "name" => "string", "age" => "integer" } # def parse_hash(name) return shift if peek.is_a?(Hash) hash = {} while current_is_value? && peek.include?(":") key, value = shift.split(":", 2) hash[key] = value end hash end # Runs through the argument array getting all strings until no string is # found or a switch is found. # # ["a", "b", "c"] # # And returns it as an array: # # ["a", "b", "c"] # def parse_array(name) return shift if peek.is_a?(Array) array = [] array << shift while current_is_value? array end # Check if the peek is numeric format and return a Float or Integer. # Check if the peek is included in enum if enum is provided. # Otherwise raises an error. # def parse_numeric(name) return shift if peek.is_a?(Numeric) unless peek =~ NUMERIC && $& == peek fail MalformattedArgumentError, "Expected numeric value for '#{name}'; got #{peek.inspect}" end value = $&.index(".") ? shift.to_f : shift.to_i if @switches.is_a?(Hash) && switch = @switches[name] if switch.enum && !switch.enum.include?(value) fail MalformattedArgumentError, "Expected '#{name}' to be one of #{switch.enum.join(', ')}; got #{value}" end end value end # Parse string: # for --string-arg, just return the current value in the pile # for --no-string-arg, nil # Check if the peek is included in enum if enum is provided. Otherwise raises an error. # def parse_string(name) if no_or_skip?(name) nil else value = shift if @switches.is_a?(Hash) && switch = @switches[name] # rubocop:disable AssignmentInCondition if switch.enum && !switch.enum.include?(value) fail MalformattedArgumentError, "Expected '#{name}' to be one of #{switch.enum.join(', ')}; got #{value}" end end value end end # Raises an error if @non_assigned_required array is not empty. # def check_requirement! unless @non_assigned_required.empty? names = @non_assigned_required.map do |o| o.respond_to?(:switch_name) ? o.switch_name : o.human_name end.join("', '") class_name = self.class.name.split("::").last.downcase fail RequiredArgumentMissingError, "No value provided for required #{class_name} '#{names}'" end end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/parser/argument.rb0000644000004100000410000000343512652443364025134 0ustar www-datawww-dataclass Bundler::Thor class Argument #:nodoc: VALID_TYPES = [:numeric, :hash, :array, :string] attr_reader :name, :description, :enum, :required, :type, :default, :banner alias_method :human_name, :name def initialize(name, options = {}) class_name = self.class.name.split("::").last type = options[:type] fail ArgumentError, "#{class_name} name can't be nil." if name.nil? fail ArgumentError, "Type :#{type} is not valid for #{class_name.downcase}s." if type && !valid_type?(type) @name = name.to_s @description = options[:desc] @required = options.key?(:required) ? options[:required] : true @type = (type || :string).to_sym @default = options[:default] @banner = options[:banner] || default_banner @enum = options[:enum] validate! # Trigger specific validations end def usage required? ? banner : "[#{banner}]" end def required? required end def show_default? case default when Array, String, Hash !default.empty? else default end end protected def validate! if required? && !default.nil? fail ArgumentError, "An argument cannot be required and have default value." elsif @enum && !@enum.is_a?(Array) fail ArgumentError, "An argument cannot have an enum other than an array." end end def valid_type?(type) self.class::VALID_TYPES.include?(type.to_sym) end def default_banner case type when :boolean nil when :string, :default human_name.upcase when :numeric "N" when :hash "key:value" when :array "one two three" end end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/parser/option.rb0000644000004100000410000000663412652443364024626 0ustar www-datawww-dataclass Bundler::Thor class Option < Argument #:nodoc: attr_reader :aliases, :group, :lazy_default, :hide VALID_TYPES = [:boolean, :numeric, :hash, :array, :string] def initialize(name, options = {}) options[:required] = false unless options.key?(:required) super @lazy_default = options[:lazy_default] @group = options[:group].to_s.capitalize if options[:group] @aliases = Array(options[:aliases]) @hide = options[:hide] end # This parse quick options given as method_options. It makes several # assumptions, but you can be more specific using the option method. # # parse :foo => "bar" # #=> Option foo with default value bar # # parse [:foo, :baz] => "bar" # #=> Option foo with default value bar and alias :baz # # parse :foo => :required # #=> Required option foo without default value # # parse :foo => 2 # #=> Option foo with default value 2 and type numeric # # parse :foo => :numeric # #=> Option foo without default value and type numeric # # parse :foo => true # #=> Option foo with default value true and type boolean # # The valid types are :boolean, :numeric, :hash, :array and :string. If none # is given a default type is assumed. This default type accepts arguments as # string (--foo=value) or booleans (just --foo). # # By default all options are optional, unless :required is given. # def self.parse(key, value) # rubocop:disable MethodLength if key.is_a?(Array) name, *aliases = key else name, aliases = key, [] end name = name.to_s default = value type = case value when Symbol default = nil if VALID_TYPES.include?(value) value elsif required = (value == :required) # rubocop:disable AssignmentInCondition :string end when TrueClass, FalseClass :boolean when Numeric :numeric when Hash, Array, String value.class.name.downcase.to_sym end new(name.to_s, :required => required, :type => type, :default => default, :aliases => aliases) end def switch_name @switch_name ||= dasherized? ? name : dasherize(name) end def human_name @human_name ||= dasherized? ? undasherize(name) : name end def usage(padding = 0) sample = if banner && !banner.to_s.empty? "#{switch_name}=#{banner}" else switch_name end sample = "[#{sample}]" unless required? if boolean? sample << ", [#{dasherize("no-" + human_name)}]" unless name == "force" end if aliases.empty? (" " * padding) << sample else "#{aliases.join(', ')}, #{sample}" end end VALID_TYPES.each do |type| class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{type}? self.type == #{type.inspect} end RUBY end protected def validate! fail ArgumentError, "An option cannot be boolean and required." if boolean? && required? end def dasherized? name.index("-") == 0 end def undasherize(str) str.sub(/^-{1,2}/, "") end def dasherize(str) (str.length > 1 ? "--" : "-") + str.gsub("_", "-") end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/shell.rb0000644000004100000410000000445012652443364023123 0ustar www-datawww-datarequire "rbconfig" class Bundler::Thor module Base class << self attr_writer :shell # Returns the shell used in all Bundler::Thor classes. If you are in a Unix platform # it will use a colored log, otherwise it will use a basic one without color. # def shell @shell ||= if ENV["THOR_SHELL"] && ENV["THOR_SHELL"].size > 0 Bundler::Thor::Shell.const_get(ENV["THOR_SHELL"]) elsif RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ && !ENV["ANSICON"] Bundler::Thor::Shell::Basic else Bundler::Thor::Shell::Color end end end end module Shell SHELL_DELEGATED_METHODS = [:ask, :error, :set_color, :yes?, :no?, :say, :say_status, :print_in_columns, :print_table, :print_wrapped, :file_collision, :terminal_width] attr_writer :shell autoload :Basic, "bundler/vendor/thor/lib/thor/shell/basic" autoload :Color, "bundler/vendor/thor/lib/thor/shell/color" autoload :HTML, "bundler/vendor/thor/lib/thor/shell/html" # Add shell to initialize config values. # # ==== Configuration # shell:: An instance of the shell to be used. # # ==== Examples # # class MyScript < Bundler::Thor # argument :first, :type => :numeric # end # # MyScript.new [1.0], { :foo => :bar }, :shell => Bundler::Thor::Shell::Basic.new # def initialize(args = [], options = {}, config = {}) super self.shell = config[:shell] shell.base ||= self if shell.respond_to?(:base) end # Holds the shell for the given Bundler::Thor instance. If no shell is given, # it gets a default shell from Bundler::Thor::Base.shell. def shell @shell ||= Bundler::Thor::Base.shell.new end # Common methods that are delegated to the shell. SHELL_DELEGATED_METHODS.each do |method| module_eval <<-METHOD, __FILE__, __LINE__ def #{method}(*args,&block) shell.#{method}(*args,&block) end METHOD end # Yields the given block with padding. def with_padding shell.padding += 1 yield ensure shell.padding -= 1 end protected # Allow shell to be shared between invocations. # def _shared_configuration #:nodoc: super.merge!(:shell => shell) end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/invocation.rb0000644000004100000410000001410112652443364024157 0ustar www-datawww-dataclass Bundler::Thor module Invocation def self.included(base) #:nodoc: base.extend ClassMethods end module ClassMethods # This method is responsible for receiving a name and find the proper # class and command for it. The key is an optional parameter which is # available only in class methods invocations (i.e. in Bundler::Thor::Group). def prepare_for_invocation(key, name) #:nodoc: case name when Symbol, String Bundler::Thor::Util.find_class_and_command_by_namespace(name.to_s, !key) else name end end end # Make initializer aware of invocations and the initialization args. def initialize(args = [], options = {}, config = {}, &block) #:nodoc: @_invocations = config[:invocations] || Hash.new { |h, k| h[k] = [] } @_initializer = [args, options, config] super end # Make the current command chain accessible with in a Bundler::Thor-(sub)command def current_command_chain @_invocations.values.flatten.map(&:to_sym) end # Receives a name and invokes it. The name can be a string (either "command" or # "namespace:command"), a Bundler::Thor::Command, a Class or a Bundler::Thor instance. If the # command cannot be guessed by name, it can also be supplied as second argument. # # You can also supply the arguments, options and configuration values for # the command to be invoked, if none is given, the same values used to # initialize the invoker are used to initialize the invoked. # # When no name is given, it will invoke the default command of the current class. # # ==== Examples # # class A < Bundler::Thor # def foo # invoke :bar # invoke "b:hello", ["Erik"] # end # # def bar # invoke "b:hello", ["Erik"] # end # end # # class B < Bundler::Thor # def hello(name) # puts "hello #{name}" # end # end # # You can notice that the method "foo" above invokes two commands: "bar", # which belongs to the same class and "hello" which belongs to the class B. # # By using an invocation system you ensure that a command is invoked only once. # In the example above, invoking "foo" will invoke "b:hello" just once, even # if it's invoked later by "bar" method. # # When class A invokes class B, all arguments used on A initialization are # supplied to B. This allows lazy parse of options. Let's suppose you have # some rspec commands: # # class Rspec < Bundler::Thor::Group # class_option :mock_framework, :type => :string, :default => :rr # # def invoke_mock_framework # invoke "rspec:#{options[:mock_framework]}" # end # end # # As you noticed, it invokes the given mock framework, which might have its # own options: # # class Rspec::RR < Bundler::Thor::Group # class_option :style, :type => :string, :default => :mock # end # # Since it's not rspec concern to parse mock framework options, when RR # is invoked all options are parsed again, so RR can extract only the options # that it's going to use. # # If you want Rspec::RR to be initialized with its own set of options, you # have to do that explicitly: # # invoke "rspec:rr", [], :style => :foo # # Besides giving an instance, you can also give a class to invoke: # # invoke Rspec::RR, [], :style => :foo # def invoke(name = nil, *args) if name.nil? warn "[Bundler::Thor] Calling invoke() without argument is deprecated. Please use invoke_all instead.\n#{caller.join("\n")}" return invoke_all end args.unshift(nil) if args.first.is_a?(Array) || args.first.nil? command, args, opts, config = args klass, command = _retrieve_class_and_command(name, command) fail "Missing Bundler::Thor class for invoke #{name}" unless klass fail "Expected Bundler::Thor class, got #{klass}" unless klass <= Bundler::Thor::Base args, opts, config = _parse_initialization_options(args, opts, config) klass.send(:dispatch, command, args, opts, config) do |instance| instance.parent_options = options end end # Invoke the given command if the given args. def invoke_command(command, *args) #:nodoc: current = @_invocations[self.class] unless current.include?(command.name) current << command.name command.run(self, *args) end end alias_method :invoke_task, :invoke_command # Invoke all commands for the current instance. def invoke_all #:nodoc: self.class.all_commands.map { |_, command| invoke_command(command) } end # Invokes using shell padding. def invoke_with_padding(*args) with_padding { invoke(*args) } end protected # Configuration values that are shared between invocations. def _shared_configuration #:nodoc: {:invocations => @_invocations} end # This method simply retrieves the class and command to be invoked. # If the name is nil or the given name is a command in the current class, # use the given name and return self as class. Otherwise, call # prepare_for_invocation in the current class. def _retrieve_class_and_command(name, sent_command = nil) #:nodoc: case when name.nil? [self.class, nil] when self.class.all_commands[name.to_s] [self.class, name.to_s] else klass, command = self.class.prepare_for_invocation(nil, name) [klass, command || sent_command] end end alias_method :_retrieve_class_and_task, :_retrieve_class_and_command # Initialize klass using values stored in the @_initializer. def _parse_initialization_options(args, opts, config) #:nodoc: stored_args, stored_opts, stored_config = @_initializer args ||= stored_args.dup opts ||= stored_opts.dup config ||= {} config = stored_config.merge(_shared_configuration).merge!(config) [args, opts, config] end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/version.rb0000644000004100000410000000005512652443364023476 0ustar www-datawww-dataclass Bundler::Thor VERSION = "0.19.1" end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/rake_compat.rb0000644000004100000410000000414412652443364024301 0ustar www-datawww-datarequire "rake" require "rake/dsl_definition" class Bundler::Thor # Adds a compatibility layer to your Bundler::Thor classes which allows you to use # rake package tasks. For example, to use rspec rake tasks, one can do: # # require 'bundler/vendor/thor/lib/thor/rake_compat' # require 'rspec/core/rake_task' # # class Default < Bundler::Thor # include Bundler::Thor::RakeCompat # # RSpec::Core::RakeTask.new(:spec) do |t| # t.spec_opts = ['--options', './.rspec'] # t.spec_files = FileList['spec/**/*_spec.rb'] # end # end # module RakeCompat include Rake::DSL if defined?(Rake::DSL) def self.rake_classes @rake_classes ||= [] end def self.included(base) # Hack. Make rakefile point to invoker, so rdoc task is generated properly. rakefile = File.basename(caller[0].match(/(.*):\d+/)[1]) Rake.application.instance_variable_set(:@rakefile, rakefile) rake_classes << base end end end # override task on (main), for compatibility with Rake 0.9 instance_eval do alias rake_namespace namespace def task(*) task = super if klass = Bundler::Thor::RakeCompat.rake_classes.last # rubocop:disable AssignmentInCondition non_namespaced_name = task.name.split(":").last description = non_namespaced_name description << task.arg_names.map { |n| n.to_s.upcase }.join(" ") description.strip! klass.desc description, Rake.application.last_description || non_namespaced_name Rake.application.last_description = nil klass.send :define_method, non_namespaced_name do |*args| Rake::Task[task.name.to_sym].invoke(*args) end end task end def namespace(name) if klass = Bundler::Thor::RakeCompat.rake_classes.last # rubocop:disable AssignmentInCondition const_name = Bundler::Thor::Util.camel_case(name.to_s).to_sym klass.const_set(const_name, Class.new(Bundler::Thor)) new_klass = klass.const_get(const_name) Bundler::Thor::RakeCompat.rake_classes << new_klass end super Bundler::Thor::RakeCompat.rake_classes.pop end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/actions.rb0000644000004100000410000002434512652443364023461 0ustar www-datawww-datarequire "fileutils" require "uri" require "bundler/vendor/thor/lib/thor/core_ext/io_binary_read" require "bundler/vendor/thor/lib/thor/actions/create_file" require "bundler/vendor/thor/lib/thor/actions/create_link" require "bundler/vendor/thor/lib/thor/actions/directory" require "bundler/vendor/thor/lib/thor/actions/empty_directory" require "bundler/vendor/thor/lib/thor/actions/file_manipulation" require "bundler/vendor/thor/lib/thor/actions/inject_into_file" class Bundler::Thor module Actions attr_accessor :behavior def self.included(base) #:nodoc: base.extend ClassMethods end module ClassMethods # Hold source paths for one Bundler::Thor instance. source_paths_for_search is the # method responsible to gather source_paths from this current class, # inherited paths and the source root. # def source_paths @_source_paths ||= [] end # Stores and return the source root for this class def source_root(path = nil) @_source_root = path if path @_source_root ||= nil end # Returns the source paths in the following order: # # 1) This class source paths # 2) Source root # 3) Parents source paths # def source_paths_for_search paths = [] paths += source_paths paths << source_root if source_root paths += from_superclass(:source_paths, []) paths end # Add runtime options that help actions execution. # def add_runtime_options! class_option :force, :type => :boolean, :aliases => "-f", :group => :runtime, :desc => "Overwrite files that already exist" class_option :pretend, :type => :boolean, :aliases => "-p", :group => :runtime, :desc => "Run but do not make any changes" class_option :quiet, :type => :boolean, :aliases => "-q", :group => :runtime, :desc => "Suppress status output" class_option :skip, :type => :boolean, :aliases => "-s", :group => :runtime, :desc => "Skip files that already exist" end end # Extends initializer to add more configuration options. # # ==== Configuration # behavior:: The actions default behavior. Can be :invoke or :revoke. # It also accepts :force, :skip and :pretend to set the behavior # and the respective option. # # destination_root:: The root directory needed for some actions. # def initialize(args = [], options = {}, config = {}) self.behavior = case config[:behavior].to_s when "force", "skip" _cleanup_options_and_set(options, config[:behavior]) :invoke when "revoke" :revoke else :invoke end super self.destination_root = config[:destination_root] end # Wraps an action object and call it accordingly to the thor class behavior. # def action(instance) #:nodoc: if behavior == :revoke instance.revoke! else instance.invoke! end end # Returns the root for this thor class (also aliased as destination root). # def destination_root @destination_stack.last end # Sets the root for this thor class. Relatives path are added to the # directory where the script was invoked and expanded. # def destination_root=(root) @destination_stack ||= [] @destination_stack[0] = File.expand_path(root || "") end # Returns the given path relative to the absolute root (ie, root where # the script started). # def relative_to_original_destination_root(path, remove_dot = true) path = path.dup if path.gsub!(@destination_stack[0], ".") remove_dot ? (path[2..-1] || "") : path else path end end # Holds source paths in instance so they can be manipulated. # def source_paths @source_paths ||= self.class.source_paths_for_search end # Receives a file or directory and search for it in the source paths. # def find_in_source_paths(file) # rubocop:disable MethodLength possible_files = [file, file + TEMPLATE_EXTNAME] relative_root = relative_to_original_destination_root(destination_root, false) source_paths.each do |source| possible_files.each do |f| source_file = File.expand_path(f, File.join(source, relative_root)) return source_file if File.exist?(source_file) end end message = "Could not find #{file.inspect} in any of your source paths. " unless self.class.source_root message << "Please invoke #{self.class.name}.source_root(PATH) with the PATH containing your templates. " end if source_paths.empty? message << "Currently you have no source paths." else message << "Your current source paths are: \n#{source_paths.join("\n")}" end fail Error, message end # Do something in the root or on a provided subfolder. If a relative path # is given it's referenced from the current root. The full path is yielded # to the block you provide. The path is set back to the previous path when # the method exits. # # ==== Parameters # dir:: the directory to move to. # config:: give :verbose => true to log and use padding. # def inside(dir = "", config = {}, &block) verbose = config.fetch(:verbose, false) pretend = options[:pretend] say_status :inside, dir, verbose shell.padding += 1 if verbose @destination_stack.push File.expand_path(dir, destination_root) # If the directory doesnt exist and we're not pretending if !File.exist?(destination_root) && !pretend FileUtils.mkdir_p(destination_root) end if pretend # In pretend mode, just yield down to the block block.arity == 1 ? yield(destination_root) : yield else FileUtils.cd(destination_root) { block.arity == 1 ? yield(destination_root) : yield } end @destination_stack.pop shell.padding -= 1 if verbose end # Goes to the root and execute the given block. # def in_root inside(@destination_stack.first) { yield } end # Loads an external file and execute it in the instance binding. # # ==== Parameters # path:: The path to the file to execute. Can be a web address or # a relative path from the source root. # # ==== Examples # # apply "http://gist.github.com/103208" # # apply "recipes/jquery.rb" # def apply(path, config = {}) verbose = config.fetch(:verbose, true) is_uri = path =~ %r{^https?\://} path = find_in_source_paths(path) unless is_uri say_status :apply, path, verbose shell.padding += 1 if verbose if is_uri contents = open(path, "Accept" => "application/x-thor-template") { |io| io.read } else contents = open(path) { |io| io.read } end instance_eval(contents, path) shell.padding -= 1 if verbose end # Executes a command returning the contents of the command. # # ==== Parameters # command:: the command to be executed. # config:: give :verbose => false to not log the status, :capture => true to hide to output. Specify :with # to append an executable to command execution. # # ==== Example # # inside('vendor') do # run('ln -s ~/edge rails') # end # def run(command, config = {}) return unless behavior == :invoke destination = relative_to_original_destination_root(destination_root, false) desc = "#{command} from #{destination.inspect}" if config[:with] desc = "#{File.basename(config[:with].to_s)} #{desc}" command = "#{config[:with]} #{command}" end say_status :run, desc, config.fetch(:verbose, true) unless options[:pretend] config[:capture] ? `#{command}` : system("#{command}") end end # Executes a ruby script (taking into account WIN32 platform quirks). # # ==== Parameters # command:: the command to be executed. # config:: give :verbose => false to not log the status. # def run_ruby_script(command, config = {}) return unless behavior == :invoke run command, config.merge(:with => Bundler::Thor::Util.ruby_command) end # Run a thor command. A hash of options can be given and it's converted to # switches. # # ==== Parameters # command:: the command to be invoked # args:: arguments to the command # config:: give :verbose => false to not log the status, :capture => true to hide to output. # Other options are given as parameter to Bundler::Thor. # # # ==== Examples # # thor :install, "http://gist.github.com/103208" # #=> thor install http://gist.github.com/103208 # # thor :list, :all => true, :substring => 'rails' # #=> thor list --all --substring=rails # def thor(command, *args) config = args.last.is_a?(Hash) ? args.pop : {} verbose = config.key?(:verbose) ? config.delete(:verbose) : true pretend = config.key?(:pretend) ? config.delete(:pretend) : false capture = config.key?(:capture) ? config.delete(:capture) : false args.unshift(command) args.push Bundler::Thor::Options.to_switches(config) command = args.join(" ").strip run command, :with => :thor, :verbose => verbose, :pretend => pretend, :capture => capture end protected # Allow current root to be shared between invocations. # def _shared_configuration #:nodoc: super.merge!(:destination_root => destination_root) end def _cleanup_options_and_set(options, key) #:nodoc: case options when Array %w[--force -f --skip -s].each { |i| options.delete(i) } options << "--#{key}" when Hash [:force, :skip, "force", "skip"].each { |i| options.delete(i) } options.merge!(key => true) end end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/group.rb0000644000004100000410000002172412652443364023153 0ustar www-datawww-datarequire "bundler/vendor/thor/lib/thor/base" # Bundler::Thor has a special class called Bundler::Thor::Group. The main difference to Bundler::Thor class # is that it invokes all commands at once. It also include some methods that allows # invocations to be done at the class method, which are not available to Bundler::Thor # commands. class Bundler::Thor::Group # rubocop:disable ClassLength class << self # The description for this Bundler::Thor::Group. If none is provided, but a source root # exists, tries to find the USAGE one folder above it, otherwise searches # in the superclass. # # ==== Parameters # description:: The description for this Bundler::Thor::Group. # def desc(description = nil) if description @desc = description else @desc ||= from_superclass(:desc, nil) end end # Prints help information. # # ==== Options # short:: When true, shows only usage. # def help(shell) shell.say "Usage:" shell.say " #{banner}\n" shell.say class_options_help(shell) shell.say desc if desc end # Stores invocations for this class merging with superclass values. # def invocations #:nodoc: @invocations ||= from_superclass(:invocations, {}) end # Stores invocation blocks used on invoke_from_option. # def invocation_blocks #:nodoc: @invocation_blocks ||= from_superclass(:invocation_blocks, {}) end # Invoke the given namespace or class given. It adds an instance # method that will invoke the klass and command. You can give a block to # configure how it will be invoked. # # The namespace/class given will have its options showed on the help # usage. Check invoke_from_option for more information. # def invoke(*names, &block) # rubocop:disable MethodLength options = names.last.is_a?(Hash) ? names.pop : {} verbose = options.fetch(:verbose, true) names.each do |name| invocations[name] = false invocation_blocks[name] = block if block_given? class_eval <<-METHOD, __FILE__, __LINE__ def _invoke_#{name.to_s.gsub(/\W/, "_")} klass, command = self.class.prepare_for_invocation(nil, #{name.inspect}) if klass say_status :invoke, #{name.inspect}, #{verbose.inspect} block = self.class.invocation_blocks[#{name.inspect}] _invoke_for_class_method klass, command, &block else say_status :error, %(#{name.inspect} [not found]), :red end end METHOD end end # Invoke a thor class based on the value supplied by the user to the # given option named "name". A class option must be created before this # method is invoked for each name given. # # ==== Examples # # class GemGenerator < Bundler::Thor::Group # class_option :test_framework, :type => :string # invoke_from_option :test_framework # end # # ==== Boolean options # # In some cases, you want to invoke a thor class if some option is true or # false. This is automatically handled by invoke_from_option. Then the # option name is used to invoke the generator. # # ==== Preparing for invocation # # In some cases you want to customize how a specified hook is going to be # invoked. You can do that by overwriting the class method # prepare_for_invocation. The class method must necessarily return a klass # and an optional command. # # ==== Custom invocations # # You can also supply a block to customize how the option is going to be # invoked. The block receives two parameters, an instance of the current # class and the klass to be invoked. # def invoke_from_option(*names, &block) # rubocop:disable MethodLength options = names.last.is_a?(Hash) ? names.pop : {} verbose = options.fetch(:verbose, :white) names.each do |name| unless class_options.key?(name) fail ArgumentError, "You have to define the option #{name.inspect} " << "before setting invoke_from_option." end invocations[name] = true invocation_blocks[name] = block if block_given? class_eval <<-METHOD, __FILE__, __LINE__ def _invoke_from_option_#{name.to_s.gsub(/\W/, "_")} return unless options[#{name.inspect}] value = options[#{name.inspect}] value = #{name.inspect} if TrueClass === value klass, command = self.class.prepare_for_invocation(#{name.inspect}, value) if klass say_status :invoke, value, #{verbose.inspect} block = self.class.invocation_blocks[#{name.inspect}] _invoke_for_class_method klass, command, &block else say_status :error, %(\#{value} [not found]), :red end end METHOD end end # Remove a previously added invocation. # # ==== Examples # # remove_invocation :test_framework # def remove_invocation(*names) names.each do |name| remove_command(name) remove_class_option(name) invocations.delete(name) invocation_blocks.delete(name) end end # Overwrite class options help to allow invoked generators options to be # shown recursively when invoking a generator. # def class_options_help(shell, groups = {}) #:nodoc: get_options_from_invocations(groups, class_options) do |klass| klass.send(:get_options_from_invocations, groups, class_options) end super(shell, groups) end # Get invocations array and merge options from invocations. Those # options are added to group_options hash. Options that already exists # in base_options are not added twice. # def get_options_from_invocations(group_options, base_options) #:nodoc: # rubocop:disable MethodLength invocations.each do |name, from_option| value = if from_option option = class_options[name] option.type == :boolean ? name : option.default else name end next unless value klass, _ = prepare_for_invocation(name, value) next unless klass && klass.respond_to?(:class_options) value = value.to_s human_name = value.respond_to?(:classify) ? value.classify : value group_options[human_name] ||= [] group_options[human_name] += klass.class_options.values.select do |class_option| base_options[class_option.name.to_sym].nil? && class_option.group.nil? && !group_options.values.flatten.any? { |i| i.name == class_option.name } end yield klass if block_given? end end # Returns commands ready to be printed. def printable_commands(*) item = [] item << banner item << (desc ? "# #{desc.gsub(/\s+/m, ' ')}" : "") [item] end alias_method :printable_tasks, :printable_commands def handle_argument_error(command, error, args, arity) #:nodoc: msg = "#{basename} #{command.name} takes #{arity} argument" msg << "s" if arity > 1 msg << ", but it should not." fail error, msg end protected # The method responsible for dispatching given the args. def dispatch(command, given_args, given_opts, config) #:nodoc: if Bundler::Thor::HELP_MAPPINGS.include?(given_args.first) help(config[:shell]) return end args, opts = Bundler::Thor::Options.split(given_args) opts = given_opts || opts instance = new(args, opts, config) yield instance if block_given? if command instance.invoke_command(all_commands[command]) else instance.invoke_all end end # The banner for this class. You can customize it if you are invoking the # thor class by another ways which is not the Bundler::Thor::Runner. def banner "#{basename} #{self_command.formatted_usage(self, false)}" end # Represents the whole class as a command. def self_command #:nodoc: Bundler::Thor::DynamicCommand.new(namespace, class_options) end alias_method :self_task, :self_command def baseclass #:nodoc: Bundler::Thor::Group end def create_command(meth) #:nodoc: commands[meth.to_s] = Bundler::Thor::Command.new(meth, nil, nil, nil, nil) true end alias_method :create_task, :create_command end include Bundler::Thor::Base protected # Shortcut to invoke with padding and block handling. Use internally by # invoke and invoke_from_option class methods. def _invoke_for_class_method(klass, command = nil, *args, &block) #:nodoc: with_padding do if block case block.arity when 3 block.call(self, klass, command) when 2 block.call(self, klass) when 1 instance_exec(klass, &block) end else invoke klass, command, *args end end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/runner.rb0000644000004100000410000002374112652443364023331 0ustar www-datawww-datarequire "bundler/vendor/thor/lib/thor" require "bundler/vendor/thor/lib/thor/group" require "bundler/vendor/thor/lib/thor/core_ext/io_binary_read" require "fileutils" require "open-uri" require "yaml" require "digest/md5" require "pathname" class Bundler::Thor::Runner < Bundler::Thor #:nodoc: # rubocop:disable ClassLength map "-T" => :list, "-i" => :install, "-u" => :update, "-v" => :version # Override Bundler::Thor#help so it can give information about any class and any method. # def help(meth = nil) if meth && !self.respond_to?(meth) initialize_thorfiles(meth) klass, command = Bundler::Thor::Util.find_class_and_command_by_namespace(meth) self.class.handle_no_command_error(command, false) if klass.nil? klass.start(["-h", command].compact, :shell => shell) else super end end # If a command is not found on Bundler::Thor::Runner, method missing is invoked and # Bundler::Thor::Runner is then responsible for finding the command in all classes. # def method_missing(meth, *args) meth = meth.to_s initialize_thorfiles(meth) klass, command = Bundler::Thor::Util.find_class_and_command_by_namespace(meth) self.class.handle_no_command_error(command, false) if klass.nil? args.unshift(command) if command klass.start(args, :shell => shell) end desc "install NAME", "Install an optionally named Bundler::Thor file into your system commands" method_options :as => :string, :relative => :boolean, :force => :boolean def install(name) # rubocop:disable MethodLength initialize_thorfiles # If a directory name is provided as the argument, look for a 'main.thor' # command in said directory. begin if File.directory?(File.expand_path(name)) base, package = File.join(name, "main.thor"), :directory contents = open(base) { |input| input.read } else base, package = name, :file contents = open(name) { |input| input.read } end rescue OpenURI::HTTPError raise Error, "Error opening URI '#{name}'" rescue Errno::ENOENT fail Error, "Error opening file '#{name}'" end say "Your Bundler::Thorfile contains:" say contents unless options["force"] return false if no?("Do you wish to continue [y/N]?") end as = options["as"] || begin first_line = contents.split("\n")[0] (match = first_line.match(/\s*#\s*module:\s*([^\n]*)/)) ? match[1].strip : nil end unless as basename = File.basename(name) as = ask("Please specify a name for #{name} in the system repository [#{basename}]:") as = basename if as.empty? end location = if options[:relative] || name =~ %r{^https?://} name else File.expand_path(name) end thor_yaml[as] = { :filename => Digest::MD5.hexdigest(name + as), :location => location, :namespaces => Bundler::Thor::Util.namespaces_in_content(contents, base) } save_yaml(thor_yaml) say "Storing thor file in your system repository" destination = File.join(thor_root, thor_yaml[as][:filename]) if package == :file File.open(destination, "w") { |f| f.puts contents } else FileUtils.cp_r(name, destination) end thor_yaml[as][:filename] # Indicate success end desc "version", "Show Bundler::Thor version" def version require "bundler/vendor/thor/lib/thor/version" say "Bundler::Thor #{Bundler::Thor::VERSION}" end desc "uninstall NAME", "Uninstall a named Bundler::Thor module" def uninstall(name) fail Error, "Can't find module '#{name}'" unless thor_yaml[name] say "Uninstalling #{name}." FileUtils.rm_rf(File.join(thor_root, "#{thor_yaml[name][:filename]}")) thor_yaml.delete(name) save_yaml(thor_yaml) puts "Done." end desc "update NAME", "Update a Bundler::Thor file from its original location" def update(name) fail Error, "Can't find module '#{name}'" if !thor_yaml[name] || !thor_yaml[name][:location] say "Updating '#{name}' from #{thor_yaml[name][:location]}" old_filename = thor_yaml[name][:filename] self.options = options.merge("as" => name) if File.directory? File.expand_path(name) FileUtils.rm_rf(File.join(thor_root, old_filename)) thor_yaml.delete(old_filename) save_yaml(thor_yaml) filename = install(name) else filename = install(thor_yaml[name][:location]) end unless filename == old_filename File.delete(File.join(thor_root, old_filename)) end end desc "installed", "List the installed Bundler::Thor modules and commands" method_options :internal => :boolean def installed initialize_thorfiles(nil, true) display_klasses(true, options["internal"]) end desc "list [SEARCH]", "List the available thor commands (--substring means .*SEARCH)" method_options :substring => :boolean, :group => :string, :all => :boolean, :debug => :boolean def list(search = "") initialize_thorfiles search = ".*#{search}" if options["substring"] search = /^#{search}.*/i group = options[:group] || "standard" klasses = Bundler::Thor::Base.subclasses.select do |k| (options[:all] || k.group == group) && k.namespace =~ search end display_klasses(false, false, klasses) end private def self.banner(command, all = false, subcommand = false) "thor " + command.formatted_usage(self, all, subcommand) end def thor_root Bundler::Thor::Util.thor_root end def thor_yaml @thor_yaml ||= begin yaml_file = File.join(thor_root, "thor.yml") yaml = YAML.load_file(yaml_file) if File.exist?(yaml_file) yaml || {} end end # Save the yaml file. If none exists in thor root, creates one. # def save_yaml(yaml) yaml_file = File.join(thor_root, "thor.yml") unless File.exist?(yaml_file) FileUtils.mkdir_p(thor_root) yaml_file = File.join(thor_root, "thor.yml") FileUtils.touch(yaml_file) end File.open(yaml_file, "w") { |f| f.puts yaml.to_yaml } end def self.exit_on_failure? true end # Load the Bundler::Thorfiles. If relevant_to is supplied, looks for specific files # in the thor_root instead of loading them all. # # By default, it also traverses the current path until find Bundler::Thor files, as # described in thorfiles. This look up can be skipped by supplying # skip_lookup true. # def initialize_thorfiles(relevant_to = nil, skip_lookup = false) thorfiles(relevant_to, skip_lookup).each do |f| Bundler::Thor::Util.load_thorfile(f, nil, options[:debug]) unless Bundler::Thor::Base.subclass_files.keys.include?(File.expand_path(f)) end end # Finds Bundler::Thorfiles by traversing from your current directory down to the root # directory of your system. If at any time we find a Bundler::Thor file, we stop. # # We also ensure that system-wide Bundler::Thorfiles are loaded first, so local # Bundler::Thorfiles can override them. # # ==== Example # # If we start at /Users/wycats/dev/thor ... # # 1. /Users/wycats/dev/thor # 2. /Users/wycats/dev # 3. /Users/wycats <-- we find a Bundler::Thorfile here, so we stop # # Suppose we start at c:\Documents and Settings\james\dev\thor ... # # 1. c:\Documents and Settings\james\dev\thor # 2. c:\Documents and Settings\james\dev # 3. c:\Documents and Settings\james # 4. c:\Documents and Settings # 5. c:\ <-- no Bundler::Thorfiles found! # def thorfiles(relevant_to = nil, skip_lookup = false) thorfiles = [] unless skip_lookup Pathname.pwd.ascend do |path| thorfiles = Bundler::Thor::Util.globs_for(path).map { |g| Dir[g] }.flatten break unless thorfiles.empty? end end files = (relevant_to ? thorfiles_relevant_to(relevant_to) : Bundler::Thor::Util.thor_root_glob) files += thorfiles files -= ["#{thor_root}/thor.yml"] files.map! do |file| File.directory?(file) ? File.join(file, "main.thor") : file end end # Load Bundler::Thorfiles relevant to the given method. If you provide "foo:bar" it # will load all thor files in the thor.yaml that has "foo" e "foo:bar" # namespaces registered. # def thorfiles_relevant_to(meth) lookup = [meth, meth.split(":")[0...-1].join(":")] files = thor_yaml.select do |k, v| v[:namespaces] && !(v[:namespaces] & lookup).empty? end files.map { |k, v| File.join(thor_root, "#{v[:filename]}") } end # Display information about the given klasses. If with_module is given, # it shows a table with information extracted from the yaml file. # def display_klasses(with_modules = false, show_internal = false, klasses = Bundler::Thor::Base.subclasses) klasses -= [Bundler::Thor, Bundler::Thor::Runner, Bundler::Thor::Group] unless show_internal fail Error, "No Bundler::Thor commands available" if klasses.empty? show_modules if with_modules && !thor_yaml.empty? list = Hash.new { |h, k| h[k] = [] } groups = klasses.select { |k| k.ancestors.include?(Bundler::Thor::Group) } # Get classes which inherit from Bundler::Thor (klasses - groups).each { |k| list[k.namespace.split(":").first] += k.printable_commands(false) } # Get classes which inherit from Bundler::Thor::Base groups.map! { |k| k.printable_commands(false).first } list["root"] = groups # Order namespaces with default coming first list = list.sort { |a, b| a[0].sub(/^default/, "") <=> b[0].sub(/^default/, "") } list.each { |n, commands| display_commands(n, commands) unless commands.empty? } end def display_commands(namespace, list) #:nodoc: list.sort! { |a, b| a[0] <=> b[0] } say shell.set_color(namespace, :blue, true) say "-" * namespace.size print_table(list, :truncate => true) say end alias_method :display_tasks, :display_commands def show_modules #:nodoc: info = [] labels = %w[Modules Namespaces] info << labels info << ["-" * labels[0].size, "-" * labels[1].size] thor_yaml.each do |name, hash| info << [name, hash[:namespaces].join(", ")] end print_table info say "" end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/line_editor/0000755000004100000410000000000012652443364023761 5ustar www-datawww-databundler-1.11.2/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb0000644000004100000410000000342612652443364026076 0ustar www-datawww-databegin require "readline" rescue LoadError end class Bundler::Thor module LineEditor class Readline < Basic def self.available? Object.const_defined?(:Readline) end def readline if echo? ::Readline.completion_append_character = nil # Ruby 1.8.7 does not allow Readline.completion_proc= to receive nil. if complete = completion_proc ::Readline.completion_proc = complete end ::Readline.readline(prompt, add_to_history?) else super end end private def add_to_history? options.fetch(:add_to_history, true) end def completion_proc if use_path_completion? proc { |text| PathCompletion.new(text).matches } elsif completion_options.any? proc do |text| completion_options.select { |option| option.start_with?(text) } end end end def completion_options options.fetch(:limited_to, []) end def use_path_completion? options.fetch(:path, false) end class PathCompletion attr_reader :text private :text def initialize(text) @text = text end def matches relative_matches end private def relative_matches absolute_matches.map { |path| path.sub(base_path, "") } end def absolute_matches Dir[glob_pattern].map do |path| if File.directory?(path) "#{path}/" else path end end end def glob_pattern "#{base_path}#{text}*" end def base_path "#{Dir.pwd}/" end end end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb0000644000004100000410000000103512652443364025366 0ustar www-datawww-dataclass Bundler::Thor module LineEditor class Basic attr_reader :prompt, :options def self.available? true end def initialize(prompt, options) @prompt = prompt @options = options end def readline $stdout.print(prompt) get_input end private def get_input if echo? $stdin.gets else $stdin.noecho(&:gets) end end def echo? options.fetch(:echo, true) end end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/shell/0000755000004100000410000000000012652443364022573 5ustar www-datawww-databundler-1.11.2/lib/bundler/vendor/thor/lib/thor/shell/color.rb0000644000004100000410000001126012652443364024236 0ustar www-datawww-datarequire "bundler/vendor/thor/lib/thor/shell/basic" class Bundler::Thor module Shell # Inherit from Bundler::Thor::Shell::Basic and add set_color behavior. Check # Bundler::Thor::Shell::Basic to see all available methods. # class Color < Basic # Embed in a String to clear all previous ANSI sequences. CLEAR = "\e[0m" # The start of an ANSI bold sequence. BOLD = "\e[1m" # Set the terminal's foreground ANSI color to black. BLACK = "\e[30m" # Set the terminal's foreground ANSI color to red. RED = "\e[31m" # Set the terminal's foreground ANSI color to green. GREEN = "\e[32m" # Set the terminal's foreground ANSI color to yellow. YELLOW = "\e[33m" # Set the terminal's foreground ANSI color to blue. BLUE = "\e[34m" # Set the terminal's foreground ANSI color to magenta. MAGENTA = "\e[35m" # Set the terminal's foreground ANSI color to cyan. CYAN = "\e[36m" # Set the terminal's foreground ANSI color to white. WHITE = "\e[37m" # Set the terminal's background ANSI color to black. ON_BLACK = "\e[40m" # Set the terminal's background ANSI color to red. ON_RED = "\e[41m" # Set the terminal's background ANSI color to green. ON_GREEN = "\e[42m" # Set the terminal's background ANSI color to yellow. ON_YELLOW = "\e[43m" # Set the terminal's background ANSI color to blue. ON_BLUE = "\e[44m" # Set the terminal's background ANSI color to magenta. ON_MAGENTA = "\e[45m" # Set the terminal's background ANSI color to cyan. ON_CYAN = "\e[46m" # Set the terminal's background ANSI color to white. ON_WHITE = "\e[47m" # Set color by using a string or one of the defined constants. If a third # option is set to true, it also adds bold to the string. This is based # on Highline implementation and it automatically appends CLEAR to the end # of the returned String. # # Pass foreground, background and bold options to this method as # symbols. # # Example: # # set_color "Hi!", :red, :on_white, :bold # # The available colors are: # # :bold # :black # :red # :green # :yellow # :blue # :magenta # :cyan # :white # :on_black # :on_red # :on_green # :on_yellow # :on_blue # :on_magenta # :on_cyan # :on_white def set_color(string, *colors) if colors.compact.empty? || !can_display_colors? string elsif colors.all? { |color| color.is_a?(Symbol) || color.is_a?(String) } ansi_colors = colors.map { |color| lookup_color(color) } "#{ansi_colors.join}#{string}#{CLEAR}" else # The old API was `set_color(color, bold=boolean)`. We # continue to support the old API because you should never # break old APIs unnecessarily :P foreground, bold = colors foreground = self.class.const_get(foreground.to_s.upcase) if foreground.is_a?(Symbol) bold = bold ? BOLD : "" "#{bold}#{foreground}#{string}#{CLEAR}" end end protected def can_display_colors? stdout.tty? end # Overwrite show_diff to show diff with colors if Diff::LCS is # available. # def show_diff(destination, content) #:nodoc: if diff_lcs_loaded? && ENV["THOR_DIFF"].nil? && ENV["RAILS_DIFF"].nil? actual = File.binread(destination).to_s.split("\n") content = content.to_s.split("\n") Diff::LCS.sdiff(actual, content).each do |diff| output_diff_line(diff) end else super end end def output_diff_line(diff) #:nodoc: case diff.action when "-" say "- #{diff.old_element.chomp}", :red, true when "+" say "+ #{diff.new_element.chomp}", :green, true when "!" say "- #{diff.old_element.chomp}", :red, true say "+ #{diff.new_element.chomp}", :green, true else say " #{diff.old_element.chomp}", nil, true end end # Check if Diff::LCS is loaded. If it is, use it to create pretty output # for diff. # def diff_lcs_loaded? #:nodoc: return true if defined?(Diff::LCS) return @diff_lcs_loaded unless @diff_lcs_loaded.nil? @diff_lcs_loaded = begin require "diff/lcs" true rescue LoadError false end end end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/shell/basic.rb0000644000004100000410000003043512652443364024206 0ustar www-datawww-datarequire "tempfile" require "io/console" if RUBY_VERSION > "1.9.2" class Bundler::Thor module Shell class Basic # rubocop:disable ClassLength attr_accessor :base attr_reader :padding # Initialize base, mute and padding to nil. # def initialize #:nodoc: @base, @mute, @padding, @always_force = nil, false, 0, false end # Mute everything that's inside given block # def mute @mute = true yield ensure @mute = false end # Check if base is muted # def mute? # rubocop:disable TrivialAccessors @mute end # Sets the output padding, not allowing less than zero values. # def padding=(value) @padding = [0, value].max end # Asks something to the user and receives a response. # # If asked to limit the correct responses, you can pass in an # array of acceptable answers. If one of those is not supplied, # they will be shown a message stating that one of those answers # must be given and re-asked the question. # # If asking for sensitive information, the :echo option can be set # to false to mask user input from $stdin. # # If the required input is a path, then set the path option to # true. This will enable tab completion for file paths relative # to the current working directory on systems that support # Readline. # # ==== Example # ask("What is your name?") # # ask("What is your favorite Neopolitan flavor?", :limited_to => ["strawberry", "chocolate", "vanilla"]) # # ask("What is your password?", :echo => false) # # ask("Where should the file be saved?", :path => true) # def ask(statement, *args) options = args.last.is_a?(Hash) ? args.pop : {} color = args.first if options[:limited_to] ask_filtered(statement, color, options) else ask_simply(statement, color, options) end end # Say (print) something to the user. If the sentence ends with a whitespace # or tab character, a new line is not appended (print + flush). Otherwise # are passed straight to puts (behavior got from Highline). # # ==== Example # say("I know you knew that.") # def say(message = "", color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/)) buffer = prepare_message(message, *color) buffer << "\n" if force_new_line && !message.to_s.end_with?("\n") stdout.print(buffer) stdout.flush end # Say a status with the given color and appends the message. Since this # method is used frequently by actions, it allows nil or false to be given # in log_status, avoiding the message from being shown. If a Symbol is # given in log_status, it's used as the color. # def say_status(status, message, log_status = true) return if quiet? || log_status == false spaces = " " * (padding + 1) color = log_status.is_a?(Symbol) ? log_status : :green status = status.to_s.rjust(12) status = set_color status, color, true if color buffer = "#{status}#{spaces}#{message}" buffer << "\n" unless buffer.end_with?("\n") stdout.print(buffer) stdout.flush end # Make a question the to user and returns true if the user replies "y" or # "yes". # def yes?(statement, color = nil) !!(ask(statement, color, :add_to_history => false) =~ is?(:yes)) end # Make a question the to user and returns true if the user replies "n" or # "no". # def no?(statement, color = nil) !!(ask(statement, color, :add_to_history => false) =~ is?(:no)) end # Prints values in columns # # ==== Parameters # Array[String, String, ...] # def print_in_columns(array) return if array.empty? colwidth = (array.map { |el| el.to_s.size }.max || 0) + 2 array.each_with_index do |value, index| # Don't output trailing spaces when printing the last column if ((((index + 1) % (terminal_width / colwidth))).zero? && !index.zero?) || index + 1 == array.length stdout.puts value else stdout.printf("%-#{colwidth}s", value) end end end # Prints a table. # # ==== Parameters # Array[Array[String, String, ...]] # # ==== Options # indent:: Indent the first column by indent value. # colwidth:: Force the first column to colwidth spaces wide. # def print_table(array, options = {}) # rubocop:disable MethodLength return if array.empty? formats, indent, colwidth = [], options[:indent].to_i, options[:colwidth] options[:truncate] = terminal_width if options[:truncate] == true formats << "%-#{colwidth + 2}s" if colwidth start = colwidth ? 1 : 0 colcount = array.max { |a, b| a.size <=> b.size }.size maximas = [] start.upto(colcount - 1) do |index| maxima = array.map { |row| row[index] ? row[index].to_s.size : 0 }.max maximas << maxima if index == colcount - 1 # Don't output 2 trailing spaces when printing the last column formats << "%-s" else formats << "%-#{maxima + 2}s" end end formats[0] = formats[0].insert(0, " " * indent) formats << "%s" array.each do |row| sentence = "" row.each_with_index do |column, index| maxima = maximas[index] if column.is_a?(Numeric) if index == row.size - 1 # Don't output 2 trailing spaces when printing the last column f = "%#{maxima}s" else f = "%#{maxima}s " end else f = formats[index] end sentence << f % column.to_s end sentence = truncate(sentence, options[:truncate]) if options[:truncate] stdout.puts sentence end end # Prints a long string, word-wrapping the text to the current width of the # terminal display. Ideal for printing heredocs. # # ==== Parameters # String # # ==== Options # indent:: Indent each line of the printed paragraph by indent value. # def print_wrapped(message, options = {}) indent = options[:indent] || 0 width = terminal_width - indent paras = message.split("\n\n") paras.map! do |unwrapped| unwrapped.strip.gsub(/\n/, " ").squeeze(" ").gsub(/.{1,#{width}}(?:\s|\Z)/) { ($& + 5.chr).gsub(/\n\005/, "\n").gsub(/\005/, "\n") } end paras.each do |para| para.split("\n").each do |line| stdout.puts line.insert(0, " " * indent) end stdout.puts unless para == paras.last end end # Deals with file collision and returns true if the file should be # overwritten and false otherwise. If a block is given, it uses the block # response as the content for the diff. # # ==== Parameters # destination:: the destination file to solve conflicts # block:: an optional block that returns the value to be used in diff # def file_collision(destination) # rubocop:disable MethodLength return true if @always_force options = block_given? ? "[Ynaqdh]" : "[Ynaqh]" loop do answer = ask( %[Overwrite #{destination}? (enter "h" for help) #{options}], :add_to_history => false ) case answer when is?(:yes), is?(:force), "" return true when is?(:no), is?(:skip) return false when is?(:always) return @always_force = true when is?(:quit) say "Aborting..." fail SystemExit when is?(:diff) show_diff(destination, yield) if block_given? say "Retrying..." else say file_collision_help end end end # This code was copied from Rake, available under MIT-LICENSE # Copyright (c) 2003, 2004 Jim Weirich def terminal_width if ENV["THOR_COLUMNS"] result = ENV["THOR_COLUMNS"].to_i else result = unix? ? dynamic_width : 80 end result < 10 ? 80 : result rescue 80 end # Called if something goes wrong during the execution. This is used by Bundler::Thor # internally and should not be used inside your scripts. If something went # wrong, you can always raise an exception. If you raise a Bundler::Thor::Error, it # will be rescued and wrapped in the method below. # def error(statement) stderr.puts statement end # Apply color to the given string with optional bold. Disabled in the # Bundler::Thor::Shell::Basic class. # def set_color(string, *args) #:nodoc: string end protected def prepare_message(message, *color) spaces = " " * padding spaces + set_color(message.to_s, *color) end def can_display_colors? false end def lookup_color(color) return color unless color.is_a?(Symbol) self.class.const_get(color.to_s.upcase) end def stdout $stdout end def stderr $stderr end def is?(value) #:nodoc: value = value.to_s if value.size == 1 /\A#{value}\z/i else /\A(#{value}|#{value[0, 1]})\z/i end end def file_collision_help #:nodoc: <<-HELP Y - yes, overwrite n - no, do not overwrite a - all, overwrite this and all others q - quit, abort d - diff, show the differences between the old and the new h - help, show this help HELP end def show_diff(destination, content) #:nodoc: diff_cmd = ENV["THOR_DIFF"] || ENV["RAILS_DIFF"] || "diff -u" Tempfile.open(File.basename(destination), File.dirname(destination)) do |temp| temp.write content temp.rewind system %(#{diff_cmd} "#{destination}" "#{temp.path}") end end def quiet? #:nodoc: mute? || (base && base.options[:quiet]) end # Calculate the dynamic width of the terminal def dynamic_width @dynamic_width ||= (dynamic_width_stty.nonzero? || dynamic_width_tput) end def dynamic_width_stty %x(stty size 2>/dev/null).split[1].to_i end def dynamic_width_tput %x(tput cols 2>/dev/null).to_i end def unix? RUBY_PLATFORM =~ /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i end def truncate(string, width) as_unicode do chars = string.chars.to_a if chars.length <= width chars.join else ( chars[0, width - 3].join) + "..." end end end if "".respond_to?(:encode) def as_unicode yield end else def as_unicode old, $KCODE = $KCODE, "U" yield ensure $KCODE = old end end def ask_simply(statement, color, options) default = options[:default] message = [statement, ("(#{default})" if default), nil].uniq.join(" ") message = prepare_message(message, color) result = Bundler::Thor::LineEditor.readline(message, options) return unless result result.strip! if default && result == "" default else result end end def ask_filtered(statement, color, options) answer_set = options[:limited_to] correct_answer = nil until correct_answer answers = answer_set.join(", ") answer = ask_simply("#{statement} [#{answers}]", color, options) correct_answer = answer_set.include?(answer) ? answer : nil say("Your response must be one of: [#{answers}]. Please try again.") unless correct_answer end correct_answer end end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/shell/html.rb0000644000004100000410000001055712652443364024074 0ustar www-datawww-datarequire "bundler/vendor/thor/lib/thor/shell/basic" class Bundler::Thor module Shell # Inherit from Bundler::Thor::Shell::Basic and add set_color behavior. Check # Bundler::Thor::Shell::Basic to see all available methods. # class HTML < Basic # The start of an HTML bold sequence. BOLD = "font-weight: bold" # Set the terminal's foreground HTML color to black. BLACK = "color: black" # Set the terminal's foreground HTML color to red. RED = "color: red" # Set the terminal's foreground HTML color to green. GREEN = "color: green" # Set the terminal's foreground HTML color to yellow. YELLOW = "color: yellow" # Set the terminal's foreground HTML color to blue. BLUE = "color: blue" # Set the terminal's foreground HTML color to magenta. MAGENTA = "color: magenta" # Set the terminal's foreground HTML color to cyan. CYAN = "color: cyan" # Set the terminal's foreground HTML color to white. WHITE = "color: white" # Set the terminal's background HTML color to black. ON_BLACK = "background-color: black" # Set the terminal's background HTML color to red. ON_RED = "background-color: red" # Set the terminal's background HTML color to green. ON_GREEN = "background-color: green" # Set the terminal's background HTML color to yellow. ON_YELLOW = "background-color: yellow" # Set the terminal's background HTML color to blue. ON_BLUE = "background-color: blue" # Set the terminal's background HTML color to magenta. ON_MAGENTA = "background-color: magenta" # Set the terminal's background HTML color to cyan. ON_CYAN = "background-color: cyan" # Set the terminal's background HTML color to white. ON_WHITE = "background-color: white" # Set color by using a string or one of the defined constants. If a third # option is set to true, it also adds bold to the string. This is based # on Highline implementation and it automatically appends CLEAR to the end # of the returned String. # def set_color(string, *colors) if colors.all? { |color| color.is_a?(Symbol) || color.is_a?(String) } html_colors = colors.map { |color| lookup_color(color) } "#{string}" else color, bold = colors html_color = self.class.const_get(color.to_s.upcase) if color.is_a?(Symbol) styles = [html_color] styles << BOLD if bold "#{string}" end end # Ask something to the user and receives a response. # # ==== Example # ask("What is your name?") # # TODO: Implement #ask for Bundler::Thor::Shell::HTML def ask(statement, color = nil) fail NotImplementedError, "Implement #ask for Bundler::Thor::Shell::HTML" end protected def can_display_colors? true end # Overwrite show_diff to show diff with colors if Diff::LCS is # available. # def show_diff(destination, content) #:nodoc: if diff_lcs_loaded? && ENV["THOR_DIFF"].nil? && ENV["RAILS_DIFF"].nil? actual = File.binread(destination).to_s.split("\n") content = content.to_s.split("\n") Diff::LCS.sdiff(actual, content).each do |diff| output_diff_line(diff) end else super end end def output_diff_line(diff) #:nodoc: case diff.action when "-" say "- #{diff.old_element.chomp}", :red, true when "+" say "+ #{diff.new_element.chomp}", :green, true when "!" say "- #{diff.old_element.chomp}", :red, true say "+ #{diff.new_element.chomp}", :green, true else say " #{diff.old_element.chomp}", nil, true end end # Check if Diff::LCS is loaded. If it is, use it to create pretty output # for diff. # def diff_lcs_loaded? #:nodoc: return true if defined?(Diff::LCS) return @diff_lcs_loaded unless @diff_lcs_loaded.nil? @diff_lcs_loaded = begin require "diff/lcs" true rescue LoadError false end end end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/line_editor.rb0000644000004100000410000000065712652443364024316 0ustar www-datawww-datarequire "bundler/vendor/thor/lib/thor/line_editor/basic" require "bundler/vendor/thor/lib/thor/line_editor/readline" class Bundler::Thor module LineEditor def self.readline(prompt, options = {}) best_available.new(prompt, options).readline end def self.best_available [ Bundler::Thor::LineEditor::Readline, Bundler::Thor::LineEditor::Basic ].detect(&:available?) end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/base.rb0000644000004100000410000005553412652443364022737 0ustar www-datawww-datarequire "bundler/vendor/thor/lib/thor/command" require "bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access" require "bundler/vendor/thor/lib/thor/core_ext/ordered_hash" require "bundler/vendor/thor/lib/thor/error" require "bundler/vendor/thor/lib/thor/invocation" require "bundler/vendor/thor/lib/thor/parser" require "bundler/vendor/thor/lib/thor/shell" require "bundler/vendor/thor/lib/thor/line_editor" require "bundler/vendor/thor/lib/thor/util" class Bundler::Thor autoload :Actions, "bundler/vendor/thor/lib/thor/actions" autoload :RakeCompat, "bundler/vendor/thor/lib/thor/rake_compat" autoload :Group, "bundler/vendor/thor/lib/thor/group" # Shortcuts for help. HELP_MAPPINGS = %w[-h -? --help -D] # Bundler::Thor methods that should not be overwritten by the user. THOR_RESERVED_WORDS = %w[invoke shell options behavior root destination_root relative_root action add_file create_file in_root inside run run_ruby_script] TEMPLATE_EXTNAME = ".tt" module Base attr_accessor :options, :parent_options, :args # It receives arguments in an Array and two hashes, one for options and # other for configuration. # # Notice that it does not check if all required arguments were supplied. # It should be done by the parser. # # ==== Parameters # args:: An array of objects. The objects are applied to their # respective accessors declared with argument. # # options:: An options hash that will be available as self.options. # The hash given is converted to a hash with indifferent # access, magic predicates (options.skip?) and then frozen. # # config:: Configuration for this Bundler::Thor class. # def initialize(args = [], local_options = {}, config = {}) # rubocop:disable MethodLength parse_options = self.class.class_options # The start method splits inbound arguments at the first argument # that looks like an option (starts with - or --). It then calls # new, passing in the two halves of the arguments Array as the # first two parameters. command_options = config.delete(:command_options) # hook for start parse_options = parse_options.merge(command_options) if command_options if local_options.is_a?(Array) array_options, hash_options = local_options, {} else # Handle the case where the class was explicitly instantiated # with pre-parsed options. array_options, hash_options = [], local_options end # Let Bundler::Thor::Options parse the options first, so it can remove # declared options from the array. This will leave us with # a list of arguments that weren't declared. stop_on_unknown = self.class.stop_on_unknown_option? config[:current_command] opts = Bundler::Thor::Options.new(parse_options, hash_options, stop_on_unknown) self.options = opts.parse(array_options) self.options = config[:class_options].merge(options) if config[:class_options] # If unknown options are disallowed, make sure that none of the # remaining arguments looks like an option. opts.check_unknown! if self.class.check_unknown_options?(config) # Add the remaining arguments from the options parser to the # arguments passed in to initialize. Then remove any positional # arguments declared using #argument (this is primarily used # by Bundler::Thor::Group). Tis will leave us with the remaining # positional arguments. to_parse = args to_parse += opts.remaining unless self.class.strict_args_position?(config) thor_args = Bundler::Thor::Arguments.new(self.class.arguments) thor_args.parse(to_parse).each { |k, v| __send__("#{k}=", v) } @args = thor_args.remaining end class << self def included(base) #:nodoc: base.extend ClassMethods base.send :include, Invocation base.send :include, Shell end # Returns the classes that inherits from Bundler::Thor or Bundler::Thor::Group. # # ==== Returns # Array[Class] # def subclasses @subclasses ||= [] end # Returns the files where the subclasses are kept. # # ==== Returns # Hash[path => Class] # def subclass_files @subclass_files ||= Hash.new { |h, k| h[k] = [] } end # Whenever a class inherits from Bundler::Thor or Bundler::Thor::Group, we should track the # class and the file on Bundler::Thor::Base. This is the method responsable for it. # def register_klass_file(klass) #:nodoc: file = caller[1].match(/(.*):\d+/)[1] Bundler::Thor::Base.subclasses << klass unless Bundler::Thor::Base.subclasses.include?(klass) file_subclasses = Bundler::Thor::Base.subclass_files[File.expand_path(file)] file_subclasses << klass unless file_subclasses.include?(klass) end end module ClassMethods def attr_reader(*) #:nodoc: no_commands { super } end def attr_writer(*) #:nodoc: no_commands { super } end def attr_accessor(*) #:nodoc: no_commands { super } end # If you want to raise an error for unknown options, call check_unknown_options! # This is disabled by default to allow dynamic invocations. def check_unknown_options! @check_unknown_options = true end def check_unknown_options #:nodoc: @check_unknown_options ||= from_superclass(:check_unknown_options, false) end def check_unknown_options?(config) #:nodoc: !!check_unknown_options end # If true, option parsing is suspended as soon as an unknown option or a # regular argument is encountered. All remaining arguments are passed to # the command as regular arguments. def stop_on_unknown_option?(command_name) #:nodoc: false end # If you want only strict string args (useful when cascading thor classes), # call strict_args_position! This is disabled by default to allow dynamic # invocations. def strict_args_position! @strict_args_position = true end def strict_args_position #:nodoc: @strict_args_position ||= from_superclass(:strict_args_position, false) end def strict_args_position?(config) #:nodoc: !!strict_args_position end # Adds an argument to the class and creates an attr_accessor for it. # # Arguments are different from options in several aspects. The first one # is how they are parsed from the command line, arguments are retrieved # from position: # # thor command NAME # # Instead of: # # thor command --name=NAME # # Besides, arguments are used inside your code as an accessor (self.argument), # while options are all kept in a hash (self.options). # # Finally, arguments cannot have type :default or :boolean but can be # optional (supplying :optional => :true or :required => false), although # you cannot have a required argument after a non-required argument. If you # try it, an error is raised. # # ==== Parameters # name:: The name of the argument. # options:: Described below. # # ==== Options # :desc - Description for the argument. # :required - If the argument is required or not. # :optional - If the argument is optional or not. # :type - The type of the argument, can be :string, :hash, :array, :numeric. # :default - Default value for this argument. It cannot be required and have default values. # :banner - String to show on usage notes. # # ==== Errors # ArgumentError:: Raised if you supply a required argument after a non required one. # def argument(name, options = {}) # rubocop:disable MethodLength is_thor_reserved_word?(name, :argument) no_commands { attr_accessor name } required = if options.key?(:optional) !options[:optional] elsif options.key?(:required) options[:required] else options[:default].nil? end remove_argument name arguments.each do |argument| next if argument.required? fail ArgumentError, "You cannot have #{name.to_s.inspect} as required argument after " << "the non-required argument #{argument.human_name.inspect}." end if required options[:required] = required arguments << Bundler::Thor::Argument.new(name, options) end # Returns this class arguments, looking up in the ancestors chain. # # ==== Returns # Array[Bundler::Thor::Argument] # def arguments @arguments ||= from_superclass(:arguments, []) end # Adds a bunch of options to the set of class options. # # class_options :foo => false, :bar => :required, :baz => :string # # If you prefer more detailed declaration, check class_option. # # ==== Parameters # Hash[Symbol => Object] # def class_options(options = nil) @class_options ||= from_superclass(:class_options, {}) build_options(options, @class_options) if options @class_options end # Adds an option to the set of class options # # ==== Parameters # name:: The name of the argument. # options:: Described below. # # ==== Options # :desc:: -- Description for the argument. # :required:: -- If the argument is required or not. # :default:: -- Default value for this argument. # :group:: -- The group for this options. Use by class options to output options in different levels. # :aliases:: -- Aliases for this option. Note: Bundler::Thor follows a convention of one-dash-one-letter options. Thus aliases like "-something" wouldn't be parsed; use either "\--something" or "-s" instead. # :type:: -- The type of the argument, can be :string, :hash, :array, :numeric or :boolean. # :banner:: -- String to show on usage notes. # :hide:: -- If you want to hide this option from the help. # def class_option(name, options = {}) build_option(name, options, class_options) end # Removes a previous defined argument. If :undefine is given, undefine # accessors as well. # # ==== Parameters # names:: Arguments to be removed # # ==== Examples # # remove_argument :foo # remove_argument :foo, :bar, :baz, :undefine => true # def remove_argument(*names) options = names.last.is_a?(Hash) ? names.pop : {} names.each do |name| arguments.delete_if { |a| a.name == name.to_s } undef_method name, "#{name}=" if options[:undefine] end end # Removes a previous defined class option. # # ==== Parameters # names:: Class options to be removed # # ==== Examples # # remove_class_option :foo # remove_class_option :foo, :bar, :baz # def remove_class_option(*names) names.each do |name| class_options.delete(name) end end # Defines the group. This is used when thor list is invoked so you can specify # that only commands from a pre-defined group will be shown. Defaults to standard. # # ==== Parameters # name # def group(name = nil) if name @group = name.to_s else @group ||= from_superclass(:group, "standard") end end # Returns the commands for this Bundler::Thor class. # # ==== Returns # OrderedHash:: An ordered hash with commands names as keys and Bundler::Thor::Command # objects as values. # def commands @commands ||= Bundler::Thor::CoreExt::OrderedHash.new end alias_method :tasks, :commands # Returns the commands for this Bundler::Thor class and all subclasses. # # ==== Returns # OrderedHash:: An ordered hash with commands names as keys and Bundler::Thor::Command # objects as values. # def all_commands @all_commands ||= from_superclass(:all_commands, Bundler::Thor::CoreExt::OrderedHash.new) @all_commands.merge(commands) end alias_method :all_tasks, :all_commands # Removes a given command from this Bundler::Thor class. This is usually done if you # are inheriting from another class and don't want it to be available # anymore. # # By default it only remove the mapping to the command. But you can supply # :undefine => true to undefine the method from the class as well. # # ==== Parameters # name:: The name of the command to be removed # options:: You can give :undefine => true if you want commands the method # to be undefined from the class as well. # def remove_command(*names) options = names.last.is_a?(Hash) ? names.pop : {} names.each do |name| commands.delete(name.to_s) all_commands.delete(name.to_s) undef_method name if options[:undefine] end end alias_method :remove_task, :remove_command # All methods defined inside the given block are not added as commands. # # So you can do: # # class MyScript < Bundler::Thor # no_commands do # def this_is_not_a_command # end # end # end # # You can also add the method and remove it from the command list: # # class MyScript < Bundler::Thor # def this_is_not_a_command # end # remove_command :this_is_not_a_command # end # def no_commands @no_commands = true yield ensure @no_commands = false end alias_method :no_tasks, :no_commands # Sets the namespace for the Bundler::Thor or Bundler::Thor::Group class. By default the # namespace is retrieved from the class name. If your Bundler::Thor class is named # Scripts::MyScript, the help method, for example, will be called as: # # thor scripts:my_script -h # # If you change the namespace: # # namespace :my_scripts # # You change how your commands are invoked: # # thor my_scripts -h # # Finally, if you change your namespace to default: # # namespace :default # # Your commands can be invoked with a shortcut. Instead of: # # thor :my_command # def namespace(name = nil) if name @namespace = name.to_s else @namespace ||= Bundler::Thor::Util.namespace_from_thor_class(self) end end # Parses the command and options from the given args, instantiate the class # and invoke the command. This method is used when the arguments must be parsed # from an array. If you are inside Ruby and want to use a Bundler::Thor class, you # can simply initialize it: # # script = MyScript.new(args, options, config) # script.invoke(:command, first_arg, second_arg, third_arg) # def start(given_args = ARGV, config = {}) config[:shell] ||= Bundler::Thor::Base.shell.new dispatch(nil, given_args.dup, nil, config) rescue Bundler::Thor::Error => e config[:debug] || ENV["THOR_DEBUG"] == "1" ? (raise e) : config[:shell].error(e.message) exit(1) if exit_on_failure? rescue Errno::EPIPE # This happens if a thor command is piped to something like `head`, # which closes the pipe when it's done reading. This will also # mean that if the pipe is closed, further unnecessary # computation will not occur. exit(0) end # Allows to use private methods from parent in child classes as commands. # # ==== Parameters # names:: Method names to be used as commands # # ==== Examples # # public_command :foo # public_command :foo, :bar, :baz # def public_command(*names) names.each do |name| class_eval "def #{name}(*); super end" end end alias_method :public_task, :public_command def handle_no_command_error(command, has_namespace = $thor_runner) #:nodoc: if has_namespace fail UndefinedCommandError, "Could not find command #{command.inspect} in #{namespace.inspect} namespace." else fail UndefinedCommandError, "Could not find command #{command.inspect}." end end alias_method :handle_no_task_error, :handle_no_command_error def handle_argument_error(command, error, args, arity) #:nodoc: msg = "ERROR: \"#{basename} #{command.name}\" was called with " msg << "no arguments" if args.empty? msg << "arguments " << args.inspect unless args.empty? msg << "\nUsage: #{banner(command).inspect}" fail InvocationError, msg end protected # Prints the class options per group. If an option does not belong to # any group, it's printed as Class option. # def class_options_help(shell, groups = {}) #:nodoc: # Group options by group class_options.each do |_, value| groups[value.group] ||= [] groups[value.group] << value end # Deal with default group global_options = groups.delete(nil) || [] print_options(shell, global_options) # Print all others groups.each do |group_name, options| print_options(shell, options, group_name) end end # Receives a set of options and print them. def print_options(shell, options, group_name = nil) return if options.empty? list = [] padding = options.map { |o| o.aliases.size }.max.to_i * 4 options.each do |option| unless option.hide item = [option.usage(padding)] item.push(option.description ? "# #{option.description}" : "") list << item list << ["", "# Default: #{option.default}"] if option.show_default? list << ["", "# Possible values: #{option.enum.join(', ')}"] if option.enum end end shell.say(group_name ? "#{group_name} options:" : "Options:") shell.print_table(list, :indent => 2) shell.say "" end # Raises an error if the word given is a Bundler::Thor reserved word. def is_thor_reserved_word?(word, type) #:nodoc: return false unless THOR_RESERVED_WORDS.include?(word.to_s) fail "#{word.inspect} is a Bundler::Thor reserved word and cannot be defined as #{type}" end # Build an option and adds it to the given scope. # # ==== Parameters # name:: The name of the argument. # options:: Described in both class_option and method_option. # scope:: Options hash that is being built up def build_option(name, options, scope) #:nodoc: scope[name] = Bundler::Thor::Option.new(name, options) end # Receives a hash of options, parse them and add to the scope. This is a # fast way to set a bunch of options: # # build_options :foo => true, :bar => :required, :baz => :string # # ==== Parameters # Hash[Symbol => Object] def build_options(options, scope) #:nodoc: options.each do |key, value| scope[key] = Bundler::Thor::Option.parse(key, value) end end # Finds a command with the given name. If the command belongs to the current # class, just return it, otherwise dup it and add the fresh copy to the # current command hash. def find_and_refresh_command(name) #:nodoc: if commands[name.to_s] commands[name.to_s] elsif command = all_commands[name.to_s] # rubocop:disable AssignmentInCondition commands[name.to_s] = command.clone else fail ArgumentError, "You supplied :for => #{name.inspect}, but the command #{name.inspect} could not be found." end end alias_method :find_and_refresh_task, :find_and_refresh_command # Everytime someone inherits from a Bundler::Thor class, register the klass # and file into baseclass. def inherited(klass) Bundler::Thor::Base.register_klass_file(klass) klass.instance_variable_set(:@no_commands, false) end # Fire this callback whenever a method is added. Added methods are # tracked as commands by invoking the create_command method. def method_added(meth) meth = meth.to_s if meth == "initialize" initialize_added return end # Return if it's not a public instance method return unless public_method_defined?(meth.to_sym) @no_commands ||= false return if @no_commands || !create_command(meth) is_thor_reserved_word?(meth, :command) Bundler::Thor::Base.register_klass_file(self) end # Retrieves a value from superclass. If it reaches the baseclass, # returns default. def from_superclass(method, default = nil) if self == baseclass || !superclass.respond_to?(method, true) default else value = superclass.send(method) # Ruby implements `dup` on Object, but raises a `TypeError` # if the method is called on immediates. As a result, we # don't have a good way to check whether dup will succeed # without calling it and rescuing the TypeError. begin value.dup rescue TypeError value end end end # A flag that makes the process exit with status 1 if any error happens. def exit_on_failure? false end # # The basename of the program invoking the thor class. # def basename File.basename($PROGRAM_NAME).split(" ").first end # SIGNATURE: Sets the baseclass. This is where the superclass lookup # finishes. def baseclass #:nodoc: end # SIGNATURE: Creates a new command if valid_command? is true. This method is # called when a new method is added to the class. def create_command(meth) #:nodoc: end alias_method :create_task, :create_command # SIGNATURE: Defines behavior when the initialize method is added to the # class. def initialize_added #:nodoc: end # SIGNATURE: The hook invoked by start. def dispatch(command, given_args, given_opts, config) #:nodoc: fail NotImplementedError end end end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/error.rb0000644000004100000410000000176012652443364023146 0ustar www-datawww-dataclass Bundler::Thor # Bundler::Thor::Error is raised when it's caused by wrong usage of thor classes. Those # errors have their backtrace suppressed and are nicely shown to the user. # # Errors that are caused by the developer, like declaring a method which # overwrites a thor keyword, it SHOULD NOT raise a Bundler::Thor::Error. This way, we # ensure that developer errors are shown with full backtrace. class Error < StandardError end # Raised when a command was not found. class UndefinedCommandError < Error end UndefinedTaskError = UndefinedCommandError # rubocop:disable ConstantName class AmbiguousCommandError < Error end AmbiguousTaskError = AmbiguousCommandError # rubocop:disable ConstantName # Raised when a command was found, but not invoked properly. class InvocationError < Error end class UnknownArgumentError < Error end class RequiredArgumentMissingError < InvocationError end class MalformattedArgumentError < InvocationError end end bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/util.rb0000644000004100000410000002111512652443364022766 0ustar www-datawww-datarequire "rbconfig" class Bundler::Thor module Sandbox #:nodoc: end # This module holds several utilities: # # 1) Methods to convert thor namespaces to constants and vice-versa. # # Bundler::Thor::Util.namespace_from_thor_class(Foo::Bar::Baz) #=> "foo:bar:baz" # # 2) Loading thor files and sandboxing: # # Bundler::Thor::Util.load_thorfile("~/.thor/foo") # module Util class << self # Receives a namespace and search for it in the Bundler::Thor::Base subclasses. # # ==== Parameters # namespace:: The namespace to search for. # def find_by_namespace(namespace) namespace = "default#{namespace}" if namespace.empty? || namespace =~ /^:/ Bundler::Thor::Base.subclasses.detect { |klass| klass.namespace == namespace } end # Receives a constant and converts it to a Bundler::Thor namespace. Since Bundler::Thor # commands can be added to a sandbox, this method is also responsable for # removing the sandbox namespace. # # This method should not be used in general because it's used to deal with # older versions of Bundler::Thor. On current versions, if you need to get the # namespace from a class, just call namespace on it. # # ==== Parameters # constant:: The constant to be converted to the thor path. # # ==== Returns # String:: If we receive Foo::Bar::Baz it returns "foo:bar:baz" # def namespace_from_thor_class(constant) constant = constant.to_s.gsub(/^Bundler::Thor::Sandbox::/, "") constant = snake_case(constant).squeeze(":") constant end # Given the contents, evaluate it inside the sandbox and returns the # namespaces defined in the sandbox. # # ==== Parameters # contents # # ==== Returns # Array[Object] # def namespaces_in_content(contents, file = __FILE__) old_constants = Bundler::Thor::Base.subclasses.dup Bundler::Thor::Base.subclasses.clear load_thorfile(file, contents) new_constants = Bundler::Thor::Base.subclasses.dup Bundler::Thor::Base.subclasses.replace(old_constants) new_constants.map! { |c| c.namespace } new_constants.compact! new_constants end # Returns the thor classes declared inside the given class. # def thor_classes_in(klass) stringfied_constants = klass.constants.map { |c| c.to_s } Bundler::Thor::Base.subclasses.select do |subclass| next unless subclass.name stringfied_constants.include?(subclass.name.gsub("#{klass.name}::", "")) end end # Receives a string and convert it to snake case. SnakeCase returns snake_case. # # ==== Parameters # String # # ==== Returns # String # def snake_case(str) return str.downcase if str =~ /^[A-Z_]+$/ str.gsub(/\B[A-Z]/, '_\&').squeeze("_") =~ /_*(.*)/ $+.downcase end # Receives a string and convert it to camel case. camel_case returns CamelCase. # # ==== Parameters # String # # ==== Returns # String # def camel_case(str) return str if str !~ /_/ && str =~ /[A-Z]+.*/ str.split("_").map { |i| i.capitalize }.join end # Receives a namespace and tries to retrieve a Bundler::Thor or Bundler::Thor::Group class # from it. It first searches for a class using the all the given namespace, # if it's not found, removes the highest entry and searches for the class # again. If found, returns the highest entry as the class name. # # ==== Examples # # class Foo::Bar < Bundler::Thor # def baz # end # end # # class Baz::Foo < Bundler::Thor::Group # end # # Bundler::Thor::Util.namespace_to_thor_class("foo:bar") #=> Foo::Bar, nil # will invoke default command # Bundler::Thor::Util.namespace_to_thor_class("baz:foo") #=> Baz::Foo, nil # Bundler::Thor::Util.namespace_to_thor_class("foo:bar:baz") #=> Foo::Bar, "baz" # # ==== Parameters # namespace # def find_class_and_command_by_namespace(namespace, fallback = true) if namespace.include?(":") # look for a namespaced command pieces = namespace.split(":") command = pieces.pop klass = Bundler::Thor::Util.find_by_namespace(pieces.join(":")) end unless klass # look for a Bundler::Thor::Group with the right name klass, command = Bundler::Thor::Util.find_by_namespace(namespace), nil end if !klass && fallback # try a command in the default namespace command = namespace klass = Bundler::Thor::Util.find_by_namespace("") end [klass, command] end alias_method :find_class_and_task_by_namespace, :find_class_and_command_by_namespace # Receives a path and load the thor file in the path. The file is evaluated # inside the sandbox to avoid namespacing conflicts. # def load_thorfile(path, content = nil, debug = false) content ||= File.binread(path) begin Bundler::Thor::Sandbox.class_eval(content, path) rescue StandardError => e $stderr.puts("WARNING: unable to load thorfile #{path.inspect}: #{e.message}") if debug $stderr.puts(*e.backtrace) else $stderr.puts(e.backtrace.first) end end end def user_home # rubocop:disable MethodLength @@user_home ||= if ENV["HOME"] ENV["HOME"] elsif ENV["USERPROFILE"] ENV["USERPROFILE"] elsif ENV["HOMEDRIVE"] && ENV["HOMEPATH"] File.join(ENV["HOMEDRIVE"], ENV["HOMEPATH"]) elsif ENV["APPDATA"] ENV["APPDATA"] else begin File.expand_path("~") rescue if File::ALT_SEPARATOR "C:/" else "/" end end end end # Returns the root where thor files are located, depending on the OS. # def thor_root File.join(user_home, ".thor").gsub(/\\/, "/") end # Returns the files in the thor root. On Windows thor_root will be something # like this: # # C:\Documents and Settings\james\.thor # # If we don't #gsub the \ character, Dir.glob will fail. # def thor_root_glob files = Dir["#{escape_globs(thor_root)}/*"] files.map! do |file| File.directory?(file) ? File.join(file, "main.thor") : file end end # Where to look for Bundler::Thor files. # def globs_for(path) path = escape_globs(path) ["#{path}/Bundler::Thorfile", "#{path}/*.thor", "#{path}/tasks/*.thor", "#{path}/lib/tasks/*.thor"] end # Return the path to the ruby interpreter taking into account multiple # installations and windows extensions. # def ruby_command # rubocop:disable MethodLength @ruby_command ||= begin ruby_name = RbConfig::CONFIG["ruby_install_name"] ruby = File.join(RbConfig::CONFIG["bindir"], ruby_name) ruby << RbConfig::CONFIG["EXEEXT"] # avoid using different name than ruby (on platforms supporting links) if ruby_name != "ruby" && File.respond_to?(:readlink) begin alternate_ruby = File.join(RbConfig::CONFIG["bindir"], "ruby") alternate_ruby << RbConfig::CONFIG["EXEEXT"] # ruby is a symlink if File.symlink? alternate_ruby linked_ruby = File.readlink alternate_ruby # symlink points to 'ruby_install_name' ruby = alternate_ruby if linked_ruby == ruby_name || linked_ruby == ruby end rescue NotImplementedError # rubocop:disable HandleExceptions # just ignore on windows end end # escape string in case path to ruby executable contain spaces. ruby.sub!(/.*\s.*/m, '"\&"') ruby end end # Returns a string that has had any glob characters escaped. # The glob characters are `* ? { } [ ]`. # # ==== Examples # # Bundler::Thor::Util.escape_globs('[apps]') # => '\[apps\]' # # ==== Parameters # String # # ==== Returns # String # def escape_globs(path) path.to_s.gsub(/[*?{}\[\]]/, '\\\\\\&') end end end end bundler-1.11.2/lib/bundler/vendored_persistent.rb0000644000004100000410000000054712652443364022112 0ustar www-datawww-data# We forcibly require OpenSSL, because net/http/persistent will only autoload # it. On some Rubies, autoload fails but explicit require succeeds. begin require "openssl" rescue LoadError # some Ruby builds don't have OpenSSL end vendor = File.expand_path("../vendor", __FILE__) $:.unshift(vendor) unless $:.include?(vendor) require "net/http/persistent" bundler-1.11.2/lib/bundler/installer.rb0000644000004100000410000001742212652443364020021 0ustar www-datawww-datarequire "erb" require "rubygems/dependency_installer" require "bundler/worker" require "bundler/installer/parallel_installer" require "bundler/installer/standalone" require "bundler/installer/gem_installer" module Bundler class Installer < Environment class << self attr_accessor :post_install_messages, :ambiguous_gems Installer.post_install_messages = {} Installer.ambiguous_gems = [] end # Begins the installation process for Bundler. # For more information see the #run method on this class. def self.install(root, definition, options = {}) installer = new(root, definition) installer.run(options) installer end # Runs the install procedures for a specific Gemfile. # # Firstly, this method will check to see if Bundler.bundle_path exists # and if not then will create it. This is usually the location of gems # on the system, be it RVM or at a system path. # # Secondly, it checks if Bundler has been configured to be "frozen" # Frozen ensures that the Gemfile and the Gemfile.lock file are matching. # This stops a situation where a developer may update the Gemfile but may not run # `bundle install`, which leads to the Gemfile.lock file not being correctly updated. # If this file is not correctly updated then any other developer running # `bundle install` will potentially not install the correct gems. # # Thirdly, Bundler checks if there are any dependencies specified in the Gemfile using # Bundler::Environment#dependencies. If there are no dependencies specified then # Bundler returns a warning message stating so and this method returns. # # Fourthly, Bundler checks if the default lockfile (Gemfile.lock) exists, and if so # then proceeds to set up a defintion based on the default gemfile (Gemfile) and the # default lock file (Gemfile.lock). However, this is not the case if the platform is different # to that which is specified in Gemfile.lock, or if there are any missing specs for the gems. # # Fifthly, Bundler resolves the dependencies either through a cache of gems or by remote. # This then leads into the gems being installed, along with stubs for their executables, # but only if the --binstubs option has been passed or Bundler.options[:bin] has been set # earlier. # # Sixthly, a new Gemfile.lock is created from the installed gems to ensure that the next time # that a user runs `bundle install` they will receive any updates from this process. # # Finally: TODO add documentation for how the standalone process works. def run(options) create_bundle_path if Bundler.settings[:frozen] @definition.ensure_equivalent_gemfile_and_lockfile(options[:deployment]) end if dependencies.empty? Bundler.ui.warn "The Gemfile specifies no dependencies" lock return end resolve_if_need(options) install(options) lock unless Bundler.settings[:frozen] Standalone.new(options[:standalone], @definition).generate if options[:standalone] end def generate_bundler_executable_stubs(spec, options = {}) if options[:binstubs_cmd] && spec.executables.empty? options = {} spec.runtime_dependencies.each do |dep| bins = @definition.specs[dep].first.executables options[dep.name] = bins unless bins.empty? end if options.any? Bundler.ui.warn "#{spec.name} has no executables, but you may want " \ "one from a gem it depends on." options.each {|name, bins| Bundler.ui.warn " #{name} has: #{bins.join(", ")}" } else Bundler.ui.warn "There are no executables for the gem #{spec.name}." end return end # double-assignment to avoid warnings about variables that will be used by ERB bin_path = bin_path = Bundler.bin_path template = template = File.read(File.expand_path("../templates/Executable", __FILE__)) relative_gemfile_path = relative_gemfile_path = Bundler.default_gemfile.relative_path_from(bin_path) ruby_command = ruby_command = Thor::Util.ruby_command exists = [] spec.executables.each do |executable| next if executable == "bundle" binstub_path = "#{bin_path}/#{executable}" if File.exist?(binstub_path) && !options[:force] exists << executable next end File.open(binstub_path, "w", 0777 & ~File.umask) do |f| f.puts ERB.new(template, nil, "-").result(binding) end end if options[:binstubs_cmd] && exists.any? case exists.size when 1 Bundler.ui.warn "Skipped #{exists[0]} since it already exists." when 2 Bundler.ui.warn "Skipped #{exists.join(" and ")} since they already exist." else items = exists[0...-1].empty? ? nil : exists[0...-1].join(", ") skipped = [items, exists[-1]].compact.join(" and ") Bundler.ui.warn "Skipped #{skipped} since they already exist." end Bundler.ui.warn "If you want to overwrite skipped stubs, use --force." end end def generate_standalone_bundler_executable_stubs(spec) # double-assignment to avoid warnings about variables that will be used by ERB bin_path = Bundler.bin_path template = File.read(File.expand_path("../templates/Executable.standalone", __FILE__)) ruby_command = ruby_command = Thor::Util.ruby_command spec.executables.each do |executable| next if executable == "bundle" standalone_path = standalone_path = Pathname(Bundler.settings[:path]).expand_path.relative_path_from(bin_path) executable_path = executable_path = Pathname(spec.full_gem_path).join(spec.bindir, executable).relative_path_from(bin_path) File.open "#{bin_path}/#{executable}", "w", 0755 do |f| f.puts ERB.new(template, nil, "-").result(binding) end end end private # the order that the resolver provides is significant, since # dependencies might actually affect the installation of a gem. # that said, it's a rare situation (other than rake), and parallel # installation is just SO MUCH FASTER. so we let people opt in. def install(options) force = options["force"] jobs = 1 jobs = [Bundler.settings[:jobs].to_i - 1, 1].max if can_install_in_parallel? install_in_parallel jobs, options[:standalone], force end def can_install_in_parallel? if Bundler.rubygems.provides?(">= 2.1.0") true else Bundler.ui.warn "Rubygems #{Gem::VERSION} is not threadsafe, so your "\ "gems will be installed one at a time. Upgrade to Rubygems 2.1.0 " \ "or higher to enable parallel gem installation." false end end def install_in_parallel(size, standalone, force = false) ParallelInstaller.call(self, specs, size, standalone, force) end def create_bundle_path SharedHelpers.filesystem_access(Bundler.bundle_path.to_s) do |p| Bundler.mkdir_p(p) end unless Bundler.bundle_path.exist? rescue Errno::EEXIST raise PathError, "Could not install to path `#{Bundler.settings[:path]}` " \ "because of an invalid symlink. Remove the symlink so the directory can be created." end def resolve_if_need(options) if Bundler.default_lockfile.exist? && !options["update"] local = Bundler.ui.silence do begin tmpdef = Definition.build(Bundler.default_gemfile, Bundler.default_lockfile, nil) true unless tmpdef.new_platform? || tmpdef.missing_specs.any? rescue BundlerError end end end unless local options["local"] ? @definition.resolve_with_cache! : @definition.resolve_remotely! end end end end bundler-1.11.2/lib/bundler/errors.rb0000644000004100000410000000467012652443364017341 0ustar www-datawww-datamodule Bundler class BundlerError < StandardError def self.status_code(code) define_method(:status_code) { code } end end class GemfileNotFound < BundlerError; status_code(10); end class GemNotFound < BundlerError; status_code(7); end class GemfileError < BundlerError; status_code(4); end class InstallError < BundlerError; status_code(5); end class InstallHookError < BundlerError; status_code(8); end class PathError < BundlerError; status_code(13); end class GitError < BundlerError; status_code(11); end class DeprecatedError < BundlerError; status_code(12); end class GemspecError < BundlerError; status_code(14); end class InvalidOption < BundlerError; status_code(15); end class ProductionError < BundlerError; status_code(16); end class HTTPError < BundlerError; status_code(17); end class RubyVersionMismatch < BundlerError; status_code(18); end class SecurityError < BundlerError; status_code(19); end class LockfileError < BundlerError; status_code(20); end class CyclicDependencyError < BundlerError; status_code(21); end class GemfileLockNotFound < BundlerError; status_code(22); end class GemfileEvalError < GemfileError; end class MarshalError < StandardError; end # Internal errors, should be rescued class VersionConflict < BundlerError attr_reader :conflicts def initialize(conflicts, msg = nil) super(msg) @conflicts = conflicts end status_code(6) end class GemRequireError < BundlerError attr_reader :orig_exception def initialize(orig_exception, msg) super(msg) @orig_exception = orig_exception end status_code(24) end class PermissionError < BundlerError def initialize(path, permission_type = :write) @path = path @permission_type = permission_type end def message action = case @permission_type when :read then "read from" when :write then "write to" when :executable, :exec then "execute" else @permission_type.to_s end "There was an error while trying to #{action} `#{@path}`. " \ "It is likely that you need to grant #{@permission_type} permissions " \ "for that path." end status_code(23) end class YamlSyntaxError < BundlerError attr_reader :orig_exception def initialize(orig_exception, msg) super(msg) @orig_exception = orig_exception end status_code(25) end end bundler-1.11.2/lib/bundler/installer/0000755000004100000410000000000012652443364017466 5ustar www-datawww-databundler-1.11.2/lib/bundler/installer/standalone.rb0000644000004100000410000000301212652443364022137 0ustar www-datawww-datamodule Bundler class Standalone def initialize(groups, definition) @specs = groups.empty? ? definition.requested_specs : definition.specs_for(groups.map(&:to_sym)) end def generate SharedHelpers.filesystem_access(bundler_path) do |p| FileUtils.mkdir_p(p) end File.open File.join(bundler_path, "setup.rb"), "w" do |file| file.puts "require 'rbconfig'" file.puts "# ruby 1.8.7 doesn't define RUBY_ENGINE" file.puts "ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'" file.puts "ruby_version = RbConfig::CONFIG[\"ruby_version\"]" file.puts "path = File.expand_path('..', __FILE__)" paths.each do |path| file.puts %($:.unshift "\#{path}/#{path}") end end end private def paths @specs.map do |spec| next if spec.name == "bundler" Array(spec.require_paths).map do |path| gem_path(path, spec).sub(version_dir, '#{ruby_engine}/#{ruby_version}') # This is a static string intentionally. It's interpolated at a later time. end end.flatten end def version_dir "#{Bundler.ruby_version.engine}/#{RbConfig::CONFIG["ruby_version"]}" end def bundler_path File.join(Bundler.settings[:path], "bundler") end def gem_path(path, spec) full_path = Pathname.new(path).absolute? ? path : File.join(spec.full_gem_path, path) Pathname.new(full_path).relative_path_from(Bundler.root.join(bundler_path)).to_s end end end bundler-1.11.2/lib/bundler/installer/parallel_installer.rb0000644000004100000410000000722212652443364023667 0ustar www-datawww-datarequire "bundler/worker" require "bundler/installer/gem_installer" class ParallelInstaller class SpecInstallation attr_accessor :spec, :name, :post_install_message, :state def initialize(spec) @spec = spec @name = spec.name @state = :none @post_install_message = "" end def installed? state == :installed end def enqueued? state == :enqueued end # Only true when spec in neither installed nor already enqueued def ready_to_enqueue? !installed? && !enqueued? end def has_post_install_message? !post_install_message.empty? end def ignorable_dependency?(dep) dep.type == :development || dep.name == @name end # Checks installed dependencies against spec's dependencies to make # sure needed dependencies have been installed. def dependencies_installed?(all_specs) installed_specs = all_specs.select(&:installed?).map(&:name) dependencies(all_specs.map(&:name)).all? {|d| installed_specs.include? d.name } end # Represents only the non-development dependencies, the ones that are # itself and are in the total list. def dependencies(all_spec_names) @dependencies ||= begin deps = all_dependencies.reject {|dep| ignorable_dependency? dep } missing = deps.reject {|dep| all_spec_names.include? dep.name } if missing.size > 0 raise Bundler::LockfileError, "Your Gemfile.lock is corrupt. The following #{missing.size > 1 ? "gems are" : "gem is"} missing " \ "from the DEPENDENCIES section: '#{missing.map(&:name).join('\' \'')}'" end deps end end # Represents all dependencies def all_dependencies @spec.dependencies end end def self.call(*args) new(*args).call end # Returns max number of threads machine can handle with a min of 1 def self.max_threads [Bundler.settings[:jobs].to_i - 1, 1].max end def initialize(installer, all_specs, size, standalone, force) @installer = installer @size = size @standalone = standalone @force = force @specs = all_specs.map {|s| SpecInstallation.new(s) } end def call enqueue_specs process_specs until @specs.all?(&:installed?) ensure worker_pool && worker_pool.stop end def worker_pool @worker_pool ||= Bundler::Worker.new @size, lambda { |spec_install, worker_num| message = Bundler::GemInstaller.new( spec_install.spec, @installer, @standalone, worker_num, @force ).install_from_spec spec_install.post_install_message = message unless message.nil? spec_install } end # Dequeue a spec and save its post-install message and then enqueue the # remaining specs. # Some specs might've had to wait til this spec was installed to be # processed so the call to `enqueue_specs` is important after every # dequeue. def process_specs spec = worker_pool.deq spec.state = :installed collect_post_install_message spec if spec.has_post_install_message? enqueue_specs end def collect_post_install_message(spec) Bundler::Installer.post_install_messages[spec.name] = spec.post_install_message end # Keys in the remains hash represent uninstalled gems specs. # We enqueue all gem specs that do not have any dependencies. # Later we call this lambda again to install specs that depended on # previously installed specifications. We continue until all specs # are installed. def enqueue_specs @specs.select(&:ready_to_enqueue?).each do |spec| if spec.dependencies_installed? @specs worker_pool.enq spec spec.state = :enqueued end end end end bundler-1.11.2/lib/bundler/installer/gem_installer.rb0000644000004100000410000000452212652443364022643 0ustar www-datawww-datamodule Bundler class GemInstaller attr_reader :spec, :standalone, :worker, :force, :installer def initialize(spec, installer, standalone = false, worker = 0, force = false) @spec = spec @installer = installer @standalone = standalone @worker = worker @force = force end def install_from_spec post_install_message = spec_settings ? install_with_settings : install Bundler.ui.debug "#{worker}: #{spec.name} (#{spec.version}) from #{spec.loaded_from}" generate_executable_stubs post_install_message rescue Errno::ENOSPC raise Bundler::InstallError, out_of_space_message rescue => e handle_exception(e) end private def failure_message return install_error_message if spec.source.options["git"] "#{install_error_message}\n#{gem_install_message}" end def install_error_message "An error occurred while installing #{spec.name} (#{spec.version}), and Bundler cannot continue." end def gem_install_message "Make sure that `gem install #{spec.name} -v '#{spec.version}'` succeeds before bundling." end def handle_exception(e) # if install hook failed or gem signature is bad, just die raise e if e.is_a?(Bundler::InstallHookError) || e.is_a?(Bundler::SecurityError) # other failure, likely a native extension build failure Bundler.ui.info "" Bundler.ui.warn "#{e.class}: #{e.message}" Bundler.ui.debug e.backtrace.join("\n") raise Bundler::InstallError, failure_message end def spec_settings # Fetch the build settings, if there are any Bundler.settings["build.#{spec.name}"] end def install spec.source.install(spec, :force => force, :ensure_builtin_gems_cached => standalone) end def install_with_settings # Build arguments are global, so this is mutexed Bundler.rubygems.with_build_args([spec_settings]) { install } end def out_of_space_message "Your disk is out of space. Free some space to be able to install your bundle." end def generate_executable_stubs if Bundler.settings[:bin] && standalone installer.generate_standalone_bundler_executable_stubs(spec) elsif Bundler.settings[:bin] installer.generate_bundler_executable_stubs(spec, :force => true) end end end end bundler-1.11.2/lib/bundler/friendly_errors.rb0000644000004100000410000000562612652443364021237 0ustar www-datawww-data# encoding: utf-8 require "cgi" require "bundler/vendored_thor" module Bundler def self.with_friendly_errors yield rescue Bundler::YamlSyntaxError => e Bundler.ui.error e.message Bundler.ui.trace e.orig_exception exit e.status_code rescue Bundler::Dsl::DSLError => e Bundler.ui.error e.message exit e.status_code rescue Bundler::GemRequireError => e Bundler.ui.error e.message Bundler.ui.trace e.orig_exception, nil, true exit e.status_code rescue Bundler::BundlerError => e Bundler.ui.error e.message, :wrap => true Bundler.ui.trace e exit e.status_code rescue Thor::AmbiguousTaskError => e Bundler.ui.error e.message exit 15 rescue Thor::UndefinedTaskError => e Bundler.ui.error e.message exit 15 rescue Thor::Error => e Bundler.ui.error e.message exit 1 rescue LoadError => e raise e unless e.message =~ /cannot load such file -- openssl|openssl.so|libcrypto.so/ Bundler.ui.error "\nCould not load OpenSSL." Bundler.ui.warn <<-WARN, :wrap => true You must recompile Ruby with OpenSSL support or change the sources in your \ Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL \ using RVM are available at http://rvm.io/packages/openssl. WARN Bundler.ui.trace e exit 1 rescue Interrupt => e Bundler.ui.error "\nQuitting..." Bundler.ui.trace e exit 1 rescue SystemExit => e exit e.status rescue Exception => e request_issue_report_for(e) exit 1 end def self.request_issue_report_for(e) Bundler.ui.info <<-EOS.gsub(/^ {6}/, "") --- ERROR REPORT TEMPLATE ------------------------------------------------------- - What did you do? I ran the command `#{$PROGRAM_NAME} #{ARGV.join(" ")}` - What did you expect to happen? I expected Bundler to... - What happened instead? Instead, what actually happened was... Error details #{e.class}: #{e.message} #{e.backtrace.join("\n ")} #{Bundler::Env.new.report(:print_gemfile => false, :print_gemspecs => false).gsub(/\n/, "\n ").strip} --- TEMPLATE END ---------------------------------------------------------------- EOS Bundler.ui.error "Unfortunately, an unexpected error occurred, and Bundler cannot continue." Bundler.ui.warn <<-EOS.gsub(/^ {6}/, "") First, try this link to see if there are any existing issue reports for this error: #{issues_url(e)} If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at: https://github.com/bundler/bundler/issues/new EOS end def self.issues_url(exception) "https://github.com/bundler/bundler/search?q=" \ "#{CGI.escape(exception.message.lines.first.chomp)}&type=Issues" end end bundler-1.11.2/lib/bundler/dependency.rb0000644000004100000410000000700412652443364020135 0ustar www-datawww-datarequire "rubygems/dependency" require "bundler/shared_helpers" require "bundler/rubygems_ext" module Bundler class Dependency < Gem::Dependency attr_reader :autorequire attr_reader :groups attr_reader :platforms PLATFORM_MAP = { :ruby => Gem::Platform::RUBY, :ruby_18 => Gem::Platform::RUBY, :ruby_19 => Gem::Platform::RUBY, :ruby_20 => Gem::Platform::RUBY, :ruby_21 => Gem::Platform::RUBY, :ruby_22 => Gem::Platform::RUBY, :ruby_23 => Gem::Platform::RUBY, :mri => Gem::Platform::RUBY, :mri_18 => Gem::Platform::RUBY, :mri_19 => Gem::Platform::RUBY, :mri_20 => Gem::Platform::RUBY, :mri_21 => Gem::Platform::RUBY, :mri_22 => Gem::Platform::RUBY, :mri_23 => Gem::Platform::RUBY, :rbx => Gem::Platform::RUBY, :jruby => Gem::Platform::JAVA, :jruby_18 => Gem::Platform::JAVA, :jruby_19 => Gem::Platform::JAVA, :mswin => Gem::Platform::MSWIN, :mswin_18 => Gem::Platform::MSWIN, :mswin_19 => Gem::Platform::MSWIN, :mswin_20 => Gem::Platform::MSWIN, :mswin_21 => Gem::Platform::MSWIN, :mswin_22 => Gem::Platform::MSWIN, :mswin_23 => Gem::Platform::MSWIN, :mswin64 => Gem::Platform::MSWIN64, :mswin64_19 => Gem::Platform::MSWIN64, :mswin64_20 => Gem::Platform::MSWIN64, :mswin64_21 => Gem::Platform::MSWIN64, :mswin64_22 => Gem::Platform::MSWIN64, :mswin64_23 => Gem::Platform::MSWIN64, :mingw => Gem::Platform::MINGW, :mingw_18 => Gem::Platform::MINGW, :mingw_19 => Gem::Platform::MINGW, :mingw_20 => Gem::Platform::MINGW, :mingw_21 => Gem::Platform::MINGW, :mingw_22 => Gem::Platform::MINGW, :mingw_23 => Gem::Platform::MINGW, :x64_mingw => Gem::Platform::X64_MINGW, :x64_mingw_20 => Gem::Platform::X64_MINGW, :x64_mingw_21 => Gem::Platform::X64_MINGW, :x64_mingw_22 => Gem::Platform::X64_MINGW, :x64_mingw_23 => Gem::Platform::X64_MINGW }.freeze def initialize(name, version, options = {}, &blk) type = options["type"] || :runtime super(name, version, type) @autorequire = nil @groups = Array(options["group"] || :default).map(&:to_sym) @source = options["source"] @platforms = Array(options["platforms"]) @env = options["env"] @should_include = options.fetch("should_include", true) @autorequire = Array(options["require"] || []) if options.key?("require") end def gem_platforms(valid_platforms) return valid_platforms if @platforms.empty? platforms = [] @platforms.each do |p| platform = PLATFORM_MAP[p] next unless valid_platforms.include?(platform) platforms |= [platform] end platforms end def should_include? @should_include && current_env? && current_platform? end def current_env? return true unless @env if @env.is_a?(Hash) @env.all? do |key, val| ENV[key.to_s] && (val.is_a?(String) ? ENV[key.to_s] == val : ENV[key.to_s] =~ val) end else ENV[@env.to_s] end end def current_platform? return true if @platforms.empty? @platforms.any? do |p| Bundler.current_ruby.send("#{p}?") end end def to_lock out = super out << "!" if source out << "\n" end def specific? super rescue NoMethodError requirement != ">= 0" end end end bundler-1.11.2/lib/bundler/ui/0000755000004100000410000000000012652443364016106 5ustar www-datawww-databundler-1.11.2/lib/bundler/ui/silent.rb0000644000004100000410000000113112652443364017725 0ustar www-datawww-datamodule Bundler module UI class Silent def info(message, newline = nil) end def confirm(message, newline = nil) end def warn(message, newline = nil) end def error(message, newline = nil) end def debug(message, newline = nil) end def debug? false end def quiet? false end def ask(message) end def level=(name) end def level(name = nil) end def trace(message, newline = nil) end def silence yield end end end end bundler-1.11.2/lib/bundler/ui/shell.rb0000644000004100000410000000512712652443364017547 0ustar www-datawww-datarequire "bundler/vendored_thor" module Bundler module UI class Shell LEVELS = %w(silent error warn confirm info debug) attr_writer :shell def initialize(options = {}) if options["no-color"] || !STDOUT.tty? Thor::Base.shell = Thor::Shell::Basic end @shell = Thor::Base.shell.new @level = ENV["DEBUG"] ? "debug" : "info" @warning_history = [] end def info(msg, newline = nil) tell_me(msg, nil, newline) if level("info") end def confirm(msg, newline = nil) tell_me(msg, :green, newline) if level("confirm") end def warn(msg, newline = nil) return if @warning_history.include? msg @warning_history << msg tell_me(msg, :yellow, newline) if level("warn") end def error(msg, newline = nil) tell_me(msg, :red, newline) if level("error") end def debug(msg, newline = nil) tell_me(msg, nil, newline) if level("debug") end def debug? # needs to be false instead of nil to be newline param to other methods level("debug") end def quiet? LEVELS.index(@level) <= LEVELS.index("warn") end def ask(msg) @shell.ask(msg) end def yes?(msg) @shell.yes?(msg) end def no? @shell.no?(msg) end def level=(level) raise ArgumentError unless LEVELS.include?(level.to_s) @level = level end def level(name = nil) name ? LEVELS.index(name) <= LEVELS.index(@level) : @level end def trace(e, newline = nil, force = false) return unless debug? || force msg = "#{e.class}: #{e.message}\n#{e.backtrace.join("\n ")}" tell_me(msg, nil, newline) end def silence old_level = @level @level = "silent" yield ensure @level = old_level end private # valimism def tell_me(msg, color = nil, newline = nil) msg = word_wrap(msg) if newline.is_a?(Hash) && newline[:wrap] if newline.nil? @shell.say(msg, color) else @shell.say(msg, color, newline) end end def strip_leading_spaces(text) spaces = text[/\A\s+/, 0] spaces ? text.gsub(/#{spaces}/, "") : text end def word_wrap(text, line_width = @shell.terminal_width) strip_leading_spaces(text).split("\n").collect do |line| line.length > line_width ? line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n").strip : line end * "\n" end end end end bundler-1.11.2/lib/bundler/ui/rg_proxy.rb0000644000004100000410000000042312652443364020303 0ustar www-datawww-datarequire "bundler/ui" require "rubygems/user_interaction" module Bundler module UI class RGProxy < ::Gem::SilentUI def initialize(ui) @ui = ui super() end def say(message) @ui && @ui.debug(message) end end end end bundler-1.11.2/lib/bundler/runtime.rb0000644000004100000410000002343612652443364017511 0ustar www-datawww-datarequire "digest/sha1" module Bundler class Runtime < Environment include SharedHelpers def setup(*groups) groups.map!(&:to_sym) # Has to happen first clean_load_path specs = groups.any? ? @definition.specs_for(groups) : requested_specs setup_environment Bundler.rubygems.replace_entrypoints(specs) # Activate the specs specs.each do |spec| unless spec.loaded_from raise GemNotFound, "#{spec.full_name} is missing. Run `bundle` to get it." end if (activated_spec = Bundler.rubygems.loaded_specs(spec.name)) && activated_spec.version != spec.version e = Gem::LoadError.new "You have already activated #{activated_spec.name} #{activated_spec.version}, " \ "but your Gemfile requires #{spec.name} #{spec.version}. Prepending " \ "`bundle exec` to your command may solve this." e.name = spec.name if e.respond_to?(:requirement=) e.requirement = Gem::Requirement.new(spec.version.to_s) else e.version_requirement = Gem::Requirement.new(spec.version.to_s) end raise e end Bundler.rubygems.mark_loaded(spec) load_paths = spec.load_paths.reject {|path| $LOAD_PATH.include?(path) } $LOAD_PATH.unshift(*load_paths) end setup_manpath lock(:preserve_bundled_with => true) self end REQUIRE_ERRORS = [ /^no such file to load -- (.+)$/i, /^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i, /^Missing API definition file in (.+)$/i, /^cannot load such file -- (.+)$/i, /^dlopen\([^)]*\): Library not loaded: (.+)$/i, ] def require(*groups) groups.map!(&:to_sym) groups = [:default] if groups.empty? @definition.dependencies.each do |dep| # Skip the dependency if it is not in any of the requested # groups next unless (dep.groups & groups).any? && dep.current_platform? required_file = nil begin # Loop through all the specified autorequires for the # dependency. If there are none, use the dependency's name # as the autorequire. Array(dep.autorequire || dep.name).each do |file| # Allow `require: true` as an alias for `require: ` file = dep.name if file == true required_file = file begin Kernel.require file rescue => e raise e if e.is_a?(LoadError) # we handle this a little later raise Bundler::GemRequireError.new e, "There was an error while trying to load the gem '#{file}'." end end rescue LoadError => e REQUIRE_ERRORS.find {|r| r =~ e.message } raise if dep.autorequire || $1 != required_file if dep.autorequire.nil? && dep.name.include?("-") begin namespaced_file = dep.name.tr("-", "/") Kernel.require namespaced_file rescue LoadError => e REQUIRE_ERRORS.find {|r| r =~ e.message } raise if $1 != namespaced_file end end end end end def dependencies_for(*groups) if groups.empty? dependencies else dependencies.select {|d| (groups & d.groups).any? } end end alias_method :gems, :specs def cache(custom_path = nil) cache_path = Bundler.app_cache(custom_path) SharedHelpers.filesystem_access(cache_path) do |p| FileUtils.mkdir_p(p) end unless File.exist?(cache_path) Bundler.ui.info "Updating files in #{Bundler.settings.app_cache_path}" # Do not try to cache specification for the gem described by the .gemspec root_gem_name = nil if gemspec_cache_hash = Bundler.instance_variable_get(:@gemspec_cache) gemspec = gemspec_cache_hash.values.first root_gem_name = gemspec.name unless gemspec.nil? end specs.each do |spec| next if spec.name == "bundler" next if File.exist?("#{root_gem_name}.gemspec") && spec.source.class == Bundler::Source::Path && root_gem_name && spec.name == root_gem_name spec.source.send(:fetch_gem, spec) if Bundler.settings[:cache_all_platforms] && spec.source.respond_to?(:fetch_gem, true) spec.source.cache(spec, custom_path) if spec.source.respond_to?(:cache) end Dir[cache_path.join("*/.git")].each do |git_dir| FileUtils.rm_rf(git_dir) FileUtils.touch(File.expand_path("../.bundlecache", git_dir)) end prune_cache(cache_path) unless Bundler.settings[:no_prune] end def prune_cache(cache_path) SharedHelpers.filesystem_access(cache_path) do |p| FileUtils.mkdir_p(p) end unless File.exist?(cache_path) resolve = @definition.resolve prune_gem_cache(resolve, cache_path) prune_git_and_path_cache(resolve, cache_path) end def clean(dry_run = false) gem_bins = Dir["#{Gem.dir}/bin/*"] git_dirs = Dir["#{Gem.dir}/bundler/gems/*"] git_cache_dirs = Dir["#{Gem.dir}/cache/bundler/git/*"] gem_dirs = Dir["#{Gem.dir}/gems/*"] gem_files = Dir["#{Gem.dir}/cache/*.gem"] gemspec_files = Dir["#{Gem.dir}/specifications/*.gemspec"] spec_gem_paths = [] # need to keep git sources around spec_git_paths = @definition.spec_git_paths spec_git_cache_dirs = [] spec_gem_executables = [] spec_cache_paths = [] spec_gemspec_paths = [] specs.each do |spec| spec_gem_paths << spec.full_gem_path # need to check here in case gems are nested like for the rails git repo md = %r{(.+bundler/gems/.+-[a-f0-9]{7,12})}.match(spec.full_gem_path) spec_git_paths << md[1] if md spec_gem_executables << spec.executables.collect do |executable| e = "#{Bundler.rubygems.gem_bindir}/#{executable}" [e, "#{e}.bat"] end spec_cache_paths << spec.cache_file spec_gemspec_paths << spec.spec_file spec_git_cache_dirs << spec.source.cache_path.to_s if spec.source.is_a?(Bundler::Source::Git) end spec_gem_paths.uniq! spec_gem_executables.flatten! stale_gem_bins = gem_bins - spec_gem_executables stale_git_dirs = git_dirs - spec_git_paths - ["#{Gem.dir}/bundler/gems/extensions"] stale_git_cache_dirs = git_cache_dirs - spec_git_cache_dirs stale_gem_dirs = gem_dirs - spec_gem_paths stale_gem_files = gem_files - spec_cache_paths stale_gemspec_files = gemspec_files - spec_gemspec_paths removed_stale_gem_dirs = stale_gem_dirs.collect {|dir| remove_dir(dir, dry_run) } removed_stale_git_dirs = stale_git_dirs.collect {|dir| remove_dir(dir, dry_run) } output = removed_stale_gem_dirs + removed_stale_git_dirs unless dry_run stale_files = stale_gem_bins + stale_gem_files + stale_gemspec_files stale_files.each {|file| FileUtils.rm(file) if File.exist?(file) } stale_git_cache_dirs.each {|dir| FileUtils.rm_rf(dir) if File.exist?(dir) } end output end def setup_environment begin ENV["BUNDLE_BIN_PATH"] = Bundler.rubygems.bin_path("bundler", "bundle", VERSION) rescue Gem::GemNotFoundException ENV["BUNDLE_BIN_PATH"] = File.expand_path("../../../exe/bundle", __FILE__) end # Set BUNDLE_GEMFILE ENV["BUNDLE_GEMFILE"] = default_gemfile.to_s SharedHelpers.set_bundle_environment end private def prune_gem_cache(resolve, cache_path) cached = Dir["#{cache_path}/*.gem"] cached = cached.delete_if do |path| spec = Bundler.rubygems.spec_from_gem path resolve.any? do |s| s.name == spec.name && s.version == spec.version && !s.source.is_a?(Bundler::Source::Git) end end if cached.any? Bundler.ui.info "Removing outdated .gem files from #{Bundler.settings.app_cache_path}" cached.each do |path| Bundler.ui.info " * #{File.basename(path)}" File.delete(path) end end end def prune_git_and_path_cache(resolve, cache_path) cached = Dir["#{cache_path}/*/.bundlecache"] cached = cached.delete_if do |path| name = File.basename(File.dirname(path)) resolve.any? do |s| source = s.source source.respond_to?(:app_cache_dirname) && source.app_cache_dirname == name end end if cached.any? Bundler.ui.info "Removing outdated git and path gems from #{Bundler.settings.app_cache_path}" cached.each do |path| path = File.dirname(path) Bundler.ui.info " * #{File.basename(path)}" FileUtils.rm_rf(path) end end end def setup_manpath # Store original MANPATH for restoration later in with_clean_env() ENV["BUNDLE_ORIG_MANPATH"] = ENV["MANPATH"] # Add man/ subdirectories from activated bundles to MANPATH for man(1) manuals = $LOAD_PATH.map do |path| man_subdir = path.sub(/lib$/, "man") man_subdir unless Dir[man_subdir + "/man?/"].empty? end.compact unless manuals.empty? ENV["MANPATH"] = manuals.concat( ENV["MANPATH"].to_s.split(File::PATH_SEPARATOR) ).uniq.join(File::PATH_SEPARATOR) end end def remove_dir(dir, dry_run) full_name = Pathname.new(dir).basename.to_s parts = full_name.split("-") name = parts[0..-2].join("-") version = parts.last output = "#{name} (#{version})" if dry_run Bundler.ui.info "Would have removed #{output}" else Bundler.ui.info "Removing #{output}" FileUtils.rm_rf(dir) end output end end end bundler-1.11.2/lib/bundler/templates/0000755000004100000410000000000012652443364017467 5ustar www-datawww-databundler-1.11.2/lib/bundler/templates/Gemfile0000644000004100000410000000010012652443364020751 0ustar www-datawww-data# A sample Gemfile source "https://rubygems.org" # gem "rails" bundler-1.11.2/lib/bundler/templates/Executable.standalone0000644000004100000410000000062512652443364023625 0ustar www-datawww-data#!/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG['ruby_install_name'] %> # # This file was generated by Bundler. # # The application '<%= executable %>' is installed as part of a gem, and # this file is here to facilitate running it. # $:.unshift File.expand_path '../<%= standalone_path %>', __FILE__ require 'bundler/setup' load File.expand_path '../<%= executable_path %>', __FILE__ bundler-1.11.2/lib/bundler/templates/newgem/0000755000004100000410000000000012652443364020751 5ustar www-datawww-databundler-1.11.2/lib/bundler/templates/newgem/LICENSE.txt.tt0000644000004100000410000000211512652443364023221 0ustar www-datawww-dataThe MIT License (MIT) Copyright (c) <%=Time.now.year%> <%=config[:author]%> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. bundler-1.11.2/lib/bundler/templates/newgem/exe/0000755000004100000410000000000012652443364021532 5ustar www-datawww-databundler-1.11.2/lib/bundler/templates/newgem/exe/newgem.tt0000644000004100000410000000007712652443364023371 0ustar www-datawww-data#!/usr/bin/env ruby require "<%= config[:namespaced_path] %>" bundler-1.11.2/lib/bundler/templates/newgem/bin/0000755000004100000410000000000012652443364021521 5ustar www-datawww-databundler-1.11.2/lib/bundler/templates/newgem/bin/console.tt0000644000004100000410000000054412652443364023537 0ustar www-datawww-data#!/usr/bin/env ruby require "bundler/setup" require "<%= config[:namespaced_path] %>" # You can add fixtures and/or initialization code here to make experimenting # with your gem easier. You can also use a different console, if you like. # (If you use this, don't forget to add pry to your Gemfile!) # require "pry" # Pry.start require "irb" IRB.start bundler-1.11.2/lib/bundler/templates/newgem/bin/setup.tt0000644000004100000410000000020312652443364023225 0ustar www-datawww-data#!/usr/bin/env bash set -euo pipefail IFS=$'\n\t' set -vx bundle install # Do any other automated setup that you need to do here bundler-1.11.2/lib/bundler/templates/newgem/Gemfile.tt0000644000004100000410000000014712652443364022674 0ustar www-datawww-datasource 'https://rubygems.org' # Specify your gem's dependencies in <%=config[:name]%>.gemspec gemspec bundler-1.11.2/lib/bundler/templates/newgem/newgem.gemspec.tt0000644000004100000410000000340012652443364024223 0ustar www-datawww-data# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require '<%=config[:namespaced_path]%>/version' Gem::Specification.new do |spec| spec.name = <%=config[:name].inspect%> spec.version = <%=config[:constant_name]%>::VERSION spec.authors = [<%=config[:author].inspect%>] spec.email = [<%=config[:email].inspect%>] spec.summary = %q{TODO: Write a short summary, because Rubygems requires one.} spec.description = %q{TODO: Write a longer description or delete this line.} spec.homepage = "TODO: Put your gem's website or public repo URL here." <%- if config[:mit] -%> spec.license = "MIT" <%- end -%> # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or # delete this section to allow pushing this gem to any host. if spec.respond_to?(:metadata) spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'" else raise "RubyGems 2.0 or newer is required to protect against public gem pushes." end spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] <%- if config[:ext] -%> spec.extensions = ["ext/<%=config[:underscored_name]%>/extconf.rb"] <%- end -%> spec.add_development_dependency "bundler", "~> <%= config[:bundler_version] %>" spec.add_development_dependency "rake", "~> 10.0" <%- if config[:ext] -%> spec.add_development_dependency "rake-compiler" <%- end -%> <%- if config[:test] -%> spec.add_development_dependency "<%=config[:test]%>", "~> <%=config[:test_framework_version]%>" <%- end -%> end bundler-1.11.2/lib/bundler/templates/newgem/spec/0000755000004100000410000000000012652443364021703 5ustar www-datawww-databundler-1.11.2/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt0000644000004100000410000000036012652443364025151 0ustar www-datawww-datarequire 'spec_helper' describe <%= config[:constant_name] %> do it 'has a version number' do expect(<%= config[:constant_name] %>::VERSION).not_to be nil end it 'does something useful' do expect(false).to eq(true) end end bundler-1.11.2/lib/bundler/templates/newgem/spec/spec_helper.rb.tt0000644000004100000410000000014512652443364025147 0ustar www-datawww-data$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require '<%= config[:namespaced_path] %>' bundler-1.11.2/lib/bundler/templates/newgem/lib/0000755000004100000410000000000012652443364021517 5ustar www-datawww-databundler-1.11.2/lib/bundler/templates/newgem/lib/newgem.rb.tt0000644000004100000410000000062612652443364023760 0ustar www-datawww-datarequire "<%=config[:namespaced_path]%>/version" <%- if config[:ext] -%> require "<%=config[:namespaced_path]%>/<%=config[:underscored_name]%>" <%- end -%> <%- config[:constant_array].each_with_index do |c,i| -%> <%= ' '*i %>module <%= c %> <%- end -%> <%= ' '*config[:constant_array].size %># Your code goes here... <%- (config[:constant_array].size-1).downto(0) do |i| -%> <%= ' '*i %>end <%- end -%> bundler-1.11.2/lib/bundler/templates/newgem/lib/newgem/0000755000004100000410000000000012652443364023001 5ustar www-datawww-databundler-1.11.2/lib/bundler/templates/newgem/lib/newgem/version.rb.tt0000644000004100000410000000036312652443364025443 0ustar www-datawww-data<%- config[:constant_array].each_with_index do |c,i| -%> <%= ' '*i %>module <%= c %> <%- end -%> <%= ' '*config[:constant_array].size %>VERSION = "0.1.0" <%- (config[:constant_array].size-1).downto(0) do |i| -%> <%= ' '*i %>end <%- end -%> bundler-1.11.2/lib/bundler/templates/newgem/rspec.tt0000644000004100000410000000003712652443364022436 0ustar www-datawww-data--format documentation --color bundler-1.11.2/lib/bundler/templates/newgem/test/0000755000004100000410000000000012652443364021730 5ustar www-datawww-databundler-1.11.2/lib/bundler/templates/newgem/test/test_helper.rb.tt0000644000004100000410000000020112652443364025212 0ustar www-datawww-data$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require '<%= config[:namespaced_path] %>' require 'minitest/autorun' bundler-1.11.2/lib/bundler/templates/newgem/test/newgem_test.rb.tt0000644000004100000410000000036612652443364025231 0ustar www-datawww-datarequire 'test_helper' class <%= config[:constant_name] %>Test < Minitest::Test def test_that_it_has_a_version_number refute_nil ::<%= config[:constant_name] %>::VERSION end def test_it_does_something_useful assert false end end bundler-1.11.2/lib/bundler/templates/newgem/Rakefile.tt0000644000004100000410000000122712652443364023046 0ustar www-datawww-datarequire "bundler/gem_tasks" <% if config[:test] == 'minitest' -%> require "rake/testtask" Rake::TestTask.new(:test) do |t| t.libs << "test" t.libs << "lib" t.test_files = FileList['test/**/*_test.rb'] end <% elsif config[:test] == 'rspec' -%> require "rspec/core/rake_task" RSpec::Core::RakeTask.new(:spec) <% end -%> <% if config[:ext] -%> require "rake/extensiontask" task :build => :compile Rake::ExtensionTask.new("<%=config[:underscored_name]%>") do |ext| ext.lib_dir = "lib/<%=config[:namespaced_path]%>" end task :default => [:clobber, :compile, :<%= config[:test_task] %>] <% else -%> task :default => :<%= config[:test_task] %> <% end -%> bundler-1.11.2/lib/bundler/templates/newgem/README.md.tt0000644000004100000410000000354512652443364022665 0ustar www-datawww-data# <%=config[:constant_name]%> Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/<%=config[:namespaced_path]%>`. To experiment with that code, run `bin/console` for an interactive prompt. TODO: Delete this and the text above, and describe your gem ## Installation Add this line to your application's Gemfile: ```ruby gem '<%=config[:name]%>' ``` And then execute: $ bundle Or install it yourself as: $ gem install <%=config[:name]%> ## Usage TODO: Write usage instructions here ## Development After checking out the repo, run `bin/setup` to install dependencies.<% if config[:test] %> Then, run `rake <%= config[:test].sub('mini', '').sub('rspec', 'spec') %>` to run the tests.<% end %> You can also run `bin/console` for an interactive prompt that will allow you to experiment.<% if config[:bin] %> Run `bundle exec <%= config[:name] %>` to use the gem in this directory, ignoring other installed copies of this gem.<% end %> To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.<% end %> <% if config[:mit] %> ## License The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). <% end %> bundler-1.11.2/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt0000644000004100000410000000452312652443364024202 0ustar www-datawww-data# Contributor Code of Conduct As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery * Personal attacks * Trolling or insulting/derogatory comments * Public or private harassment * Publishing other's private information, such as physical or electronic addresses, without explicit permission * Other unethical or unprofessional conduct Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a project maintainer at <%=config[:email]%>. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Maintainers are obligated to maintain confidentiality with regard to the reporter of an incident. This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.3.0, available at [http://contributor-covenant.org/version/1/3/0/][version] [homepage]: http://contributor-covenant.org [version]: http://contributor-covenant.org/version/1/3/0/bundler-1.11.2/lib/bundler/templates/newgem/gitignore.tt0000644000004100000410000000023212652443364023306 0ustar www-datawww-data/.bundle/ /.yardoc /Gemfile.lock /_yardoc/ /coverage/ /doc/ /pkg/ /spec/reports/ /tmp/ <%- if config[:ext] -%> *.bundle *.so *.o *.a mkmf.log <%- end -%> bundler-1.11.2/lib/bundler/templates/newgem/.travis.yml.tt0000644000004100000410000000015312652443364023507 0ustar www-datawww-datalanguage: ruby rvm: - <%= RUBY_VERSION %> before_install: gem install bundler -v <%= Bundler::VERSION %> bundler-1.11.2/lib/bundler/templates/newgem/ext/0000755000004100000410000000000012652443364021551 5ustar www-datawww-databundler-1.11.2/lib/bundler/templates/newgem/ext/newgem/0000755000004100000410000000000012652443364023033 5ustar www-datawww-databundler-1.11.2/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt0000644000004100000410000000035712652443364025114 0ustar www-datawww-data#include "<%=config[:underscored_name]%>.h" VALUE rb_m<%=config[:constant_array].join%>; void Init_<%=config[:underscored_name]%>(void) { rb_m<%=config[:constant_array].join%> = rb_define_module(<%=config[:constant_name].inspect%>); } bundler-1.11.2/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt0000644000004100000410000000025312652443364025114 0ustar www-datawww-data#ifndef <%=config[:underscored_name].upcase%>_H #define <%=config[:underscored_name].upcase%>_H 1 #include "ruby.h" #endif /* <%=config[:underscored_name].upcase%>_H */ bundler-1.11.2/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt0000644000004100000410000000010712652443364025452 0ustar www-datawww-datarequire "mkmf" create_makefile(<%= config[:makefile_path].inspect %>) bundler-1.11.2/lib/bundler/templates/Executable0000755000004100000410000000075212652443364021502 0ustar www-datawww-data#!/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG['ruby_install_name'] %> # # This file was generated by Bundler. # # The application '<%= executable %>' is installed as part of a gem, and # this file is here to facilitate running it. # require "pathname" ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../<%= relative_gemfile_path %>", Pathname.new(__FILE__).realpath) require "rubygems" require "bundler/setup" load Gem.bin_path("<%= spec.name %>", "<%= executable %>") bundler-1.11.2/lib/bundler/resolver.rb0000644000004100000410000002663112652443364017667 0ustar www-datawww-datamodule Bundler class Resolver require "bundler/vendored_molinillo" class Molinillo::VersionConflict def printable_dep(dep) if dep.is_a?(Bundler::Dependency) DepProxy.new(dep, dep.platforms.join(", ")).to_s.strip else dep.to_s end end def message conflicts.sort.reduce("") do |o, (name, conflict)| o << %(Bundler could not find compatible versions for gem "#{name}":\n) if conflict.locked_requirement o << %( In snapshot (#{Bundler.default_lockfile.basename}):\n) o << %( #{printable_dep(conflict.locked_requirement)}\n) o << %(\n) end o << %( In Gemfile:\n) o << conflict.requirement_trees.sort_by {|t| t.reverse.map(&:name) }.map do |tree| t = "" depth = 2 tree.each do |req| t << " " * depth << req.to_s unless tree.last == req if spec = conflict.activated_by_name[req.name] t << %( was resolved to #{spec.version}, which) end t << %( depends on) end t << %(\n) depth += 1 end t end.join("\n") if name == "bundler" o << %(\n Current Bundler version:\n bundler (#{Bundler::VERSION})) other_bundler_required = !conflict.requirement.requirement.satisfied_by?(Gem::Version.new Bundler::VERSION) end if name == "bundler" && other_bundler_required o << "\n" o << "This Gemfile requires a different version of Bundler.\n" o << "Perhaps you need to update Bundler by running `gem install bundler`?\n" end if conflict.locked_requirement o << "\n" o << %(Running `bundle update` will rebuild your snapshot from scratch, using only\n) o << %(the gems in your Gemfile, which may resolve the conflict.\n) elsif !conflict.existing o << "\n" if conflict.requirement_trees.first.size > 1 o << "Could not find gem '#{conflict.requirement}', which is required by " o << "gem '#{conflict.requirement_trees.first[-2]}', in any of the sources." else o << "Could not find gem '#{conflict.requirement}' in any of the sources\n" end end o end end end ALL = Bundler::Dependency::PLATFORM_MAP.values.uniq.freeze class SpecGroup < Array include GemHelpers attr_reader :activated, :required_by def initialize(a) super @required_by = [] @activated = [] @dependencies = nil @specs = {} ALL.each do |p| @specs[p] = reverse.find {|s| s.match_platform(p) } end end def initialize_copy(o) super @required_by = o.required_by.dup @activated = o.activated.dup end def to_specs specs = {} @activated.each do |p| next unless s = @specs[p] platform = generic(Gem::Platform.new(s.platform)) next if specs[platform] lazy_spec = LazySpecification.new(name, version, platform, source) lazy_spec.dependencies.replace s.dependencies specs[platform] = lazy_spec end specs.values end def activate_platform(platform) unless @activated.include?(platform) if for?(platform, nil) @activated << platform return __dependencies[platform] || [] end end [] end def name @name ||= first.name end def version @version ||= first.version end def source @source ||= first.source end def for?(platform, required_ruby_version) if spec = @specs[platform] if required_ruby_version && spec.respond_to?(:required_ruby_version) && spec_required_ruby_version = spec.required_ruby_version spec_required_ruby_version.satisfied_by?(required_ruby_version) else true end end end def to_s "#{name} (#{version})" end def dependencies_for_activated_platforms @activated.map {|p| __dependencies[p] }.flatten end def platforms_for_dependency_named(dependency) __dependencies.select {|_, deps| deps.map(&:name).include? dependency }.keys end private def __dependencies @dependencies ||= begin dependencies = {} ALL.each do |p| next unless spec = @specs[p] dependencies[p] = [] spec.dependencies.each do |dep| next if dep.type == :development dependencies[p] << DepProxy.new(dep, p) end end dependencies end end end # Figures out the best possible configuration of gems that satisfies # the list of passed dependencies and any child dependencies without # causing any gem activation errors. # # ==== Parameters # *dependencies:: The list of dependencies to resolve # # ==== Returns # ,nil:: If the list of dependencies can be resolved, a # collection of gemspecs is returned. Otherwise, nil is returned. def self.resolve(requirements, index, source_requirements = {}, base = [], ruby_version = nil) base = SpecSet.new(base) unless base.is_a?(SpecSet) resolver = new(index, source_requirements, base, ruby_version) result = resolver.start(requirements) SpecSet.new(result) end def initialize(index, source_requirements, base, ruby_version) @index = index @source_requirements = source_requirements @base = base @resolver = Molinillo::Resolver.new(self, self) @search_for = {} @base_dg = Molinillo::DependencyGraph.new @base.each {|ls| @base_dg.add_vertex(ls.name, Dependency.new(ls.name, ls.version), true) } @ruby_version = ruby_version ? Gem::Version.create(ruby_version) : nil end def start(requirements) verify_gemfile_dependencies_are_found!(requirements) dg = @resolver.resolve(requirements, @base_dg) dg.map(&:payload).map(&:to_specs).flatten rescue Molinillo::VersionConflict => e raise VersionConflict.new(e.conflicts.keys.uniq, e.message) rescue Molinillo::CircularDependencyError => e names = e.dependencies.sort_by(&:name).map {|d| "gem '#{d.name}'" } raise CyclicDependencyError, "Your bundle requires gems that depend" \ " on each other, creating an infinite loop. Please remove" \ " #{names.count > 1 ? "either " : ""}#{names.join(" or ")}" \ " and try again." end include Molinillo::UI # Conveys debug information to the user. # # @param [Integer] depth the current depth of the resolution process. # @return [void] def debug(depth = 0) if debug? debug_info = yield debug_info = debug_info.inspect unless debug_info.is_a?(String) STDERR.puts debug_info.split("\n").map {|s| " " * depth + s } end end def debug? ENV["DEBUG_RESOLVER"] || ENV["DEBUG_RESOLVER_TREE"] end def before_resolution Bundler.ui.info "Resolving dependencies...", false end def after_resolution Bundler.ui.info "" end def indicate_progress Bundler.ui.info ".", false end private include Molinillo::SpecificationProvider def dependencies_for(specification) specification.dependencies_for_activated_platforms end def search_for(dependency) platform = dependency.__platform dependency = dependency.dep unless dependency.is_a? Gem::Dependency search = @search_for[dependency] ||= begin index = @source_requirements[dependency.name] || @index results = index.search(dependency, @base[dependency.name]) if vertex = @base_dg.vertex_named(dependency.name) locked_requirement = vertex.payload.requirement end if results.any? version = results.first.version nested = [[]] results.each do |spec| if spec.version != version nested << [] version = spec.version end nested.last << spec end groups = nested.map {|a| SpecGroup.new(a) } !locked_requirement ? groups : groups.select {|sg| locked_requirement.satisfied_by? sg.version } else [] end end search.select {|sg| sg.for?(platform, @ruby_version) }.each {|sg| sg.activate_platform(platform) } end def name_for(dependency) dependency.name end def name_for_explicit_dependency_source Bundler.default_gemfile.basename.to_s rescue "Gemfile" end def name_for_locking_dependency_source Bundler.default_lockfile.basename.to_s rescue "Gemfile.lock" end def requirement_satisfied_by?(requirement, activated, spec) requirement.matches_spec?(spec) end def sort_dependencies(dependencies, activated, conflicts) dependencies.sort_by do |dependency| name = name_for(dependency) [ activated.vertex_named(name).payload ? 0 : 1, amount_constrained(dependency), conflicts[name] ? 0 : 1, activated.vertex_named(name).payload ? 0 : search_for(dependency).count, ] end end def amount_constrained(dependency) @amount_constrained ||= {} @amount_constrained[dependency.name] ||= begin if (base = @base[dependency.name]) && !base.empty? dependency.requirement.satisfied_by?(base.first.version) ? 0 : 1 else base_dep = Dependency.new dependency.name, ">= 0.a" all = search_for(DepProxy.new base_dep, dependency.__platform).size.to_f if all.zero? 0 elsif (search = search_for(dependency).size.to_f) == all && all == 1 0 else search / all end end end end def verify_gemfile_dependencies_are_found!(requirements) requirements.each do |requirement| next if requirement.name == "bundler" next unless search_for(requirement).empty? if (base = @base[requirement.name]) && !base.empty? version = base.first.version message = "You have requested:\n" \ " #{requirement.name} #{requirement.requirement}\n\n" \ "The bundle currently has #{requirement.name} locked at #{version}.\n" \ "Try running `bundle update #{requirement.name}`\n\n" \ "If you are updating multiple gems in your Gemfile at once,\n" \ "try passing them all to `bundle update`" elsif requirement.source name = requirement.name versions = @source_requirements[name][name].map(&:version) message = "Could not find gem '#{requirement}' in #{requirement.source}.\n" if versions.any? message << "Source contains '#{name}' at: #{versions.join(", ")}" else message << "Source does not contain any versions of '#{requirement}'" end else message = "Could not find gem '#{requirement}' in any of the gem sources " \ "listed in your Gemfile or available on this machine." end raise GemNotFound, message end end end end bundler-1.11.2/lib/bundler/gem_helper.rb0000644000004100000410000001275512652443364020137 0ustar www-datawww-datarequire "bundler/vendored_thor" unless defined?(Thor) require "bundler" module Bundler class GemHelper include Rake::DSL if defined? Rake::DSL class << self # set when install'd. attr_accessor :instance def install_tasks(opts = {}) new(opts[:dir], opts[:name]).install end def gemspec(&block) gemspec = instance.gemspec block.call(gemspec) if block gemspec end end attr_reader :spec_path, :base, :gemspec def initialize(base = nil, name = nil) Bundler.ui = UI::Shell.new @base = (base ||= SharedHelpers.pwd) gemspecs = name ? [File.join(base, "#{name}.gemspec")] : Dir[File.join(base, "{,*}.gemspec")] raise "Unable to determine name from existing gemspec. Use :name => 'gemname' in #install_tasks to manually set it." unless gemspecs.size == 1 @spec_path = gemspecs.first @gemspec = Bundler.load_gemspec(@spec_path) end def install built_gem_path = nil desc "Build #{name}-#{version}.gem into the pkg directory." task "build" do built_gem_path = build_gem end desc "Build and install #{name}-#{version}.gem into system gems." task "install" => "build" do install_gem(built_gem_path) end desc "Build and install #{name}-#{version}.gem into system gems without network access." task "install:local" => "build" do install_gem(built_gem_path, :local) end desc "Create tag #{version_tag} and build and push #{name}-#{version}.gem to Rubygems\n" \ "To prevent publishing in Rubygems use `gem_push=no rake release`" task "release", [:remote] => ["build", "release:guard_clean", "release:source_control_push", "release:rubygem_push"] do end task "release:guard_clean" do guard_clean end task "release:source_control_push", [:remote] do |_, args| tag_version { git_push(args[:remote]) } unless already_tagged? end task "release:rubygem_push" do rubygem_push(built_gem_path) if gem_push? end GemHelper.instance = self end def build_gem file_name = nil sh("gem build -V '#{spec_path}'") do file_name = File.basename(built_gem_path) SharedHelpers.filesystem_access(File.join(base, "pkg")) {|p| FileUtils.mkdir_p(p) } FileUtils.mv(built_gem_path, "pkg") Bundler.ui.confirm "#{name} #{version} built to pkg/#{file_name}." end File.join(base, "pkg", file_name) end def install_gem(built_gem_path = nil, local = false) built_gem_path ||= build_gem out, _ = sh_with_code("gem install '#{built_gem_path}'#{" --local" if local}") raise "Couldn't install gem, run `gem install #{built_gem_path}' for more detailed output" unless out[/Successfully installed/] Bundler.ui.confirm "#{name} (#{version}) installed." end protected def rubygem_push(path) if Pathname.new("~/.gem/credentials").expand_path.exist? allowed_push_host = nil gem_command = "gem push '#{path}'" if @gemspec.respond_to?(:metadata) allowed_push_host = @gemspec.metadata["allowed_push_host"] gem_command << " --host #{allowed_push_host}" if allowed_push_host end sh(gem_command) Bundler.ui.confirm "Pushed #{name} #{version} to #{allowed_push_host ? allowed_push_host : "rubygems.org."}" else raise "Your rubygems.org credentials aren't set. Run `gem push` to set them." end end def built_gem_path Dir[File.join(base, "#{name}-*.gem")].sort_by {|f| File.mtime(f) }.last end def git_push(remote = "") perform_git_push remote perform_git_push "#{remote} --tags" Bundler.ui.confirm "Pushed git commits and tags." end def perform_git_push(options = "") cmd = "git push #{options}" out, code = sh_with_code(cmd) raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n" unless code == 0 end def already_tagged? if sh("git tag").split(/\n/).include?(version_tag) Bundler.ui.confirm "Tag #{version_tag} has already been created." true end end def guard_clean clean? && committed? || raise("There are files that need to be committed first.") end def clean? sh_with_code("git diff --exit-code")[1] == 0 end def committed? sh_with_code("git diff-index --quiet --cached HEAD")[1] == 0 end def tag_version sh "git tag -a -m \"Version #{version}\" #{version_tag}" Bundler.ui.confirm "Tagged #{version_tag}." yield if block_given? rescue Bundler.ui.error "Untagging #{version_tag} due to error." sh_with_code "git tag -d #{version_tag}" raise end def version gemspec.version end def version_tag "v#{version}" end def name gemspec.name end def sh(cmd, &block) out, code = sh_with_code(cmd, &block) if code == 0 out else raise(out.empty? ? "Running `#{cmd}` failed. Run this command directly for more detailed output." : out) end end def sh_with_code(cmd, &block) cmd << " 2>&1" outbuf = "" Bundler.ui.debug(cmd) SharedHelpers.chdir(base) do outbuf = `#{cmd}` block.call(outbuf) if $? == 0 && block end [outbuf, $?] end def gem_push? ! %w(n no nil false off 0).include?(ENV["gem_push"].to_s.downcase) end end end bundler-1.11.2/lib/bundler/deployment.rb0000644000004100000410000000566012652443364020205 0ustar www-datawww-datamodule Bundler class Deployment def self.define_task(context, task_method = :task, opts = {}) if defined?(Capistrano) && context.is_a?(Capistrano::Configuration) context_name = "capistrano" role_default = "{:except => {:no_release => true}}" error_type = ::Capistrano::CommandError else context_name = "vlad" role_default = "[:app]" error_type = ::Rake::CommandFailedError end roles = context.fetch(:bundle_roles, false) opts[:roles] = roles if roles context.send :namespace, :bundle do send :desc, <<-DESC Install the current Bundler environment. By default, gems will be \ installed to the shared/bundle path. Gems in the development and \ test group will not be installed. The install command is executed \ with the --deployment and --quiet flags. If the bundle cmd cannot \ be found then you can override the bundle_cmd variable to specify \ which one it should use. The base path to the app is fetched from \ the :latest_release variable. Set it for custom deploy layouts. You can override any of these defaults by setting the variables shown below. N.B. bundle_roles must be defined before you require 'bundler/#{context_name}' \ in your deploy.rb file. set :bundle_gemfile, "Gemfile" set :bundle_dir, File.join(fetch(:shared_path), 'bundle') set :bundle_flags, "--deployment --quiet" set :bundle_without, [:development, :test] set :bundle_with, [:mysql] set :bundle_cmd, "bundle" # e.g. "/opt/ruby/bin/bundle" set :bundle_roles, #{role_default} # e.g. [:app, :batch] DESC send task_method, :install, opts do bundle_cmd = context.fetch(:bundle_cmd, "bundle") bundle_flags = context.fetch(:bundle_flags, "--deployment --quiet") bundle_dir = context.fetch(:bundle_dir, File.join(context.fetch(:shared_path), "bundle")) bundle_gemfile = context.fetch(:bundle_gemfile, "Gemfile") bundle_without = [*context.fetch(:bundle_without, [:development, :test])].compact bundle_with = [*context.fetch(:bundle_with, [])].compact app_path = context.fetch(:latest_release) if app_path.to_s.empty? raise error_type.new("Cannot detect current release path - make sure you have deployed at least once.") end args = ["--gemfile #{File.join(app_path, bundle_gemfile)}"] args << "--path #{bundle_dir}" unless bundle_dir.to_s.empty? args << bundle_flags.to_s args << "--without #{bundle_without.join(" ")}" unless bundle_without.empty? args << "--with #{bundle_with.join(" ")}" unless bundle_with.empty? run "cd #{app_path} && #{bundle_cmd} install #{args.join(" ")}" end end end end end bundler-1.11.2/lib/bundler/inline.rb0000644000004100000410000000352612652443364017302 0ustar www-datawww-data# 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 Bundler::SharedHelpers.pwd.expand_path end ENV["BUNDLE_GEMFILE"] ||= "Gemfile" builder = Bundler::Dsl.new builder.instance_eval(&gemfile) definition = builder.to_definition(nil, true) def definition.lock(*); end definition.validate_ruby! if install Bundler.ui = Bundler::UI::Shell.new Bundler::Installer.install(Bundler.root, definition, :system => true) Bundler::Installer.post_install_messages.each do |name, message| Bundler.ui.info "Post-install message from #{name}:\n#{message}" end end runtime = Bundler::Runtime.new(nil, definition) runtime.setup.require bundler_module = class << Bundler; self; end bundler_module.send(:define_method, :root, old_root) end bundler-1.11.2/lib/bundler/vlad.rb0000644000004100000410000000051412652443364016744 0ustar www-datawww-data# Vlad task for Bundler. # # Just add "require 'bundler/vlad'" in your Vlad deploy.rb, and # include the vlad:bundle:install task in your vlad:deploy task. require "bundler/deployment" include Rake::DSL if defined? Rake::DSL namespace :vlad do Bundler::Deployment.define_task(Rake::RemoteTask, :remote_task, :roles => :app) end bundler-1.11.2/lib/bundler/rubygems_integration.rb0000644000004100000410000004546012652443364022267 0ustar www-datawww-datarequire "monitor" require "rubygems" require "rubygems/config_file" module Bundler class RubygemsIntegration if defined?(Gem::Ext::Builder::CHDIR_MONITOR) EXT_LOCK = Gem::Ext::Builder::CHDIR_MONITOR else EXT_LOCK = Monitor.new end def self.version @version ||= Gem::Version.new(Gem::VERSION) end def self.provides?(req_str) Gem::Requirement.new(req_str).satisfied_by?(version) end def version self.class.version end def provides?(req_str) self.class.provides?(req_str) end def build_args Gem::Command.build_args end def build_args=(args) Gem::Command.build_args = args end def loaded_specs(name) Gem.loaded_specs[name] end def mark_loaded(spec) if spec.respond_to?(:activated=) current = Gem.loaded_specs[spec.name] current.activated = false if current spec.activated = true end Gem.loaded_specs[spec.name] = spec end def validate(spec) Bundler.ui.silence { spec.validate(false) } rescue Errno::ENOENT nil end def path(obj) obj.to_s end def platforms Gem.platforms end def configuration require "bundler/psyched_yaml" Gem.configuration rescue Gem::SystemExitException => e Bundler.ui.error "#{e.class}: #{e.message}" Bundler.ui.trace e raise rescue YamlLibrarySyntaxError => e raise YamlSyntaxError.new(e, "Your RubyGems configuration, which is " \ "usually located in ~/.gemrc, contains invalid YAML syntax.") end def ruby_engine Gem.ruby_engine end def read_binary(path) Gem.read_binary(path) end def inflate(obj) Gem.inflate(obj) end def sources=(val) # Gem.configuration creates a new Gem::ConfigFile, which by default will read ~/.gemrc # If that file exists, its settings (including sources) will overwrite the values we # are about to set here. In order to avoid that, we force memoizing the config file now. configuration Gem.sources = val end def sources Gem.sources end def gem_dir Gem.dir end def gem_bindir Gem.bindir end def user_home Gem.user_home end def gem_path Gem.path end def gem_cache gem_path.map {|p| File.expand_path("cache", p) } end def spec_cache_dirs @spec_cache_dirs ||= begin dirs = gem_path.map {|dir| File.join(dir, "specifications") } dirs << Gem.spec_cache_dir if Gem.respond_to?(:spec_cache_dir) # Not in Rubygems 2.0.3 or earlier dirs.uniq.select {|dir| File.directory? dir } end end def marshal_spec_dir Gem::MARSHAL_SPEC_DIR end def config_map Gem::ConfigMap end def repository_subdirectories %w(cache doc gems specifications) end def clear_paths Gem.clear_paths end def bin_path(gem, bin, ver) Gem.bin_path(gem, bin, ver) end def preserve_paths # this is a no-op outside of Rubygems 1.8 yield end def loaded_gem_paths # RubyGems 2.2+ can put binary extension into dedicated folders, # therefore use RubyGems facilities to obtain their load paths. if Gem::Specification.method_defined? :full_require_paths loaded_gem_paths = Gem.loaded_specs.map {|_, s| s.full_require_paths } loaded_gem_paths.flatten else $LOAD_PATH.select do |p| Bundler.rubygems.gem_path.any? {|gp| p =~ /^#{Regexp.escape(gp)}/ } end end end def ui=(obj) Gem::DefaultUserInteraction.ui = obj end def ext_lock EXT_LOCK end def fetch_specs(all, pre, &blk) specs = Gem::SpecFetcher.new.list(all, pre) specs.each { yield } if block_given? specs end def fetch_prerelease_specs fetch_specs(false, true) rescue Gem::RemoteFetcher::FetchError [] # if we can't download them, there aren't any end # TODO: This is for older versions of Rubygems... should we support the # X-Gemfile-Source header on these old versions? # Maybe the newer implementation will work on older Rubygems? # It seems difficult to keep this implementation and still send the header. def fetch_all_remote_specs(remote) old_sources = Bundler.rubygems.sources Bundler.rubygems.sources = [remote.uri.to_s] # Fetch all specs, minus prerelease specs spec_list = fetch_specs(true, false) # Then fetch the prerelease specs fetch_prerelease_specs.each {|k, v| spec_list[k] += v } spec_list ensure Bundler.rubygems.sources = old_sources end def with_build_args(args) ext_lock.synchronize do old_args = build_args begin self.build_args = args yield ensure self.build_args = old_args end end end def gem_from_path(path, policy = nil) require "rubygems/format" Gem::Format.from_file_by_path(path, policy) end def spec_from_gem(path, policy = nil) require "rubygems/security" gem_from_path(path, security_policies[policy]).spec rescue Gem::Package::FormatError raise GemspecError, "Could not read gem at #{path}. It may be corrupted." rescue Exception, Gem::Exception, Gem::Security::Exception => e if e.is_a?(Gem::Security::Exception) || e.message =~ /unknown trust policy|unsigned gem/i || e.message =~ /couldn't verify (meta)?data signature/i raise SecurityError, "The gem #{File.basename(path, ".gem")} can't be installed because " \ "the security policy didn't allow it, with the message: #{e.message}" else raise e end end def build(spec, skip_validation = false) require "rubygems/builder" Gem::Builder.new(spec).build end def build_gem(gem_dir, spec) build(spec) end def download_gem(spec, uri, path) uri = Bundler.settings.mirror_for(uri) fetcher = Gem::RemoteFetcher.new(configuration[:http_proxy]) fetcher.download(spec, uri, path) end def security_policy_keys %w(High Medium Low AlmostNo No).map {|level| "#{level}Security" } end def security_policies @security_policies ||= begin require "rubygems/security" Gem::Security::Policies rescue LoadError, NameError {} end end def reverse_rubygems_kernel_mixin # Disable rubygems' gem activation system ::Kernel.class_eval do if private_method_defined?(:gem_original_require) alias_method :rubygems_require, :require alias_method :require, :gem_original_require end undef gem end end def replace_gem(specs) reverse_rubygems_kernel_mixin executables = specs.map(&:executables).flatten ::Kernel.send(:define_method, :gem) do |dep, *reqs| if executables.include? File.basename(caller.first.split(":").first) break end reqs.pop if reqs.last.is_a?(Hash) unless dep.respond_to?(:name) && dep.respond_to?(:requirement) dep = Gem::Dependency.new(dep, reqs) end spec = specs.find {|s| s.name == dep.name } if spec.nil? e = Gem::LoadError.new "#{dep.name} is not part of the bundle. Add it to Gemfile." e.name = dep.name if e.respond_to?(:requirement=) e.requirement = dep.requirement else e.version_requirement = dep.requirement end raise e elsif dep !~ spec e = Gem::LoadError.new "can't activate #{dep}, already activated #{spec.full_name}. " \ "Make sure all dependencies are added to Gemfile." e.name = dep.name if e.respond_to?(:requirement=) e.requirement = dep.requirement else e.version_requirement = dep.requirement end raise e end true end end def stub_source_index(specs) Gem::SourceIndex.send(:alias_method, :old_initialize, :initialize) redefine_method(Gem::SourceIndex, :initialize) do |*args| @gems = {} # You're looking at this thinking: Oh! This is how I make those # rubygems deprecations go away! # # You'd be correct BUT using of this method in production code # must be approved by the rubygems team itself! # # This is your warning. If you use this and don't have approval # we can't protect you. # Deprecate.skip_during do self.spec_dirs = *args add_specs(*specs) end end end # Used to make bin stubs that are not created by bundler work # under bundler. The new Gem.bin_path only considers gems in # +specs+ def replace_bin_path(specs) gem_class = (class << Gem; self; end) redefine_method(gem_class, :bin_path) do |name, *args| exec_name = args.first return ENV["BUNDLE_BIN_PATH"] if exec_name == "bundle" spec = nil if exec_name spec = specs.find {|s| s.executables.include?(exec_name) } raise(Gem::Exception, "can't find executable #{exec_name}") unless spec unless spec.name == name warn "Bundler is using a binstub that was created for a different gem.\n" \ "This is deprecated, in future versions you may need to `bundle binstub #{name}` " \ "to work around a system/bundle conflict." end else spec = specs.find {|s| s.name == name } raise Gem::Exception, "no default executable for #{spec.full_name}" unless exec_name = spec.default_executable end gem_bin = File.join(spec.full_gem_path, spec.bindir, exec_name) gem_from_path_bin = File.join(File.dirname(spec.loaded_from), spec.bindir, exec_name) File.exist?(gem_bin) ? gem_bin : gem_from_path_bin end end # Because Bundler has a static view of what specs are available, # we don't #refresh, so stub it out. def replace_refresh gem_class = (class << Gem; self; end) redefine_method(gem_class, :refresh) {} end # Replace or hook into Rubygems to provide a bundlerized view # of the world. def replace_entrypoints(specs) replace_gem(specs) stub_rubygems(specs) replace_bin_path(specs) replace_refresh Gem.clear_paths end # This backports the correct segment generation code from Rubygems 1.4+ # by monkeypatching it into the method in Rubygems 1.3.6 and 1.3.7. def backport_segment_generation redefine_method(Gem::Version, :segments) do @segments ||= @version.scan(/[0-9]+|[a-z]+/i).map do |s| /^\d+$/ =~ s ? s.to_i : s end end end # This backport fixes the marshaling of @segments. def backport_yaml_initialize redefine_method(Gem::Version, :yaml_initialize) do |_, map| @version = map["version"] @segments = nil @hash = nil end end # This backports base_dir which replaces installation path # Rubygems 1.8+ def backport_base_dir redefine_method(Gem::Specification, :base_dir) do return Gem.dir unless loaded_from File.dirname File.dirname loaded_from end end def backport_cache_file redefine_method(Gem::Specification, :cache_dir) do @cache_dir ||= File.join base_dir, "cache" end redefine_method(Gem::Specification, :cache_file) do @cache_file ||= File.join cache_dir, "#{full_name}.gem" end end def backport_spec_file redefine_method(Gem::Specification, :spec_dir) do @spec_dir ||= File.join base_dir, "specifications" end redefine_method(Gem::Specification, :spec_file) do @spec_file ||= File.join spec_dir, "#{full_name}.gemspec" end end def redefine_method(klass, method, &block) if klass.instance_methods(false).include?(method) klass.send(:remove_method, method) end klass.send(:define_method, method, &block) end # Rubygems 1.4 through 1.6 class Legacy < RubygemsIntegration def initialize super backport_base_dir backport_cache_file backport_spec_file backport_yaml_initialize end def stub_rubygems(specs) # Rubygems versions lower than 1.7 use SourceIndex#from_gems_in source_index_class = (class << Gem::SourceIndex; self; end) source_index_class.send(:define_method, :from_gems_in) do |*args| source_index = Gem::SourceIndex.new source_index.spec_dirs = *args source_index.add_specs(*specs) source_index end end def all_specs Gem.source_index.gems.values end def find_name(name) Gem.source_index.find_name(name) end def validate(spec) # These versions of RubyGems always validate in "packaging" mode, # which is too strict for the kinds of checks we care about. As a # result, validation is disabled on versions of RubyGems below 1.7. end end # Rubygems versions 1.3.6 and 1.3.7 class Ancient < Legacy def initialize super backport_segment_generation end end # Rubygems 1.7 class Transitional < Legacy def stub_rubygems(specs) stub_source_index(specs) end def validate(spec) # Missing summary is downgraded to a warning in later versions, # so we set it to an empty string to prevent an exception here. spec.summary ||= "" Bundler.ui.silence { spec.validate(false) } rescue Errno::ENOENT nil end end # Rubygems 1.8.5-1.8.19 class Modern < RubygemsIntegration def stub_rubygems(specs) Gem::Specification.all = specs Gem.post_reset do Gem::Specification.all = specs end stub_source_index(specs) end def all_specs Gem::Specification.to_a end def find_name(name) Gem::Specification.find_all_by_name name end end # Rubygems 1.8.0 to 1.8.4 class AlmostModern < Modern # Rubygems [>= 1.8.0, < 1.8.5] has a bug that changes Gem.dir whenever # you call Gem::Installer#install with an :install_dir set. We have to # change it back for our sudo mode to work. def preserve_paths old_dir = gem_dir old_path = gem_path yield Gem.use_paths(old_dir, old_path) end end # Rubygems 1.8.20+ class MoreModern < Modern # Rubygems 1.8.20 and adds the skip_validation parameter, so that's # when we start passing it through. def build(spec, skip_validation = false) require "rubygems/builder" Gem::Builder.new(spec).build(skip_validation) end end # Rubygems 2.0 class Future < RubygemsIntegration def stub_rubygems(specs) Gem::Specification.all = specs Gem.post_reset do Gem::Specification.all = specs end end def all_specs Gem::Specification.to_a end def find_name(name) Gem::Specification.find_all_by_name name end def fetch_specs(source, remote, name) path = source + "#{name}.#{Gem.marshal_version}.gz" fetcher = gem_remote_fetcher fetcher.headers = { "X-Gemfile-Source" => remote.original_uri.to_s } if remote.original_uri string = fetcher.fetch_path(path) Bundler.load_marshal(string) rescue Gem::RemoteFetcher::FetchError => e # it's okay for prerelease to fail raise e unless name == "prerelease_specs" end def fetch_all_remote_specs(remote) # Since SpecFetcher now returns NameTuples, we just fetch directly # and unmarshal the array ourselves. hash = {} source = remote.uri source = URI.parse(source.to_s) unless source.is_a?(URI) hash[source] = fetch_specs(source, remote, "specs") pres = fetch_specs(source, remote, "prerelease_specs") hash[source].push(*pres) if pres && !pres.empty? hash end def download_gem(spec, uri, path) uri = Bundler.settings.mirror_for(uri) fetcher = gem_remote_fetcher fetcher.headers = { "X-Gemfile-Source" => spec.remote.original_uri.to_s } if spec.remote.original_uri fetcher.download(spec, uri, path) end def gem_remote_fetcher require "resolv" proxy = configuration[:http_proxy] dns = Resolv::DNS.new Bundler::GemRemoteFetcher.new(proxy, dns) end def gem_from_path(path, policy = nil) require "rubygems/package" p = Gem::Package.new(path) p.security_policy = policy if policy p end def build(spec, skip_validation = false) require "rubygems/package" Gem::Package.build(spec, skip_validation) end def repository_subdirectories Gem::REPOSITORY_SUBDIRECTORIES end end # RubyGems 2.1.0 class MoreFuture < Future def initialize super backport_ext_builder_monitor end def all_specs require "bundler/remote_specification" Gem::Specification.stubs.map do |stub| StubSpecification.from_stub(stub) end end def backport_ext_builder_monitor require "rubygems/ext" Gem::Ext::Builder.class_eval do unless const_defined?(:CHDIR_MONITOR) const_set(:CHDIR_MONITOR, EXT_LOCK) end remove_const(:CHDIR_MUTEX) if const_defined?(:CHDIR_MUTEX) const_set(:CHDIR_MUTEX, const_get(:CHDIR_MONITOR)) end end if Gem::Specification.respond_to?(:stubs_for) def find_name(name) Gem::Specification.stubs_for(name).map(&:to_spec) end else def find_name(name) Gem::Specification.stubs.find_all do |spec| spec.name == name end.map(&:to_spec) end end end end if RubygemsIntegration.provides?(">= 2.1.0") @rubygems = RubygemsIntegration::MoreFuture.new elsif RubygemsIntegration.provides?(">= 1.99.99") @rubygems = RubygemsIntegration::Future.new elsif RubygemsIntegration.provides?(">= 1.8.20") @rubygems = RubygemsIntegration::MoreModern.new elsif RubygemsIntegration.provides?(">= 1.8.5") @rubygems = RubygemsIntegration::Modern.new elsif RubygemsIntegration.provides?(">= 1.8.0") @rubygems = RubygemsIntegration::AlmostModern.new elsif RubygemsIntegration.provides?(">= 1.7.0") @rubygems = RubygemsIntegration::Transitional.new elsif RubygemsIntegration.provides?(">= 1.4.0") @rubygems = RubygemsIntegration::Legacy.new else # Rubygems 1.3.6 and 1.3.7 @rubygems = RubygemsIntegration::Ancient.new end class << self attr_reader :rubygems end end bundler-1.11.2/lib/bundler/man/0000755000004100000410000000000012652443364016244 5ustar www-datawww-databundler-1.11.2/lib/bundler/man/gemfile.50000644000004100000410000004737212652443364017757 0ustar www-datawww-data.\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . .TH "GEMFILE" "5" "September 2015" "" "" . .SH "NAME" \fBGemfile\fR \- A format for describing gem dependencies for Ruby programs . .SH "SYNOPSIS" A \fBGemfile\fR describes the gem dependencies required to execute associated Ruby code\. . .P Place the \fBGemfile\fR in the root of the directory containing the associated code\. For instance, in a Rails application, place the \fBGemfile\fR in the same directory as the \fBRakefile\fR\. . .SH "SYNTAX" A \fBGemfile\fR is evaluated as Ruby code, in a context which makes available a number of methods used to describe the gem requirements\. . .SH "GLOBAL SOURCES (#source)" At the top of the \fBGemfile\fR, add a line for the \fBRubygems\fR source that contains the gems listed in the \fBGemfile\fR\. . .IP "" 4 . .nf source "https://rubygems\.org" . .fi . .IP "" 0 . .P It is possible, but not recommended as of Bundler 1\.7, to add multiple global \fBsource\fR lines\. Each of these \fBsource\fRs \fBMUST\fR be a valid Rubygems repository\. . .P Sources are checked for gems following the heuristics described in \fISOURCE PRIORITY\fR\. If a gem is found in more than one global source, Bundler will print a warning after installing the gem indicating which source was used, and listing the other sources where the gem is available\. A specific source can be selected for gems that need to use a non\-standard repository, suppressing this warning, by using the \fI\fB:source\fR option\fR or a \fI\fBsource\fR block\fR\. . .SS "CREDENTIALS (#credentials)" Some gem sources require a username and password\. Use \fBbundle config\fR to set the username and password for any sources that need it\. The command must be run once on each computer that will install the Gemfile, but this keeps the credentials from being stored in plain text in version control\. . .IP "" 4 . .nf bundle config gems\.example\.com user:password . .fi . .IP "" 0 . .P For some sources, like a company Gemfury account, it may be easier to simply include the credentials in the Gemfile as part of the source URL\. . .IP "" 4 . .nf source "https://user:password@gems\.example\.com" . .fi . .IP "" 0 . .P Credentials in the source URL will take precedence over credentials set using \fBconfig\fR\. . .SH "RUBY (#ruby)" If your application requires a specific Ruby version or engine, specify your requirements using the \fBruby\fR method, with the following arguments\. All parameters are \fBOPTIONAL\fR unless otherwise specified\. . .SS "VERSION (required)" The version of Ruby that your application requires\. If your application requires an alternate Ruby engine, such as JRuby or Rubinius, this should be the Ruby version that the engine is compatible with\. . .IP "" 4 . .nf ruby "1\.9\.3" . .fi . .IP "" 0 . .SS "ENGINE (:engine)" Each application \fImay\fR specify a Ruby engine\. If an engine is specified, an engine version \fImust\fR also be specified\. . .SS "ENGINE VERSION (:engine_version)" Each application \fImay\fR specify a Ruby engine version\. If an engine version is specified, an engine \fImust\fR also be specified\. If the engine is "ruby" the engine version specified \fImust\fR match the Ruby version\. . .IP "" 4 . .nf ruby "1\.8\.7", :engine => "jruby", :engine_version => "1\.6\.7" . .fi . .IP "" 0 . .SS "PATCHLEVEL (:patchlevel)" Each application \fImay\fR specify a Ruby patchlevel\. . .IP "" 4 . .nf ruby "2\.0\.0", :patchlevel => "247" . .fi . .IP "" 0 . .SH "GEMS (#gem)" Specify gem requirements using the \fBgem\fR method, with the following arguments\. All parameters are \fBOPTIONAL\fR unless otherwise specified\. . .SS "NAME (required)" For each gem requirement, list a single \fIgem\fR line\. . .IP "" 4 . .nf gem "nokogiri" . .fi . .IP "" 0 . .SS "VERSION" Each \fIgem\fR \fBMAY\fR have one or more version specifiers\. . .IP "" 4 . .nf gem "nokogiri", ">= 1\.4\.2" gem "RedCloth", ">= 4\.1\.0", "< 4\.2\.0" . .fi . .IP "" 0 . .SS "REQUIRE AS (:require)" Each \fIgem\fR \fBMAY\fR specify files that should be used when autorequiring via \fBBundler\.require\fR\. You may pass an array with multiple files or \fBtrue\fR if file you want \fBrequired\fR has same name as \fIgem\fR or \fBfalse\fR to prevent any file from being autorequired\. . .IP "" 4 . .nf gem "redis", :require => ["redis/connection/hiredis", "redis"] gem "webmock", :require => false gem "debugger", :require => true . .fi . .IP "" 0 . .P The argument defaults to the name of the gem\. For example, these are identical: . .IP "" 4 . .nf gem "nokogiri" gem "nokogiri", :require => "nokogiri" gem "nokogiri", :require => true . .fi . .IP "" 0 . .SS "GROUPS (:group or :groups)" Each \fIgem\fR \fBMAY\fR specify membership in one or more groups\. Any \fIgem\fR that does not specify membership in any group is placed in the \fBdefault\fR group\. . .IP "" 4 . .nf gem "rspec", :group => :test gem "wirble", :groups => [:development, :test] . .fi . .IP "" 0 . .P The Bundler runtime allows its two main methods, \fBBundler\.setup\fR and \fBBundler\.require\fR, to limit their impact to particular groups\. . .IP "" 4 . .nf # setup adds gems to Ruby\'s load path Bundler\.setup # defaults to all groups require "bundler/setup" # same as Bundler\.setup Bundler\.setup(:default) # only set up the _default_ group Bundler\.setup(:test) # only set up the _test_ group (but `not` _default_) Bundler\.setup(:default, :test) # set up the _default_ and _test_ groups, but no others # require requires all of the gems in the specified groups Bundler\.require # defaults to just the _default_ group Bundler\.require(:default) # identical Bundler\.require(:default, :test) # requires the _default_ and _test_ groups Bundler\.require(:test) # requires just the _test_ group . .fi . .IP "" 0 . .P The Bundler CLI allows you to specify a list of groups whose gems \fBbundle install\fR should not install with the \fB\-\-without\fR option\. To specify multiple groups to ignore, specify a list of groups separated by spaces\. . .IP "" 4 . .nf bundle install \-\-without test bundle install \-\-without development test . .fi . .IP "" 0 . .P After running \fBbundle install \-\-without test\fR, bundler will remember that you excluded the test group in the last installation\. The next time you run \fBbundle install\fR, without any \fB\-\-without option\fR, bundler will recall it\. . .P Also, calling \fBBundler\.setup\fR with no parameters, or calling \fBrequire "bundler/setup"\fR will setup all groups except for the ones you excluded via \fB\-\-without\fR (since they are obviously not available)\. . .P Note that on \fBbundle install\fR, bundler downloads and evaluates all gems, in order to create a single canonical list of all of the required gems and their dependencies\. This means that you cannot list different versions of the same gems in different groups\. For more details, see Understanding Bundler \fIhttp://bundler\.io/rationale\.html\fR\. . .SS "PLATFORMS (:platforms)" If a gem should only be used in a particular platform or set of platforms, you can specify them\. Platforms are essentially identical to groups, except that you do not need to use the \fB\-\-without\fR install\-time flag to exclude groups of gems for other platforms\. . .P There are a number of \fBGemfile\fR platforms: . .TP \fBruby\fR C Ruby (MRI) or Rubinius, but \fBNOT\fR Windows . .TP \fBruby_18\fR \fIruby\fR \fBAND\fR version 1\.8 . .TP \fBruby_19\fR \fIruby\fR \fBAND\fR version 1\.9 . .TP \fBruby_20\fR \fIruby\fR \fBAND\fR version 2\.0 . .TP \fBruby_21\fR \fIruby\fR \fBAND\fR version 2\.1 . .TP \fBruby_22\fR \fIruby\fR \fBAND\fR version 2\.2 . .TP \fBruby_23\fR \fIruby\fR \fBAND\fR version 2\.3 . .TP \fBmri\fR Same as \fIruby\fR, but not Rubinius . .TP \fBmri_18\fR \fImri\fR \fBAND\fR version 1\.8 . .TP \fBmri_19\fR \fImri\fR \fBAND\fR version 1\.9 . .TP \fBmri_20\fR \fImri\fR \fBAND\fR version 2\.0 . .TP \fBmri_21\fR \fImri\fR \fBAND\fR version 2\.1 . .TP \fBmri_22\fR \fImri\fR \fBAND\fR version 2\.2 . .TP \fBmri_23\fR \fImri\fR \fBAND\fR version 2\.3 . .TP \fBrbx\fR Same as \fIruby\fR, but only Rubinius (not MRI) . .TP \fBjruby\fR JRuby . .TP \fBmswin\fR Windows . .TP \fBmingw\fR Windows 32 bit \'mingw32\' platform (aka RubyInstaller) . .TP \fBmingw_18\fR \fImingw\fR \fBAND\fR version 1\.8 . .TP \fBmingw_19\fR \fImingw\fR \fBAND\fR version 1\.9 . .TP \fBmingw_20\fR \fImingw\fR \fBAND\fR version 2\.0 . .TP \fBmingw_21\fR \fImingw\fR \fBAND\fR version 2\.1 . .TP \fBmingw_22\fR \fImingw\fR \fBAND\fR version 2\.2 . .TP \fBmingw_23\fR \fImingw\fR \fBAND\fR version 2\.3 . .TP \fBx64_mingw\fR Windows 64 bit \'mingw32\' platform (aka RubyInstaller x64) . .TP \fBx64_mingw_20\fR \fIx64_mingw\fR \fBAND\fR version 2\.0 . .TP \fBx64_mingw_21\fR \fIx64_mingw\fR \fBAND\fR version 2\.1 . .TP \fBx64_mingw_22\fR \fIx64_mingw\fR \fBAND\fR version 2\.2 . .TP \fBx64_mingw_23\fR \fIx64_mingw\fR \fBAND\fR version 2\.3 . .P As with groups, you can specify one or more platforms: . .IP "" 4 . .nf gem "weakling", :platforms => :jruby gem "ruby\-debug", :platforms => :mri_18 gem "nokogiri", :platforms => [:mri_18, :jruby] . .fi . .IP "" 0 . .P All operations involving groups (\fBbundle install\fR, \fBBundler\.setup\fR, \fBBundler\.require\fR) behave exactly the same as if any groups not matching the current platform were explicitly excluded\. . .SS "SOURCE (:source)" You can select an alternate Rubygems repository for a gem using the \':source\' option\. . .IP "" 4 . .nf gem "some_internal_gem", :source => "https://gems\.example\.com" . .fi . .IP "" 0 . .P This forces the gem to be loaded from this source and ignores any global sources declared at the top level of the file\. If the gem does not exist in this source, it will not be installed\. . .P Bundler will search for child dependencies of this gem by first looking in the source selected for the parent, but if they are not found there, it will fall back on global sources using the ordering described in \fISOURCE PRIORITY\fR\. . .P Selecting a specific source repository this way also suppresses the ambiguous gem warning described above in \fIGLOBAL SOURCES (#source)\fR\. . .SS "GIT (:git)" If necessary, you can specify that a gem is located at a particular git repository using the \fB:git\fR parameter\. The repository can be accessed via several protocols: . .TP \fBHTTP(S)\fR gem "rails", :git => "https://github\.com/rails/rails\.git" . .TP \fBSSH\fR gem "rails", :git => "git@github\.com:rails/rails\.git" . .TP \fBgit\fR gem "rails", :git => "git://github\.com/rails/rails\.git" . .P If using SSH, the user that you use to run \fBbundle install\fR \fBMUST\fR have the appropriate keys available in their \fB$HOME/\.ssh\fR\. . .P \fBNOTE\fR: \fBhttp://\fR and \fBgit://\fR URLs should be avoided if at all possible\. These protocols are unauthenticated, so a man\-in\-the\-middle attacker can deliver malicious code and compromise your system\. HTTPS and SSH are strongly preferred\. . .P The \fBgroup\fR, \fBplatforms\fR, and \fBrequire\fR options are available and behave exactly the same as they would for a normal gem\. . .P A git repository \fBSHOULD\fR have at least one file, at the root of the directory containing the gem, with the extension \fB\.gemspec\fR\. This file \fBMUST\fR contain a valid gem specification, as expected by the \fBgem build\fR command\. . .P If a git repository does not have a \fB\.gemspec\fR, bundler will attempt to create one, but it will not contain any dependencies, executables, or C extension compilation instructions\. As a result, it may fail to properly integrate into your application\. . .P If a git repository does have a \fB\.gemspec\fR for the gem you attached it to, a version specifier, if provided, means that the git repository is only valid if the \fB\.gemspec\fR specifies a version matching the version specifier\. If not, bundler will print a warning\. . .IP "" 4 . .nf gem "rails", "2\.3\.8", :git => "https://github\.com/rails/rails\.git" # bundle install will fail, because the \.gemspec in the rails # repository\'s master branch specifies version 3\.0\.0 . .fi . .IP "" 0 . .P If a git repository does \fBnot\fR have a \fB\.gemspec\fR for the gem you attached it to, a version specifier \fBMUST\fR be provided\. Bundler will use this version in the simple \fB\.gemspec\fR it creates\. . .P Git repositories support a number of additional options\. . .TP \fBbranch\fR, \fBtag\fR, and \fBref\fR You \fBMUST\fR only specify at most one of these options\. The default is \fB:branch => "master"\fR . .TP \fBsubmodules\fR Specify \fB:submodules => true\fR to cause bundler to expand any submodules included in the git repository . .P If a git repository contains multiple \fB\.gemspecs\fR, each \fB\.gemspec\fR represents a gem located at the same place in the file system as the \fB\.gemspec\fR\. . .IP "" 4 . .nf |~rails [git root] | |\-rails\.gemspec [rails gem located here] |~actionpack | |\-actionpack\.gemspec [actionpack gem located here] |~activesupport | |\-activesupport\.gemspec [activesupport gem located here] |\.\.\. . .fi . .IP "" 0 . .P To install a gem located in a git repository, bundler changes to the directory containing the gemspec, runs \fBgem build name\.gemspec\fR and then installs the resulting gem\. The \fBgem build\fR command, which comes standard with Rubygems, evaluates the \fB\.gemspec\fR in the context of the directory in which it is located\. . .SS "GIT SOURCE (:git_source)" A custom git source can be defined via the \fBgit_source\fR method\. Provide the source\'s name as an argument, and a block which receives a single argument and interpolates it into a string to return the full repo address: . .IP "" 4 . .nf git_source(:stash){ |repo_name| "https://stash\.corp\.acme\.pl/#{repo_name}\.git" } gem \'rails\', :stash => \'forks/rails\' . .fi . .IP "" 0 . .P In addition, if you wish to choose a specific branch: . .IP "" 4 . .nf gem "rails", :stash => "forks/rails", :branch => "branch_name" . .fi . .IP "" 0 . .SS "GITHUB (:github)" \fBNOTE\fR: This shorthand should be avoided until Bundler 2\.0, since it currently expands to an insecure \fBgit://\fR URL\. This allows a man\-in\-the\-middle attacker to compromise your system\. . .P If the git repository you want to use is hosted on GitHub and is public, you can use the :github shorthand to specify just the github username and repository name (without the trailing "\.git"), separated by a slash\. If both the username and repository name are the same, you can omit one\. . .IP "" 4 . .nf gem "rails", :github => "rails/rails" gem "rails", :github => "rails" . .fi . .IP "" 0 . .P Are both equivalent to . .IP "" 4 . .nf gem "rails", :git => "git://github\.com/rails/rails\.git" . .fi . .IP "" 0 . .P Since the \fBgithub\fR method is a specialization of \fBgit_source\fR, it accepts a \fB:branch\fR named argument\. . .SS "GIST (:gist)" If the git repository you want to use is hosted as a Github Gist and is public, you can use the :gist shorthand to specify just the gist identifier (without the trailing "\.git")\. . .IP "" 4 . .nf gem "the_hatch", :gist => "4815162342" . .fi . .IP "" 0 . .P Is equivalent to: . .IP "" 4 . .nf gem "the_hatch", :git => "https://gist\.github\.com/4815162342\.git" . .fi . .IP "" 0 . .P Since the \fBgist\fR method is a specialization of \fBgit_source\fR, it accepts a \fB:branch\fR named argument\. . .SS "BITBUCKET (:bitbucket)" If the git repository you want to use is hosted on Bitbucket and is public, you can use the :bitbucket shorthand to specify just the bitbucket username and repository name (without the trailing "\.git"), separated by a slash\. If both the username and repository name are the same, you can omit one\. . .IP "" 4 . .nf gem "rails", :bitbucket => "rails/rails" gem "rails", :bitbucket => "rails" . .fi . .IP "" 0 . .P Are both equivalent to . .IP "" 4 . .nf gem "rails", :git => "https://rails@bitbucket\.org/rails/rails\.git" . .fi . .IP "" 0 . .P Since the \fBbitbucket\fR method is a specialization of \fBgit_source\fR, it accepts a \fB:branch\fR named argument\. . .SS "PATH (:path)" You can specify that a gem is located in a particular location on the file system\. Relative paths are resolved relative to the directory containing the \fBGemfile\fR\. . .P Similar to the semantics of the \fB:git\fR option, the \fB:path\fR option requires that the directory in question either contains a \fB\.gemspec\fR for the gem, or that you specify an explicit version that bundler should use\. . .P Unlike \fB:git\fR, bundler does not compile C extensions for gems specified as paths\. . .IP "" 4 . .nf gem "rails", :path => "vendor/rails" . .fi . .IP "" 0 . .P If you would like to use multiple local gems directly from the filesystem, you can set a global \fBpath\fR option to the path containing the gem\'s files\. This will automatically load gemspec files from subdirectories\. . .IP "" 4 . .nf path \'components\' do gem \'admin_ui\' gem \'public_ui\' end . .fi . .IP "" 0 . .SH "BLOCK FORM OF SOURCE, GIT, PATH, GROUP and PLATFORMS" The \fB:source\fR, \fB:git\fR, \fB:path\fR, \fB:group\fR, and \fB:platforms\fR options may be applied to a group of gems by using block form\. . .IP "" 4 . .nf source "https://gems\.example\.com" do gem "some_internal_gem" gem "another_internal_gem" end git "https://github\.com/rails/rails\.git" do gem "activesupport" gem "actionpack" end platforms :ruby do gem "ruby\-debug" gem "sqlite3" end group :development, :optional => true do gem "wirble" gem "faker" end . .fi . .IP "" 0 . .P In the case of the group block form the :optional option can be given to prevent a group from being installed unless listed in the \fB\-\-with\fR option given to the \fBbundle install\fR command\. . .P In the case of the \fBgit\fR block form, the \fB:ref\fR, \fB:branch\fR, \fB:tag\fR, and \fB:submodules\fR options may be passed to the \fBgit\fR method, and all gems in the block will inherit those options\. . .SH "INSTALL_IF (#install_if)" The \fBinstall_if\fR method allows gems to be installed based on a proc or lambda\. This is especially useful for optional gems that can only be used if certain software is installed or some other conditions are met\. . .IP "" 4 . .nf install_if \-> { RUBY_PLATFORM =~ /darwin/ } do gem "pasteboard" end . .fi . .IP "" 0 . .SH "GEMSPEC (#gemspec)" If you wish to use Bundler to help install dependencies for a gem while it is being developed, use the \fBgemspec\fR method to pull in the dependencies listed in the \fB\.gemspec\fR file\. . .P The \fBgemspec\fR method adds any runtime dependencies as gem requirements in the default group\. It also adds development dependencies as gem requirements in the \fBdevelopment\fR group\. Finally, it adds a gem requirement on your project (\fB:path => \'\.\'\fR)\. In conjunction with \fBBundler\.setup\fR, this allows you to require project files in your test code as you would if the project were installed as a gem; you need not manipulate the load path manually or require project files via relative paths\. . .P The \fBgemspec\fR method supports optional \fB:path\fR, \fB:glob\fR, \fB:name\fR, and \fB:development_group\fR options, which control where bundler looks for the \fB\.gemspec\fR, the glob it uses to look for the gemspec (defaults to: "{,\fI,\fR/*}\.gemspec"), what named \fB\.gemspec\fR it uses (if more than one is present), and which group development dependencies are included in\. . .SH "SOURCE PRIORITY" When attempting to locate a gem to satisfy a gem requirement, bundler uses the following priority order: . .IP "1." 4 The source explicitly attached to the gem (using \fB:source\fR, \fB:path\fR, or \fB:git\fR) . .IP "2." 4 For implicit gems (dependencies of explicit gems), any source, git, or path repository declared on the parent\. This results in bundler prioritizing the ActiveSupport gem from the Rails git repository over ones from \fBrubygems\.org\fR . .IP "3." 4 The sources specified via global \fBsource\fR lines, searching each source in your \fBGemfile\fR from last added to first added\. . .IP "" 0 bundler-1.11.2/lib/bundler/man/bundle-install.txt0000644000004100000410000004210412652443364021723 0ustar www-datawww-dataBUNDLE-INSTALL(1) BUNDLE-INSTALL(1) NAME bundle-install - Install the dependencies specified in your Gemfile SYNOPSIS bundle install [--binstubs[=DIRECTORY]] [--clean] [--full-index] [--gemfile=GEMFILE] [--jobs=NUMBER] [--local] [--deployment] [--force] [--no-cache] [--no-prune] [--path PATH] [--system] [--quiet] [--retry=NUMBER] [--shebang] [--standalone[=GROUP[ GROUP...]]] [--trust-policy=POLICY] [--without=GROUP[ GROUP...]] [--with=GROUP[ GROUP...]] DESCRIPTION Install the gems specified in your Gemfile(5). If this is the first time you run bundle install (and a Gemfile.lock does not exist), Bundler will fetch all remote sources, resolve dependencies and install all needed gems. If a Gemfile.lock does exist, and you have not updated your Gemfile(5), Bundler will fetch all remote sources, but use the dependencies speci- fied in the Gemfile.lock instead of resolving dependencies. If a Gemfile.lock does exist, and you have updated your Gemfile(5), Bundler will use the dependencies in the Gemfile.lock for all gems that you did not update, but will re-resolve the dependencies of gems that you did update. You can find more information about this update process below under CONSERVATIVE UPDATING. OPTIONS --binstubs[=] Creates a directory (defaults to ~/bin) and place any executa- bles from the gem there. These executables run in Bundler's con- text. If used, you might add this directory to your environ- ment's PATH variable. For instance, if the rails gem comes with a rails executable, this flag will create a bin/rails executable that ensures that all referred dependencies will be resolved using the bundled gems. --clean On finishing the installation Bundler is going to remove any gems not present in the current Gemfile(5). Don't worry, gems currently in use will not be removed. --full-index Bundler will not call Rubygems' API endpoint (default) but down- load and cache a (currently big) index file of all gems. Perfor- mance can be improved for large bundles that seldomly change by enabling this option. --gemfile= The location of the Gemfile(5) which Bundler should use. This defaults to a Gemfile(5) in the current working directory. In general, Bundler will assume that the location of the Gemfile(5) is also the project's root and will try to find Gemfile.lock and vendor/cache relative to this location. --jobs=[] The maximum number of parallel download and install jobs. The default is 1. --local Do not attempt to connect to rubygems.org. Instead, Bundler will use the gems already present in Rubygems' cache or in ven- dor/cache. Note that if a appropriate platform-specific gem exists on rubygems.org it will not be found. --deployment In deployment mode, Bundler will 'roll-out' the bundle for pro- duction or CI use. Please check carefully if you want to have this option enabled in your development environment. --force Force download every gem, even if the required versions are already available locally. --system Installs the gems specified in the bundle to the system's Rubygems location. This overrides any previous remembered use of --path. --no-cache Do not update the cache in vendor/cache with the newly bundled gems. This does not remove any gems in the cache but keeps the newly bundled gems from being cached during the install. --no-prune Don't remove stale gems from the cache when the installation finishes. --path= The location to install the specified gems to. This defaults to Rubygems' setting. Bundler shares this location with Rubygems, gem install ... will have gem installed there, too. Therefore, gems installed without a --path ... setting will show up by calling gem list. Accodingly, gems installed to other locations will not get listed. This setting is a remembered option. --quiet Do not print progress information to the standard output. Instead, Bundler will exit using a status code ($?). --retry=[] Retry failed network or git requests for number times. --shebang= Uses the specified ruby executable (usually ruby) to execute the scripts created with --binstubs. In addition, if you use --bin- stubs together with --shebang jruby these executables will be changed to execute jruby instead. --standalone[=] Makes a bundle that can work without depending on Rubygems or Bundler at runtime. A space separated list of groups to install has to be specified. Bundler creates a directory named bundle and installs the bundle there. It also generates a bun- dle/bundler/setup.rb file to replace Bundler's own setup in the manner required. Using this option implicitly sets path, which is a remembered option. --trust-policy=[] Apply the Rubygems security policy policy, where policy is one of HighSecurity, MediumSecurity, LowSecurity, AlmostNoSecurity, or NoSecurity. For more details, please see the Rubygems signing documentation linked below in SEE ALSO. --without= A space-separated list of groups referencing gems to skip during installation. If a group is given that is in the remembered list of groups given to --with, it is removed from that list. This is a remembered option. --with= A space-separated list of groups referencing gems to install. If an optional group is given it is installed. If a group is given that is in the remembered list of groups given to --without, it is removed from that list. This is a remembered option. DEPLOYMENT MODE Bundler's defaults are optimized for development. To switch to defaults optimized for deployment and for CI, use the --deployment flag. Do not activate deployment mode on development machines, as it will cause an error when the Gemfile(5) is modified. 1. A Gemfile.lock is required. To ensure that the same versions of the gems you developed with and tested with are also used in deployments, a Gemfile.lock is required. This is mainly to ensure that you remember to check your Gem- file.lock into version control. 2. The Gemfile.lock must be up to date In development, you can modify your Gemfile(5) and re-run bundle install to conservatively update your Gemfile.lock snapshot. In deployment, your Gemfile.lock should be up-to-date with changes made in your Gemfile(5). 3. Gems are installed to vendor/bundle not your default system loca- tion In development, it's convenient to share the gems used in your application with other applications and other scripts run on the system. In deployment, isolation is a more important default. In addition, the user deploying the application may not have permission to install gems to the system, or the web server may not have permis- sion to read them. As a result, bundle install --deployment installs gems to the ven- dor/bundle directory in the application. This may be overridden using the --path option. SUDO USAGE By default, Bundler installs gems to the same location as gem install. In some cases, that location may not be writable by your Unix user. In that case, Bundler will stage everything in a temporary directory, then ask you for your sudo password in order to copy the gems into their system location. From your perspective, this is identical to installing them gems directly into the system. You should never use sudo bundle install. This is because several other steps in bundle install must be performed as the current user: o Updating your Gemfile.lock o Updating your vendor/cache, if necessary o Checking out private git repositories using your user's SSH keys Of these three, the first two could theoretically be performed by chowning the resulting files to $SUDO_USER. The third, however, can only be performed by actually invoking the git command as the current user. Therefore, git gems are downloaded and installed into ~/.bundle rather than $GEM_HOME or $BUNDLE_PATH. As a result, you should run bundle install as the current user, and Bundler will ask for your password if it is needed to put the gems into their final location. INSTALLING GROUPS By default, bundle install will install all gems in all groups in your Gemfile(5), except those declared for a different platform. However, you can explicitly tell Bundler to skip installing certain groups with the --without option. This option takes a space-separated list of groups. While the --without option will skip installing the gems in the speci- fied groups, it will still download those gems and use them to resolve the dependencies of every gem in your Gemfile(5). This is so that installing a different set of groups on another machine (such as a production server) will not change the gems and versions that you have already developed and tested against. Bundler offers a rock-solid guarantee that the third-party code you are running in development and testing is also the third-party code you are running in production. You can choose to exclude some of that code in different environments, but you will never be caught flat-footed by different versions of third-party code being used in different environ- ments. For a simple illustration, consider the following Gemfile(5): source 'https://rubygems.org' gem 'sinatra' group :production do gem 'rack-perftools-profiler' end In this case, sinatra depends on any version of Rack (>= 1.0), while rack-perftools-profiler depends on 1.x (~> 1.0). When you run bundle install --without production in development, we look at the dependencies of rack-perftools-profiler as well. That way, you do not spend all your time developing against Rack 2.0, using new APIs unavailable in Rack 1.x, only to have Bundler switch to Rack 1.2 when the production group is used. This should not cause any problems in practice, because we do not attempt to install the gems in the excluded groups, and only evaluate as part of the dependency resolution process. This also means that you cannot include different versions of the same gem in different groups, because doing so would result in different sets of dependencies used in development and production. Because of the vagaries of the dependency resolution process, this usually affects more than just the gems you list in your Gemfile(5), and can (surpris- ingly) radically change the gems you are using. REMEMBERED OPTIONS Some options (marked above in the OPTIONS section) are remembered between calls to bundle install, and by the Bundler runtime. For instance, if you run bundle install --without test, a subsequent call to bundle install that does not include a --without flag will remember your previous choice. In addition, a call to Bundler.setup will not attempt to make the gems in those groups available on the Ruby load path, as they were not installed. The settings that are remembered are: --deployment At runtime, this remembered setting will also result in Bundler raising an exception if the Gemfile.lock is out of date. --path Subsequent calls to bundle install will install gems to the directory originally passed to --path. The Bundler runtime will look for gems in that location. You can revert this option by running bundle install --system. --binstubs Bundler will update the executables every subsequent call to bundle install. --without As described above, Bundler will skip the gems specified by --without in subsequent calls to bundle install. The Bundler runtime will also not try to make the gems in the skipped groups available. THE GEMFILE.LOCK When you run bundle install, Bundler will persist the full names and versions of all gems that you used (including dependencies of the gems specified in the Gemfile(5)) into a file called Gemfile.lock. Bundler uses this file in all subsequent calls to bundle install, which guarantees that you always use the same exact code, even as your appli- cation moves across machines. Because of the way dependency resolution works, even a seemingly small change (for instance, an update to a point-release of a dependency of a gem in your Gemfile(5)) can result in radically different gems being needed to satisfy all dependencies. As a result, you SHOULD check your Gemfile.lock into version control. If you do not, every machine that checks out your repository (including your production server) will resolve all dependencies again, which will result in different versions of third-party code being used if any of the gems in the Gemfile(5) or any of their dependencies have been updated. CONSERVATIVE UPDATING When you make a change to the Gemfile(5) and then run bundle install, Bundler will update only the gems that you modified. In other words, if a gem that you did not modify worked before you called bundle install, it will continue to use the exact same versions of all dependencies as it used before the update. Let's take a look at an example. Here's your original Gemfile(5): source 'https://rubygems.org' gem 'actionpack', '2.3.8' gem 'activemerchant' In this case, both actionpack and activemerchant depend on activesup- port. The actionpack gem depends on activesupport 2.3.8 and rack ~> 1.1.0, while the activemerchant gem depends on activesupport >= 2.3.2, braintree >= 2.0.0, and builder >= 2.0.0. When the dependencies are first resolved, Bundler will select activesupport 2.3.8, which satisfies the requirements of both gems in your Gemfile(5). Next, you modify your Gemfile(5) to: source 'https://rubygems.org' gem 'actionpack', '3.0.0.rc' gem 'activemerchant' The actionpack 3.0.0.rc gem has a number of new dependencies, and updates the activesupport dependency to = 3.0.0.rc and the rack depen- dency to ~> 1.2.1. When you run bundle install, Bundler notices that you changed the actionpack gem, but not the activemerchant gem. It evaluates the gems currently being used to satisfy its requirements: activesupport 2.3.8 also used to satisfy a dependency in activemerchant, which is not being updated rack ~> 1.1.0 not currently being used to satisfy another dependency Because you did not explicitly ask to update activemerchant, you would not expect it to suddenly stop working after updating actionpack. How- ever, satisfying the new activesupport 3.0.0.rc dependency of action- pack requires updating one of its dependencies. Even though activemerchant declares a very loose dependency that theo- retically matches activesupport 3.0.0.rc, Bundler treats gems in your Gemfile(5) that have not changed as an atomic unit together with their dependencies. In this case, the activemerchant dependency is treated as activemerchant 1.7.1 + activesupport 2.3.8, so bundle install will report that it cannot update actionpack. To explicitly update actionpack, including its dependencies which other gems in the Gemfile(5) still depend on, run bundle update actionpack (see bundle update(1)). Summary: In general, after making a change to the Gemfile(5) , you should first try to run bundle install, which will guarantee that no other gems in the Gemfile(5) are impacted by the change. If that does not work, run bundle update(1) bundle-update.1.html. SEE ALSO o Gem install docs: http://guides.rubygems.org/rubygems-basics/#installing-gems o Rubygems signing docs: http://guides.rubygems.org/security/ December 2015 BUNDLE-INSTALL(1) bundler-1.11.2/lib/bundler/man/bundle-package.txt0000644000004100000410000000564112652443364021655 0ustar www-datawww-dataBUNDLE-PACKAGE(1) BUNDLE-PACKAGE(1) NAME bundle-package - Package your needed .gem files into your application SYNOPSIS bundle package DESCRIPTION Copy all of the .gem files needed to run the application into the ven- dor/cache directory. In the future, when running bundle install(1) bun- dle-install.1.html, use the gems in the cache in preference to the ones on rubygems.org. GIT AND PATH GEMS Since Bundler 1.2, the bundle package command can also package :git and :path dependencies besides .gem files. This needs to be explicitly enabled via the --all option. Once used, the --all option will be remembered. SUPPORT FOR MULTIPLE PLATFORMS When using gems that have different packages for different platforms, Bundler 1.8 and newer support caching of gems for other platforms in vendor/cache. This needs to be enabled via the --all-platforms option. This setting will be remembered in your local bundler configuration. REMOTE FETCHING By default, if you simply run bundle install(1) bundle-install.1.html after running bundle package(1) bundle-package.1.html, bundler will still connect to rubygems.org to check whether a platform-specific gem exists for any of the gems in vendor/cache. For instance, consider this Gemfile(5): source "https://rubygems.org" gem "nokogiri" If you run bundle package under C Ruby, bundler will retrieve the ver- sion of nokogiri for the "ruby" platform. If you deploy to JRuby and run bundle install, bundler is forced to check to see whether a "java" platformed nokogiri exists. Even though the nokogiri gem for the Ruby platform is technically acceptable on JRuby, it actually has a C extension that does not run on JRuby. As a result, bundler will, by default, still connect to rubygems.org to check whether it has a version of one of your gems more specific to your platform. This problem is also not just limited to the "java" platform. A similar (common) problem can happen when developing on Windows and deploying to Linux, or even when developing on OSX and deploying to Linux. If you know for sure that the gems packaged in vendor/cache are appro- priate for the platform you are on, you can run bundle install --local to skip checking for more appropriate gems, and just use the ones in vendor/cache. One way to be sure that you have the right platformed versions of all your gems is to run bundle package on an identical machine and check in the gems. For instance, you can run bundle package on an identical staging box during your staging process, and check in the vendor/cache before deploying to production. September 2015 BUNDLE-PACKAGE(1) bundler-1.11.2/lib/bundler/man/bundle-exec.txt0000644000004100000410000001305212652443364021201 0ustar www-datawww-dataBUNDLE-EXEC(1) BUNDLE-EXEC(1) NAME bundle-exec - Execute a command in the context of the bundle SYNOPSIS bundle exec [--keep-file-descriptors] command DESCRIPTION This command executes the command, making all gems specified in the Gemfile(5) available to require in Ruby programs. Essentially, if you would normally have run something like rspec spec/my_spec.rb, and you want to use the gems specified in the Gem- file(5) and installed via bundle install(1) bundle-install.1.html, you should run bundle exec rspec spec/my_spec.rb. Note that bundle exec does not require that an executable is available on your shell's $PATH. OPTIONS --keep-file-descriptors Exec in Ruby 2.0 began discarding non-standard file descriptors. When this flag is passed, exec will revert to the 1.9 behaviour of passing all file descriptors to the new process. BUNDLE INSTALL --BINSTUBS If you use the --binstubs flag in bundle install(1) bun- dle-install.1.html, Bundler will automatically create a directory (which defaults to app_root/bin) containing all of the executables available from gems in the bundle. After using --binstubs, bin/rspec spec/my_spec.rb is identical to bun- dle exec rspec spec/my_spec.rb. ENVIRONMENT MODIFICATIONS bundle exec makes a number of changes to the shell environment, then executes the command you specify in full. o make sure that it's still possible to shell out to bundle from inside a command invoked by bundle exec (using $BUNDLE_BIN_PATH) o put the directory containing executables (like rails, rspec, rackup) for your bundle on $PATH o make sure that if bundler is invoked in the subshell, it uses the same Gemfile (by setting BUNDLE_GEMFILE) o add -rbundler/setup to $RUBYOPT, which makes sure that Ruby pro- grams invoked in the subshell can see the gems in the bundle It also modifies Rubygems: o disallow loading additional gems not in the bundle o modify the gem method to be a no-op if a gem matching the require- ments is in the bundle, and to raise a Gem::LoadError if it's not o Define Gem.refresh to be a no-op, since the source index is always frozen when using bundler, and to prevent gems from the system leaking into the environment o Override Gem.bin_path to use the gems in the bundle, making system executables work o Add all gems in the bundle into Gem.loaded_specs Shelling out Any Ruby code that opens a subshell (like system, backticks, or %x{}) will automatically use the current Bundler environment. If you need to shell out to a Ruby command that is not part of your current bundle, use the with_clean_env method with a block. Any subshells created inside the block will be given the environment present before Bundler was activated. For example, Homebrew commands run Ruby, but don't work inside a bundle: Bundler.with_clean_env do `brew install wget` end Using with_clean_env is also necessary if you are shelling out to a different bundle. Any Bundler commands run in a subshell will inherit the current Gemfile, so commands that need to run in the context of a different bundle also need to use with_clean_env. Bundler.with_clean_env do Dir.chdir "/other/bundler/project" do `bundle exec ./script` end end Bundler provides convenience helpers that wrap system and exec, and they can be used like this: Bundler.clean_system('brew install wget') Bundler.clean_exec('brew install wget') RUBYGEMS PLUGINS At present, the Rubygems plugin system requires all files named rubygems_plugin.rb on the load path of any installed gem when any Ruby code requires rubygems.rb. This includes executables installed into the system, like rails, rackup, and rspec. Since Rubygems plugins can contain arbitrary Ruby code, they commonly end up activating themselves or their dependencies. For instance, the gemcutter 0.5 gem depended on json_pure. If you had that version of gemcutter installed (even if you also had a newer ver- sion without this problem), Rubygems would activate gemcutter 0.5 and json_pure . If your Gemfile(5) also contained json_pure (or a gem with a dependency on json_pure), the latest version on your system might conflict with the version in your Gemfile(5), or the snapshot version in your Gem- file.lock. If this happens, bundler will say: You have already activated json_pure 1.4.6 but your Gemfile requires json_pure 1.4.3. Consider using bundle exec. In this situation, you almost certainly want to remove the underlying gem with the problematic gem plugin. In general, the authors of these plugins (in this case, the gemcutter gem) have released newer versions that are more careful in their plugins. You can find a list of all the gems containing gem plugins by running ruby -rubygems -e "puts Gem.find_files('rubygems_plugin.rb')" At the very least, you should remove all but the newest version of each gem plugin, and also remove all gem plugins that you aren't using (gem uninstall gem_name). September 2015 BUNDLE-EXEC(1) bundler-1.11.2/lib/bundler/man/bundle-lock.txt0000644000004100000410000000326612652443364021213 0ustar www-datawww-dataBUNDLE-LOCK(1) BUNDLE-LOCK(1) NAME bundle-lock - Creates / Updates a lockfile without installing SYNOPSIS bundle lock [--update] [--local] [--print] [--lockfile=PATH] DESCRIPTION Lock the gems specified in Gemfile. OPTIONS --update=<*gems> Ignores the existing lockfile. Resolve then updates lockfile. Taking a list of gems or updating all gems if no list is given. --local Do not attempt to connect to rubygems.org. Instead, Bundler will use the gems already present in Rubygems' cache or in ven- dor/cache. Note that if a appropriate platform-specific gem exists on rubygems.org it will not be found. --print Prints the lockfile to STDOUT instead of writing to the file system. --lockfile= The path where the lockfile should be written to. UPDATING ALL GEMS If you run bundle lock with --update option without list of gems, bundler will ignore any previously installed gems and resolve all dependencies again based on the latest versions of all gems available in the sources. UPDATING A LIST OF GEMS Sometimes, you want to update a single gem in the Gemfile(5), and leave the rest of the gems that you specified locked to the versions in the Gemfile.lock. For instance, you only want to update nokogiri, run bundle lock --update nokogiri. Bundler will update nokogiri and any of its dependencies, but leave the rest of the gems that you specified locked to the versions in the Gem- file.lock. December 2015 BUNDLE-LOCK(1) bundler-1.11.2/lib/bundler/man/bundle-config.txt0000644000004100000410000002177712652443364021537 0ustar www-datawww-dataBUNDLE-CONFIG(1) BUNDLE-CONFIG(1) NAME bundle-config - Set bundler configuration options SYNOPSIS bundle config [name [value]] DESCRIPTION This command allows you to interact with bundler's configuration sys- tem. Bundler retrieves its configuration from the local application (app/.bundle/config), environment variables, and the user's home direc- tory (~/.bundle/config), in that order of priority. Executing bundle config with no parameters will print a list of all bundler configuration for the current bundle, and where that configura- tion was set. Executing bundle config will print the value of that configura- tion setting, and where it was set. Executing bundle config will set that configuration to the value specified for all bundles executed as the current user. The configuration will be stored in ~/.bundle/config. If name already is set, name will be overridden and user will be warned. Executing bundle config --global works the same as above. Executing bundle config --local will set that configura- tion to the local application. The configuration will be stored in app/.bundle/config. Executing bundle config --delete will delete the configuration in both local and global sources. Not compatible with --global or --local flag. Executing bundle with the BUNDLE_IGNORE_CONFIG environment variable set will cause it to ignore all configuration. Executing bundle config disable_multisource true upgrades the warning about the Gemfile containing multiple primary sources to an error. Exe- cuting bundle config --delete disable_multisource downgrades this error to a warning. BUILD OPTIONS You can use bundle config to give bundler the flags to pass to the gem installer every time bundler tries to install a particular gem. A very common example, the mysql gem, requires Snow Leopard users to pass configuration flags to gem install to specify where to find the mysql_config executable. gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config Since the specific location of that executable can change from machine to machine, you can specify these flags on a per-machine basis. bundle config build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config After running this command, every time bundler needs to install the mysql gem, it will pass along the flags you specified. CONFIGURATION KEYS Configuration keys in bundler have two forms: the canonical form and the environment variable form. For instance, passing the --without flag to bundle install(1) bun- dle-install.1.html prevents Bundler from installing certain groups specified in the Gemfile(5). Bundler persists this value in app/.bun- dle/config so that calls to Bundler.setup do not try to find gems from the Gemfile that you didn't install. Additionally, subsequent calls to bundle install(1) bundle-install.1.html remember this setting and skip those groups. The canonical form of this configuration is "without". To convert the canonical form to the environment variable form, capitalize it, and prepend BUNDLE_. The environment variable form of "without" is BUN- DLE_WITHOUT. Any periods in the configuration keys must be replaced with two under- scores when setting it via environment variables. The configuration key local.rack becomes the environment variable BUNDLE_LOCAL__RACK. LIST OF AVAILABLE KEYS The following is a list of all configuration keys and their purpose. You can learn more about their operation in bundle install(1) bun- dle-install.1.html. o path (BUNDLE_PATH): The location on disk where all gems in your bundle will be located regardless of $GEM_HOME or $GEM_PATH values. Bundle gems not found in this location will be installed by bundle install. Defaults to Gem.dir. When --deployment is used, defaults to vendor/bundle. o frozen (BUNDLE_FROZEN): Disallow changes to the Gemfile. Defaults to true when --deployment is used. o without (BUNDLE_WITHOUT): A :-separated list of groups whose gems bundler should not install o bin (BUNDLE_BIN): Install executables from gems in the bundle to the specified directory. Defaults to false. o gemfile (BUNDLE_GEMFILE): The name of the file that bundler should use as the Gemfile. This location of this file also sets the root of the project, which is used to resolve relative paths in the Gem- file, among other things. By default, bundler will search up from the current working directory until it finds a Gemfile. o ssl_ca_cert (BUNDLE_SSL_CA_CERT): Path to a designated CA certifi- cate file or folder containing multiple certificates for trusted CAs in PEM format. o ssl_client_cert (BUNDLE_SSL_CLIENT_CERT): Path to a designated file containing a X.509 client certificate and key in PEM format. o cache_path (BUNDLE_CACHE_PATH): The directory that bundler will place cached gems in when running bundle package, and that bundler will look in when installing gems. o disable_multisource (BUNDLE_DISABLE_MULTISOURCE): When set, Gem- files containing multiple sources will produce errors instead of warnings. Use bundle config --delete disable_multisource to unset. o ignore_messages (BUNDLE_IGNORE_MESSAGES): When set, no post install messages will be printed. To silence a single gem, use dot notation like ignore_messages.httparty true. In general, you should set these settings per-application by using the applicable flag to the bundle install(1) bundle-install.1.html or bun- dle package(1) bundle-package.1.html command. You can set them globally either via environment variables or bundle config, whichever is preferable for your setup. If you use both, envi- ronment variables will take preference over global settings. LOCAL GIT REPOS Bundler also allows you to work against a git repository locally instead of using the remote version. This can be achieved by setting up a local override: bundle config local.GEM_NAME /path/to/local/git/repository For example, in order to use a local Rack repository, a developer could call: bundle config local.rack ~/Work/git/rack Now instead of checking out the remote git repository, the local over- ride will be used. Similar to a path source, every time the local git repository change, changes will be automatically picked up by Bundler. This means a commit in the local git repo will update the revision in the Gemfile.lock to the local git repo revision. This requires the same attention as git submodules. Before pushing to the remote, you need to ensure the local override was pushed, otherwise you may point to a com- mit that only exists in your local machine. Bundler does many checks to ensure a developer won't work with invalid references. Particularly, we force a developer to specify a branch in the Gemfile in order to use this feature. If the branch specified in the Gemfile and the current branch in the local git repository do not match, Bundler will abort. This ensures that a developer is always working against the correct branches, and prevents accidental locking to a different branch. Finally, Bundler also ensures that the current revision in the Gem- file.lock exists in the local git repository. By doing this, Bundler forces you to fetch the latest changes in the remotes. MIRRORS OF GEM SOURCES Bundler supports overriding gem sources with mirrors. This allows you to configure rubygems.org as the gem source in your Gemfile while still using your mirror to fetch gems. bundle config mirror.SOURCE_URL MIRROR_URL For example, to use a mirror of rubygems.org hosted at bundle config mirror.http://rubygems.org http://rubygems-mirror.org CREDENTIALS FOR GEM SOURCES Bundler allows you to configure credentials for any gem source, which allows you to avoid putting secrets into your Gemfile. bundle config SOURCE_HOSTNAME USERNAME:PASSWORD For example, to save the credentials of user claudette for the gem source at gems.longerous.com, you would run: bundle config gems.longerous.com claudette:s00pers3krit Or you can set the credentials as an environment variable like this: export BUNDLE_GEMS__LONGEROUS__COM="claudette:s00pers3krit" October 2015 BUNDLE-CONFIG(1) bundler-1.11.2/lib/bundler/man/bundle.txt0000644000004100000410000000537612652443364020271 0ustar www-datawww-dataBUNDLE(1) BUNDLE(1) NAME bundle - Ruby Dependency Management SYNOPSIS bundle COMMAND [--no-color] [--verbose] [ARGS] DESCRIPTION Bundler manages an application's dependencies through its entire life across many machines systematically and repeatably. See the bundler website http://bundler.io for information on getting started, and Gemfile(5) for more information on the Gemfile format. OPTIONS --no-color Prints all output without color --verbose Prints out additional logging information BUNDLE COMMANDS We divide bundle subcommands into primary commands and utilities. PRIMARY COMMANDS bundle install(1) bundle-install.1.html Install the gems specified by the Gemfile or Gemfile.lock bundle update(1) bundle-update.1.html Update dependencies to their latest versions bundle package(1) bundle-package.1.html Package the .gem files required by your application into the vendor/cache directory bundle exec(1) bundle-exec.1.html Execute a script in the context of the current bundle bundle config(1) bundle-config.1.html Specify and read configuration options for bundler bundle help(1) Displays detailed help for each subcommand UTILITIES bundle check(1) Determine whether the requirements for your application are installed and available to bundler bundle list(1) Show all of the gems in the current bundle bundle show(1) Show the source location of a particular gem in the bundle bundle outdated(1) Show all of the outdated gems in the current bundle bundle console(1) Start an IRB session in the context of the current bundle bundle open(1) Open an installed gem in the editor bundle lock(1) Generate a lockfile for your dependencies bundle viz(1) Generate a visual representation of your dependencies bundle init(1) Generate a simple Gemfile, placed in the current directory bundle gem(1) bundle-gem.1.html Create a simple gem, suitable for development with bundler bundle platform(1) bundle-platform.1.html Displays platform compatibility information bundle clean(1) Cleans up unused gems in your bundler directory PLUGINS When running a command that isn't listed in PRIMARY COMMANDS or UTILI- TIES, Bundler will try to find an executable on your path named bundler- and execute it, passing down any extra arguments to it. OBSOLETE These commands are obsolete and should no longer be used o bundle cache(1) October 2015 BUNDLE(1) bundler-1.11.2/lib/bundler/man/bundle-update.txt0000644000004100000410000001705112652443364021542 0ustar www-datawww-dataBUNDLE-UPDATE(1) BUNDLE-UPDATE(1) NAME bundle-update - Update your gems to the latest available versions SYNOPSIS bundle update *gems [--group=NAME] [--source=NAME] [--local] DESCRIPTION Update the gems specified (all gems, if none are specified), ignoring the previously installed gems specified in the Gemfile.lock. In gen- eral, you should use bundle install(1) bundle-install.1.html to install the same exact gems and versions across machines. You would use bundle update to explicitly update the version of a gem. OPTIONS --group= Only update the gems in the specified group. For instance, you can update all gems in the development group with bundle update --group development. You can also call bundle update rails --group test to update the rails gem and all gems in the test group, for example. --source= The name of a :git or :path source used in the Gemfile(5). For instance, with a :git source of http://github.com/rails/rails.git, you would call bundle update --source rails --local Do not attempt to fetch gems remotely and use the gem cache instead. UPDATING ALL GEMS If you run bundle update with no parameters, bundler will ignore any previously installed gems and resolve all dependencies again based on the latest versions of all gems available in the sources. Consider the following Gemfile(5): source "https://rubygems.org" gem "rails", "3.0.0.rc" gem "nokogiri" When you run bundle install(1) bundle-install.1.html the first time, bundler will resolve all of the dependencies, all the way down, and install what you need: Fetching gem metadata from https://rubygems.org/......... Resolving dependencies... Installing builder 2.1.2 Installing abstract 1.0.0 Installing rack 1.2.8 Using bundler 1.7.6 Installing rake 10.4.0 Installing polyglot 0.3.5 Installing mime-types 1.25.1 Installing i18n 0.4.2 Installing mini_portile 0.6.1 Installing tzinfo 0.3.42 Installing rack-mount 0.6.14 Installing rack-test 0.5.7 Installing treetop 1.4.15 Installing thor 0.14.6 Installing activesupport 3.0.0.rc Installing erubis 2.6.6 Installing activemodel 3.0.0.rc Installing arel 0.4.0 Installing mail 2.2.20 Installing activeresource 3.0.0.rc Installing actionpack 3.0.0.rc Installing activerecord 3.0.0.rc Installing actionmailer 3.0.0.rc Installing railties 3.0.0.rc Installing rails 3.0.0.rc Installing nokogiri 1.6.5 Bundle complete! 2 Gemfile dependencies, 26 gems total. Use `bundle show [gemname]` to see where a bundled gem is installed. As you can see, even though you have just two gems in the Gemfile(5), your application actually needs 26 different gems in order to run. Bundler remembers the exact versions it installed in Gemfile.lock. The next time you run bundle install(1) bundle-install.1.html, bundler skips the dependency resolution and installs the same gems as it installed last time. After checking in the Gemfile.lock into version control and cloning it on another machine, running bundle install(1) bundle-install.1.html will still install the gems that you installed last time. You don't need to worry that a new release of erubis or mail changes the gems you use. However, from time to time, you might want to update the gems you are using to the newest versions that still match the gems in your Gem- file(5). To do this, run bundle update, which will ignore the Gemfile.lock, and resolve all the dependencies again. Keep in mind that this process can result in a significantly different set of the 25 gems, based on the requirements of new gems that the gem authors released since the last time you ran bundle update. UPDATING A LIST OF GEMS Sometimes, you want to update a single gem in the Gemfile(5), and leave the rest of the gems that you specified locked to the versions in the Gemfile.lock. For instance, in the scenario above, imagine that nokogiri releases version 1.4.4, and you want to update it without updating Rails and all of its dependencies. To do this, run bundle update nokogiri. Bundler will update nokogiri and any of its dependencies, but leave alone Rails and its dependencies. OVERLAPPING DEPENDENCIES Sometimes, multiple gems declared in your Gemfile(5) are satisfied by the same second-level dependency. For instance, consider the case of thin and rack-perftools-profiler. source "https://rubygems.org" gem "thin" gem "rack-perftools-profiler" The thin gem depends on rack >= 1.0, while rack-perftools-profiler depends on rack ~> 1.0. If you run bundle install, you get: Fetching source index for https://rubygems.org/ Installing daemons (1.1.0) Installing eventmachine (0.12.10) with native extensions Installing open4 (1.0.1) Installing perftools.rb (0.4.7) with native extensions Installing rack (1.2.1) Installing rack-perftools_profiler (0.0.2) Installing thin (1.2.7) with native extensions Using bundler (1.0.0.rc.3) In this case, the two gems have their own set of dependencies, but they share rack in common. If you run bundle update thin, bundler will update daemons, eventmachine and rack, which are dependencies of thin, but not open4 or perftools.rb, which are dependencies of rack-perftools_profiler. Note that bundle update thin will update rack even though it's also a dependency of rack-perftools_profiler. In short, when you update a gem using bundle update, bundler will update all dependencies of that gem, including those that are also dependencies of another gem. In this scenario, updating the thin version manually in the Gemfile(5), and then running bundle install(1) bundle-install.1.html will only update daemons and eventmachine, but not rack. For more information, see the CONSERVATIVE UPDATING section of bundle install(1) bun- dle-install.1.html. RECOMMENDED WORKFLOW In general, when working with an application managed with bundler, you should use the following workflow: o After you create your Gemfile(5) for the first time, run $ bundle install o Check the resulting Gemfile.lock into version control $ git add Gemfile.lock o When checking out this repository on another development machine, run $ bundle install o When checking out this repository on a deployment machine, run $ bundle install --deployment o After changing the Gemfile(5) to reflect a new or update depen- dency, run $ bundle install o Make sure to check the updated Gemfile.lock into version control $ git add Gemfile.lock o If bundle install(1) bundle-install.1.html reports a conflict, man- ually update the specific gems that you changed in the Gemfile(5) $ bundle update rails thin o If you want to update all the gems to the latest possible versions that still match the gems listed in the Gemfile(5), run $ bundle update September 2015 BUNDLE-UPDATE(1) bundler-1.11.2/lib/bundler/man/bundle-package0000644000004100000410000000570312652443364021036 0ustar www-datawww-data.\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . .TH "BUNDLE\-PACKAGE" "1" "September 2015" "" "" . .SH "NAME" \fBbundle\-package\fR \- Package your needed \fB\.gem\fR files into your application . .SH "SYNOPSIS" \fBbundle package\fR . .SH "DESCRIPTION" Copy all of the \fB\.gem\fR files needed to run the application into the \fBvendor/cache\fR directory\. In the future, when running bundle install(1) \fIbundle\-install\.1\.html\fR, use the gems in the cache in preference to the ones on \fBrubygems\.org\fR\. . .SH "GIT AND PATH GEMS" Since Bundler 1\.2, the \fBbundle package\fR command can also package \fB:git\fR and \fB:path\fR dependencies besides \.gem files\. This needs to be explicitly enabled via the \fB\-\-all\fR option\. Once used, the \fB\-\-all\fR option will be remembered\. . .SH "SUPPORT FOR MULTIPLE PLATFORMS" When using gems that have different packages for different platforms, Bundler 1\.8 and newer support caching of gems for other platforms in \fBvendor/cache\fR\. This needs to be enabled via the \fB\-\-all\-platforms\fR option\. This setting will be remembered in your local bundler configuration\. . .SH "REMOTE FETCHING" By default, if you simply run bundle install(1) \fIbundle\-install\.1\.html\fR after running bundle package(1) \fIbundle\-package\.1\.html\fR, bundler will still connect to \fBrubygems\.org\fR to check whether a platform\-specific gem exists for any of the gems in \fBvendor/cache\fR\. . .P For instance, consider this Gemfile(5): . .IP "" 4 . .nf source "https://rubygems\.org" gem "nokogiri" . .fi . .IP "" 0 . .P If you run \fBbundle package\fR under C Ruby, bundler will retrieve the version of \fBnokogiri\fR for the \fB"ruby"\fR platform\. If you deploy to JRuby and run \fBbundle install\fR, bundler is forced to check to see whether a \fB"java"\fR platformed \fBnokogiri\fR exists\. . .P Even though the \fBnokogiri\fR gem for the Ruby platform is \fItechnically\fR acceptable on JRuby, it actually has a C extension that does not run on JRuby\. As a result, bundler will, by default, still connect to \fBrubygems\.org\fR to check whether it has a version of one of your gems more specific to your platform\. . .P This problem is also not just limited to the \fB"java"\fR platform\. A similar (common) problem can happen when developing on Windows and deploying to Linux, or even when developing on OSX and deploying to Linux\. . .P If you know for sure that the gems packaged in \fBvendor/cache\fR are appropriate for the platform you are on, you can run \fBbundle install \-\-local\fR to skip checking for more appropriate gems, and just use the ones in \fBvendor/cache\fR\. . .P One way to be sure that you have the right platformed versions of all your gems is to run \fBbundle package\fR on an identical machine and check in the gems\. For instance, you can run \fBbundle package\fR on an identical staging box during your staging process, and check in the \fBvendor/cache\fR before deploying to production\. bundler-1.11.2/lib/bundler/man/bundle-gem.txt0000644000004100000410000000571412652443364021033 0ustar www-datawww-dataBUNDLE-GEM(1) BUNDLE-GEM(1) NAME bundle-gem - Generate a project skeleton for creating a rubygem SYNOPSIS bundle gem GEM_NAME OPTIONS DESCRIPTION Generates a directory named GEM_NAME with a Rakefile, GEM_NAME.gemspec, and other supporting files and directories that can be used to develop a rubygem with that name. Run rake -T in the resulting project for a list of Rake tasks that can used to test and publish the gem to rubygems.org. The generated project skeleton can be customized with OPTIONS, as explained below. Note that these options can also be specified via Bundler's global configuration file using the following names: o gem.coc o gem.mit o gem.test OPTIONS -b or --bin Specify that Bundler should create a binary (as exe/GEM_NAME) in the generated rubygem project. This binary will also be added to the GEM_NAME.gemspec manifest. This behavior is disabled by default. --no-bin Do not create a binary (overrides --bin specified in the global config). --coc Add a CODE_OF_CONDUCT.md file to the root of the generated project. If this option is unspecified, an interactive prompt will be displayed and the answer will be saved in Bundler's global config for future bundle gem use. --no-coc Do not create a CODE_OF_CONDUCT.md (overrides --coc specified in the global config). --ext Add boilerplate for C extension code to the generated project. This behavior is disabled by default. --no-ext Do not add C extension code (overrides --ext specified in the global config). --mit Add an MIT license to a LICENSE.txt file in the root of the gen- erated project. Your name from the global git config is used for the copyright statement. If this option is unspecified, an interactive prompt will be displayed and the answer will be saved in Bundler's global config for future bundle gem use. --no-mit Do not create a LICENSE.txt (overrides --mit specified in the global config). -t, --test=minitest, --test=rspec Specify the test framework that Bundler should use when generat- ing the project. Acceptable values are minitest and rspec. The GEM_NAME.gemspec will be configured and a skeleton test/spec directory will be created based on this option. If this option is unspecified, an interactive prompt will be displayed and the answer will be saved in Bundler's global config for future bun- dle gem use. -e, --edit[=EDITOR] Open the resulting GEM_NAME.gemspec in EDITOR, or the default editor if not specified. The default is $BUNDLER_EDITOR, $VISUAL, or $EDITOR. SEE ALSO o bundle-config(1) October 2015 BUNDLE-GEM(1) bundler-1.11.2/lib/bundler/man/bundle-gem0000644000004100000410000000605312652443364020212 0ustar www-datawww-data.\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . .TH "BUNDLE\-GEM" "1" "October 2015" "" "" . .SH "NAME" \fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem . .SH "SYNOPSIS" \fBbundle gem\fR \fIGEM_NAME\fR \fIOPTIONS\fR . .SH "DESCRIPTION" Generates a directory named \fBGEM_NAME\fR with a \fBRakefile\fR, \fBGEM_NAME\.gemspec\fR, and other supporting files and directories that can be used to develop a rubygem with that name\. . .P Run \fBrake \-T\fR in the resulting project for a list of Rake tasks that can used to test and publish the gem to rubygems\.org\. . .P The generated project skeleton can be customized with OPTIONS, as explained below\. Note that these options can also be specified via Bundler\'s global configuration file using the following names: . .IP "\(bu" 4 \fBgem\.coc\fR . .IP "\(bu" 4 \fBgem\.mit\fR . .IP "\(bu" 4 \fBgem\.test\fR . .IP "" 0 . .SH "OPTIONS" . .TP \fB\-b\fR or \fB\-\-bin\fR Specify that Bundler should create a binary (as \fBexe/GEM_NAME\fR) in the generated rubygem project\. This binary will also be added to the \fBGEM_NAME\.gemspec\fR manifest\. This behavior is disabled by default\. . .TP \fB\-\-no\-bin\fR Do not create a binary (overrides \fB\-\-bin\fR specified in the global config)\. . .TP \fB\-\-coc\fR Add a \fBCODE_OF_CONDUCT\.md\fR file to the root of the generated project\. If this option is unspecified, an interactive prompt will be displayed and the answer will be saved in Bundler\'s global config for future \fBbundle gem\fR use\. . .TP \fB\-\-no\-coc\fR Do not create a \fBCODE_OF_CONDUCT\.md\fR (overrides \fB\-\-coc\fR specified in the global config)\. . .TP \fB\-\-ext\fR Add boilerplate for C extension code to the generated project\. This behavior is disabled by default\. . .TP \fB\-\-no\-ext\fR Do not add C extension code (overrides \fB\-\-ext\fR specified in the global config)\. . .TP \fB\-\-mit\fR Add an MIT license to a \fBLICENSE\.txt\fR file in the root of the generated project\. Your name from the global git config is used for the copyright statement\. If this option is unspecified, an interactive prompt will be displayed and the answer will be saved in Bundler\'s global config for future \fBbundle gem\fR use\. . .TP \fB\-\-no\-mit\fR Do not create a \fBLICENSE\.txt\fR (overrides \fB\-\-mit\fR specified in the global config)\. . .TP \fB\-t\fR, \fB\-\-test=minitest\fR, \fB\-\-test=rspec\fR Specify the test framework that Bundler should use when generating the project\. Acceptable values are \fBminitest\fR and \fBrspec\fR\. The \fBGEM_NAME\.gemspec\fR will be configured and a skeleton test/spec directory will be created based on this option\. If this option is unspecified, an interactive prompt will be displayed and the answer will be saved in Bundler\'s global config for future \fBbundle gem\fR use\. . .TP \fB\-e\fR, \fB\-\-edit[=EDITOR]\fR Open the resulting GEM_NAME\.gemspec in EDITOR, or the default editor if not specified\. The default is \fB$BUNDLER_EDITOR\fR, \fB$VISUAL\fR, or \fB$EDITOR\fR\. . .SH "SEE ALSO" . .IP "\(bu" 4 bundle\-config(1) . .IP "" 0 bundler-1.11.2/lib/bundler/man/gemfile.5.txt0000644000004100000410000004612112652443364020564 0ustar www-datawww-dataGEMFILE(5) GEMFILE(5) NAME Gemfile - A format for describing gem dependencies for Ruby programs SYNOPSIS A Gemfile describes the gem dependencies required to execute associated Ruby code. Place the Gemfile in the root of the directory containing the associ- ated code. For instance, in a Rails application, place the Gemfile in the same directory as the Rakefile. SYNTAX A Gemfile is evaluated as Ruby code, in a context which makes available a number of methods used to describe the gem requirements. GLOBAL SOURCES (#source) At the top of the Gemfile, add a line for the Rubygems source that con- tains the gems listed in the Gemfile. source "https://rubygems.org" It is possible, but not recommended as of Bundler 1.7, to add multiple global source lines. Each of these sources MUST be a valid Rubygems repository. Sources are checked for gems following the heuristics described in SOURCE PRIORITY. If a gem is found in more than one global source, Bundler will print a warning after installing the gem indicating which source was used, and listing the other sources where the gem is avail- able. A specific source can be selected for gems that need to use a non-standard repository, suppressing this warning, by using the :source option or a source block. CREDENTIALS (#credentials) Some gem sources require a username and password. Use bundle config to set the username and password for any sources that need it. The command must be run once on each computer that will install the Gemfile, but this keeps the credentials from being stored in plain text in version control. bundle config gems.example.com user:password For some sources, like a company Gemfury account, it may be easier to simply include the credentials in the Gemfile as part of the source URL. source "https://user:password@gems.example.com" Credentials in the source URL will take precedence over credentials set using config. RUBY (#ruby) If your application requires a specific Ruby version or engine, specify your requirements using the ruby method, with the following arguments. All parameters are OPTIONAL unless otherwise specified. VERSION (required) The version of Ruby that your application requires. If your application requires an alternate Ruby engine, such as JRuby or Rubinius, this should be the Ruby version that the engine is compatible with. ruby "1.9.3" ENGINE (:engine) Each application may specify a Ruby engine. If an engine is specified, an engine version must also be specified. ENGINE VERSION (:engine_version) Each application may specify a Ruby engine version. If an engine ver- sion is specified, an engine must also be specified. If the engine is "ruby" the engine version specified must match the Ruby version. ruby "1.8.7", :engine => "jruby", :engine_version => "1.6.7" PATCHLEVEL (:patchlevel) Each application may specify a Ruby patchlevel. ruby "2.0.0", :patchlevel => "247" GEMS (#gem) Specify gem requirements using the gem method, with the following argu- ments. All parameters are OPTIONAL unless otherwise specified. NAME (required) For each gem requirement, list a single gem line. gem "nokogiri" VERSION Each gem MAY have one or more version specifiers. gem "nokogiri", ">= 1.4.2" gem "RedCloth", ">= 4.1.0", "< 4.2.0" REQUIRE AS (:require) Each gem MAY specify files that should be used when autorequiring via Bundler.require. You may pass an array with multiple files or true if file you want required has same name as gem or false to prevent any file from being autorequired. gem "redis", :require => ["redis/connection/hiredis", "redis"] gem "webmock", :require => false gem "debugger", :require => true The argument defaults to the name of the gem. For example, these are identical: gem "nokogiri" gem "nokogiri", :require => "nokogiri" gem "nokogiri", :require => true GROUPS (:group or :groups) Each gem MAY specify membership in one or more groups. Any gem that does not specify membership in any group is placed in the default group. gem "rspec", :group => :test gem "wirble", :groups => [:development, :test] The Bundler runtime allows its two main methods, Bundler.setup and Bundler.require, to limit their impact to particular groups. # setup adds gems to Ruby's load path Bundler.setup # defaults to all groups require "bundler/setup" # same as Bundler.setup Bundler.setup(:default) # only set up the _default_ group Bundler.setup(:test) # only set up the _test_ group (but `not` _default_) Bundler.setup(:default, :test) # set up the _default_ and _test_ groups, but no others # require requires all of the gems in the specified groups Bundler.require # defaults to just the _default_ group Bundler.require(:default) # identical Bundler.require(:default, :test) # requires the _default_ and _test_ groups Bundler.require(:test) # requires just the _test_ group The Bundler CLI allows you to specify a list of groups whose gems bun- dle install should not install with the --without option. To specify multiple groups to ignore, specify a list of groups separated by spa- ces. bundle install --without test bundle install --without development test After running bundle install --without test, bundler will remember that you excluded the test group in the last installation. The next time you run bundle install, without any --without option, bundler will recall it. Also, calling Bundler.setup with no parameters, or calling require "bundler/setup" will setup all groups except for the ones you excluded via --without (since they are obviously not available). Note that on bundle install, bundler downloads and evaluates all gems, in order to create a single canonical list of all of the required gems and their dependencies. This means that you cannot list different ver- sions of the same gems in different groups. For more details, see Understanding Bundler http://bundler.io/rationale.html. PLATFORMS (:platforms) If a gem should only be used in a particular platform or set of plat- forms, you can specify them. Platforms are essentially identical to groups, except that you do not need to use the --without install-time flag to exclude groups of gems for other platforms. There are a number of Gemfile platforms: ruby C Ruby (MRI) or Rubinius, but NOT Windows ruby_18 ruby AND version 1.8 ruby_19 ruby AND version 1.9 ruby_20 ruby AND version 2.0 ruby_21 ruby AND version 2.1 ruby_22 ruby AND version 2.2 ruby_23 ruby AND version 2.3 mri Same as ruby, but not Rubinius mri_18 mri AND version 1.8 mri_19 mri AND version 1.9 mri_20 mri AND version 2.0 mri_21 mri AND version 2.1 mri_22 mri AND version 2.2 mri_23 mri AND version 2.3 rbx Same as ruby, but only Rubinius (not MRI) jruby JRuby mswin Windows mingw Windows 32 bit 'mingw32' platform (aka RubyInstaller) mingw_18 mingw AND version 1.8 mingw_19 mingw AND version 1.9 mingw_20 mingw AND version 2.0 mingw_21 mingw AND version 2.1 mingw_22 mingw AND version 2.2 mingw_23 mingw AND version 2.3 x64_mingw Windows 64 bit 'mingw32' platform (aka RubyInstaller x64) x64_mingw_20 x64_mingw AND version 2.0 x64_mingw_21 x64_mingw AND version 2.1 x64_mingw_22 x64_mingw AND version 2.2 x64_mingw_23 x64_mingw AND version 2.3 As with groups, you can specify one or more platforms: gem "weakling", :platforms => :jruby gem "ruby-debug", :platforms => :mri_18 gem "nokogiri", :platforms => [:mri_18, :jruby] All operations involving groups (bundle install, Bundler.setup, Bundler.require) behave exactly the same as if any groups not matching the current platform were explicitly excluded. SOURCE (:source) You can select an alternate Rubygems repository for a gem using the ':source' option. gem "some_internal_gem", :source => "https://gems.example.com" This forces the gem to be loaded from this source and ignores any global sources declared at the top level of the file. If the gem does not exist in this source, it will not be installed. Bundler will search for child dependencies of this gem by first looking in the source selected for the parent, but if they are not found there, it will fall back on global sources using the ordering described in SOURCE PRIORITY. Selecting a specific source repository this way also suppresses the ambiguous gem warning described above in GLOBAL SOURCES (#source). GIT (:git) If necessary, you can specify that a gem is located at a particular git repository using the :git parameter. The repository can be accessed via several protocols: HTTP(S) gem "rails", :git => "https://github.com/rails/rails.git" SSH gem "rails", :git => "git@github.com:rails/rails.git" git gem "rails", :git => "git://github.com/rails/rails.git" If using SSH, the user that you use to run bundle install MUST have the appropriate keys available in their $HOME/.ssh. NOTE: http:// and git:// URLs should be avoided if at all possible. These protocols are unauthenticated, so a man-in-the-middle attacker can deliver malicious code and compromise your system. HTTPS and SSH are strongly preferred. The group, platforms, and require options are available and behave exactly the same as they would for a normal gem. A git repository SHOULD have at least one file, at the root of the directory containing the gem, with the extension .gemspec. This file MUST contain a valid gem specification, as expected by the gem build command. If a git repository does not have a .gemspec, bundler will attempt to create one, but it will not contain any dependencies, executables, or C extension compilation instructions. As a result, it may fail to prop- erly integrate into your application. If a git repository does have a .gemspec for the gem you attached it to, a version specifier, if provided, means that the git repository is only valid if the .gemspec specifies a version matching the version specifier. If not, bundler will print a warning. gem "rails", "2.3.8", :git => "https://github.com/rails/rails.git" # bundle install will fail, because the .gemspec in the rails # repository's master branch specifies version 3.0.0 If a git repository does not have a .gemspec for the gem you attached it to, a version specifier MUST be provided. Bundler will use this ver- sion in the simple .gemspec it creates. Git repositories support a number of additional options. branch, tag, and ref You MUST only specify at most one of these options. The default is :branch => "master" submodules Specify :submodules => true to cause bundler to expand any sub- modules included in the git repository If a git repository contains multiple .gemspecs, each .gemspec repre- sents a gem located at the same place in the file system as the .gem- spec. |~rails [git root] | |-rails.gemspec [rails gem located here] |~actionpack | |-actionpack.gemspec [actionpack gem located here] |~activesupport | |-activesupport.gemspec [activesupport gem located here] |... To install a gem located in a git repository, bundler changes to the directory containing the gemspec, runs gem build name.gemspec and then installs the resulting gem. The gem build command, which comes standard with Rubygems, evaluates the .gemspec in the context of the directory in which it is located. GIT SOURCE (:git_source) A custom git source can be defined via the git_source method. Provide the source's name as an argument, and a block which receives a single argument and interpolates it into a string to return the full repo address: git_source(:stash){ |repo_name| "https://stash.corp.acme.pl/#{repo_name}.git" } gem 'rails', :stash => 'forks/rails' In addition, if you wish to choose a specific branch: gem "rails", :stash => "forks/rails", :branch => "branch_name" GITHUB (:github) NOTE: This shorthand should be avoided until Bundler 2.0, since it cur- rently expands to an insecure git:// URL. This allows a man-in-the-mid- dle attacker to compromise your system. If the git repository you want to use is hosted on GitHub and is pub- lic, you can use the :github shorthand to specify just the github user- name and repository name (without the trailing ".git"), separated by a slash. If both the username and repository name are the same, you can omit one. gem "rails", :github => "rails/rails" gem "rails", :github => "rails" Are both equivalent to gem "rails", :git => "git://github.com/rails/rails.git" Since the github method is a specialization of git_source, it accepts a :branch named argument. GIST (:gist) If the git repository you want to use is hosted as a Github Gist and is public, you can use the :gist shorthand to specify just the gist iden- tifier (without the trailing ".git"). gem "the_hatch", :gist => "4815162342" Is equivalent to: gem "the_hatch", :git => "https://gist.github.com/4815162342.git" Since the gist method is a specialization of git_source, it accepts a :branch named argument. BITBUCKET (:bitbucket) If the git repository you want to use is hosted on Bitbucket and is public, you can use the :bitbucket shorthand to specify just the bit- bucket username and repository name (without the trailing ".git"), sep- arated by a slash. If both the username and repository name are the same, you can omit one. gem "rails", :bitbucket => "rails/rails" gem "rails", :bitbucket => "rails" Are both equivalent to gem "rails", :git => "https://rails@bitbucket.org/rails/rails.git" Since the bitbucket method is a specialization of git_source, it accepts a :branch named argument. PATH (:path) You can specify that a gem is located in a particular location on the file system. Relative paths are resolved relative to the directory con- taining the Gemfile. Similar to the semantics of the :git option, the :path option requires that the directory in question either contains a .gemspec for the gem, or that you specify an explicit version that bundler should use. Unlike :git, bundler does not compile C extensions for gems specified as paths. gem "rails", :path => "vendor/rails" If you would like to use multiple local gems directly from the filesys- tem, you can set a global path option to the path containing the gem's files. This will automatically load gemspec files from subdirectories. path 'components' do gem 'admin_ui' gem 'public_ui' end BLOCK FORM OF SOURCE, GIT, PATH, GROUP and PLATFORMS The :source, :git, :path, :group, and :platforms options may be applied to a group of gems by using block form. source "https://gems.example.com" do gem "some_internal_gem" gem "another_internal_gem" end git "https://github.com/rails/rails.git" do gem "activesupport" gem "actionpack" end platforms :ruby do gem "ruby-debug" gem "sqlite3" end group :development, :optional => true do gem "wirble" gem "faker" end In the case of the group block form the :optional option can be given to prevent a group from being installed unless listed in the --with option given to the bundle install command. In the case of the git block form, the :ref, :branch, :tag, and :sub- modules options may be passed to the git method, and all gems in the block will inherit those options. INSTALL_IF (#install_if) The install_if method allows gems to be installed based on a proc or lambda. This is especially useful for optional gems that can only be used if certain software is installed or some other conditions are met. install_if -> { RUBY_PLATFORM =~ /darwin/ } do gem "pasteboard" end GEMSPEC (#gemspec) If you wish to use Bundler to help install dependencies for a gem while it is being developed, use the gemspec method to pull in the dependen- cies listed in the .gemspec file. The gemspec method adds any runtime dependencies as gem requirements in the default group. It also adds development dependencies as gem requirements in the development group. Finally, it adds a gem require- ment on your project (:path => '.'). In conjunction with Bundler.setup, this allows you to require project files in your test code as you would if the project were installed as a gem; you need not manipulate the load path manually or require project files via relative paths. The gemspec method supports optional :path, :glob, :name, and :develop- ment_group options, which control where bundler looks for the .gemspec, the glob it uses to look for the gemspec (defaults to: "{,,/*}.gem- spec"), what named .gemspec it uses (if more than one is present), and which group development dependencies are included in. SOURCE PRIORITY When attempting to locate a gem to satisfy a gem requirement, bundler uses the following priority order: 1. The source explicitly attached to the gem (using :source, :path, or :git) 2. For implicit gems (dependencies of explicit gems), any source, git, or path repository declared on the parent. This results in bundler prioritizing the ActiveSupport gem from the Rails git repository over ones from rubygems.org 3. The sources specified via global source lines, searching each source in your Gemfile from last added to first added. September 2015 GEMFILE(5) bundler-1.11.2/lib/bundler/man/bundle-exec0000644000004100000410000001331612652443364020366 0ustar www-datawww-data.\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . .TH "BUNDLE\-EXEC" "1" "September 2015" "" "" . .SH "NAME" \fBbundle\-exec\fR \- Execute a command in the context of the bundle . .SH "SYNOPSIS" \fBbundle exec\fR [\-\-keep\-file\-descriptors] \fIcommand\fR . .SH "DESCRIPTION" This command executes the command, making all gems specified in the \fBGemfile(5)\fR available to \fBrequire\fR in Ruby programs\. . .P Essentially, if you would normally have run something like \fBrspec spec/my_spec\.rb\fR, and you want to use the gems specified in the \fBGemfile(5)\fR and installed via bundle install(1) \fIbundle\-install\.1\.html\fR, you should run \fBbundle exec rspec spec/my_spec\.rb\fR\. . .P Note that \fBbundle exec\fR does not require that an executable is available on your shell\'s \fB$PATH\fR\. . .SH "OPTIONS" . .TP \fB\-\-keep\-file\-descriptors\fR Exec in Ruby 2\.0 began discarding non\-standard file descriptors\. When this flag is passed, exec will revert to the 1\.9 behaviour of passing all file descriptors to the new process\. . .SH "BUNDLE INSTALL \-\-BINSTUBS" If you use the \fB\-\-binstubs\fR flag in bundle install(1) \fIbundle\-install\.1\.html\fR, Bundler will automatically create a directory (which defaults to \fBapp_root/bin\fR) containing all of the executables available from gems in the bundle\. . .P After using \fB\-\-binstubs\fR, \fBbin/rspec spec/my_spec\.rb\fR is identical to \fBbundle exec rspec spec/my_spec\.rb\fR\. . .SH "ENVIRONMENT MODIFICATIONS" \fBbundle exec\fR makes a number of changes to the shell environment, then executes the command you specify in full\. . .IP "\(bu" 4 make sure that it\'s still possible to shell out to \fBbundle\fR from inside a command invoked by \fBbundle exec\fR (using \fB$BUNDLE_BIN_PATH\fR) . .IP "\(bu" 4 put the directory containing executables (like \fBrails\fR, \fBrspec\fR, \fBrackup\fR) for your bundle on \fB$PATH\fR . .IP "\(bu" 4 make sure that if bundler is invoked in the subshell, it uses the same \fBGemfile\fR (by setting \fBBUNDLE_GEMFILE\fR) . .IP "\(bu" 4 add \fB\-rbundler/setup\fR to \fB$RUBYOPT\fR, which makes sure that Ruby programs invoked in the subshell can see the gems in the bundle . .IP "" 0 . .P It also modifies Rubygems: . .IP "\(bu" 4 disallow loading additional gems not in the bundle . .IP "\(bu" 4 modify the \fBgem\fR method to be a no\-op if a gem matching the requirements is in the bundle, and to raise a \fBGem::LoadError\fR if it\'s not . .IP "\(bu" 4 Define \fBGem\.refresh\fR to be a no\-op, since the source index is always frozen when using bundler, and to prevent gems from the system leaking into the environment . .IP "\(bu" 4 Override \fBGem\.bin_path\fR to use the gems in the bundle, making system executables work . .IP "\(bu" 4 Add all gems in the bundle into Gem\.loaded_specs . .IP "" 0 . .SS "Shelling out" Any Ruby code that opens a subshell (like \fBsystem\fR, backticks, or \fB%x{}\fR) will automatically use the current Bundler environment\. If you need to shell out to a Ruby command that is not part of your current bundle, use the \fBwith_clean_env\fR method with a block\. Any subshells created inside the block will be given the environment present before Bundler was activated\. For example, Homebrew commands run Ruby, but don\'t work inside a bundle: . .IP "" 4 . .nf Bundler\.with_clean_env do `brew install wget` end . .fi . .IP "" 0 . .P Using \fBwith_clean_env\fR is also necessary if you are shelling out to a different bundle\. Any Bundler commands run in a subshell will inherit the current Gemfile, so commands that need to run in the context of a different bundle also need to use \fBwith_clean_env\fR\. . .IP "" 4 . .nf Bundler\.with_clean_env do Dir\.chdir "/other/bundler/project" do `bundle exec \./script` end end . .fi . .IP "" 0 . .P Bundler provides convenience helpers that wrap \fBsystem\fR and \fBexec\fR, and they can be used like this: . .IP "" 4 . .nf Bundler\.clean_system(\'brew install wget\') Bundler\.clean_exec(\'brew install wget\') . .fi . .IP "" 0 . .SH "RUBYGEMS PLUGINS" At present, the Rubygems plugin system requires all files named \fBrubygems_plugin\.rb\fR on the load path of \fIany\fR installed gem when any Ruby code requires \fBrubygems\.rb\fR\. This includes executables installed into the system, like \fBrails\fR, \fBrackup\fR, and \fBrspec\fR\. . .P Since Rubygems plugins can contain arbitrary Ruby code, they commonly end up activating themselves or their dependencies\. . .P For instance, the \fBgemcutter 0\.5\fR gem depended on \fBjson_pure\fR\. If you had that version of gemcutter installed (even if you \fIalso\fR had a newer version without this problem), Rubygems would activate \fBgemcutter 0\.5\fR and \fBjson_pure \fR\. . .P If your Gemfile(5) also contained \fBjson_pure\fR (or a gem with a dependency on \fBjson_pure\fR), the latest version on your system might conflict with the version in your Gemfile(5), or the snapshot version in your \fBGemfile\.lock\fR\. . .P If this happens, bundler will say: . .IP "" 4 . .nf You have already activated json_pure 1\.4\.6 but your Gemfile requires json_pure 1\.4\.3\. Consider using bundle exec\. . .fi . .IP "" 0 . .P In this situation, you almost certainly want to remove the underlying gem with the problematic gem plugin\. In general, the authors of these plugins (in this case, the \fBgemcutter\fR gem) have released newer versions that are more careful in their plugins\. . .P You can find a list of all the gems containing gem plugins by running . .IP "" 4 . .nf ruby \-rubygems \-e "puts Gem\.find_files(\'rubygems_plugin\.rb\')" . .fi . .IP "" 0 . .P At the very least, you should remove all but the newest version of each gem plugin, and also remove all gem plugins that you aren\'t using (\fBgem uninstall gem_name\fR)\. bundler-1.11.2/lib/bundler/man/bundle-platform0000644000004100000410000000250212652443364021261 0ustar www-datawww-data.\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . .TH "BUNDLE\-PLATFORM" "1" "September 2015" "" "" . .SH "NAME" \fBbundle\-platform\fR \- Displays platform compatibility information . .SH "SYNOPSIS" \fBbundle platform\fR [\-\-ruby] . .SH "DESCRIPTION" \fBplatform\fR will display information from your Gemfile, Gemfile\.lock, and Ruby VM about your platform\. . .P For instance, using this Gemfile(5): . .IP "" 4 . .nf source "https://rubygems\.org" ruby "1\.9\.3" gem "rack" . .fi . .IP "" 0 . .P If you run \fBbundle platform\fR on Ruby 1\.9\.3, it will display the following output: . .IP "" 4 . .nf Your platform is: x86_64\-linux Your app has gems that work on these platforms: * ruby Your Gemfile specifies a Ruby version requirement: * ruby 1\.9\.3 Your current platform satisfies the Ruby version requirement\. . .fi . .IP "" 0 . .P \fBplatform\fR will list all the platforms in your \fBGemfile\.lock\fR as well as the \fBruby\fR directive if applicable from your Gemfile(5)\. It will also let you know if the \fBruby\fR directive requirement has been met\. If \fBruby\fR directive doesn\'t match the running Ruby VM, it will tell you what part does not\. . .SH "OPTIONS" . .TP \fB\-\-ruby\fR It will just display the ruby directive information, so you don\'t have to parse it from the Gemfile(5)\. bundler-1.11.2/lib/bundler/man/bundle0000644000004100000410000000547212652443364017450 0ustar www-datawww-data.\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . .TH "BUNDLE" "1" "October 2015" "" "" . .SH "NAME" \fBbundle\fR \- Ruby Dependency Management . .SH "SYNOPSIS" \fBbundle\fR COMMAND [\-\-no\-color] [\-\-verbose] [ARGS] . .SH "DESCRIPTION" Bundler manages an \fBapplication\'s dependencies\fR through its entire life across many machines systematically and repeatably\. . .P See the bundler website \fIhttp://bundler\.io\fR for information on getting started, and Gemfile(5) for more information on the \fBGemfile\fR format\. . .SH "OPTIONS" . .TP \fB\-\-no\-color\fR Prints all output without color . .TP \fB\-\-verbose\fR Prints out additional logging information . .SH "BUNDLE COMMANDS" We divide \fBbundle\fR subcommands into primary commands and utilities\. . .SH "PRIMARY COMMANDS" . .TP bundle install(1) \fIbundle\-install\.1\.html\fR Install the gems specified by the \fBGemfile\fR or \fBGemfile\.lock\fR . .TP bundle update(1) \fIbundle\-update\.1\.html\fR Update dependencies to their latest versions . .TP bundle package(1) \fIbundle\-package\.1\.html\fR Package the \.gem files required by your application into the \fBvendor/cache\fR directory . .TP bundle exec(1) \fIbundle\-exec\.1\.html\fR Execute a script in the context of the current bundle . .TP bundle config(1) \fIbundle\-config\.1\.html\fR Specify and read configuration options for bundler . .TP \fBbundle help(1)\fR Displays detailed help for each subcommand . .SH "UTILITIES" . .TP \fBbundle check(1)\fR Determine whether the requirements for your application are installed and available to bundler . .TP \fBbundle list(1)\fR Show all of the gems in the current bundle . .TP \fBbundle show(1)\fR Show the source location of a particular gem in the bundle . .TP \fBbundle outdated(1)\fR Show all of the outdated gems in the current bundle . .TP \fBbundle console(1)\fR Start an IRB session in the context of the current bundle . .TP \fBbundle open(1)\fR Open an installed gem in the editor . .TP \fBbundle lock(1)\fR Generate a lockfile for your dependencies . .TP \fBbundle viz(1)\fR Generate a visual representation of your dependencies . .TP \fBbundle init(1)\fR Generate a simple \fBGemfile\fR, placed in the current directory . .TP bundle gem(1) \fIbundle\-gem\.1\.html\fR Create a simple gem, suitable for development with bundler . .TP bundle platform(1) \fIbundle\-platform\.1\.html\fR Displays platform compatibility information . .TP \fBbundle clean(1)\fR Cleans up unused gems in your bundler directory . .SH "PLUGINS" When running a command that isn\'t listed in PRIMARY COMMANDS or UTILITIES, Bundler will try to find an executable on your path named \fBbundler\-\fR and execute it, passing down any extra arguments to it\. . .SH "OBSOLETE" These commands are obsolete and should no longer be used . .IP "\(bu" 4 \fBbundle cache(1)\fR . .IP "" 0 bundler-1.11.2/lib/bundler/man/bundle-install0000644000004100000410000004203212652443364021105 0ustar www-datawww-data.\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . .TH "BUNDLE\-INSTALL" "1" "December 2015" "" "" . .SH "NAME" \fBbundle\-install\fR \- Install the dependencies specified in your Gemfile . .SH "SYNOPSIS" \fBbundle install\fR [\-\-binstubs[=DIRECTORY]] . .IP "" 4 . .nf [\-\-clean] [\-\-full\-index] [\-\-gemfile=GEMFILE] [\-\-jobs=NUMBER] [\-\-local] [\-\-deployment] [\-\-force] [\-\-no\-cache] [\-\-no\-prune] [\-\-path PATH] [\-\-system] [\-\-quiet] [\-\-retry=NUMBER] [\-\-shebang] [\-\-standalone[=GROUP[ GROUP\.\.\.]]] [\-\-trust\-policy=POLICY] [\-\-without=GROUP[ GROUP\.\.\.]] [\-\-with=GROUP[ GROUP\.\.\.]] . .fi . .IP "" 0 . .SH "DESCRIPTION" Install the gems specified in your Gemfile(5)\. If this is the first time you run bundle install (and a \fBGemfile\.lock\fR does not exist), Bundler will fetch all remote sources, resolve dependencies and install all needed gems\. . .P If a \fBGemfile\.lock\fR does exist, and you have not updated your Gemfile(5), Bundler will fetch all remote sources, but use the dependencies specified in the \fBGemfile\.lock\fR instead of resolving dependencies\. . .P If a \fBGemfile\.lock\fR does exist, and you have updated your Gemfile(5), Bundler will use the dependencies in the \fBGemfile\.lock\fR for all gems that you did not update, but will re\-resolve the dependencies of gems that you did update\. You can find more information about this update process below under \fICONSERVATIVE UPDATING\fR\. . .SH "OPTIONS" . .TP \fB\-\-binstubs[=]\fR Creates a directory (defaults to \fB~/bin\fR) and place any executables from the gem there\. These executables run in Bundler\'s context\. If used, you might add this directory to your environment\'s \fBPATH\fR variable\. For instance, if the \fBrails\fR gem comes with a \fBrails\fR executable, this flag will create a \fBbin/rails\fR executable that ensures that all referred dependencies will be resolved using the bundled gems\. . .TP \fB\-\-clean\fR On finishing the installation Bundler is going to remove any gems not present in the current Gemfile(5)\. Don\'t worry, gems currently in use will not be removed\. . .TP \fB\-\-full\-index\fR Bundler will not call Rubygems\' API endpoint (default) but download and cache a (currently big) index file of all gems\. Performance can be improved for large bundles that seldomly change by enabling this option\. . .TP \fB\-\-gemfile=\fR The location of the Gemfile(5) which Bundler should use\. This defaults to a Gemfile(5) in the current working directory\. In general, Bundler will assume that the location of the Gemfile(5) is also the project\'s root and will try to find \fBGemfile\.lock\fR and \fBvendor/cache\fR relative to this location\. . .TP \fB\-\-jobs=[]\fR The maximum number of parallel download and install jobs\. The default is \fB1\fR\. . .TP \fB\-\-local\fR Do not attempt to connect to \fBrubygems\.org\fR\. Instead, Bundler will use the gems already present in Rubygems\' cache or in \fBvendor/cache\fR\. Note that if a appropriate platform\-specific gem exists on \fBrubygems\.org\fR it will not be found\. . .TP \fB\-\-deployment\fR In \fIdeployment mode\fR, Bundler will \'roll\-out\' the bundle for production or CI use\. Please check carefully if you want to have this option enabled in your development environment\. . .TP \fB\-\-force\fR Force download every gem, even if the required versions are already available locally\. . .TP \fB\-\-system\fR Installs the gems specified in the bundle to the system\'s Rubygems location\. This overrides any previous \fIremembered\fR use of \fB\-\-path\fR\. . .TP \fB\-\-no\-cache\fR Do not update the cache in \fBvendor/cache\fR with the newly bundled gems\. This does not remove any gems in the cache but keeps the newly bundled gems from being cached during the install\. . .TP \fB\-\-no\-prune\fR Don\'t remove stale gems from the cache when the installation finishes\. . .TP \fB\-\-path=\fR The location to install the specified gems to\. This defaults to Rubygems\' setting\. Bundler shares this location with Rubygems, \fBgem install \.\.\.\fR will have gem installed there, too\. Therefore, gems installed without a \fB\-\-path \.\.\.\fR setting will show up by calling \fBgem list\fR\. Accodingly, gems installed to other locations will not get listed\. This setting is a \fIremembered option\fR\. . .TP \fB\-\-quiet\fR Do not print progress information to the standard output\. Instead, Bundler will exit using a status code (\fB$?\fR)\. . .TP \fB\-\-retry=[]\fR Retry failed network or git requests for \fInumber\fR times\. . .TP \fB\-\-shebang=\fR Uses the specified ruby executable (usually \fBruby\fR) to execute the scripts created with \fB\-\-binstubs\fR\. In addition, if you use \fB\-\-binstubs\fR together with \fB\-\-shebang jruby\fR these executables will be changed to execute \fBjruby\fR instead\. . .TP \fB\-\-standalone[=]\fR Makes a bundle that can work without depending on Rubygems or Bundler at runtime\. A space separated list of groups to install has to be specified\. Bundler creates a directory named \fBbundle\fR and installs the bundle there\. It also generates a \fBbundle/bundler/setup\.rb\fR file to replace Bundler\'s own setup in the manner required\. Using this option implicitly sets \fBpath\fR, which is a \fIremembered option\fR\. . .TP \fB\-\-trust\-policy=[]\fR Apply the Rubygems security policy \fIpolicy\fR, where policy is one of \fBHighSecurity\fR, \fBMediumSecurity\fR, \fBLowSecurity\fR, \fBAlmostNoSecurity\fR, or \fBNoSecurity\fR\. For more details, please see the Rubygems signing documentation linked below in \fISEE ALSO\fR\. . .TP \fB\-\-without=\fR A space\-separated list of groups referencing gems to skip during installation\. If a group is given that is in the remembered list of groups given to \-\-with, it is removed from that list\. This is a \fIremembered option\fR\. . .TP \fB\-\-with=\fR A space\-separated list of groups referencing gems to install\. If an optional group is given it is installed\. If a group is given that is in the remembered list of groups given to \-\-without, it is removed from that list\. This is a \fIremembered option\fR\. . .SH "DEPLOYMENT MODE" Bundler\'s defaults are optimized for development\. To switch to defaults optimized for deployment and for CI, use the \fB\-\-deployment\fR flag\. Do not activate deployment mode on development machines, as it will cause an error when the Gemfile(5) is modified\. . .IP "1." 4 A \fBGemfile\.lock\fR is required\. . .IP To ensure that the same versions of the gems you developed with and tested with are also used in deployments, a \fBGemfile\.lock\fR is required\. . .IP This is mainly to ensure that you remember to check your \fBGemfile\.lock\fR into version control\. . .IP "2." 4 The \fBGemfile\.lock\fR must be up to date . .IP In development, you can modify your Gemfile(5) and re\-run \fBbundle install\fR to \fIconservatively update\fR your \fBGemfile\.lock\fR snapshot\. . .IP In deployment, your \fBGemfile\.lock\fR should be up\-to\-date with changes made in your Gemfile(5)\. . .IP "3." 4 Gems are installed to \fBvendor/bundle\fR not your default system location . .IP In development, it\'s convenient to share the gems used in your application with other applications and other scripts run on the system\. . .IP In deployment, isolation is a more important default\. In addition, the user deploying the application may not have permission to install gems to the system, or the web server may not have permission to read them\. . .IP As a result, \fBbundle install \-\-deployment\fR installs gems to the \fBvendor/bundle\fR directory in the application\. This may be overridden using the \fB\-\-path\fR option\. . .IP "" 0 . .SH "SUDO USAGE" By default, Bundler installs gems to the same location as \fBgem install\fR\. . .P In some cases, that location may not be writable by your Unix user\. In that case, Bundler will stage everything in a temporary directory, then ask you for your \fBsudo\fR password in order to copy the gems into their system location\. . .P From your perspective, this is identical to installing them gems directly into the system\. . .P You should never use \fBsudo bundle install\fR\. This is because several other steps in \fBbundle install\fR must be performed as the current user: . .IP "\(bu" 4 Updating your \fBGemfile\.lock\fR . .IP "\(bu" 4 Updating your \fBvendor/cache\fR, if necessary . .IP "\(bu" 4 Checking out private git repositories using your user\'s SSH keys . .IP "" 0 . .P Of these three, the first two could theoretically be performed by \fBchown\fRing the resulting files to \fB$SUDO_USER\fR\. The third, however, can only be performed by actually invoking the \fBgit\fR command as the current user\. Therefore, git gems are downloaded and installed into \fB~/\.bundle\fR rather than $GEM_HOME or $BUNDLE_PATH\. . .P As a result, you should run \fBbundle install\fR as the current user, and Bundler will ask for your password if it is needed to put the gems into their final location\. . .SH "INSTALLING GROUPS" By default, \fBbundle install\fR will install all gems in all groups in your Gemfile(5), except those declared for a different platform\. . .P However, you can explicitly tell Bundler to skip installing certain groups with the \fB\-\-without\fR option\. This option takes a space\-separated list of groups\. . .P While the \fB\-\-without\fR option will skip \fIinstalling\fR the gems in the specified groups, it will still \fIdownload\fR those gems and use them to resolve the dependencies of every gem in your Gemfile(5)\. . .P This is so that installing a different set of groups on another machine (such as a production server) will not change the gems and versions that you have already developed and tested against\. . .P \fBBundler offers a rock\-solid guarantee that the third\-party code you are running in development and testing is also the third\-party code you are running in production\. You can choose to exclude some of that code in different environments, but you will never be caught flat\-footed by different versions of third\-party code being used in different environments\.\fR . .P For a simple illustration, consider the following Gemfile(5): . .IP "" 4 . .nf source \'https://rubygems\.org\' gem \'sinatra\' group :production do gem \'rack\-perftools\-profiler\' end . .fi . .IP "" 0 . .P In this case, \fBsinatra\fR depends on any version of Rack (\fB>= 1\.0\fR), while \fBrack\-perftools\-profiler\fR depends on 1\.x (\fB~> 1\.0\fR)\. . .P When you run \fBbundle install \-\-without production\fR in development, we look at the dependencies of \fBrack\-perftools\-profiler\fR as well\. That way, you do not spend all your time developing against Rack 2\.0, using new APIs unavailable in Rack 1\.x, only to have Bundler switch to Rack 1\.2 when the \fBproduction\fR group \fIis\fR used\. . .P This should not cause any problems in practice, because we do not attempt to \fBinstall\fR the gems in the excluded groups, and only evaluate as part of the dependency resolution process\. . .P This also means that you cannot include different versions of the same gem in different groups, because doing so would result in different sets of dependencies used in development and production\. Because of the vagaries of the dependency resolution process, this usually affects more than just the gems you list in your Gemfile(5), and can (surprisingly) radically change the gems you are using\. . .SH "REMEMBERED OPTIONS" Some options (marked above in the \fIOPTIONS\fR section) are remembered between calls to \fBbundle install\fR, and by the Bundler runtime\. . .P For instance, if you run \fBbundle install \-\-without test\fR, a subsequent call to \fBbundle install\fR that does not include a \fB\-\-without\fR flag will remember your previous choice\. . .P In addition, a call to \fBBundler\.setup\fR will not attempt to make the gems in those groups available on the Ruby load path, as they were not installed\. . .P The settings that are remembered are: . .TP \fB\-\-deployment\fR At runtime, this remembered setting will also result in Bundler raising an exception if the \fBGemfile\.lock\fR is out of date\. . .TP \fB\-\-path\fR Subsequent calls to \fBbundle install\fR will install gems to the directory originally passed to \fB\-\-path\fR\. The Bundler runtime will look for gems in that location\. You can revert this option by running \fBbundle install \-\-system\fR\. . .TP \fB\-\-binstubs\fR Bundler will update the executables every subsequent call to \fBbundle install\fR\. . .TP \fB\-\-without\fR As described above, Bundler will skip the gems specified by \fB\-\-without\fR in subsequent calls to \fBbundle install\fR\. The Bundler runtime will also not try to make the gems in the skipped groups available\. . .SH "THE GEMFILE\.LOCK" When you run \fBbundle install\fR, Bundler will persist the full names and versions of all gems that you used (including dependencies of the gems specified in the Gemfile(5)) into a file called \fBGemfile\.lock\fR\. . .P Bundler uses this file in all subsequent calls to \fBbundle install\fR, which guarantees that you always use the same exact code, even as your application moves across machines\. . .P Because of the way dependency resolution works, even a seemingly small change (for instance, an update to a point\-release of a dependency of a gem in your Gemfile(5)) can result in radically different gems being needed to satisfy all dependencies\. . .P As a result, you \fBSHOULD\fR check your \fBGemfile\.lock\fR into version control\. If you do not, every machine that checks out your repository (including your production server) will resolve all dependencies again, which will result in different versions of third\-party code being used if \fBany\fR of the gems in the Gemfile(5) or any of their dependencies have been updated\. . .SH "CONSERVATIVE UPDATING" When you make a change to the Gemfile(5) and then run \fBbundle install\fR, Bundler will update only the gems that you modified\. . .P In other words, if a gem that you \fBdid not modify\fR worked before you called \fBbundle install\fR, it will continue to use the exact same versions of all dependencies as it used before the update\. . .P Let\'s take a look at an example\. Here\'s your original Gemfile(5): . .IP "" 4 . .nf source \'https://rubygems\.org\' gem \'actionpack\', \'2\.3\.8\' gem \'activemerchant\' . .fi . .IP "" 0 . .P In this case, both \fBactionpack\fR and \fBactivemerchant\fR depend on \fBactivesupport\fR\. The \fBactionpack\fR gem depends on \fBactivesupport 2\.3\.8\fR and \fBrack ~> 1\.1\.0\fR, while the \fBactivemerchant\fR gem depends on \fBactivesupport >= 2\.3\.2\fR, \fBbraintree >= 2\.0\.0\fR, and \fBbuilder >= 2\.0\.0\fR\. . .P When the dependencies are first resolved, Bundler will select \fBactivesupport 2\.3\.8\fR, which satisfies the requirements of both gems in your Gemfile(5)\. . .P Next, you modify your Gemfile(5) to: . .IP "" 4 . .nf source \'https://rubygems\.org\' gem \'actionpack\', \'3\.0\.0\.rc\' gem \'activemerchant\' . .fi . .IP "" 0 . .P The \fBactionpack 3\.0\.0\.rc\fR gem has a number of new dependencies, and updates the \fBactivesupport\fR dependency to \fB= 3\.0\.0\.rc\fR and the \fBrack\fR dependency to \fB~> 1\.2\.1\fR\. . .P When you run \fBbundle install\fR, Bundler notices that you changed the \fBactionpack\fR gem, but not the \fBactivemerchant\fR gem\. It evaluates the gems currently being used to satisfy its requirements: . .TP \fBactivesupport 2\.3\.8\fR also used to satisfy a dependency in \fBactivemerchant\fR, which is not being updated . .TP \fBrack ~> 1\.1\.0\fR not currently being used to satisfy another dependency . .P Because you did not explicitly ask to update \fBactivemerchant\fR, you would not expect it to suddenly stop working after updating \fBactionpack\fR\. However, satisfying the new \fBactivesupport 3\.0\.0\.rc\fR dependency of actionpack requires updating one of its dependencies\. . .P Even though \fBactivemerchant\fR declares a very loose dependency that theoretically matches \fBactivesupport 3\.0\.0\.rc\fR, Bundler treats gems in your Gemfile(5) that have not changed as an atomic unit together with their dependencies\. In this case, the \fBactivemerchant\fR dependency is treated as \fBactivemerchant 1\.7\.1 + activesupport 2\.3\.8\fR, so \fBbundle install\fR will report that it cannot update \fBactionpack\fR\. . .P To explicitly update \fBactionpack\fR, including its dependencies which other gems in the Gemfile(5) still depend on, run \fBbundle update actionpack\fR (see \fBbundle update(1)\fR)\. . .P \fBSummary\fR: In general, after making a change to the Gemfile(5) , you should first try to run \fBbundle install\fR, which will guarantee that no other gems in the Gemfile(5) are impacted by the change\. If that does not work, run bundle update(1) \fIbundle\-update\.1\.html\fR\. . .SH "SEE ALSO" . .IP "\(bu" 4 Gem install docs: http://guides\.rubygems\.org/rubygems\-basics/#installing\-gems . .IP "\(bu" 4 Rubygems signing docs: http://guides\.rubygems\.org/security/ . .IP "" 0 bundler-1.11.2/lib/bundler/man/bundle-update0000644000004100000410000001707312652443364020730 0ustar www-datawww-data.\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . .TH "BUNDLE\-UPDATE" "1" "September 2015" "" "" . .SH "NAME" \fBbundle\-update\fR \- Update your gems to the latest available versions . .SH "SYNOPSIS" \fBbundle update\fR \fI*gems\fR [\-\-group=NAME] [\-\-source=NAME] [\-\-local] . .SH "DESCRIPTION" Update the gems specified (all gems, if none are specified), ignoring the previously installed gems specified in the \fBGemfile\.lock\fR\. In general, you should use bundle install(1) \fIbundle\-install\.1\.html\fR to install the same exact gems and versions across machines\. . .P You would use \fBbundle update\fR to explicitly update the version of a gem\. . .SH "OPTIONS" . .TP \fB\-\-group=\fR Only update the gems in the specified group\. For instance, you can update all gems in the development group with \fBbundle update \-\-group development\fR\. You can also call \fBbundle update rails \-\-group test\fR to update the rails gem and all gems in the test group, for example\. . .TP \fB\-\-source=\fR The name of a \fB:git\fR or \fB:path\fR source used in the Gemfile(5)\. For instance, with a \fB:git\fR source of \fBhttp://github\.com/rails/rails\.git\fR, you would call \fBbundle update \-\-source rails\fR . .TP \fB\-\-local\fR Do not attempt to fetch gems remotely and use the gem cache instead\. . .SH "UPDATING ALL GEMS" If you run \fBbundle update\fR with no parameters, bundler will ignore any previously installed gems and resolve all dependencies again based on the latest versions of all gems available in the sources\. . .P Consider the following Gemfile(5): . .IP "" 4 . .nf source "https://rubygems\.org" gem "rails", "3\.0\.0\.rc" gem "nokogiri" . .fi . .IP "" 0 . .P When you run bundle install(1) \fIbundle\-install\.1\.html\fR the first time, bundler will resolve all of the dependencies, all the way down, and install what you need: . .IP "" 4 . .nf Fetching gem metadata from https://rubygems\.org/\.\.\.\.\.\.\.\.\. Resolving dependencies\.\.\. Installing builder 2\.1\.2 Installing abstract 1\.0\.0 Installing rack 1\.2\.8 Using bundler 1\.7\.6 Installing rake 10\.4\.0 Installing polyglot 0\.3\.5 Installing mime\-types 1\.25\.1 Installing i18n 0\.4\.2 Installing mini_portile 0\.6\.1 Installing tzinfo 0\.3\.42 Installing rack\-mount 0\.6\.14 Installing rack\-test 0\.5\.7 Installing treetop 1\.4\.15 Installing thor 0\.14\.6 Installing activesupport 3\.0\.0\.rc Installing erubis 2\.6\.6 Installing activemodel 3\.0\.0\.rc Installing arel 0\.4\.0 Installing mail 2\.2\.20 Installing activeresource 3\.0\.0\.rc Installing actionpack 3\.0\.0\.rc Installing activerecord 3\.0\.0\.rc Installing actionmailer 3\.0\.0\.rc Installing railties 3\.0\.0\.rc Installing rails 3\.0\.0\.rc Installing nokogiri 1\.6\.5 Bundle complete! 2 Gemfile dependencies, 26 gems total\. Use `bundle show [gemname]` to see where a bundled gem is installed\. . .fi . .IP "" 0 . .P As you can see, even though you have just two gems in the Gemfile(5), your application actually needs 26 different gems in order to run\. Bundler remembers the exact versions it installed in \fBGemfile\.lock\fR\. The next time you run bundle install(1) \fIbundle\-install\.1\.html\fR, bundler skips the dependency resolution and installs the same gems as it installed last time\. . .P After checking in the \fBGemfile\.lock\fR into version control and cloning it on another machine, running bundle install(1) \fIbundle\-install\.1\.html\fR will \fIstill\fR install the gems that you installed last time\. You don\'t need to worry that a new release of \fBerubis\fR or \fBmail\fR changes the gems you use\. . .P However, from time to time, you might want to update the gems you are using to the newest versions that still match the gems in your Gemfile(5)\. . .P To do this, run \fBbundle update\fR, which will ignore the \fBGemfile\.lock\fR, and resolve all the dependencies again\. Keep in mind that this process can result in a significantly different set of the 25 gems, based on the requirements of new gems that the gem authors released since the last time you ran \fBbundle update\fR\. . .SH "UPDATING A LIST OF GEMS" Sometimes, you want to update a single gem in the Gemfile(5), and leave the rest of the gems that you specified locked to the versions in the \fBGemfile\.lock\fR\. . .P For instance, in the scenario above, imagine that \fBnokogiri\fR releases version \fB1\.4\.4\fR, and you want to update it \fIwithout\fR updating Rails and all of its dependencies\. To do this, run \fBbundle update nokogiri\fR\. . .P Bundler will update \fBnokogiri\fR and any of its dependencies, but leave alone Rails and its dependencies\. . .SH "OVERLAPPING DEPENDENCIES" Sometimes, multiple gems declared in your Gemfile(5) are satisfied by the same second\-level dependency\. For instance, consider the case of \fBthin\fR and \fBrack\-perftools\-profiler\fR\. . .IP "" 4 . .nf source "https://rubygems\.org" gem "thin" gem "rack\-perftools\-profiler" . .fi . .IP "" 0 . .P The \fBthin\fR gem depends on \fBrack >= 1\.0\fR, while \fBrack\-perftools\-profiler\fR depends on \fBrack ~> 1\.0\fR\. If you run bundle install, you get: . .IP "" 4 . .nf Fetching source index for https://rubygems\.org/ Installing daemons (1\.1\.0) Installing eventmachine (0\.12\.10) with native extensions Installing open4 (1\.0\.1) Installing perftools\.rb (0\.4\.7) with native extensions Installing rack (1\.2\.1) Installing rack\-perftools_profiler (0\.0\.2) Installing thin (1\.2\.7) with native extensions Using bundler (1\.0\.0\.rc\.3) . .fi . .IP "" 0 . .P In this case, the two gems have their own set of dependencies, but they share \fBrack\fR in common\. If you run \fBbundle update thin\fR, bundler will update \fBdaemons\fR, \fBeventmachine\fR and \fBrack\fR, which are dependencies of \fBthin\fR, but not \fBopen4\fR or \fBperftools\.rb\fR, which are dependencies of \fBrack\-perftools_profiler\fR\. Note that \fBbundle update thin\fR will update \fBrack\fR even though it\'s \fIalso\fR a dependency of \fBrack\-perftools_profiler\fR\. . .P \fBIn short\fR, when you update a gem using \fBbundle update\fR, bundler will update all dependencies of that gem, including those that are also dependencies of another gem\. . .P In this scenario, updating the \fBthin\fR version manually in the Gemfile(5), and then running bundle install(1) \fIbundle\-install\.1\.html\fR will only update \fBdaemons\fR and \fBeventmachine\fR, but not \fBrack\fR\. For more information, see the \fBCONSERVATIVE UPDATING\fR section of bundle install(1) \fIbundle\-install\.1\.html\fR\. . .SH "RECOMMENDED WORKFLOW" In general, when working with an application managed with bundler, you should use the following workflow: . .IP "\(bu" 4 After you create your Gemfile(5) for the first time, run . .IP $ bundle install . .IP "\(bu" 4 Check the resulting \fBGemfile\.lock\fR into version control . .IP $ git add Gemfile\.lock . .IP "\(bu" 4 When checking out this repository on another development machine, run . .IP $ bundle install . .IP "\(bu" 4 When checking out this repository on a deployment machine, run . .IP $ bundle install \-\-deployment . .IP "\(bu" 4 After changing the Gemfile(5) to reflect a new or update dependency, run . .IP $ bundle install . .IP "\(bu" 4 Make sure to check the updated \fBGemfile\.lock\fR into version control . .IP $ git add Gemfile\.lock . .IP "\(bu" 4 If bundle install(1) \fIbundle\-install\.1\.html\fR reports a conflict, manually update the specific gems that you changed in the Gemfile(5) . .IP $ bundle update rails thin . .IP "\(bu" 4 If you want to update all the gems to the latest possible versions that still match the gems listed in the Gemfile(5), run . .IP $ bundle update . .IP "" 0 bundler-1.11.2/lib/bundler/man/bundle-platform.txt0000644000004100000410000000236012652443364022101 0ustar www-datawww-dataBUNDLE-PLATFORM(1) BUNDLE-PLATFORM(1) NAME bundle-platform - Displays platform compatibility information SYNOPSIS bundle platform [--ruby] DESCRIPTION platform will display information from your Gemfile, Gemfile.lock, and Ruby VM about your platform. For instance, using this Gemfile(5): source "https://rubygems.org" ruby "1.9.3" gem "rack" If you run bundle platform on Ruby 1.9.3, it will display the following output: Your platform is: x86_64-linux Your app has gems that work on these platforms: * ruby Your Gemfile specifies a Ruby version requirement: * ruby 1.9.3 Your current platform satisfies the Ruby version requirement. platform will list all the platforms in your Gemfile.lock as well as the ruby directive if applicable from your Gemfile(5). It will also let you know if the ruby directive requirement has been met. If ruby direc- tive doesn't match the running Ruby VM, it will tell you what part does not. OPTIONS --ruby It will just display the ruby directive information, so you don't have to parse it from the Gemfile(5). September 2015 BUNDLE-PLATFORM(1) bundler-1.11.2/lib/bundler/man/bundle-config0000644000004100000410000002224112652443364020704 0ustar www-datawww-data.\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . .TH "BUNDLE\-CONFIG" "1" "October 2015" "" "" . .SH "NAME" \fBbundle\-config\fR \- Set bundler configuration options . .SH "SYNOPSIS" \fBbundle config\fR [\fIname\fR [\fIvalue\fR]] . .SH "DESCRIPTION" This command allows you to interact with bundler\'s configuration system\. Bundler retrieves its configuration from the local application (\fBapp/\.bundle/config\fR), environment variables, and the user\'s home directory (\fB~/\.bundle/config\fR), in that order of priority\. . .P Executing \fBbundle config\fR with no parameters will print a list of all bundler configuration for the current bundle, and where that configuration was set\. . .P Executing \fBbundle config \fR will print the value of that configuration setting, and where it was set\. . .P Executing \fBbundle config \fR will set that configuration to the value specified for all bundles executed as the current user\. The configuration will be stored in \fB~/\.bundle/config\fR\. If \fIname\fR already is set, \fIname\fR will be overridden and user will be warned\. . .P Executing \fBbundle config \-\-global \fR works the same as above\. . .P Executing \fBbundle config \-\-local \fR will set that configuration to the local application\. The configuration will be stored in \fBapp/\.bundle/config\fR\. . .P Executing \fBbundle config \-\-delete \fR will delete the configuration in both local and global sources\. Not compatible with \-\-global or \-\-local flag\. . .P Executing bundle with the \fBBUNDLE_IGNORE_CONFIG\fR environment variable set will cause it to ignore all configuration\. . .P Executing \fBbundle config disable_multisource true\fR upgrades the warning about the Gemfile containing multiple primary sources to an error\. Executing \fBbundle config \-\-delete disable_multisource\fR downgrades this error to a warning\. . .SH "BUILD OPTIONS" You can use \fBbundle config\fR to give bundler the flags to pass to the gem installer every time bundler tries to install a particular gem\. . .P A very common example, the \fBmysql\fR gem, requires Snow Leopard users to pass configuration flags to \fBgem install\fR to specify where to find the \fBmysql_config\fR executable\. . .IP "" 4 . .nf gem install mysql \-\- \-\-with\-mysql\-config=/usr/local/mysql/bin/mysql_config . .fi . .IP "" 0 . .P Since the specific location of that executable can change from machine to machine, you can specify these flags on a per\-machine basis\. . .IP "" 4 . .nf bundle config build\.mysql \-\-with\-mysql\-config=/usr/local/mysql/bin/mysql_config . .fi . .IP "" 0 . .P After running this command, every time bundler needs to install the \fBmysql\fR gem, it will pass along the flags you specified\. . .SH "CONFIGURATION KEYS" Configuration keys in bundler have two forms: the canonical form and the environment variable form\. . .P For instance, passing the \fB\-\-without\fR flag to bundle install(1) \fIbundle\-install\.1\.html\fR prevents Bundler from installing certain groups specified in the Gemfile(5)\. Bundler persists this value in \fBapp/\.bundle/config\fR so that calls to \fBBundler\.setup\fR do not try to find gems from the \fBGemfile\fR that you didn\'t install\. Additionally, subsequent calls to bundle install(1) \fIbundle\-install\.1\.html\fR remember this setting and skip those groups\. . .P The canonical form of this configuration is \fB"without"\fR\. To convert the canonical form to the environment variable form, capitalize it, and prepend \fBBUNDLE_\fR\. The environment variable form of \fB"without"\fR is \fBBUNDLE_WITHOUT\fR\. . .P Any periods in the configuration keys must be replaced with two underscores when setting it via environment variables\. The configuration key \fBlocal\.rack\fR becomes the environment variable \fBBUNDLE_LOCAL__RACK\fR\. . .SH "LIST OF AVAILABLE KEYS" The following is a list of all configuration keys and their purpose\. You can learn more about their operation in bundle install(1) \fIbundle\-install\.1\.html\fR\. . .IP "\(bu" 4 \fBpath\fR (\fBBUNDLE_PATH\fR): The location on disk where all gems in your bundle will be located regardless of \fB$GEM_HOME\fR or \fB$GEM_PATH\fR values\. Bundle gems not found in this location will be installed by \fBbundle install\fR\. Defaults to \fBGem\.dir\fR\. When \-\-deployment is used, defaults to vendor/bundle\. . .IP "\(bu" 4 \fBfrozen\fR (\fBBUNDLE_FROZEN\fR): Disallow changes to the \fBGemfile\fR\. Defaults to \fBtrue\fR when \fB\-\-deployment\fR is used\. . .IP "\(bu" 4 \fBwithout\fR (\fBBUNDLE_WITHOUT\fR): A \fB:\fR\-separated list of groups whose gems bundler should not install . .IP "\(bu" 4 \fBbin\fR (\fBBUNDLE_BIN\fR): Install executables from gems in the bundle to the specified directory\. Defaults to \fBfalse\fR\. . .IP "\(bu" 4 \fBgemfile\fR (\fBBUNDLE_GEMFILE\fR): The name of the file that bundler should use as the \fBGemfile\fR\. This location of this file also sets the root of the project, which is used to resolve relative paths in the \fBGemfile\fR, among other things\. By default, bundler will search up from the current working directory until it finds a \fBGemfile\fR\. . .IP "\(bu" 4 \fBssl_ca_cert\fR (\fBBUNDLE_SSL_CA_CERT\fR): Path to a designated CA certificate file or folder containing multiple certificates for trusted CAs in PEM format\. . .IP "\(bu" 4 \fBssl_client_cert\fR (\fBBUNDLE_SSL_CLIENT_CERT\fR): Path to a designated file containing a X\.509 client certificate and key in PEM format\. . .IP "\(bu" 4 \fBcache_path\fR (\fBBUNDLE_CACHE_PATH\fR): The directory that bundler will place cached gems in when running \fBbundle package\fR, and that bundler will look in when installing gems\. . .IP "\(bu" 4 \fBdisable_multisource\fR (\fBBUNDLE_DISABLE_MULTISOURCE\fR): When set, Gemfiles containing multiple sources will produce errors instead of warnings\. Use \fBbundle config \-\-delete disable_multisource\fR to unset\. . .IP "\(bu" 4 \fBignore_messages\fR (\fBBUNDLE_IGNORE_MESSAGES\fR): When set, no post install messages will be printed\. To silence a single gem, use dot notation like \fBignore_messages\.httparty true\fR\. . .IP "" 0 . .P In general, you should set these settings per\-application by using the applicable flag to the bundle install(1) \fIbundle\-install\.1\.html\fR or bundle package(1) \fIbundle\-package\.1\.html\fR command\. . .P You can set them globally either via environment variables or \fBbundle config\fR, whichever is preferable for your setup\. If you use both, environment variables will take preference over global settings\. . .SH "LOCAL GIT REPOS" Bundler also allows you to work against a git repository locally instead of using the remote version\. This can be achieved by setting up a local override: . .IP "" 4 . .nf bundle config local\.GEM_NAME /path/to/local/git/repository . .fi . .IP "" 0 . .P For example, in order to use a local Rack repository, a developer could call: . .IP "" 4 . .nf bundle config local\.rack ~/Work/git/rack . .fi . .IP "" 0 . .P Now instead of checking out the remote git repository, the local override will be used\. Similar to a path source, every time the local git repository change, changes will be automatically picked up by Bundler\. This means a commit in the local git repo will update the revision in the \fBGemfile\.lock\fR to the local git repo revision\. This requires the same attention as git submodules\. Before pushing to the remote, you need to ensure the local override was pushed, otherwise you may point to a commit that only exists in your local machine\. . .P Bundler does many checks to ensure a developer won\'t work with invalid references\. Particularly, we force a developer to specify a branch in the \fBGemfile\fR in order to use this feature\. If the branch specified in the \fBGemfile\fR and the current branch in the local git repository do not match, Bundler will abort\. This ensures that a developer is always working against the correct branches, and prevents accidental locking to a different branch\. . .P Finally, Bundler also ensures that the current revision in the \fBGemfile\.lock\fR exists in the local git repository\. By doing this, Bundler forces you to fetch the latest changes in the remotes\. . .SH "MIRRORS OF GEM SOURCES" Bundler supports overriding gem sources with mirrors\. This allows you to configure rubygems\.org as the gem source in your Gemfile while still using your mirror to fetch gems\. . .IP "" 4 . .nf bundle config mirror\.SOURCE_URL MIRROR_URL . .fi . .IP "" 0 . .P For example, to use a mirror of rubygems\.org hosted at . .IP "" 4 . .nf bundle config mirror\.http://rubygems\.org http://rubygems\-mirror\.org . .fi . .IP "" 0 . .SH "CREDENTIALS FOR GEM SOURCES" Bundler allows you to configure credentials for any gem source, which allows you to avoid putting secrets into your Gemfile\. . .IP "" 4 . .nf bundle config SOURCE_HOSTNAME USERNAME:PASSWORD . .fi . .IP "" 0 . .P For example, to save the credentials of user \fBclaudette\fR for the gem source at \fBgems\.longerous\.com\fR, you would run: . .IP "" 4 . .nf bundle config gems\.longerous\.com claudette:s00pers3krit . .fi . .IP "" 0 . .P Or you can set the credentials as an environment variable like this: . .IP "" 4 . .nf export BUNDLE_GEMS__LONGEROUS__COM="claudette:s00pers3krit" . .fi . .IP "" 0 bundler-1.11.2/lib/bundler/man/bundle-lock0000644000004100000410000000336012652443364020370 0ustar www-datawww-data.\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . .TH "BUNDLE\-LOCK" "1" "December 2015" "" "" . .SH "NAME" \fBbundle\-lock\fR \- Creates / Updates a lockfile without installing . .SH "SYNOPSIS" \fBbundle lock\fR [\-\-update] . .IP "" 4 . .nf [\-\-local] [\-\-print] [\-\-lockfile=PATH] . .fi . .IP "" 0 . .SH "DESCRIPTION" Lock the gems specified in Gemfile\. . .SH "OPTIONS" . .TP \fB\-\-update=<*gems>\fR Ignores the existing lockfile\. Resolve then updates lockfile\. Taking a list of gems or updating all gems if no list is given\. . .TP \fB\-\-local\fR Do not attempt to connect to \fBrubygems\.org\fR\. Instead, Bundler will use the gems already present in Rubygems\' cache or in \fBvendor/cache\fR\. Note that if a appropriate platform\-specific gem exists on \fBrubygems\.org\fR it will not be found\. . .TP \fB\-\-print\fR Prints the lockfile to STDOUT instead of writing to the file system\. . .TP \fB\-\-lockfile=\fR The path where the lockfile should be written to\. . .SH "UPDATING ALL GEMS" If you run \fBbundle lock\fR with \fB\-\-update\fR option without list of gems, bundler will ignore any previously installed gems and resolve all dependencies again based on the latest versions of all gems available in the sources\. . .SH "UPDATING A LIST OF GEMS" Sometimes, you want to update a single gem in the Gemfile(5), and leave the rest of the gems that you specified locked to the versions in the \fBGemfile\.lock\fR\. . .P For instance, you only want to update \fBnokogiri\fR, run \fBbundle lock \-\-update nokogiri\fR\. . .P Bundler will update \fBnokogiri\fR and any of its dependencies, but leave the rest of the gems that you specified locked to the versions in the \fBGemfile\.lock\fR\. bundler-1.11.2/lib/bundler/endpoint_specification.rb0000644000004100000410000000455612652443364022550 0ustar www-datawww-datamodule Bundler # used for Creating Specifications from the Gemcutter Endpoint class EndpointSpecification < Gem::Specification include MatchPlatform attr_reader :name, :version, :platform, :dependencies attr_accessor :source, :remote def initialize(name, version, platform, dependencies) @name = name @version = version @platform = platform @dependencies = dependencies end def fetch_platform @platform end # needed for standalone, load required_paths from local gemspec # after the gem is installed def require_paths if @remote_specification @remote_specification.require_paths elsif _local_specification _local_specification.require_paths else super end end # needed for inline def load_paths # remote specs aren't installed, and can't have load_paths if _local_specification _local_specification.load_paths else super end end # needed for binstubs def executables if @remote_specification @remote_specification.executables elsif _local_specification _local_specification.executables else super end end # needed for bundle clean def bindir if @remote_specification @remote_specification.bindir elsif _local_specification _local_specification.bindir else super end end # needed for post_install_messages during install def post_install_message if @remote_specification @remote_specification.post_install_message elsif _local_specification _local_specification.post_install_message end end # needed for "with native extensions" during install def extensions if @remote_specification @remote_specification.extensions elsif _local_specification _local_specification.extensions end end def _local_specification if @loaded_from && File.exist?(local_specification_path) eval(File.read(local_specification_path)).tap do |spec| spec.loaded_from = @loaded_from end end end def __swap__(spec) @remote_specification = spec end private def local_specification_path "#{base_dir}/specifications/#{full_name}.gemspec" end end end bundler-1.11.2/lib/bundler/graph.rb0000644000004100000410000001327712652443364017131 0ustar www-datawww-datarequire "set" module Bundler class Graph GRAPH_NAME = :Gemfile def initialize(env, output_file, show_version = false, show_requirements = false, output_format = "png", without = []) @env = env @output_file = output_file @show_version = show_version @show_requirements = show_requirements @output_format = output_format @without_groups = without.map(&:to_sym) @groups = [] @relations = Hash.new {|h, k| h[k] = Set.new } @node_options = {} @edge_options = {} _patching_gem_dependency_class _populate_relations end attr_reader :groups, :relations, :node_options, :edge_options, :output_file, :output_format def viz GraphVizClient.new(self).run end private def _populate_relations parent_dependencies = _groups.values.to_set.flatten loop do if parent_dependencies.empty? break else tmp = Set.new parent_dependencies.each do |dependency| # if the dependency is a prerelease, allow to_spec to be non-nil dependency.prerelease = true child_dependencies = dependency.to_spec.runtime_dependencies.to_set @relations[dependency.name] += child_dependencies.map(&:name).to_set tmp += child_dependencies @node_options[dependency.name] = _make_label(dependency, :node) child_dependencies.each do |c_dependency| @edge_options["#{dependency.name}_#{c_dependency.name}"] = _make_label(c_dependency, :edge) end end parent_dependencies = tmp end end end def _groups relations = Hash.new {|h, k| h[k] = Set.new } @env.current_dependencies.each do |dependency| dependency.groups.each do |group| next if @without_groups.include?(group) relations[group.to_s].add(dependency) @relations[group.to_s].add(dependency.name) @node_options[group.to_s] ||= _make_label(group, :node) @edge_options["#{group}_#{dependency.name}"] = _make_label(dependency, :edge) end end @groups = relations.keys relations end def _make_label(symbol_or_string_or_dependency, element_type) case element_type.to_sym when :node if symbol_or_string_or_dependency.is_a?(Gem::Dependency) label = symbol_or_string_or_dependency.name.dup label << "\n#{symbol_or_string_or_dependency.to_spec.version}" if @show_version else label = symbol_or_string_or_dependency.to_s end when :edge label = nil if symbol_or_string_or_dependency.respond_to?(:requirements_list) && @show_requirements tmp = symbol_or_string_or_dependency.requirements_list.join(", ") label = tmp if tmp != ">= 0" end else raise ArgumentError, "2nd argument is invalid" end label.nil? ? {} : { :label => label } end def _patching_gem_dependency_class # method borrow from rubygems/dependency.rb # redefinition of matching_specs will also redefine to_spec and to_specs Gem::Dependency.class_eval do def matching_specs(platform_only = false) matches = Bundler.load.specs.select do |spec| name == spec.name && requirement.satisfied_by?(spec.version) end if platform_only matches.select! do |spec| Gem::Platform.match spec.platform end end matches = matches.sort_by(&:sort_obj) # HACK: shouldn't be needed end end end class GraphVizClient def initialize(graph_instance) @graph_name = graph_instance.class::GRAPH_NAME @groups = graph_instance.groups @relations = graph_instance.relations @node_options = graph_instance.node_options @edge_options = graph_instance.edge_options @output_file = graph_instance.output_file @output_format = graph_instance.output_format end def g @g ||= ::GraphViz.digraph(@graph_name, :concentrate => true, :normalize => true, :nodesep => 0.55) do |g| g.edge[:weight] = 2 g.edge[:fontname] = g.node[:fontname] = "Arial, Helvetica, SansSerif" g.edge[:fontsize] = 12 end end def run @groups.each do |group| g.add_nodes( group, { :style => "filled", :fillcolor => "#B9B9D5", :shape => "box3d", :fontsize => 16 }.merge(@node_options[group]) ) end @relations.each do |parent, children| children.each do |child| if @groups.include?(parent) g.add_nodes(child, { :style => "filled", :fillcolor => "#B9B9D5" }.merge(@node_options[child])) g.add_edges(parent, child, { :constraint => false }.merge(@edge_options["#{parent}_#{child}"])) else g.add_nodes(child, @node_options[child]) g.add_edges(parent, child, @edge_options["#{parent}_#{child}"]) end end end if @output_format.to_s == "debug" $stdout.puts g.output :none => String Bundler.ui.info "debugging bundle viz..." else begin g.output @output_format.to_sym => "#{@output_file}.#{@output_format}" Bundler.ui.info "#{@output_file}.#{@output_format}" rescue ArgumentError => e $stderr.puts "Unsupported output format. See Ruby-Graphviz/lib/graphviz/constants.rb" raise e end end end end end end bundler-1.11.2/lib/bundler/deprecate.rb0000644000004100000410000000042412652443364017752 0ustar www-datawww-datamodule Bundler if defined? ::Deprecate Deprecate = ::Deprecate elsif defined? Gem::Deprecate Deprecate = Gem::Deprecate else class Deprecate; end end unless Deprecate.respond_to?(:skip_during) def Deprecate.skip_during yield end end end bundler-1.11.2/lib/bundler/ssl_certs/0000755000004100000410000000000012652443364017472 5ustar www-datawww-databundler-1.11.2/lib/bundler/ssl_certs/GeoTrustGlobalCA.pem0000644000004100000410000000230012652443364023271 0ustar www-datawww-data-----BEGIN CERTIFICATE----- MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9 9BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU 1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+ bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV 5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw== -----END CERTIFICATE----- bundler-1.11.2/lib/bundler/ssl_certs/certificate_manager.rb0000644000004100000410000000301112652443364023766 0ustar www-datawww-datarequire "fileutils" require "net/https" require "openssl" module Bundler module SSLCerts class CertificateManager attr_reader :bundler_cert_path, :bundler_certs, :rubygems_certs def self.update_from!(rubygems_path) new(rubygems_path).update! end def initialize(rubygems_path = nil) if rubygems_path rubygems_cert_path = File.join(rubygems_path, "lib/rubygems/ssl_certs") @rubygems_certs = certificates_in(rubygems_cert_path) end @bundler_cert_path = File.expand_path("..", __FILE__) @bundler_certs = certificates_in(bundler_cert_path) end def up_to_date? rubygems_certs.all? do |rc| bundler_certs.find do |bc| File.basename(bc) == File.basename(rc) && FileUtils.compare_file(bc, rc) end end end def update! return if up_to_date? FileUtils.rm bundler_certs FileUtils.cp rubygems_certs, bundler_cert_path end def connect_to(host) http = Net::HTTP.new(host, 443) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_PEER http.cert_store = store http.head("/") end private def certificates_in(path) Dir[File.join(path, "*.pem")].sort end def store @store ||= begin store = OpenSSL::X509::Store.new bundler_certs.each do |cert| store.add_file cert end store end end end end end bundler-1.11.2/lib/bundler/ssl_certs/AddTrustExternalCARoot-2048.pem0000644000004100000410000000276112652443364025103 0ustar www-datawww-data-----BEGIN CERTIFICATE----- MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU MBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs IFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290 MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h bCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt H7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9 uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX mk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX a0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN E0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0 WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD VR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0 Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRU cnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsx IjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJKoZIhvcN AQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ= -----END CERTIFICATE----- bundler-1.11.2/lib/bundler/ssl_certs/DigiCertHighAssuranceEVRootCA.pem0000644000004100000410000000252712652443364025645 0ustar www-datawww-data-----BEGIN CERTIFICATE----- MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3 LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm +9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3 hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2 Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep +OkuE6N36B9K -----END CERTIFICATE----- bundler-1.11.2/lib/bundler/ssl_certs/AddTrustExternalCARoot.pem0000644000004100000410000000364012652443364024505 0ustar www-datawww-data-----BEGIN CERTIFICATE----- MIIFdDCCBFygAwIBAgIQJ2buVutJ846r13Ci/ITeIjANBgkqhkiG9w0BAQwFADBv MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFk ZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBF eHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFow gYUxCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAO BgNVBAcTB1NhbGZvcmQxGjAYBgNVBAoTEUNPTU9ETyBDQSBMaW1pdGVkMSswKQYD VQQDEyJDT01PRE8gUlNBIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkq hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAkehUktIKVrGsDSTdxc9EZ3SZKzejfSNw AHG8U9/E+ioSj0t/EFa9n3Byt2F/yUsPF6c947AEYe7/EZfH9IY+Cvo+XPmT5jR6 2RRr55yzhaCCenavcZDX7P0N+pxs+t+wgvQUfvm+xKYvT3+Zf7X8Z0NyvQwA1onr ayzT7Y+YHBSrfuXjbvzYqOSSJNpDa2K4Vf3qwbxstovzDo2a5JtsaZn4eEgwRdWt 4Q08RWD8MpZRJ7xnw8outmvqRsfHIKCxH2XeSAi6pE6p8oNGN4Tr6MyBSENnTnIq m1y9TBsoilwie7SrmNnu4FGDwwlGTm0+mfqVF9p8M1dBPI1R7Qu2XK8sYxrfV8g/ vOldxJuvRZnio1oktLqpVj3Pb6r/SVi+8Kj/9Lit6Tf7urj0Czr56ENCHonYhMsT 8dm74YlguIwoVqwUHZwK53Hrzw7dPamWoUi9PPevtQ0iTMARgexWO/bTouJbt7IE IlKVgJNp6I5MZfGRAy1wdALqi2cVKWlSArvX31BqVUa/oKMoYX9w0MOiqiwhqkfO KJwGRXa/ghgntNWutMtQ5mv0TIZxMOmm3xaG4Nj/QN370EKIf6MzOi5cHkERgWPO GHFrK+ymircxXDpqR+DDeVnWIBqv8mqYqnK8V0rSS527EPywTEHl7R09XiidnMy/ s1Hap0flhFMCAwEAAaOB9DCB8TAfBgNVHSMEGDAWgBStvZh6NLQm9/rEJlTvA73g JMtUGjAdBgNVHQ4EFgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQD AgGGMA8GA1UdEwEB/wQFMAMBAf8wEQYDVR0gBAowCDAGBgRVHSAAMEQGA1UdHwQ9 MDswOaA3oDWGM2h0dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9BZGRUcnVzdEV4dGVy bmFsQ0FSb290LmNybDA1BggrBgEFBQcBAQQpMCcwJQYIKwYBBQUHMAGGGWh0dHA6 Ly9vY3NwLnVzZXJ0cnVzdC5jb20wDQYJKoZIhvcNAQEMBQADggEBAGS/g/FfmoXQ zbihKVcN6Fr30ek+8nYEbvFScLsePP9NDXRqzIGCJdPDoCpdTPW6i6FtxFQJdcfj Jw5dhHk3QBN39bSsHNA7qxcS1u80GH4r6XnTq1dFDK8o+tDb5VCViLvfhVdpfZLY Uspzgb8c8+a4bmYRBbMelC1/kZWSWfFMzqORcUx8Rww7Cxn2obFshj5cqsQugsv5 B5a6SE2Q8pTIqXOi6wZ7I53eovNNVZ96YUWYGGjHXkBrI/V5eu+MtWuLt29G9Hvx PUsE2JOAWVrgQSQdso8VYFhH2+9uRv0V9dlfmrPb2LjkQLPNlzmuhbsdjrzch5vR pu/xO28QOG8= -----END CERTIFICATE----- bundler-1.11.2/lib/bundler/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem0000644000004100000410000000331412652443364031324 0ustar www-datawww-data-----BEGIN CERTIFICATE----- MIIE2DCCBEGgAwIBAgIEN0rSQzANBgkqhkiG9w0BAQUFADCBwzELMAkGA1UEBhMC VVMxFDASBgNVBAoTC0VudHJ1c3QubmV0MTswOQYDVQQLEzJ3d3cuZW50cnVzdC5u ZXQvQ1BTIGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTElMCMGA1UECxMc KGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDE6MDgGA1UEAxMxRW50cnVzdC5u ZXQgU2VjdXJlIFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05OTA1 MjUxNjA5NDBaFw0xOTA1MjUxNjM5NDBaMIHDMQswCQYDVQQGEwJVUzEUMBIGA1UE ChMLRW50cnVzdC5uZXQxOzA5BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5j b3JwLiBieSByZWYuIChsaW1pdHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBF bnRydXN0Lm5ldCBMaW1pdGVkMTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUg U2VydmVyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGdMA0GCSqGSIb3DQEBAQUA A4GLADCBhwKBgQDNKIM0VBuJ8w+vN5Ex/68xYMmo6LIQaO2f55M28Qpku0f1BBc/ I0dNxScZgSYMVHINiC3ZH5oSn7yzcdOAGT9HZnuMNSjSuQrfJNqc1lB5gXpa0zf3 wkrYKZImZNHkmGw6AIr1NJtl+O3jEP/9uElY3KDegjlrgbEWGWG5VLbmQwIBA6OC AdcwggHTMBEGCWCGSAGG+EIBAQQEAwIABzCCARkGA1UdHwSCARAwggEMMIHeoIHb oIHYpIHVMIHSMQswCQYDVQQGEwJVUzEUMBIGA1UEChMLRW50cnVzdC5uZXQxOzA5 BgNVBAsTMnd3dy5lbnRydXN0Lm5ldC9DUFMgaW5jb3JwLiBieSByZWYuIChsaW1p dHMgbGlhYi4pMSUwIwYDVQQLExwoYykgMTk5OSBFbnRydXN0Lm5ldCBMaW1pdGVk MTowOAYDVQQDEzFFbnRydXN0Lm5ldCBTZWN1cmUgU2VydmVyIENlcnRpZmljYXRp b24gQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMCmgJ6AlhiNodHRwOi8vd3d3LmVu dHJ1c3QubmV0L0NSTC9uZXQxLmNybDArBgNVHRAEJDAigA8xOTk5MDUyNTE2MDk0 MFqBDzIwMTkwNTI1MTYwOTQwWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAU8Bdi E1U9s/8KAGv7UISX8+1i0BowHQYDVR0OBBYEFPAXYhNVPbP/CgBr+1CEl/PtYtAa MAwGA1UdEwQFMAMBAf8wGQYJKoZIhvZ9B0EABAwwChsEVjQuMAMCBJAwDQYJKoZI hvcNAQEFBQADgYEAkNwwAvpkdMKnCqV8IY00F6j7Rw7/JXyNEwr75Ji174z4xRAN 95K+8cPV1ZVqBLssziY2ZcgxxufuP+NXdYR6Ee9GTxj005i7qIcyunL2POI9n9cd 2cNgQ4xYDiKWL2KjLB+6rQXvqzJ4h6BUcxm1XAX5Uj5tLUUL9wqT6u0G+bI= -----END CERTIFICATE----- bundler-1.11.2/lib/bundler/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem0000644000004100000410000000150212652443364030443 0ustar www-datawww-data-----BEGIN CERTIFICATE----- MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2 MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k -----END CERTIFICATE----- bundler-1.11.2/lib/bundler/ssl_certs/.document0000644000004100000410000000004512652443364021310 0ustar www-datawww-data# Ignore all files in this directory bundler-1.11.2/lib/bundler/cli.rb0000644000004100000410000005003212652443364016565 0ustar www-datawww-datarequire "bundler" require "bundler/vendored_thor" module Bundler class CLI < Thor include Thor::Actions AUTO_INSTALL_CMDS = %w(show binstubs outdated exec open console licenses clean) def self.start(*) super rescue Exception => e Bundler.ui = UI::Shell.new raise e end def initialize(*args) super custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile] ENV["BUNDLE_GEMFILE"] = File.expand_path(custom_gemfile) if custom_gemfile && !custom_gemfile.empty? Bundler.settings[:retry] = options[:retry] if options[:retry] current_cmd = args.last[:current_command].name auto_install if AUTO_INSTALL_CMDS.include?(current_cmd) rescue UnknownArgumentError => e raise InvalidOption, e.message ensure self.options ||= {} Bundler.ui = UI::Shell.new(options) Bundler.ui.level = "debug" if options["verbose"] if ENV["RUBYGEMS_GEMDEPS"] && !ENV["RUBYGEMS_GEMDEPS"].empty? Bundler.ui.warn( "The RUBYGEMS_GEMDEPS environment variable is set. This enables RubyGems' " \ "experimental Gemfile mode, which may conflict with Bundler and cause unexpected errors. " \ "To remove this warning, unset RUBYGEMS_GEMDEPS.", :wrap => true) end end check_unknown_options!(:except => [:config, :exec]) stop_on_unknown_option! :exec default_task :install class_option "no-color", :type => :boolean, :desc => "Disable colorization in output" class_option "retry", :type => :numeric, :aliases => "-r", :banner => "NUM", :desc => "Specify the number of times you wish to attempt network commands" class_option "verbose", :type => :boolean, :desc => "Enable verbose output mode", :aliases => "-V" def help(cli = nil) case cli when "gemfile" then command = "gemfile.5" when nil then command = "bundle" else command = "bundle-#{cli}" end manpages = %w( bundle bundle-config bundle-exec bundle-gem bundle-install bundle-package bundle-update bundle-platform gemfile.5) if manpages.include?(command) root = File.expand_path("../man", __FILE__) if Bundler.which("man") && root !~ %r{^file:/.+!/META-INF/jruby.home/.+} Kernel.exec "man #{root}/#{command}" else puts File.read("#{root}/#{command}.txt") end elsif command_path = Bundler.which("bundler-#{cli}") Kernel.exec(command_path, "--help") else super end end def self.handle_no_command_error(command, has_namespace = $thor_runner) return super unless command_path = Bundler.which("bundler-#{command}") Kernel.exec(command_path, *ARGV[1..-1]) end desc "init [OPTIONS]", "Generates a Gemfile into the current working directory" long_desc <<-D Init generates a default Gemfile in the current working directory. When adding a Gemfile to a gem with a gemspec, the --gemspec option will automatically add each dependency listed in the gemspec file to the newly created Gemfile. D method_option "gemspec", :type => :string, :banner => "Use the specified .gemspec to create the Gemfile" def init require "bundler/cli/init" Init.new(options.dup).run end desc "check [OPTIONS]", "Checks if the dependencies listed in Gemfile are satisfied by currently installed gems" long_desc <<-D Check searches the local machine for each of the gems requested in the Gemfile. If all gems are found, Bundler prints a success message and exits with a status of 0. If not, the first missing gem is listed and Bundler exits status 1. D method_option "dry-run", :type => :boolean, :default => false, :banner => "Lock the Gemfile" method_option "gemfile", :type => :string, :banner => "Use the specified gemfile instead of Gemfile" method_option "path", :type => :string, :banner => "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine" map "c" => "check" def check require "bundler/cli/check" Check.new(options).run end desc "install [OPTIONS]", "Install the current environment to the system" long_desc <<-D Install will install all of the gems in the current bundle, making them available for use. In a freshly checked out repository, this command will give you the same gem versions as the last person who updated the Gemfile and ran `bundle update`. Passing [DIR] to install (e.g. vendor) will cause the unpacked gems to be installed into the [DIR] directory rather than into system gems. If the bundle has already been installed, bundler will tell you so and then exit. D method_option "binstubs", :type => :string, :lazy_default => "bin", :banner => "Generate bin stubs for bundled gems to ./bin" method_option "clean", :type => :boolean, :banner => "Run bundle clean automatically after install" method_option "deployment", :type => :boolean, :banner => "Install using defaults tuned for deployment environments" method_option "frozen", :type => :boolean, :banner => "Do not allow the Gemfile.lock to be updated after this install" method_option "full-index", :type => :boolean, :banner => "Use the rubygems modern index instead of the API endpoint" method_option "gemfile", :type => :string, :banner => "Use the specified gemfile instead of Gemfile" method_option "jobs", :aliases => "-j", :type => :numeric, :banner => "Specify the number of jobs to run in parallel" method_option "local", :type => :boolean, :banner => "Do not attempt to fetch gems remotely and use the gem cache instead" method_option "no-cache", :type => :boolean, :banner => "Don't update the existing gem cache." method_option "force", :type => :boolean, :banner => "Force downloading every gem." method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache." method_option "path", :type => :string, :banner => "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine" method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors." method_option "shebang", :type => :string, :banner => "Specify a different shebang executable name than the default (usually 'ruby')" method_option "standalone", :type => :array, :lazy_default => [], :banner => "Make a bundle that can work without the Bundler runtime" method_option "system", :type => :boolean, :banner => "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application" method_option "trust-policy", :alias => "P", :type => :string, :banner => "Gem trust policy (like gem install -P). Must be one of " + Bundler.rubygems.security_policy_keys.join("|") method_option "without", :type => :array, :banner => "Exclude gems that are part of the specified named group." method_option "with", :type => :array, :banner => "Include gems that are part of the specified named group." map "i" => "install" def install require "bundler/cli/install" Install.new(options.dup).run end desc "update [OPTIONS]", "update the current environment" long_desc <<-D Update will install the newest versions of the gems listed in the Gemfile. Use update when you have changed the Gemfile, or if you want to get the newest possible versions of the gems in the bundle. D method_option "full-index", :type => :boolean, :banner => "Use the rubygems modern index instead of the API endpoint" method_option "group", :aliases => "-g", :type => :array, :banner => "Update a specific group" method_option "jobs", :aliases => "-j", :type => :numeric, :banner => "Specify the number of jobs to run in parallel" method_option "local", :type => :boolean, :banner => "Do not attempt to fetch gems remotely and use the gem cache instead" method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors." method_option "source", :type => :array, :banner => "Update a specific source (and all gems associated with it)" method_option "force", :type => :boolean, :banner => "Force downloading every gem." def update(*gems) require "bundler/cli/update" Update.new(options, gems).run end desc "show GEM [OPTIONS]", "Shows all gems that are part of the bundle, or the path to a given gem" long_desc <<-D Show lists the names and versions of all gems that are required by your Gemfile. Calling show with [GEM] will list the exact location of that gem on your machine. D method_option "paths", :type => :boolean, :banner => "List the paths of all gems that are required by your Gemfile." method_option "outdated", :type => :boolean, :banner => "Show verbose output including whether gems are outdated." def show(gem_name = nil) require "bundler/cli/show" Show.new(options, gem_name).run end map %w(list) => "show" desc "binstubs GEM [OPTIONS]", "Install the binstubs of the listed gem" long_desc <<-D Generate binstubs for executables in [GEM]. Binstubs are put into bin, or the --binstubs directory if one has been set. Calling binstubs with [GEM [GEM]] will create binstubs for all given gems. D method_option "force", :type => :boolean, :default => false, :banner => "Overwrite existing binstubs if they exist" method_option "path", :type => :string, :lazy_default => "bin", :banner => "Binstub destination directory (default bin)" def binstubs(*gems) require "bundler/cli/binstubs" Binstubs.new(options, gems).run end desc "outdated GEM [OPTIONS]", "list installed gems with newer versions available" long_desc <<-D Outdated lists the names and versions of gems that have a newer version available in the given source. Calling outdated with [GEM [GEM]] will only check for newer versions of the given gems. Prerelease gems are ignored by default. If your gems are up to date, Bundler will exit with a status of 0. Otherwise, it will exit 1. D method_option "local", :type => :boolean, :banner => "Do not attempt to fetch gems remotely and use the gem cache instead" method_option "pre", :type => :boolean, :banner => "Check for newer pre-release gems" method_option "source", :type => :array, :banner => "Check against a specific source" method_option "strict", :type => :boolean, :banner => "Only list newer versions allowed by your Gemfile requirements" def outdated(*gems) require "bundler/cli/outdated" Outdated.new(options, gems).run end desc "cache [OPTIONS]", "Cache all the gems to vendor/cache", :hide => true method_option "all", :type => :boolean, :banner => "Include all sources (including path and git)." method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms, not just the current one" method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache." def cache require "bundler/cli/cache" Cache.new(options).run end desc "package [OPTIONS]", "Locks and then caches all of the gems into vendor/cache" method_option "all", :type => :boolean, :banner => "Include all sources (including path and git)." method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms, not just the current one" method_option "cache-path", :type => :string, :banner => "Specify a different cache path than the default (vendor/cache)." method_option "gemfile", :type => :string, :banner => "Use the specified gemfile instead of Gemfile" method_option "no-install", :type => :boolean, :banner => "Don't actually install the gems, just package." method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache." method_option "path", :type => :string, :banner => "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine" method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors." long_desc <<-D The package command will copy the .gem files for every gem in the bundle into the directory ./vendor/cache. If you then check that directory into your source control repository, others who check out your source will be able to install the bundle without having to download any additional gems. D def package require "bundler/cli/package" Package.new(options).run end map %w(pack) => :package desc "exec [OPTIONS]", "Run the command in context of the bundle" method_option :keep_file_descriptors, :type => :boolean, :default => false long_desc <<-D Exec runs a command, providing it access to the gems in the bundle. While using bundle exec you can require and call the bundled gems as if they were installed into the system wide Rubygems repository. D map "e" => "exec" def exec(*args) require "bundler/cli/exec" Exec.new(options, args).run end desc "config NAME [VALUE]", "retrieve or set a configuration value" long_desc <<-D Retrieves or sets a configuration value. If only one parameter is provided, retrieve the value. If two parameters are provided, replace the existing value with the newly provided one. By default, setting a configuration value sets it for all projects on the machine. If a global setting is superceded by local configuration, this command will show the current value, as well as any superceded values and where they were specified. D def config(*args) require "bundler/cli/config" Config.new(options, args, self).run end desc "open GEM", "Opens the source directory of the given bundled gem" def open(name) require "bundler/cli/open" Open.new(options, name).run end desc "console [GROUP]", "Opens an IRB session with the bundle pre-loaded" def console(group = nil) require "bundler/cli/console" Console.new(options, group).run end desc "version", "Prints the bundler's version information" def version Bundler.ui.info "Bundler version #{Bundler::VERSION}" end map %w(-v --version) => :version desc "licenses", "Prints the license of all gems in the bundle" def licenses Bundler.load.specs.sort_by {|s| s.license.to_s }.reverse_each do |s| gem_name = s.name license = s.license || s.licenses if license.empty? Bundler.ui.warn "#{gem_name}: Unknown" else Bundler.ui.info "#{gem_name}: #{license}" end end end desc "viz [OPTIONS]", "Generates a visual dependency graph" long_desc <<-D Viz generates a PNG file of the current Gemfile as a dependency graph. Viz requires the ruby-graphviz gem (and its dependencies). The associated gems must also be installed via 'bundle install'. D method_option :file, :type => :string, :default => "gem_graph", :aliases => "-f", :banner => "The name to use for the generated file. see format option" method_option :format, :type => :string, :default => "png", :aliases => "-F", :banner => "This is output format option. Supported format is png, jpg, svg, dot ..." method_option :requirements, :type => :boolean, :default => false, :aliases => "-r", :banner => "Set to show the version of each required dependency." method_option :version, :type => :boolean, :default => false, :aliases => "-v", :banner => "Set to show each gem version." method_option :without, :type => :array, :default => [], :banner => "Exclude gems that are part of the specified named group." def viz require "bundler/cli/viz" Viz.new(options).run end desc "gem GEM [OPTIONS]", "Creates a skeleton for creating a rubygem" method_option :bin, :type => :boolean, :default => false, :aliases => "-b", :desc => "Generate a binary for your library." method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config gem.coc true`." method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR", :lazy_default => [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }, :desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)" method_option :ext, :type => :boolean, :default => false, :desc => "Generate the boilerplate for C extension code" method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config gem.mit true`." method_option :test, :type => :string, :lazy_default => "rspec", :aliases => "-t", :banner => "rspec", :desc => "Generate a test directory for your library, either rspec or minitest. Set a default with `bundle config gem.test rspec`." def gem(name) require "bundler/cli/gem" Gem.new(options, name, self).run end def self.source_root File.expand_path(File.join(File.dirname(__FILE__), "templates")) end desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory" method_option "dry-run", :type => :boolean, :default => false, :banner => "Only print out changes, do not actually clean gems" method_option "force", :type => :boolean, :default => false, :banner => "Forces clean even if --path is not set" def clean require "bundler/cli/clean" Clean.new(options.dup).run end desc "platform [OPTIONS]", "Displays platform compatibility information" method_option "ruby", :type => :boolean, :default => false, :banner => "only display ruby related platform information" def platform require "bundler/cli/platform" Platform.new(options).run end desc "inject GEM VERSION ...", "Add the named gem(s), with version requirements, to the resolved Gemfile" def inject(name, version, *gems) require "bundler/cli/inject" Inject.new(options, name, version, gems).run end desc "lock", "Creates a lockfile without installing" method_option "update", :type => :array, :lazy_default => [], :banner => "ignore the existing lockfile, update all gems by default, or update list of given gems" method_option "local", :type => :boolean, :default => false, :banner => "do not attempt to fetch remote gemspecs and use the local gem cache only" method_option "print", :type => :boolean, :default => false, :banner => "print the lockfile to STDOUT instead of writing to the file system" method_option "lockfile", :type => :string, :default => nil, :banner => "the path the lockfile should be written to" def lock require "bundler/cli/lock" Lock.new(options).run end desc "env", "Print information about the environment Bundler is running under" def env Env.new.write($stdout) end private # Automatically invoke `bundle install` and resume if # Bundler.settings[:auto_install] exists. This is set through config cmd # `bundle config auto_install 1`. # # Note that this method `nil`s out the global Definition object, so it # should be called first, before you instantiate anything like an # `Installer` that'll keep a reference to the old one instead. def auto_install return unless Bundler.settings[:auto_install] begin Bundler.definition.specs rescue GemNotFound Bundler.ui.info "Automatically installing missing gems." Bundler.reset! invoke :install, [] Bundler.reset! end end end end bundler-1.11.2/lib/bundler/retry.rb0000644000004100000410000000264312652443364017170 0ustar www-datawww-datamodule Bundler # General purpose class for retrying code that may fail class Retry attr_accessor :name, :total_runs, :current_run class << self def default_attempts default_retries + 1 end alias_method :attempts, :default_attempts def default_retries Bundler.settings[:retry] end end def initialize(name, exceptions = nil, retries = self.class.default_retries) @name = name @retries = retries @exceptions = Array(exceptions) || [] @total_runs = @retries + 1 # will run once, then upto attempts.times end def attempt(&block) @current_run = 0 @failed = false @error = nil run(&block) while keep_trying? @result end alias_method :attempts, :attempt private def run(&block) @failed = false @current_run += 1 @result = block.call rescue => e fail_attempt(e) end def fail_attempt(e) @failed = true raise e if last_attempt? || @exceptions.any? {|k| e.is_a?(k) } return true unless name Bundler.ui.warn "Retrying#{" #{name}" if name} due to error (#{current_run.next}/#{total_runs}): #{e.class} #{e.message}" end def keep_trying? return true if current_run.zero? return false if last_attempt? return true if @failed end def last_attempt? current_run >= total_runs end end end bundler-1.11.2/lib/bundler/stub_specification.rb0000644000004100000410000000062112652443364021672 0ustar www-datawww-datarequire "bundler/remote_specification" module Bundler class StubSpecification < RemoteSpecification def self.from_stub(stub) spec = new(stub.name, stub.version, stub.platform, nil) spec.stub = stub spec end attr_accessor :stub def to_yaml _remote_specification.to_yaml end private def _remote_specification stub.to_spec end end end bundler-1.11.2/lib/bundler/vendored_molinillo.rb0000644000004100000410000000010512652443364021676 0ustar www-datawww-datamodule Bundler; end require "bundler/vendor/molinillo/lib/molinillo" bundler-1.11.2/lib/bundler/version.rb0000644000004100000410000000033412652443364017503 0ustar www-datawww-datamodule Bundler # We're doing this because we might write tests that deal # with other versions of bundler and we are unsure how to # handle this better. VERSION = "1.11.2" unless defined?(::Bundler::VERSION) end bundler-1.11.2/lib/bundler/source/0000755000004100000410000000000012652443364016771 5ustar www-datawww-databundler-1.11.2/lib/bundler/source/git.rb0000644000004100000410000002054012652443364020102 0ustar www-datawww-datarequire "fileutils" require "uri" require "digest/sha1" module Bundler class Source class Git < Path autoload :GitProxy, "bundler/source/git/git_proxy" attr_reader :uri, :ref, :branch, :options, :submodules def initialize(options) @options = options @glob = options["glob"] || DEFAULT_GLOB @allow_cached = false @allow_remote = false # Stringify options that could be set as symbols %w(ref branch tag revision).each {|k| options[k] = options[k].to_s if options[k] } @uri = options["uri"] || "" @branch = options["branch"] @ref = options["ref"] || options["branch"] || options["tag"] || "master" @submodules = options["submodules"] @name = options["name"] @version = options["version"] @copied = false @local = false end def self.from_lock(options) new(options.merge("uri" => options.delete("remote"))) end def to_lock out = "GIT\n" out << " remote: #{@uri}\n" out << " revision: #{revision}\n" %w(ref branch tag submodules).each do |opt| out << " #{opt}: #{options[opt]}\n" if options[opt] end out << " glob: #{@glob}\n" unless @glob == DEFAULT_GLOB out << " specs:\n" end def hash [self.class, uri, ref, branch, name, version, submodules].hash end def eql?(other) other.is_a?(Git) && uri == other.uri && ref == other.ref && branch == other.branch && name == other.name && version == other.version && submodules == other.submodules end alias_method :==, :eql? def to_s at = if local? path elsif options["ref"] shortref_for_display(options["ref"]) else ref end rev = begin "@#{shortref_for_display(revision)}" rescue GitError nil end "#{uri} (at #{at}#{rev})" end def name File.basename(@uri, ".git") end # This is the path which is going to contain a specific # checkout of the git repository. When using local git # repos, this is set to the local repo. def install_path @install_path ||= begin git_scope = "#{base_name}-#{shortref_for_path(revision)}" path = Bundler.install_path.join(git_scope) if !path.exist? && Bundler.requires_sudo? Bundler.user_bundle_path.join(Bundler.ruby_scope).join(git_scope) else path end end end alias_method :path, :install_path def extension_dir_name "#{base_name}-#{shortref_for_path(revision)}" end def unlock! git_proxy.revision = nil @unlocked = true end def local_override!(path) return false if local? path = Pathname.new(path) path = path.expand_path(Bundler.root) unless path.relative? unless options["branch"] || Bundler.settings[:disable_local_branch_check] raise GitError, "Cannot use local override for #{name} at #{path} because " \ ":branch is not specified in Gemfile. Specify a branch or use " \ "`bundle config --delete` to remove the local override" end unless path.exist? raise GitError, "Cannot use local override for #{name} because #{path} " \ "does not exist. Check `bundle config --delete` to remove the local override" end set_local!(path) # Create a new git proxy without the cached revision # so the Gemfile.lock always picks up the new revision. @git_proxy = GitProxy.new(path, uri, ref) if git_proxy.branch != options["branch"] && !Bundler.settings[:disable_local_branch_check] raise GitError, "Local override for #{name} at #{path} is using branch " \ "#{git_proxy.branch} but Gemfile specifies #{options["branch"]}" end changed = cached_revision && cached_revision != git_proxy.revision if changed && !@unlocked && !git_proxy.contains?(cached_revision) raise GitError, "The Gemfile lock is pointing to revision #{shortref_for_display(cached_revision)} " \ "but the current branch in your local override for #{name} does not contain such commit. " \ "Please make sure your branch is up to date." end changed end # TODO: actually cache git specs def specs(*) set_local!(app_cache_path) if has_app_cache? && !local? if requires_checkout? && !@copied git_proxy.checkout git_proxy.copy_to(install_path, submodules) serialize_gemspecs_in(install_path) @copied = true end local_specs end def install(spec, force = false) Bundler.ui.info "Using #{version_message(spec)} from #{self}" if requires_checkout? && !@copied && !force Bundler.ui.debug " * Checking out revision: #{ref}" git_proxy.copy_to(install_path, submodules) serialize_gemspecs_in(install_path) @copied = true end generate_bin(spec) requires_checkout? ? spec.post_install_message : nil end def cache(spec, custom_path = nil) app_cache_path = app_cache_path(custom_path) return unless Bundler.settings[:cache_all] return if path == app_cache_path cached! FileUtils.rm_rf(app_cache_path) git_proxy.checkout if requires_checkout? git_proxy.copy_to(app_cache_path, @submodules) serialize_gemspecs_in(app_cache_path) end def load_spec_files super rescue PathError => e Bundler.ui.trace e raise GitError, "#{self} is not yet checked out. Run `bundle install` first." end # This is the path which is going to contain a cache # of the git repository. When using the same git repository # across different projects, this cache will be shared. # When using local git repos, this is set to the local repo. def cache_path @cache_path ||= begin git_scope = "#{base_name}-#{uri_hash}" if Bundler.requires_sudo? Bundler.user_bundle_path.join("cache/git", git_scope) else Bundler.cache.join("git", git_scope) end end end def app_cache_dirname "#{base_name}-#{shortref_for_path(cached_revision || revision)}" end def revision git_proxy.revision end def allow_git_ops? @allow_remote || @allow_cached end private def serialize_gemspecs_in(destination) expanded_path = destination.expand_path(Bundler.root) Dir["#{expanded_path}/#{@glob}"].each do |spec_path| # Evaluate gemspecs and cache the result. Gemspecs # in git might require git or other dependencies. # The gemspecs we cache should already be evaluated. spec = Bundler.load_gemspec(spec_path) next unless spec File.open(spec_path, "wb") {|file| file.write(spec.to_ruby) } end end def set_local!(path) @local = true @local_specs = @git_proxy = nil @cache_path = @install_path = path end def has_app_cache? cached_revision && super end def local? @local end def requires_checkout? allow_git_ops? && !local? end def base_name File.basename(uri.sub(%r{^(\w+://)?([^/:]+:)?(//\w*/)?(\w*/)*}, ""), ".git") end def shortref_for_display(ref) ref[0..6] end def shortref_for_path(ref) ref[0..11] end def uri_hash if uri =~ %r{^\w+://(\w+@)?} # Downcase the domain component of the URI # and strip off a trailing slash, if one is present input = URI.parse(uri).normalize.to_s.sub(%r{/$}, "") else # If there is no URI scheme, assume it is an ssh/git URI input = uri end Digest::SHA1.hexdigest(input) end def cached_revision options["revision"] end def cached? cache_path.exist? end def git_proxy @git_proxy ||= GitProxy.new(cache_path, uri, ref, cached_revision, self) end end end end bundler-1.11.2/lib/bundler/source/rubygems/0000755000004100000410000000000012652443364020626 5ustar www-datawww-databundler-1.11.2/lib/bundler/source/rubygems/remote.rb0000644000004100000410000000152012652443364022444 0ustar www-datawww-datamodule Bundler class Source class Rubygems class Remote attr_reader :uri, :anonymized_uri, :original_uri def initialize(uri) orig_uri = uri uri = Bundler.settings.mirror_for(uri) @original_uri = orig_uri if orig_uri != uri fallback_auth = Bundler.settings.credentials_for(uri) @uri = apply_auth(uri, fallback_auth).freeze @anonymized_uri = remove_auth(@uri).freeze end private def apply_auth(uri, auth) if auth && uri.userinfo.nil? uri = uri.dup uri.userinfo = auth end uri end def remove_auth(uri) if uri.userinfo uri = uri.dup uri.user = uri.password = nil end uri end end end end end bundler-1.11.2/lib/bundler/source/path.rb0000644000004100000410000001534412652443364020261 0ustar www-datawww-datamodule Bundler class Source class Path < Source autoload :Installer, "bundler/source/path/installer" attr_reader :path, :options attr_writer :name attr_accessor :version DEFAULT_GLOB = "{,*,*/*}.gemspec" def initialize(options) @options = options @glob = options["glob"] || DEFAULT_GLOB @allow_cached = false @allow_remote = false if options["path"] @path = Pathname.new(options["path"]) @path = expand(@path) unless @path.relative? end @name = options["name"] @version = options["version"] # Stores the original path. If at any point we move to the # cached directory, we still have the original path to copy from. @original_path = @path end def remote! @allow_remote = true end def cached! @allow_cached = true end def self.from_lock(options) new(options.merge("path" => options.delete("remote"))) end def to_lock out = "PATH\n" out << " remote: #{relative_path}\n" out << " glob: #{@glob}\n" unless @glob == DEFAULT_GLOB out << " specs:\n" end def to_s "source at `#{@path}`" end def hash [self.class, expanded_path, version].hash end def eql?(other) other.instance_of?(Path) && expanded_path == expand(other.path) && version == other.version end alias_method :==, :eql? def name File.basename(expanded_path.to_s) end def install(spec, force = false) Bundler.ui.info "Using #{version_message(spec)} from #{self}" generate_bin(spec, :disable_extensions) nil # no post-install message end def cache(spec, custom_path = nil) app_cache_path = app_cache_path(custom_path) return unless Bundler.settings[:cache_all] return if expand(@original_path).to_s.index(Bundler.root.to_s + "/") == 0 unless @original_path.exist? raise GemNotFound, "Can't cache gem #{version_message(spec)} because #{self} is missing!" end FileUtils.rm_rf(app_cache_path) FileUtils.cp_r("#{@original_path}/.", app_cache_path) FileUtils.touch(app_cache_path.join(".bundlecache")) end def local_specs(*) @local_specs ||= load_spec_files end def specs if has_app_cache? @path = app_cache_path @expanded_path = nil # Invalidate end local_specs end def app_cache_dirname name end private def expanded_path @expanded_path ||= expand(path) end def expand(somepath) somepath.expand_path(Bundler.root) rescue ArgumentError => e Bundler.ui.debug(e) raise PathError, "There was an error while trying to use the path " \ "`#{somepath}`.\nThe error message was: #{e.message}." end def app_cache_path(custom_path = nil) @app_cache_path ||= Bundler.app_cache(custom_path).join(app_cache_dirname) end def has_app_cache? SharedHelpers.in_bundle? && app_cache_path.exist? end def load_spec_files index = Index.new if File.directory?(expanded_path) # We sort depth-first since `<<` will override the earlier-found specs Dir["#{expanded_path}/#{@glob}"].sort_by {|p| -p.split(File::SEPARATOR).size }.each do |file| next unless spec = Bundler.load_gemspec(file, :validate) spec.loaded_from = file.to_s spec.source = self index << spec end if index.empty? && @name && @version index << Gem::Specification.new do |s| s.name = @name s.source = self s.version = Gem::Version.new(@version) s.platform = Gem::Platform::RUBY s.summary = "Fake gemspec for #{@name}" s.relative_loaded_from = "#{@name}.gemspec" s.authors = ["no one"] if expanded_path.join("bin").exist? executables = expanded_path.join("bin").children executables.reject! {|p| File.directory?(p) } s.executables = executables.map {|c| c.basename.to_s } end end end elsif File.exist?(expanded_path) raise PathError, "The path `#{expanded_path}` is not a directory." else raise PathError, "The path `#{expanded_path}` does not exist." end index end def relative_path if path.to_s.start_with?(Bundler.root.to_s) return path.relative_path_from(Bundler.root) end path end def generate_bin(spec, disable_extensions = false) gem_dir = Pathname.new(spec.full_gem_path) # Some gem authors put absolute paths in their gemspec # and we have to save them from themselves spec.files = spec.files.map do |p| next if File.directory?(p) begin Pathname.new(p).relative_path_from(gem_dir).to_s rescue ArgumentError p end end.compact SharedHelpers.chdir(gem_dir) do installer = Path::Installer.new(spec, :env_shebang => false) run_hooks(:pre_install, installer) installer.build_extensions unless disable_extensions run_hooks(:post_build, installer) installer.generate_bin run_hooks(:post_install, installer) end rescue Gem::InvalidSpecificationException => e Bundler.ui.warn "\n#{spec.name} at #{spec.full_gem_path} did not have a valid gemspec.\n" \ "This prevents bundler from installing bins or native extensions, but " \ "that may not affect its functionality." if !spec.extensions.empty? && !spec.email.empty? Bundler.ui.warn "If you need to use this package without installing it from a gem " \ "repository, please contact #{spec.email} and ask them " \ "to modify their .gemspec so it can work with `gem build`." end Bundler.ui.warn "The validation message from Rubygems was:\n #{e.message}" end def run_hooks(type, installer) hooks_meth = "#{type}_hooks" return unless Gem.respond_to?(hooks_meth) Gem.send(hooks_meth).each do |hook| result = hook.call(installer) next unless result == false location = " at #{$1}" if hook.inspect =~ /@(.*:\d+)/ message = "#{type} hook#{location} failed for #{installer.spec.full_name}" raise InstallHookError, message end end end end end bundler-1.11.2/lib/bundler/source/path/0000755000004100000410000000000012652443364017725 5ustar www-datawww-databundler-1.11.2/lib/bundler/source/path/installer.rb0000644000004100000410000000242212652443364022247 0ustar www-datawww-datamodule Bundler class Source class Path class Installer < Bundler::RubyGemsGemInstaller attr_reader :spec def initialize(spec, options = {}) @spec = spec @gem_dir = Bundler.rubygems.path(spec.full_gem_path) @wrappers = true @env_shebang = true @format_executable = options[:format_executable] || false @build_args = options[:build_args] || Bundler.rubygems.build_args @gem_bin_dir = "#{Bundler.rubygems.gem_dir}/bin" if Bundler.requires_sudo? @tmp_dir = Bundler.tmp(spec.full_name).to_s @bin_dir = "#{@tmp_dir}/bin" else @bin_dir = @gem_bin_dir end end def generate_bin return if spec.executables.nil? || spec.executables.empty? super if Bundler.requires_sudo? SharedHelpers.filesystem_access(@gem_bin_dir) do |p| Bundler.mkdir_p(p) end spec.executables.each do |exe| Bundler.sudo "cp -R #{@bin_dir}/#{exe} #{@gem_bin_dir}" end end ensure Bundler.rm_rf(@tmp_dir) if Bundler.requires_sudo? end end end end end bundler-1.11.2/lib/bundler/source/rubygems.rb0000644000004100000410000003427012652443364021161 0ustar www-datawww-datarequire "uri" require "rubygems/user_interaction" require "rubygems/spec_fetcher" module Bundler class Source class Rubygems < Source autoload :Remote, "bundler/source/rubygems/remote" # Use the API when installing less than X gems API_REQUEST_LIMIT = 500 # Ask for X gems per API request API_REQUEST_SIZE = 50 attr_reader :remotes, :caches def initialize(options = {}) @options = options @remotes = [] @dependency_names = [] @allow_remote = false @allow_cached = false @caches = [Bundler.app_cache, *Bundler.rubygems.gem_cache] Array(options["remotes"] || []).reverse_each {|r| add_remote(r) } end def remote! @allow_remote = true end def cached! @allow_cached = true end def hash @remotes.hash end def eql?(other) other.is_a?(Rubygems) && other.credless_remotes == credless_remotes end alias_method :==, :eql? def include?(o) o.is_a?(Rubygems) && (o.credless_remotes - credless_remotes).empty? end def can_lock?(spec) spec.source.is_a?(Rubygems) end def options { "remotes" => @remotes.map(&:to_s) } end def self.from_lock(options) new(options) end def to_lock out = "GEM\n" remotes.reverse_each do |remote| out << " remote: #{suppress_configured_credentials remote}\n" end out << " specs:\n" end def to_s remote_names = remotes.map(&:to_s).join(", ") "rubygems repository #{remote_names}" end alias_method :name, :to_s def specs @specs ||= begin # remote_specs usually generates a way larger Index than the other # sources, and large_idx.use small_idx is way faster than # small_idx.use large_idx. idx = @allow_remote ? remote_specs.dup : Index.new idx.use(cached_specs, :override_dupes) if @allow_cached || @allow_remote idx.use(installed_specs, :override_dupes) idx end end def install(spec, opts = {}) force = opts[:force] ensure_builtin_gems_cached = opts[:ensure_builtin_gems_cached] if ensure_builtin_gems_cached && builtin_gem?(spec) if !cached_path(spec) cached_built_in_gem(spec) unless spec.remote force = true else spec.loaded_from = loaded_from(spec) end end if installed?(spec) && (!force || spec.name.eql?("bundler")) Bundler.ui.info "Using #{version_message(spec)}" return nil # no post-install message end # Download the gem to get the spec, because some specs that are returned # by rubygems.org are broken and wrong. if spec.remote # Check for this spec from other sources uris = [spec.remote.anonymized_uri] uris += remotes_for_spec(spec).map(&:anonymized_uri) uris.uniq! Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1 s = Bundler.rubygems.spec_from_gem(fetch_gem(spec), Bundler.settings["trust-policy"]) spec.__swap__(s) end unless Bundler.settings[:no_install] message = "Installing #{version_message(spec)}" message << " with native extensions" if spec.extensions.any? Bundler.ui.confirm message path = cached_gem(spec) if Bundler.requires_sudo? install_path = Bundler.tmp(spec.full_name) bin_path = install_path.join("bin") else install_path = Bundler.rubygems.gem_dir bin_path = Bundler.system_bindir end installed_spec = nil Bundler.rubygems.preserve_paths do installed_spec = Bundler::RubyGemsGemInstaller.new( path, :install_dir => install_path.to_s, :bin_dir => bin_path.to_s, :ignore_dependencies => true, :wrappers => true, :env_shebang => true ).install end # SUDO HAX if Bundler.requires_sudo? Bundler.rubygems.repository_subdirectories.each do |name| src = File.join(install_path, name, "*") dst = File.join(Bundler.rubygems.gem_dir, name) if name == "extensions" && Dir.glob(src).any? src = File.join(src, "*/*") ext_src = Dir.glob(src).first ext_src.gsub!(src[0..-6], "") dst = File.dirname(File.join(dst, ext_src)) end SharedHelpers.filesystem_access(dst) do |p| Bundler.mkdir_p(p) end Bundler.sudo "cp -R #{src} #{dst}" if Dir[src].any? end spec.executables.each do |exe| SharedHelpers.filesystem_access(Bundler.system_bindir) do |p| Bundler.mkdir_p(p) end Bundler.sudo "cp -R #{install_path}/bin/#{exe} #{Bundler.system_bindir}/" end end installed_spec.loaded_from = loaded_from(spec) end spec.loaded_from = loaded_from(spec) spec.post_install_message ensure Bundler.rm_rf(install_path) if Bundler.requires_sudo? end def cache(spec, custom_path = nil) if builtin_gem?(spec) cached_path = cached_built_in_gem(spec) else cached_path = cached_gem(spec) end raise GemNotFound, "Missing gem file '#{spec.full_name}.gem'." unless cached_path return if File.dirname(cached_path) == Bundler.app_cache.to_s Bundler.ui.info " * #{File.basename(cached_path)}" FileUtils.cp(cached_path, Bundler.app_cache(custom_path)) rescue Errno::EACCES => e Bundler.ui.debug(e) raise InstallError, e.message end def cached_built_in_gem(spec) cached_path = cached_path(spec) if cached_path.nil? remote_spec = remote_specs.search(spec).first if remote_spec cached_path = fetch_gem(remote_spec) else Bundler.ui.warn "#{spec.full_name} is built in to Ruby, and can't be cached because your Gemfile doesn't have any sources that contain it." end end cached_path end def add_remote(source) uri = normalize_uri(source) @remotes.unshift(uri) unless @remotes.include?(uri) end def replace_remotes(other_remotes) return false if other_remotes == @remotes @remotes = [] other_remotes.reverse_each do |r| add_remote r.to_s end end def unmet_deps if @allow_remote && api_fetchers.any? remote_specs.unmet_dependency_names else [] end end def fetchers @fetchers ||= remotes.map do |uri| remote = Source::Rubygems::Remote.new(uri) Bundler::Fetcher.new(remote) end end protected def credless_remotes remotes.map(&method(:suppress_configured_credentials)) end def remotes_for_spec(spec) specs.search_all(spec.name).inject([]) do |uris, s| uris << s.remote if s.remote uris end end def loaded_from(spec) "#{Bundler.rubygems.gem_dir}/specifications/#{spec.full_name}.gemspec" end def cached_gem(spec) cached_gem = cached_path(spec) unless cached_gem raise Bundler::GemNotFound, "Could not find #{spec.file_name} for installation" end cached_gem end def cached_path(spec) possibilities = @caches.map {|p| "#{p}/#{spec.file_name}" } possibilities.find {|p| File.exist?(p) } end def normalize_uri(uri) uri = uri.to_s uri = "#{uri}/" unless uri =~ %r{/$} uri = URI(uri) raise ArgumentError, "The source must be an absolute URI. For example:\n" \ "source 'https://rubygems.org'" if !uri.absolute? || (uri.is_a?(URI::HTTP) && uri.host.nil?) uri end def suppress_configured_credentials(remote) remote_nouser = remote.dup.tap {|uri| uri.user = uri.password = nil }.to_s if remote.userinfo && remote.userinfo == Bundler.settings[remote_nouser] remote_nouser else remote end end def installed_specs @installed_specs ||= begin idx = Index.new have_bundler = false Bundler.rubygems.all_specs.reverse_each do |spec| next if spec.name == "bundler" && spec.version.to_s != VERSION have_bundler = true if spec.name == "bundler" spec.source = self idx << spec end # Always have bundler locally unless have_bundler # We're running bundler directly from the source # so, let's create a fake gemspec for it (it's a path) # gemspec bundler = Gem::Specification.new do |s| s.name = "bundler" s.version = VERSION s.platform = Gem::Platform::RUBY s.source = self s.authors = ["bundler team"] s.loaded_from = File.expand_path("..", __FILE__) end idx << bundler end idx end end def cached_specs @cached_specs ||= begin idx = installed_specs.dup path = Bundler.app_cache Dir["#{path}/*.gem"].each do |gemfile| next if gemfile =~ /^bundler\-[\d\.]+?\.gem/ s ||= Bundler.rubygems.spec_from_gem(gemfile) s.source = self idx << s end end idx end def api_fetchers fetchers.select(&:use_api) end def remote_specs @remote_specs ||= Index.build do |idx| index_fetchers = fetchers - api_fetchers # gather lists from non-api sites index_fetchers.each do |f| Bundler.ui.info "Fetching source index from #{f.uri}" idx.use f.specs_with_retry(nil, self) end # because ensuring we have all the gems we need involves downloading # the gemspecs of those gems, if the non-api sites contain more than # about 100 gems, we just treat all sites as non-api for speed. allow_api = idx.size < API_REQUEST_LIMIT && dependency_names.size < API_REQUEST_LIMIT Bundler.ui.debug "Need to query more than #{API_REQUEST_LIMIT} gems." \ " Downloading full index instead..." unless allow_api if allow_api api_fetchers.each do |f| Bundler.ui.info "Fetching gem metadata from #{f.uri}", Bundler.ui.debug? idx.use f.specs_with_retry(dependency_names, self) Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over end # Suppose the gem Foo depends on the gem Bar. Foo exists in Source A. Bar has some versions that exist in both # sources A and B. At this point, the API request will have found all the versions of Bar in source A, # but will not have found any versions of Bar from source B, which is a problem if the requested version # of Foo specifically depends on a version of Bar that is only found in source B. This ensures that for # each spec we found, we add all possible versions from all sources to the index. loop do idxcount = idx.size api_fetchers.each do |f| Bundler.ui.info "Fetching version metadata from #{f.uri}", Bundler.ui.debug? idx.use f.specs_with_retry(idx.dependency_names, self), true Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over end break if idxcount == idx.size end if api_fetchers.any? # it's possible that gems from one source depend on gems from some # other source, so now we download gemspecs and iterate over those # dependencies, looking for gems we don't have info on yet. unmet = idx.unmet_dependency_names # if there are any cross-site gems we missed, get them now api_fetchers.each do |f| Bundler.ui.info "Fetching dependency metadata from #{f.uri}", Bundler.ui.debug? idx.use f.specs_with_retry(unmet, self) Bundler.ui.info "" unless Bundler.ui.debug? # new line now that the dots are over end if unmet.any? else allow_api = false end end unless allow_api api_fetchers.each do |f| Bundler.ui.info "Fetching source index from #{f.uri}" idx.use f.specs_with_retry(nil, self) end end end end def fetch_gem(spec) return false unless spec.remote uri = spec.remote.uri spec.fetch_platform download_path = Bundler.requires_sudo? ? Bundler.tmp(spec.full_name) : Bundler.rubygems.gem_dir gem_path = "#{Bundler.rubygems.gem_dir}/cache/#{spec.full_name}.gem" SharedHelpers.filesystem_access("#{download_path}/cache") do |p| FileUtils.mkdir_p(p) end Bundler.rubygems.download_gem(spec, uri, download_path) if Bundler.requires_sudo? SharedHelpers.filesystem_access("#{Bundler.rubygems.gem_dir}/cache") do |p| Bundler.mkdir_p(p) end Bundler.sudo "mv #{download_path}/cache/#{spec.full_name}.gem #{gem_path}" end gem_path ensure Bundler.rm_rf(download_path) if Bundler.requires_sudo? end def builtin_gem?(spec) # Ruby 2.1, where all included gems have this summary return true if spec.summary =~ /is bundled with Ruby/ # Ruby 2.0, where gemspecs are stored in specifications/default/ spec.loaded_from && spec.loaded_from.include?("specifications/default/") end def installed?(spec) installed_specs[spec].any? end end end end bundler-1.11.2/lib/bundler/source/git/0000755000004100000410000000000012652443364017554 5ustar www-datawww-databundler-1.11.2/lib/bundler/source/git/git_proxy.rb0000644000004100000410000001517512652443364022136 0ustar www-datawww-datamodule Bundler class Source class Git < Path class GitNotInstalledError < GitError def initialize msg = "You need to install git to be able to use gems from git repositories. " msg << "For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git" super msg end end class GitNotAllowedError < GitError def initialize(command) msg = "Bundler is trying to run a `git #{command}` at runtime. You probably need to run `bundle install`. However, " msg << "this error message could probably be more useful. Please submit a ticket at http://github.com/bundler/bundler/issues " msg << "with steps to reproduce as well as the following\n\nCALLER: #{caller.join("\n")}" super msg end end class GitCommandError < GitError def initialize(command, path = nil, extra_info = nil) msg = "Git error: command `git #{command}` in directory #{SharedHelpers.pwd} has failed." msg << "\n#{extra_info}" if extra_info msg << "\nIf this error persists you could try removing the cache directory '#{path}'" if path && path.exist? super msg end end # The GitProxy is responsible to interact with git repositories. # All actions required by the Git source is encapsulated in this # object. class GitProxy attr_accessor :path, :uri, :ref attr_writer :revision def initialize(path, uri, ref, revision = nil, git = nil) @path = path @uri = uri @ref = ref @revision = revision @git = git raise GitNotInstalledError.new if allow? && !Bundler.git_present? end def revision @revision ||= allowed_in_path do msg = "Ref '#{ref}' was not found. Perhaps you mispelled it?" git("rev-parse --verify #{ref}", true, msg).strip end end def branch @branch ||= allowed_in_path do git("branch") =~ /^\* (.*)$/ && $1.strip end end def contains?(commit) allowed_in_path do result = git_null("branch --contains #{commit}") $? == 0 && result =~ /^\* (.*)$/ end end def version git("--version").sub("git version", "").strip end def checkout if path.exist? return if has_revision_cached? Bundler.ui.info "Fetching #{uri}" in_path do git_retry %(fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*") end else Bundler.ui.info "Fetching #{uri}" SharedHelpers.filesystem_access(path.dirname) do |p| FileUtils.mkdir_p(p) end git_retry %(clone #{uri_escaped_with_configured_credentials} "#{path}" --bare --no-hardlinks --quiet) end end def copy_to(destination, submodules = false) # method 1 unless File.exist?(destination.join(".git")) begin SharedHelpers.filesystem_access(destination.dirname) do |p| FileUtils.mkdir_p(p) end SharedHelpers.filesystem_access(destination) do |p| FileUtils.rm_rf(p) end git_retry %(clone --no-checkout --quiet "#{path}" "#{destination}") File.chmod(((File.stat(destination).mode | 0777) & ~File.umask), destination) rescue Errno::EEXIST => e file_path = e.message[%r{.*?(/.*)}, 1] raise GitError, "Bundler could not install a gem because it needs to " \ "create a directory, but a file exists - #{file_path}. Please delete " \ "this file and try again." end end # method 2 SharedHelpers.chdir(destination) do git_retry %(fetch --force --quiet --tags "#{path}") git "reset --hard #{@revision}" git_retry "submodule update --init --recursive" if submodules end end private # TODO: Do not rely on /dev/null. # Given that open3 is not cross platform until Ruby 1.9.3, # the best solution is to pipe to /dev/null if it exists. # If it doesn't, everything will work fine, but the user # will get the $stderr messages as well. def git_null(command) git("#{command} 2>#{Bundler::NULL}", false) end def git_retry(command) Bundler::Retry.new("git #{command}", GitNotAllowedError).attempts do git(command) end end def git(command, check_errors = true, error_msg = nil) raise GitNotAllowedError.new(command) unless allow? out = SharedHelpers.with_clean_git_env { `git #{command}` } raise GitCommandError.new(command, path, error_msg) if check_errors && !$?.success? out end def has_revision_cached? return unless @revision in_path { git("cat-file -e #{@revision}") } true rescue GitError false end # Escape the URI for git commands def uri_escaped_with_configured_credentials remote = configured_uri_for(uri) if Bundler::WINDOWS # Windows quoting requires double quotes only, with double quotes # inside the string escaped by being doubled. '"' + remote.gsub('"') { '""' } + '"' else # Bash requires single quoted strings, with the single quotes escaped # by ending the string, escaping the quote, and restarting the string. "'" + remote.gsub("'") { "'\\''" } + "'" end end # Adds credentials to the URI as Fetcher#configured_uri_for does def configured_uri_for(uri) if /https?:/ =~ uri remote = URI(uri) config_auth = Bundler.settings[remote.to_s] || Bundler.settings[remote.host] remote.userinfo ||= config_auth remote.to_s else uri end end def allow? @git ? @git.allow_git_ops? : true end def in_path(&blk) checkout unless path.exist? SharedHelpers.chdir(path, &blk) end def allowed_in_path return in_path { yield } if allow? raise GitError, "The git source #{uri} is not yet checked out. Please run `bundle install` before trying to start your application" end end end end end bundler-1.11.2/lib/bundler/spec_set.rb0000644000004100000410000000721612652443364017631 0ustar www-datawww-datarequire "tsort" require "forwardable" module Bundler class SpecSet extend Forwardable include TSort, Enumerable def_delegators :@specs, :<<, :length, :add, :remove def_delegators :sorted, :each def initialize(specs) @specs = specs.sort_by(&:name) end def for(dependencies, skip = [], check = false, match_current_platform = false) handled = {} deps = dependencies.dup specs = [] skip << "bundler" until deps.empty? dep = deps.shift next if handled[dep] || skip.include?(dep.name) spec = lookup[dep.name].find do |s| if match_current_platform Gem::Platform.match(s.platform) else s.match_platform(dep.__platform) end end handled[dep] = true if spec specs << spec spec.dependencies.each do |d| next if d.type == :development d = DepProxy.new(d, dep.__platform) unless match_current_platform deps << d end elsif check return false end end if spec = lookup["bundler"].first specs << spec end check ? true : SpecSet.new(specs) end def valid_for?(deps) self.for(deps, [], true) end def [](key) key = key.name if key.respond_to?(:name) lookup[key].reverse end def []=(key, value) @specs << value @lookup = nil @sorted = nil value end def sort! self end def to_a sorted.dup end def to_hash lookup.dup end def materialize(deps, missing_specs = nil) materialized = self.for(deps, [], false, true).to_a deps = materialized.map(&:name).uniq materialized.map! do |s| next s unless s.is_a?(LazySpecification) s.source.dependency_names = deps if s.source.respond_to?(:dependency_names=) spec = s.__materialize__ if missing_specs missing_specs << s unless spec else raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec end spec if spec end SpecSet.new(materialized.compact) end def merge(set) arr = sorted.dup set.each do |s| next if arr.any? {|s2| s2.name == s.name && s2.version == s.version && s2.platform == s.platform } arr << s end SpecSet.new(arr) end private def sorted rake = @specs.find {|s| s.name == "rake" } begin @sorted ||= ([rake] + tsort).compact.uniq rescue TSort::Cyclic => error cgems = extract_circular_gems(error) raise CyclicDependencyError, "Your bundle requires gems that depend" \ " depend on each other, creating an infinite loop. Please remove" \ " either gem '#{cgems[1]}' or gem '#{cgems[0]}' and try again." end end def extract_circular_gems(error) if Bundler.current_ruby.mri? && Bundler.current_ruby.on_19? error.message.scan(/(\w+) \([^)]/).flatten else error.message.scan(/@name="(.*?)"/).flatten end end def lookup @lookup ||= begin lookup = Hash.new {|h, k| h[k] = [] } specs = @specs.sort_by do |s| s.platform.to_s == "ruby" ? "\0" : s.platform.to_s end specs.reverse_each do |s| lookup[s.name] << s end lookup end end def tsort_each_node @specs.each {|s| yield s } end def tsort_each_child(s) s.dependencies.sort_by(&:name).each do |d| next if d.type == :development lookup[d.name].each {|s2| yield s2 } end end end end bundler-1.11.2/lib/bundler/fetcher.rb0000644000004100000410000002276612652443364017453 0ustar www-datawww-datarequire "bundler/vendored_persistent" require "cgi" require "securerandom" require "zlib" module Bundler # Handles all the fetching with the rubygems server class Fetcher autoload :Downloader, "bundler/fetcher/downloader" autoload :Dependency, "bundler/fetcher/dependency" autoload :Index, "bundler/fetcher/index" # This error is raised when it looks like the network is down class NetworkDownError < HTTPError; end # This error is raised if the API returns a 413 (only printed in verbose) class FallbackError < HTTPError; end # This is the error raised if OpenSSL fails the cert verification class CertificateFailureError < HTTPError def initialize(remote_uri) super "Could not verify the SSL certificate for #{remote_uri}.\nThere" \ " is a chance you are experiencing a man-in-the-middle attack, but" \ " most likely your system doesn't have the CA certificates needed" \ " for verification. For information about OpenSSL certificates, see" \ " http://bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile" \ " sources and change 'https' to 'http'." end end # This is the error raised when a source is HTTPS and OpenSSL didn't load class SSLError < HTTPError def initialize(msg = nil) super msg || "Could not load OpenSSL.\n" \ "You must recompile Ruby with OpenSSL support or change the sources in your " \ "Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL " \ "using RVM are available at rvm.io/packages/openssl." end end # This error is raised if HTTP authentication is required, but not provided. class AuthenticationRequiredError < HTTPError def initialize(remote_uri) super "Authentication is required for #{remote_uri}.\n" \ "Please supply credentials for this source. You can do this by running:\n" \ " bundle config #{remote_uri} username:password" end end # This error is raised if HTTP authentication is provided, but incorrect. class BadAuthenticationError < HTTPError def initialize(remote_uri) super "Bad username or password for #{remote_uri}.\n" \ "Please double-check your credentials and correct them." end end # Exceptions classes that should bypass retry attempts. If your password didn't work the # first time, it's not going to the third time. AUTH_ERRORS = [AuthenticationRequiredError, BadAuthenticationError, Net::HTTPBadGateway, Net::HTTPBadRequest, Net::HTTPForbidden, Net::HTTPMethodNotAllowed, Net::HTTPMovedPermanently, Net::HTTPNotImplemented, Net::HTTPNotFound, Net::HTTPRequestEntityTooLarge, Net::HTTPNoContent] class << self attr_accessor :disable_endpoint, :api_timeout, :redirect_limit, :max_retries end self.redirect_limit = Bundler.settings[:redirect] # How many redirects to allow in one request self.api_timeout = Bundler.settings[:timeout] # How long to wait for each API call self.max_retries = Bundler.settings[:retry] # How many retries for the API call def initialize(remote) @remote = remote Socket.do_not_reverse_lookup = true connection # create persistent connection end def uri @remote.anonymized_uri end # fetch a gem specification def fetch_spec(spec) spec -= [nil, "ruby", ""] spec_file_name = "#{spec.join "-"}.gemspec" uri = URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz") if uri.scheme == "file" Bundler.load_marshal Gem.inflate(Gem.read_binary(uri.path)) elsif cached_spec_path = gemspec_cached_path(spec_file_name) Bundler.load_gemspec(cached_spec_path) else Bundler.load_marshal Gem.inflate(downloader.fetch uri) end rescue MarshalError raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \ "Your network or your gem server is probably having issues right now." end # return the specs in the bundler format as an index with retries def specs_with_retry(gem_names, source) Bundler::Retry.new("fetcher").attempts do specs(gem_names, source) end end # return the specs in the bundler format as an index def specs(gem_names, source) old = Bundler.rubygems.sources index = Bundler::Index.new specs = {} fetchers.dup.each do |f| break unless f.api_fetcher? && !gem_names || !specs = f.specs(gem_names) fetchers.delete(f) end @use_api = false if fetchers.none?(&:api_fetcher?) specs[remote_uri].each do |name, version, platform, dependencies| next if name == "bundler" spec = nil if dependencies spec = EndpointSpecification.new(name, version, platform, dependencies) else spec = RemoteSpecification.new(name, version, platform, self) end spec.source = source spec.remote = @remote index << spec end index rescue CertificateFailureError Bundler.ui.info "" if gem_names && use_api # newline after dots raise ensure Bundler.rubygems.sources = old end def use_api return @use_api if defined?(@use_api) if remote_uri.scheme == "file" || Bundler::Fetcher.disable_endpoint @use_api = false else fetchers.reject! {|f| f.api_fetcher? && !f.api_available? } @use_api = fetchers.any?(&:api_fetcher?) end end def user_agent @user_agent ||= begin ruby = Bundler.ruby_version agent = "bundler/#{Bundler::VERSION}" agent << " rubygems/#{Gem::VERSION}" agent << " ruby/#{ruby.version}" agent << " (#{ruby.host})" agent << " command/#{ARGV.first}" if ruby.engine != "ruby" # engine_version raises on unknown engines engine_version = begin ruby.engine_version rescue "???" end agent << " #{ruby.engine}/#{engine_version}" end agent << " options/#{Bundler.settings.all.join(",")}" agent << " ci/#{cis.join(",")}" if cis.any? # add a random ID so we can consolidate runs server-side agent << " " << SecureRandom.hex(8) # add any user agent strings set in the config extra_ua = Bundler.settings[:user_agent] agent << " " << extra_ua if extra_ua agent end end def fetchers @fetchers ||= FETCHERS.map {|f| f.new(downloader, @remote, uri) } end def http_proxy if uri = connection.proxy_uri uri.to_s end end def inspect "#<#{self.class}:0x#{object_id} uri=#{uri}>" end private FETCHERS = [Dependency, Index] def cis env_cis = { "TRAVIS" => "travis", "CIRCLECI" => "circle", "SEMAPHORE" => "semaphore", "JENKINS_URL" => "jenkins", "BUILDBOX" => "buildbox", "GO_SERVER_URL" => "go", "SNAP_CI" => "snap", "CI_NAME" => ENV["CI_NAME"], "CI" => "ci" } env_cis.find_all {|env, _| ENV[env] }.map {|_, ci| ci } end def connection @connection ||= begin needs_ssl = remote_uri.scheme == "https" || Bundler.settings[:ssl_verify_mode] || Bundler.settings[:ssl_client_cert] raise SSLError if needs_ssl && !defined?(OpenSSL::SSL) con = Net::HTTP::Persistent.new "bundler", :ENV if gem_proxy = Bundler.rubygems.configuration[:http_proxy] con.proxy = URI.parse(gem_proxy) end if remote_uri.scheme == "https" con.verify_mode = (Bundler.settings[:ssl_verify_mode] || OpenSSL::SSL::VERIFY_PEER) con.cert_store = bundler_cert_store end if Bundler.settings[:ssl_client_cert] pem = File.read(Bundler.settings[:ssl_client_cert]) con.cert = OpenSSL::X509::Certificate.new(pem) con.key = OpenSSL::PKey::RSA.new(pem) end con.read_timeout = Fetcher.api_timeout con.override_headers["User-Agent"] = user_agent con.override_headers["X-Gemfile-Source"] = @remote.original_uri.to_s if @remote.original_uri con end end # cached gem specification path, if one exists def gemspec_cached_path(spec_file_name) paths = Bundler.rubygems.spec_cache_dirs.map {|dir| File.join(dir, spec_file_name) } paths = paths.select {|path| File.file? path } paths.first end HTTP_ERRORS = [ Timeout::Error, EOFError, SocketError, Errno::ENETDOWN, Errno::ENETUNREACH, Errno::EINVAL, Errno::ECONNRESET, Errno::ETIMEDOUT, Errno::EAGAIN, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError, Net::HTTP::Persistent::Error, Zlib::BufError ] def bundler_cert_store store = OpenSSL::X509::Store.new if Bundler.settings[:ssl_ca_cert] if File.directory? Bundler.settings[:ssl_ca_cert] store.add_path Bundler.settings[:ssl_ca_cert] else store.add_file Bundler.settings[:ssl_ca_cert] end else store.set_default_paths certs = File.expand_path("../ssl_certs/*.pem", __FILE__) Dir.glob(certs).each {|c| store.add_file c } end store end private def remote_uri @remote.uri end def downloader @downloader ||= Downloader.new(connection, self.class.redirect_limit) end end end bundler-1.11.2/lib/bundler/definition.rb0000644000004100000410000005462612652443364020163 0ustar www-datawww-datarequire "bundler/lockfile_parser" require "digest/sha1" require "set" module Bundler class Definition include GemHelpers attr_reader :dependencies, :platforms, :ruby_version, :locked_deps # Given a gemfile and lockfile creates a Bundler definition # # @param gemfile [Pathname] Path to Gemfile # @param lockfile [Pathname,nil] Path to Gemfile.lock # @param unlock [Hash, Boolean, nil] Gems that have been requested # to be updated or true if all gems should be updated # @return [Bundler::Definition] def self.build(gemfile, lockfile, unlock) unlock ||= {} gemfile = Pathname.new(gemfile).expand_path raise GemfileNotFound, "#{gemfile} not found" unless gemfile.file? Dsl.evaluate(gemfile, lockfile, unlock) end # # How does the new system work? # # * Load information from Gemfile and Lockfile # * Invalidate stale locked specs # * All specs from stale source are stale # * All specs that are reachable only through a stale # dependency are stale. # * If all fresh dependencies are satisfied by the locked # specs, then we can try to resolve locally. # # @param lockfile [Pathname] Path to Gemfile.lock # @param dependencies [Array(Bundler::Dependency)] array of dependencies from Gemfile # @param sources [Bundler::SourceList] # @param unlock [Hash, Boolean, nil] Gems that have been requested # to be updated or true if all gems should be updated # @param ruby_version [Bundler::RubyVersion, nil] Requested Ruby Version # @param optional_groups [Array(String)] A list of optional groups def initialize(lockfile, dependencies, sources, unlock, ruby_version = nil, optional_groups = []) @unlocking = unlock == true || !unlock.empty? @dependencies = dependencies @sources = sources @unlock = unlock @optional_groups = optional_groups @remote = false @specs = nil @ruby_version = ruby_version @lockfile_contents = "" @locked_bundler_version = nil if lockfile && File.exist?(lockfile) @lockfile_contents = Bundler.read_file(lockfile) locked = LockfileParser.new(@lockfile_contents) @platforms = locked.platforms @locked_bundler_version = locked.bundler_version if unlock != true @locked_deps = locked.dependencies @locked_specs = SpecSet.new(locked.specs) @locked_sources = locked.sources else @unlock = {} @locked_deps = [] @locked_specs = SpecSet.new([]) @locked_sources = [] end else @unlock = {} @platforms = [] @locked_deps = [] @locked_specs = SpecSet.new([]) @locked_sources = [] end @unlock[:gems] ||= [] @unlock[:sources] ||= [] current_platform = Bundler.rubygems.platforms.map {|p| generic(p) }.compact.last @new_platform = !@platforms.include?(current_platform) @platforms |= [current_platform] @path_changes = converge_paths eager_unlock = expand_dependencies(@unlock[:gems]) @unlock[:gems] = @locked_specs.for(eager_unlock).map(&:name) @source_changes = converge_sources @dependency_changes = converge_dependencies @local_changes = converge_locals fixup_dependency_types! end def fixup_dependency_types! # XXX This is a temporary workaround for a bug when using rubygems 1.8.15 # where Gem::Dependency#== matches Gem::Dependency#type. As the lockfile # doesn't carry a notion of the dependency type, if you use # add_development_dependency in a gemspec that's loaded with the gemspec # directive, the lockfile dependencies and resolved dependencies end up # with a mismatch on #type. # Test coverage to catch a regression on this is in gemspec_spec.rb @dependencies.each do |d| if ld = @locked_deps.find {|l| l.name == d.name } ld.instance_variable_set(:@type, d.type) end end end def resolve_with_cache! raise "Specs already loaded" if @specs sources.cached! specs end def resolve_remotely! raise "Specs already loaded" if @specs @remote = true sources.remote! specs end # For given dependency list returns a SpecSet with Gemspec of all the required # dependencies. # 1. The method first resolves the dependencies specified in Gemfile # 2. After that it tries and fetches gemspec of resolved dependencies # # @return [Bundler::SpecSet] def specs @specs ||= begin specs = resolve.materialize(Bundler.settings[:cache_all_platforms] ? dependencies : requested_dependencies) unless specs["bundler"].any? local = Bundler.settings[:frozen] ? rubygems_index : index bundler = local.search(Gem::Dependency.new("bundler", VERSION)).last specs["bundler"] = bundler if bundler end specs end end def new_specs specs - @locked_specs end def removed_specs @locked_specs - specs end def new_platform? @new_platform end def missing_specs missing = [] resolve.materialize(requested_dependencies, missing) missing end def requested_specs @requested_specs ||= begin groups = requested_groups groups.map!(&:to_sym) specs_for(groups) end end def current_dependencies dependencies.reject {|d| !d.should_include? } end def specs_for(groups) deps = dependencies.select {|d| (d.groups & groups).any? } deps.delete_if {|d| !d.should_include? } specs.for(expand_dependencies(deps)) end # Resolve all the dependencies specified in Gemfile. It ensures that # dependencies that have been already resolved via locked file and are fresh # are reused when resolving dependencies # # @return [SpecSet] resolved dependencies def resolve @resolve ||= begin last_resolve = converge_locked_specs if Bundler.settings[:frozen] || (!@unlocking && nothing_changed?) last_resolve else # Run a resolve against the locally available gems requested_ruby_version = ruby_version.version if ruby_version last_resolve.merge Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve, requested_ruby_version) end end end def index @index ||= Index.build do |idx| dependency_names = @dependencies.map(&:name) sources.all_sources.each do |source| source.dependency_names = dependency_names.dup idx.add_source source.specs dependency_names -= pinned_spec_names(source.specs) dependency_names.push(*source.unmet_deps).uniq! end end end # used when frozen is enabled so we can find the bundler # spec, even if (say) a git gem is not checked out. def rubygems_index @rubygems_index ||= Index.build do |idx| sources.rubygems_sources.each do |rubygems| idx.add_source rubygems.specs end end end def has_rubygems_remotes? sources.rubygems_sources.any? {|s| s.remotes.any? } end def has_local_dependencies? !sources.path_sources.empty? || !sources.git_sources.empty? end def spec_git_paths sources.git_sources.map {|s| s.path.to_s } end def groups dependencies.map(&:groups).flatten.uniq end def lock(file, preserve_bundled_with = false) contents = to_lock # Convert to \r\n if the existing lock has them # i.e., Windows with `git config core.autocrlf=true` contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match("\r\n") if @locked_bundler_version locked_major = @locked_bundler_version.segments.first current_major = Gem::Version.create(Bundler::VERSION).segments.first if updating_major = locked_major < current_major Bundler.ui.warn "Warning: the lockfile is being updated to Bundler #{current_major}, " \ "after which you will be unable to return to Bundler #{@locked_bundler_version.segments.first}." end end preserve_bundled_with ||= !updating_major && (Bundler.settings[:frozen] || !@unlocking) return if lockfiles_equal?(@lockfile_contents, contents, preserve_bundled_with) if Bundler.settings[:frozen] Bundler.ui.error "Cannot write a changed lockfile while frozen." return end SharedHelpers.filesystem_access(file) do |p| File.open(p, "wb") {|f| f.puts(contents) } end end # Returns the version of Bundler that is creating or has created # Gemfile.lock. Used in #to_lock. def lock_version if @locked_bundler_version && @locked_bundler_version < Gem::Version.new(Bundler::VERSION) new_version = Bundler::VERSION end new_version || @locked_bundler_version || Bundler::VERSION end def to_lock out = "" sources.lock_sources.each do |source| # Add the source header out << source.to_lock # Find all specs for this source resolve. select {|s| source.can_lock?(s) }. # This needs to be sorted by full name so that # gems with the same name, but different platform # are ordered consistently sort_by(&:full_name). each do |spec| next if spec.name == "bundler" out << spec.to_lock end out << "\n" end out << "PLATFORMS\n" platforms.map(&:to_s).sort.each do |p| out << " #{p}\n" end out << "\n" out << "DEPENDENCIES\n" handled = [] dependencies.sort_by(&:to_s).each do |dep| next if handled.include?(dep.name) out << dep.to_lock handled << dep.name end # Record the version of Bundler that was used to create the lockfile out << "\nBUNDLED WITH\n" out << " #{lock_version}\n" out end def ensure_equivalent_gemfile_and_lockfile(explicit_flag = false) msg = "You are trying to install in deployment mode after changing\n" \ "your Gemfile. Run `bundle install` elsewhere and add the\n" \ "updated #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} to version control." unless explicit_flag msg += "\n\nIf this is a development machine, remove the #{Bundler.default_gemfile} " \ "freeze \nby running `bundle install --no-deployment`." end added = [] deleted = [] changed = [] gemfile_sources = sources.lock_sources if @locked_sources != gemfile_sources new_sources = gemfile_sources - @locked_sources deleted_sources = @locked_sources - gemfile_sources if new_sources.any? added.concat new_sources.map {|source| "* source: #{source}" } end if deleted_sources.any? deleted.concat deleted_sources.map {|source| "* source: #{source}" } end end new_deps = @dependencies - @locked_deps deleted_deps = @locked_deps - @dependencies added.concat new_deps.map {|d| "* #{pretty_dep(d)}" } if new_deps.any? if deleted_deps.any? deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" } end both_sources = Hash.new {|h, k| h[k] = [] } @dependencies.each {|d| both_sources[d.name][0] = d } @locked_deps.each {|d| both_sources[d.name][1] = d.source } both_sources.each do |name, (dep, lock_source)| next unless (dep.nil? && !lock_source.nil?) || (!dep.nil? && !lock_source.nil? && !lock_source.can_lock?(dep)) gemfile_source_name = (dep && dep.source) || "no specified source" lockfile_source_name = lock_source || "no specified source" changed << "* #{name} from `#{gemfile_source_name}` to `#{lockfile_source_name}`" end msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any? msg << "\n\nYou have deleted from the Gemfile:\n" << deleted.join("\n") if deleted.any? msg << "\n\nYou have changed in the Gemfile:\n" << changed.join("\n") if changed.any? msg << "\n" raise ProductionError, msg if added.any? || deleted.any? || changed.any? end def validate_ruby! return unless ruby_version if diff = ruby_version.diff(Bundler.ruby_version) problem, expected, actual = diff msg = case problem when :engine "Your Ruby engine is #{actual}, but your Gemfile specified #{expected}" when :version "Your Ruby version is #{actual}, but your Gemfile specified #{expected}" when :engine_version "Your #{Bundler.ruby_version.engine} version is #{actual}, but your Gemfile specified #{ruby_version.engine} #{expected}" when :patchlevel if !expected.is_a?(String) "The Ruby patchlevel in your Gemfile must be a string" else "Your Ruby patchlevel is #{actual}, but your Gemfile specified #{expected}" end end raise RubyVersionMismatch, msg end end attr_reader :sources private :sources private def nothing_changed? !@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes end def pretty_dep(dep, source = false) msg = "#{dep.name}" msg << " (#{dep.requirement})" unless dep.requirement == Gem::Requirement.default msg << " from the `#{dep.source}` source" if source && dep.source msg end # Check if the specs of the given source changed # according to the locked source. A block should be # in order to specify how the locked version of # the source should be found. def specs_changed?(source, &block) locked = @locked_sources.find(&block) if locked unlocking = @locked_specs.any? do |locked_spec| locked_spec.source.class == locked.class && locked_spec.source != locked end end !locked || unlocking || dependencies_for_source_changed?(locked) || source.specs != locked.specs end def dependencies_for_source_changed?(source) deps_for_source = @dependencies.select {|s| s.source == source } locked_deps_for_source = @locked_deps.select {|s| s.source == source } deps_for_source != locked_deps_for_source end # Get all locals and override their matching sources. # Return true if any of the locals changed (for example, # they point to a new revision) or depend on new specs. def converge_locals locals = [] Bundler.settings.local_overrides.map do |k, v| spec = @dependencies.find {|s| s.name == k } source = spec && spec.source if source && source.respond_to?(:local_override!) source.unlock! if @unlock[:gems].include?(spec.name) locals << [source, source.local_override!(v)] end end locals.any? do |source, changed| changed || specs_changed?(source) {|o| source.class == o.class && source.uri == o.uri } end end def converge_paths sources.path_sources.any? do |source| specs_changed?(source) do |ls| ls.class == source.class && ls.path == source.path end end end def converge_sources changes = false # Get the Rubygems sources from the Gemfile.lock locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) } # Get the Rubygems remotes from the Gemfile actual_remotes = sources.rubygems_remotes # If there is a Rubygems source in both if !locked_gem_sources.empty? && !actual_remotes.empty? locked_gem_sources.each do |locked_gem| # Merge the remotes from the Gemfile into the Gemfile.lock changes |= locked_gem.replace_remotes(actual_remotes) end end # Replace the sources from the Gemfile with the sources from the Gemfile.lock, # if they exist in the Gemfile.lock and are `==`. If you can't find an equivalent # source in the Gemfile.lock, use the one from the Gemfile. changes |= sources.replace_sources!(@locked_sources) sources.all_sources.each do |source| # If the source is unlockable and the current command allows an unlock of # the source (for example, you are doing a `bundle update ` of a git-pinned # gem), unlock it. For git sources, this means to unlock the revision, which # will cause the `ref` used to be the most recent for the branch (or master) if # an explicit `ref` is not used. if source.respond_to?(:unlock!) && @unlock[:sources].include?(source.name) source.unlock! changes = true end end changes end def converge_dependencies (@dependencies + @locked_deps).each do |dep| dep.source = sources.get(dep.source) if dep.source end Set.new(@dependencies) != Set.new(@locked_deps) end # Remove elements from the locked specs that are expired. This will most # commonly happen if the Gemfile has changed since the lockfile was last # generated def converge_locked_specs deps = [] # Build a list of dependencies that are the same in the Gemfile # and Gemfile.lock. If the Gemfile modified a dependency, but # the gem in the Gemfile.lock still satisfies it, this is fine # too. locked_deps_hash = @locked_deps.inject({}) do |hsh, dep| hsh[dep] = dep hsh end @dependencies.each do |dep| locked_dep = locked_deps_hash[dep] if in_locked_deps?(dep, locked_dep) || satisfies_locked_spec?(dep) deps << dep elsif dep.source.is_a?(Source::Path) && dep.current_platform? && (!locked_dep || dep.source != locked_dep.source) @locked_specs.each do |s| @unlock[:gems] << s.name if s.source == dep.source end dep.source.unlock! if dep.source.respond_to?(:unlock!) dep.source.specs.each {|s| @unlock[:gems] << s.name } end end converged = [] @locked_specs.each do |s| # Replace the locked dependency's source with the equivalent source from the Gemfile dep = @dependencies.find {|d| s.satisfies?(d) } s.source = (dep && dep.source) || sources.get(s.source) # Don't add a spec to the list if its source is expired. For example, # if you change a Git gem to Rubygems. next if s.source.nil? || @unlock[:sources].include?(s.source.name) # XXX This is a backwards-compatibility fix to preserve the ability to # unlock a single gem by passing its name via `--source`. See issue #3759 next if s.source.nil? || @unlock[:sources].include?(s.name) # If the spec is from a path source and it doesn't exist anymore # then we just unlock it. # Path sources have special logic if s.source.instance_of?(Source::Path) other = s.source.specs[s].first # If the spec is no longer in the path source, unlock it. This # commonly happens if the version changed in the gemspec next unless other deps2 = other.dependencies.select {|d| d.type != :development } # If the dependencies of the path source have changed, unlock it next unless s.dependencies.sort == deps2.sort end converged << s end resolve = SpecSet.new(converged) resolve = resolve.for(expand_dependencies(deps, true), @unlock[:gems]) diff = @locked_specs.to_a - resolve.to_a # Now, we unlock any sources that do not have anymore gems pinned to it sources.all_sources.each do |source| next unless source.respond_to?(:unlock!) unless resolve.any? {|s| s.source == source } source.unlock! if !diff.empty? && diff.any? {|s| s.source == source } end end resolve end def in_locked_deps?(dep, locked_dep) # Because the lockfile can't link a dep to a specific remote, we need to # treat sources as equivalent anytime the locked dep has all the remotes # that the Gemfile dep does. locked_dep && locked_dep.source && dep.source && locked_dep.source.include?(dep.source) end def satisfies_locked_spec?(dep) @locked_specs.any? {|s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) } end def expanded_dependencies @expanded_dependencies ||= expand_dependencies(dependencies, @remote) end def expand_dependencies(dependencies, remote = false) deps = [] dependencies.each do |dep| dep = Dependency.new(dep, ">= 0") unless dep.respond_to?(:name) next unless remote || dep.current_platform? dep.gem_platforms(@platforms).each do |p| deps << DepProxy.new(dep, p) if remote || p == generic(Gem::Platform.local) end end deps end def requested_dependencies groups = requested_groups groups.map!(&:to_sym) dependencies.reject {|d| !d.should_include? || (d.groups & groups).empty? } end def source_requirements # Load all specs from remote sources index # Record the specs available in each gem's source, so that those # specs will be available later when the resolver knows where to # look for that gemspec (or its dependencies) source_requirements = {} dependencies.each do |dep| next unless dep.source source_requirements[dep.name] = dep.source.specs end source_requirements end def pinned_spec_names(specs) names = [] specs.each do |s| # TODO: when two sources without blocks is an error, we can change # this check to !s.source.is_a?(Source::LocalRubygems). For now, # we need to ask every Rubygems for every gem name. if s.source.is_a?(Source::Git) || s.source.is_a?(Source::Path) names << s.name end end names.uniq! names end def requested_groups groups - Bundler.settings.without - @optional_groups + Bundler.settings.with end def lockfiles_equal?(current, proposed, preserve_bundled_with) if preserve_bundled_with pattern = /\n\n#{LockfileParser::BUNDLED}\n\s+#{Gem::Version::VERSION_PATTERN}\n/ current.sub(pattern, "\n") == proposed.sub(pattern, "\n") else current == proposed end end end end bundler-1.11.2/lib/bundler/gem_path_manipulation.rb0000644000004100000410000000051412652443364022362 0ustar www-datawww-datamodule Bundler def self.preserve_gem_path original_gem_path = ENV["_ORIGINAL_GEM_PATH"] gem_path = ENV["GEM_PATH"] ENV["_ORIGINAL_GEM_PATH"] = gem_path if original_gem_path.nil? || original_gem_path == "" ENV["GEM_PATH"] = original_gem_path if gem_path.nil? || gem_path == "" end end bundler-1.11.2/lib/bundler/worker.rb0000644000004100000410000000322412652443364017330 0ustar www-datawww-datarequire "thread" module Bundler class Worker POISON = Object.new class WrappedException < StandardError attr_reader :exception def initialize(exn) @exception = exn end end # Creates a worker pool of specified size # # @param size [Integer] Size of pool # @param func [Proc] job to run in inside the worker pool def initialize(size, func) @request_queue = Queue.new @response_queue = Queue.new @func = func @threads = size.times.map {|i| Thread.start { process_queue(i) } } trap("INT") { abort_threads } end # Enqueue a request to be executed in the worker pool # # @param obj [String] mostly it is name of spec that should be downloaded def enq(obj) @request_queue.enq obj end # Retrieves results of job function being executed in worker pool def deq result = @response_queue.deq raise result.exception if result.is_a?(WrappedException) result end def stop stop_threads end private def process_queue(i) loop do obj = @request_queue.deq break if obj.equal? POISON @response_queue.enq apply_func(obj, i) end end def apply_func(obj, i) @func.call(obj, i) rescue Exception => e WrappedException.new(e) end # Stop the worker threads by sending a poison object down the request queue # so as worker threads after retrieving it, shut themselves down def stop_threads @threads.each { @request_queue.enq POISON } @threads.each(&:join) end def abort_threads @threads.each(&:exit) exit 1 end end end bundler-1.11.2/lib/bundler/injector.rb0000644000004100000410000000333312652443364017635 0ustar www-datawww-datamodule Bundler class Injector def self.inject(new_deps) injector = new(new_deps) injector.inject(Bundler.default_gemfile, Bundler.default_lockfile) end def initialize(new_deps) @new_deps = new_deps end def inject(gemfile_path, lockfile_path) if Bundler.settings[:frozen] # ensure the lock and Gemfile are synced Bundler.definition.ensure_equivalent_gemfile_and_lockfile(true) # temporarily remove frozen while we inject frozen = Bundler.settings.delete(:frozen) end # evaluate the Gemfile we have now builder = Dsl.new builder.eval_gemfile(gemfile_path) # don't inject any gems that are already in the Gemfile @new_deps -= builder.dependencies # add new deps to the end of the in-memory Gemfile builder.eval_gemfile("injected gems", new_gem_lines) if @new_deps.any? # resolve to see if the new deps broke anything definition = builder.to_definition(lockfile_path, {}) definition.resolve_remotely! # since nothing broke, we can add those gems to the gemfile append_to(gemfile_path) if @new_deps.any? # since we resolved successfully, write out the lockfile definition.lock(Bundler.default_lockfile) # return an array of the deps that we added return @new_deps ensure Bundler.settings[:frozen] = "1" if frozen end private def new_gem_lines @new_deps.map do |d| %(gem '#{d.name}', '#{d.requirement}') end.join("\n") end def append_to(gemfile_path) gemfile_path.open("a") do |f| f.puts f.puts "# Added at #{Time.now} by #{`whoami`.chomp}:" f.puts new_gem_lines end end end end bundler-1.11.2/lib/bundler/current_ruby.rb0000644000004100000410000000633712652443364020552 0ustar www-datawww-datamodule Bundler # Returns current version of Ruby # # @return [CurrentRuby] Current version of Ruby def self.current_ruby @current_ruby ||= CurrentRuby.new end class CurrentRuby def on_18? RUBY_VERSION =~ /^1\.8/ end def on_19? RUBY_VERSION =~ /^1\.9/ end def on_20? RUBY_VERSION =~ /^2\.0/ end def on_21? RUBY_VERSION =~ /^2\.1/ end def on_22? RUBY_VERSION =~ /^2\.2/ end def on_23? RUBY_VERSION =~ /^2\.3/ end def on_2? on_20? || on_21? || on_22? || on_23? end def ruby? !mswin? && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev") end def ruby_18? ruby? && on_18? end def ruby_19? ruby? && on_19? end def ruby_20? ruby? && on_20? end def ruby_21? ruby? && on_21? end def ruby_22? ruby? && on_22? end def ruby_23? ruby? && on_23? end def ruby_2? ruby? && on_2? end def mri? !mswin? && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby") end def mri_18? mri? && on_18? end def mri_19? mri? && on_19? end def mri_20? mri? && on_20? end def mri_21? mri? && on_21? end def mri_22? mri? && on_22? end def mri_23? mri? && on_23? end def rbx? ruby? && defined?(RUBY_ENGINE) && RUBY_ENGINE == "rbx" end def jruby? defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby" end def jruby_18? jruby? && on_18? end def jruby_19? jruby? && on_19? end def maglev? defined?(RUBY_ENGINE) && RUBY_ENGINE == "maglev" end def mswin? Bundler::WINDOWS end def mswin_18? mswin? && on_18? end def mswin_19? mswin? && on_19? end def mswin_20? mswin? && on_20? end def mswin_21? mswin? && on_21? end def mswin_22? mswin? && on_22? end def mswin_23? mswin? && on_23? end def mswin64? Bundler::WINDOWS && Gem::Platform.local.os == "mswin64" && Gem::Platform.local.cpu == "x64" end def mswin64_19? mswin64? && on_19? end def mswin64_20? mswin64? && on_20? end def mswin64_21? mswin64? && on_21? end def mswin64_22? mswin64? && on_22? end def mswin64_23? mswin64? && on_23? end def mingw? Bundler::WINDOWS && Gem::Platform.local.os == "mingw32" && Gem::Platform.local.cpu != "x64" end def mingw_18? mingw? && on_18? end def mingw_19? mingw? && on_19? end def mingw_20? mingw? && on_20? end def mingw_21? mingw? && on_21? end def mingw_22? mingw? && on_22? end def mingw_23? mingw? && on_23? end def x64_mingw? Bundler::WINDOWS && Gem::Platform.local.os == "mingw32" && Gem::Platform.local.cpu == "x64" end def x64_mingw_20? x64_mingw? && on_20? end def x64_mingw_21? x64_mingw? && on_21? end def x64_mingw_22? x64_mingw? && on_22? end def x64_mingw_23? x64_mingw? && on_23? end end end bundler-1.11.2/lib/bundler/shared_helpers.rb0000644000004100000410000001054512652443364021013 0ustar www-datawww-datarequire "pathname" require "rubygems" require "bundler/constants" require "bundler/rubygems_integration" require "bundler/current_ruby" module Gem class Dependency unless method_defined? :requirement def requirement version_requirements end end end end module Bundler module SharedHelpers attr_accessor :gem_loaded def default_gemfile gemfile = find_gemfile raise GemfileNotFound, "Could not locate Gemfile" unless gemfile Pathname.new(gemfile) end def default_lockfile gemfile = default_gemfile case gemfile.basename.to_s when "gems.rb" then Pathname.new(gemfile.sub(/.rb$/, ".locked")) else Pathname.new("#{gemfile}.lock") end end def default_bundle_dir bundle_dir = find_directory(".bundle") return nil unless bundle_dir global_bundle_dir = File.join(Bundler.rubygems.user_home, ".bundle") return nil if bundle_dir == global_bundle_dir Pathname.new(bundle_dir) end def in_bundle? find_gemfile end def chdir(dir, &blk) Bundler.rubygems.ext_lock.synchronize do Dir.chdir dir, &blk end end def pwd Bundler.rubygems.ext_lock.synchronize do Pathname.pwd end end def with_clean_git_env(&block) keys = %w(GIT_DIR GIT_WORK_TREE) old_env = keys.inject({}) do |h, k| h.update(k => ENV[k]) end keys.each {|key| ENV.delete(key) } block.call ensure keys.each {|key| ENV[key] = old_env[key] } end def set_bundle_environment # Set PATH paths = (ENV["PATH"] || "").split(File::PATH_SEPARATOR) paths.unshift "#{Bundler.bundle_path}/bin" ENV["PATH"] = paths.uniq.join(File::PATH_SEPARATOR) # Set RUBYOPT rubyopt = [ENV["RUBYOPT"]].compact if rubyopt.empty? || rubyopt.first !~ %r{-rbundler/setup} rubyopt.unshift %(-rbundler/setup) ENV["RUBYOPT"] = rubyopt.join(" ") end # Set RUBYLIB rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR) rubylib.unshift File.expand_path("../..", __FILE__) ENV["RUBYLIB"] = rubylib.uniq.join(File::PATH_SEPARATOR) end # Rescues permissions errors raised by file system operations # (ie. Errno:EACCESS) and raises more friendly errors instead. # # @param path [String] the path that the action will be attempted to # @param action [Symbol, #to_s] the type of operation that will be # performed. For example: :write, :read, :exec # # @yield path # # @raise [Bundler::PermissionError] if Errno:EACCES is raised in the # given block # # @example # filesystem_access("vendor/cache", :write) do # FileUtils.mkdir_p("vendor/cache") # end # # @see {Bundler::PermissionError} def filesystem_access(path, action = :write) yield path rescue Errno::EACCES raise PermissionError.new(path, action) end private def find_gemfile given = ENV["BUNDLE_GEMFILE"] return given if given && !given.empty? find_file("Gemfile", "gems.rb") end def find_file(*names) search_up(*names) do |filename| return filename if File.file?(filename) end end def find_directory(*names) search_up(*names) do |dirname| return dirname if File.directory?(dirname) end end def search_up(*names) previous = nil current = File.expand_path(SharedHelpers.pwd) until !File.directory?(current) || current == previous if ENV["BUNDLE_SPEC_RUN"] # avoid stepping above the tmp directory when testing return nil if File.file?(File.join(current, "bundler.gemspec")) end names.each do |name| filename = File.join(current, name) yield filename end previous = current current = File.expand_path("..", current) end end def clean_load_path # handle 1.9 where system gems are always on the load path if defined?(::Gem) me = File.expand_path("../../", __FILE__) me = /^#{Regexp.escape(me)}/ loaded_gem_paths = Bundler.rubygems.loaded_gem_paths $LOAD_PATH.reject! do |p| next if File.expand_path(p) =~ me loaded_gem_paths.delete(p) end $LOAD_PATH.uniq! end end extend self end end bundler-1.11.2/lib/bundler/psyched_yaml.rb0000644000004100000410000000122412652443364020476 0ustar www-datawww-data# Psych could be a gem, so try to ask for it begin gem "psych" rescue LoadError end if defined?(gem) # Psych could just be in the stdlib # but it's too late if Syck is already loaded begin require "psych" unless defined?(Syck) rescue LoadError # Apparently Psych wasn't available. Oh well. end # At least load the YAML stdlib, whatever that may be require "yaml" unless defined?(YAML.dump) module Bundler # On encountering invalid YAML, # Psych raises Psych::SyntaxError if defined?(::Psych::SyntaxError) YamlLibrarySyntaxError = ::Psych::SyntaxError else # Syck raises ArgumentError YamlLibrarySyntaxError = ::ArgumentError end end bundler-1.11.2/lib/bundler/environment.rb0000644000004100000410000000134312652443364020363 0ustar www-datawww-datamodule Bundler class Environment attr_reader :root def initialize(root, definition) @root = root @definition = definition env_file = Bundler.app_config_path.join("environment.rb") env_file.rmtree if env_file.exist? end def inspect @definition.to_lock.inspect end def requested_specs @definition.requested_specs end def specs @definition.specs end def dependencies @definition.dependencies end def current_dependencies @definition.current_dependencies end def lock(opts = {}) @definition.lock(Bundler.default_lockfile, opts[:preserve_bundled_with]) end def update(*gems) # Nothing end end end bundler-1.11.2/lib/bundler/rubygems_gem_installer.rb0000644000004100000410000000034212652443364022557 0ustar www-datawww-datarequire "rubygems/installer" module Bundler class RubyGemsGemInstaller < Gem::Installer def check_executable_overwrite(filename) # Bundler needs to install gems regardless of binstub overwriting end end end bundler-1.11.2/lib/bundler/setup.rb0000644000004100000410000000126112652443364017156 0ustar www-datawww-datarequire "bundler/shared_helpers" if Bundler::SharedHelpers.in_bundle? require "bundler" if STDOUT.tty? || ENV["BUNDLER_FORCE_TTY"] begin Bundler.setup rescue Bundler::BundlerError => e puts "\e[31m#{e.message}\e[0m" puts e.backtrace.join("\n") if ENV["DEBUG"] if e.is_a?(Bundler::GemNotFound) puts "\e[33mRun `bundle install` to install missing gems.\e[0m" end exit e.status_code end else Bundler.setup end # Add bundler to the load path after disabling system gems bundler_lib = File.expand_path("../..", __FILE__) $LOAD_PATH.unshift(bundler_lib) unless $LOAD_PATH.include?(bundler_lib) Bundler.ui = nil end bundler-1.11.2/lib/bundler/ui.rb0000644000004100000410000000024712652443364016436 0ustar www-datawww-datamodule Bundler module UI autoload :RGProxy, "bundler/ui/rg_proxy" autoload :Shell, "bundler/ui/shell" autoload :Silent, "bundler/ui/silent" end end bundler-1.11.2/lib/bundler/constants.rb0000644000004100000410000000026512652443364020035 0ustar www-datawww-datamodule Bundler WINDOWS = RbConfig::CONFIG["host_os"] =~ /(msdos|mswin|djgpp|mingw)/ FREEBSD = RbConfig::CONFIG["host_os"] =~ /bsd/ NULL = WINDOWS ? "NUL" : "/dev/null" end bundler-1.11.2/lib/bundler/env.rb0000644000004100000410000000535612652443364016617 0ustar www-datawww-datarequire "bundler/rubygems_integration" require "bundler/source/git/git_proxy" module Bundler class Env def write(io) io.write report(:print_gemfile => true, :print_gemspecs => true) end def report(options = {}) print_gemfile = options.delete(:print_gemfile) print_gemspecs = options.delete(:print_gemspecs) out = "Environment\n\n" out << " Bundler #{Bundler::VERSION}\n" out << " Rubygems #{Gem::VERSION}\n" out << " Ruby #{ruby_version}" out << " GEM_HOME #{ENV["GEM_HOME"]}\n" unless ENV["GEM_HOME"].nil? || ENV["GEM_HOME"].empty? out << " GEM_PATH #{ENV["GEM_PATH"]}\n" unless ENV["GEM_PATH"] == ENV["GEM_HOME"] out << " RVM #{ENV["rvm_version"]}\n" if ENV["rvm_version"] out << " Git #{git_version}\n" %w(rubygems-bundler open_gem).each do |name| specs = Bundler.rubygems.find_name(name) out << " #{name} (#{specs.map(&:version).join(",")})\n" unless specs.empty? end out << "\nBundler settings\n\n" unless Bundler.settings.all.empty? Bundler.settings.all.each do |setting| out << " " << setting << "\n" Bundler.settings.pretty_values_for(setting).each do |line| out << " " << line << "\n" end end if print_gemfile out << "\n#{Bundler.default_gemfile.relative_path_from(SharedHelpers.pwd)}\n\n" out << " " << read_file(Bundler.default_gemfile).gsub(/\n/, "\n ") << "\n" out << "\n#{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}\n\n" out << " " << read_file(Bundler.default_lockfile).gsub(/\n/, "\n ") << "\n" end if print_gemspecs dsl = Dsl.new.tap {|d| d.eval_gemfile(Bundler.default_gemfile) } dsl.gemspecs.each do |gs| out << "\n#{Pathname.new(gs).basename}:" out << "\n\n " << read_file(gs).gsub(/\n/, "\n ") << "\n" end end out end private def read_file(filename) File.read(filename.to_s).strip rescue Errno::ENOENT "" rescue => e "#{e.class}: #{e.message}" end def ruby_version str = "#{RUBY_VERSION}" if RUBY_VERSION < "1.9" str << " (#{RUBY_RELEASE_DATE}" str << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL str << ") [#{RUBY_PLATFORM}]\n" else str << "p#{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL str << " (#{RUBY_RELEASE_DATE} revision #{RUBY_REVISION}) [#{RUBY_PLATFORM}]\n" end end def git_version Bundler::Source::Git::GitProxy.new(nil, nil, nil).version rescue Bundler::Source::Git::GitNotInstalledError "not installed" end end end bundler-1.11.2/lib/bundler/source_list.rb0000644000004100000410000000470412652443364020356 0ustar www-datawww-datamodule Bundler class SourceList attr_reader :path_sources, :git_sources def initialize @path_sources = [] @git_sources = [] @rubygems_aggregate = Source::Rubygems.new @rubygems_sources = [] end def add_path_source(options = {}) add_source_to_list Source::Path.new(options), path_sources end def add_git_source(options = {}) add_source_to_list Source::Git.new(options), git_sources end def add_rubygems_source(options = {}) add_source_to_list Source::Rubygems.new(options), @rubygems_sources end def add_rubygems_remote(uri) @rubygems_aggregate.add_remote(uri) @rubygems_aggregate end def rubygems_sources @rubygems_sources + [@rubygems_aggregate] end def rubygems_remotes rubygems_sources.map(&:remotes).flatten.uniq end def all_sources path_sources + git_sources + rubygems_sources end def get(source) source_list_for(source).find {|s| source == s } end def lock_sources lock_sources = (path_sources + git_sources).sort_by(&:to_s) lock_sources << combine_rubygems_sources end def replace_sources!(replacement_sources) return true if replacement_sources.empty? [path_sources, git_sources].each do |source_list| source_list.map! do |source| replacement_sources.find {|s| s == source } || source end end replacement_rubygems = replacement_sources.detect {|s| s.is_a?(Source::Rubygems) } @rubygems_aggregate = replacement_rubygems if replacement_rubygems # Return true if there were changes lock_sources.to_set != replacement_sources.to_set || rubygems_remotes.to_set != replacement_rubygems.remotes.to_set end def cached! all_sources.each(&:cached!) end def remote! all_sources.each(&:remote!) end def rubygems_primary_remotes @rubygems_aggregate.remotes end private def add_source_to_list(source, list) list.unshift(source).uniq! source end def source_list_for(source) case source when Source::Git then git_sources when Source::Path then path_sources when Source::Rubygems then rubygems_sources else raise ArgumentError, "Invalid source: #{source.inspect}" end end def combine_rubygems_sources Source::Rubygems.new("remotes" => rubygems_remotes) end end end bundler-1.11.2/lib/bundler/cli/0000755000004100000410000000000012652443364016240 5ustar www-datawww-databundler-1.11.2/lib/bundler/cli/cache.rb0000644000004100000410000000203112652443364017624 0ustar www-datawww-datamodule Bundler class CLI::Cache attr_reader :options def initialize(options) @options = options end def run Bundler.definition.validate_ruby! Bundler.definition.resolve_with_cache! setup_cache_all Bundler.settings[:cache_all_platforms] = options["all-platforms"] if options.key?("all-platforms") Bundler.load.cache Bundler.settings[:no_prune] = true if options["no-prune"] Bundler.load.lock rescue GemNotFound => e Bundler.ui.error(e.message) Bundler.ui.warn "Run `bundle install` to install missing gems." exit 1 end private def setup_cache_all Bundler.settings[:cache_all] = options[:all] if options.key?("all") if Bundler.definition.has_local_dependencies? && !Bundler.settings[:cache_all] Bundler.ui.warn "Your Gemfile contains path and git dependencies. If you want " \ "to package them as well, please pass the --all flag. This will be the default " \ "on Bundler 2.0." end end end end bundler-1.11.2/lib/bundler/cli/show.rb0000644000004100000410000000427612652443364017556 0ustar www-datawww-datarequire "bundler/cli/common" module Bundler class CLI::Show attr_reader :options, :gem_name, :latest_specs def initialize(options, gem_name) @options = options @gem_name = gem_name @verbose = options[:verbose] || options[:outdated] @latest_specs = fetch_latest_specs if @verbose end def run Bundler.ui.silence do Bundler.definition.validate_ruby! Bundler.load.lock end if gem_name if gem_name == "bundler" path = File.expand_path("../../../..", __FILE__) else spec = Bundler::CLI::Common.select_spec(gem_name, :regex_match) return unless spec path = spec.full_gem_path unless File.directory?(path) Bundler.ui.warn "The gem #{gem_name} has been deleted. It was installed at:" end end return Bundler.ui.info(path) end if options[:paths] Bundler.load.specs.sort_by(&:name).map do |s| Bundler.ui.info s.full_gem_path end else Bundler.ui.info "Gems included by the bundle:" Bundler.load.specs.sort_by(&:name).each do |s| desc = " * #{s.name} (#{s.version}#{s.git_version})" if @verbose latest = latest_specs.find {|l| l.name == s.name } Bundler.ui.info <<-END.gsub(/^ +/, "") #{desc} \tSummary: #{s.summary || "No description available."} \tHomepage: #{s.homepage || "No website available."} \tStatus: #{outdated?(s, latest) ? "Outdated - #{s.version} < #{latest.version}" : "Up to date"} END else Bundler.ui.info desc end end end end private def fetch_latest_specs definition = Bundler.definition(true) if options[:outdated] Bundler.ui.info "Fetching remote specs for outdated check...\n\n" Bundler.ui.silence { definition.resolve_remotely! } else definition.resolve_with_cache! end definition.specs end def outdated?(current, latest) return false unless latest Gem::Version.new(current.version) < Gem::Version.new(latest.version) end end end bundler-1.11.2/lib/bundler/cli/inject.rb0000644000004100000410000000167112652443364020046 0ustar www-datawww-datamodule Bundler class CLI::Inject attr_reader :options, :name, :version, :gems def initialize(options, name, version, gems) @options = options @name = name @version = version @gems = gems end def run # The required arguments allow Thor to give useful feedback when the arguments # are incorrect. This adds those first two arguments onto the list as a whole. gems.unshift(version).unshift(name) # Build an array of Dependency objects out of the arguments deps = [] gems.each_slice(2) do |gem_name, gem_version| deps << Bundler::Dependency.new(gem_name, gem_version) end added = Injector.inject(deps) if added.any? Bundler.ui.confirm "Added to Gemfile:" Bundler.ui.confirm added.map {|g| " #{g}" }.join("\n") else Bundler.ui.confirm "All injected gems were already present in the Gemfile" end end end end bundler-1.11.2/lib/bundler/cli/check.rb0000644000004100000410000000244312652443364017645 0ustar www-datawww-datamodule Bundler class CLI::Check attr_reader :options def initialize(options) @options = options end def run if options[:path] Bundler.settings[:path] = File.expand_path(options[:path]) Bundler.settings[:disable_shared_gems] = "1" end begin definition = Bundler.definition definition.validate_ruby! not_installed = definition.missing_specs rescue GemNotFound, VersionConflict Bundler.ui.error "Bundler can't satisfy your Gemfile's dependencies." Bundler.ui.warn "Install missing gems with `bundle install`." exit 1 end if not_installed.any? Bundler.ui.error "The following gems are missing" not_installed.each {|s| Bundler.ui.error " * #{s.name} (#{s.version})" } Bundler.ui.warn "Install missing gems with `bundle install`" exit 1 elsif !Bundler.default_lockfile.exist? && Bundler.settings[:frozen] Bundler.ui.error "This bundle has been frozen, but there is no #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} present" exit 1 else Bundler.load.lock(:preserve_bundled_with => true) unless options[:"dry-run"] Bundler.ui.info "The Gemfile's dependencies are satisfied" end end end end bundler-1.11.2/lib/bundler/cli/update.rb0000644000004100000410000000415312652443364020052 0ustar www-datawww-datamodule Bundler class CLI::Update attr_reader :options, :gems def initialize(options, gems) @options = options @gems = gems end def run Bundler.ui.level = "error" if options[:quiet] sources = Array(options[:source]) groups = Array(options[:group]).map(&:to_sym) if gems.empty? && sources.empty? && groups.empty? # We're doing a full update Bundler.definition(true) else unless Bundler.default_lockfile.exist? raise GemfileLockNotFound, "This Bundle hasn't been installed yet. " \ "Run `bundle install` to update and install the bundled gems." end # cycle through the requested gems, just to make sure they exist names = Bundler.locked_gems.specs.map(&:name) gems.each do |g| next if names.include?(g) require "bundler/cli/common" raise GemNotFound, Bundler::CLI::Common.gem_not_found_message(g, names) end if groups.any? specs = Bundler.definition.specs_for groups gems.concat(specs.map(&:name)) end Bundler.definition(:gems => gems, :sources => sources) end Bundler::Fetcher.disable_endpoint = options["full-index"] opts = options.dup opts["update"] = true opts["local"] = options[:local] Bundler.settings[:jobs] = opts["jobs"] if opts["jobs"] # rubygems plugins sometimes hook into the gem install process Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins) Bundler.definition.validate_ruby! Installer.install Bundler.root, Bundler.definition, opts Bundler.load.cache if Bundler.app_cache.exist? if Bundler.settings[:clean] && Bundler.settings[:path] require "bundler/cli/clean" Bundler::CLI::Clean.new(options).run end Bundler.ui.confirm "Bundle updated!" without_groups_messages end private def without_groups_messages if Bundler.settings.without.any? require "bundler/cli/common" Bundler.ui.confirm Bundler::CLI::Common.without_groups_message end end end end bundler-1.11.2/lib/bundler/cli/viz.rb0000644000004100000410000000154112652443364017376 0ustar www-datawww-datamodule Bundler class CLI::Viz attr_reader :options, :gem_name def initialize(options) @options = options end def run require "graphviz" output_file = File.expand_path(options[:file]) graph = Graph.new(Bundler.load, output_file, options[:version], options[:requirements], options[:format], options[:without]) graph.viz rescue LoadError => e Bundler.ui.error e.inspect Bundler.ui.warn "Make sure you have the graphviz ruby gem. You can install it with:" Bundler.ui.warn "`gem install ruby-graphviz`" rescue StandardError => e if e.message =~ /GraphViz not installed or dot not in PATH/ Bundler.ui.error e.message Bundler.ui.warn "Please install GraphViz. On a Mac with homebrew, you can run `brew install graphviz`." else raise end end end end bundler-1.11.2/lib/bundler/cli/binstubs.rb0000644000004100000410000000210212652443364020411 0ustar www-datawww-datarequire "bundler/cli/common" module Bundler class CLI::Binstubs attr_reader :options, :gems def initialize(options, gems) @options = options @gems = gems end def run Bundler.definition.validate_ruby! Bundler.settings[:bin] = options["path"] if options["path"] Bundler.settings[:bin] = nil if options["path"] && options["path"].empty? installer = Installer.new(Bundler.root, Bundler.definition) if gems.empty? Bundler.ui.error "`bundle binstubs` needs at least one gem to run." exit 1 end gems.each do |gem_name| spec = installer.specs.find {|s| s.name == gem_name } unless spec raise GemNotFound, Bundler::CLI::Common.gem_not_found_message( gem_name, Bundler.definition.specs) end if spec.name == "bundler" Bundler.ui.warn "Sorry, Bundler can only be run via Rubygems." else installer.generate_bundler_executable_stubs(spec, :force => options[:force], :binstubs_cmd => true) end end end end end bundler-1.11.2/lib/bundler/cli/exec.rb0000644000004100000410000000272412652443364017516 0ustar www-datawww-datarequire "bundler/current_ruby" module Bundler class CLI::Exec attr_reader :options, :args, :cmd def initialize(options, args) @options = options @cmd = args.shift @args = args if Bundler.current_ruby.ruby_2? && !Bundler.current_ruby.jruby? @args << { :close_others => !options.keep_file_descriptors? } elsif options.keep_file_descriptors? Bundler.ui.warn "Ruby version #{RUBY_VERSION} defaults to keeping non-standard file descriptors on Kernel#exec." end end def run ui = Bundler.ui raise ArgumentError if cmd.nil? # First, try to exec directly to something in PATH SharedHelpers.set_bundle_environment bin_path = Bundler.which(@cmd) if bin_path Bundler.ui = nil Kernel.exec(bin_path, *args) end # If that didn't work, set up the whole bundle Bundler.definition.validate_ruby! Bundler.load.setup_environment Bundler.ui = nil Kernel.exec(@cmd, *args) rescue Errno::EACCES, Errno::ENOEXEC Bundler.ui = ui Bundler.ui.error "bundler: not executable: #{cmd}" exit 126 rescue Errno::ENOENT Bundler.ui = ui Bundler.ui.error "bundler: command not found: #{cmd}" Bundler.ui.warn "Install missing gem executables with `bundle install`" exit 127 rescue ArgumentError Bundler.ui = ui Bundler.ui.error "bundler: exec needs a command to run" exit 128 end end end bundler-1.11.2/lib/bundler/cli/console.rb0000644000004100000410000000155712652443364020237 0ustar www-datawww-datamodule Bundler class CLI::Console attr_reader :options, :group def initialize(options, group) @options = options @group = group end def run group ? Bundler.require(:default, *(group.split.map!(&:to_sym))) : Bundler.require ARGV.clear console = get_console(Bundler.settings[:console] || "irb") console.start end def get_console(name) require name get_constant(name) rescue LoadError Bundler.ui.error "Couldn't load console #{name}, falling back to irb" require "irb" get_constant("irb") end def get_constant(name) const_name = { "pry" => :Pry, "ripl" => :Ripl, "irb" => :IRB, }[name] Object.const_get(const_name) rescue NameError Bundler.ui.error "Could not find constant #{const_name}" exit 1 end end end bundler-1.11.2/lib/bundler/cli/clean.rb0000644000004100000410000000106412652443364017650 0ustar www-datawww-datamodule Bundler class CLI::Clean attr_reader :options def initialize(options) @options = options end def run require_path_or_force Bundler.load.clean(options[:"dry-run"]) end protected def require_path_or_force if !Bundler.settings[:path] && !options[:force] Bundler.ui.error "Cleaning all the gems on your system is dangerous! " \ "If you're sure you want to remove every system gem not in this " \ "bundle, run `bundle clean --force`." exit 1 end end end end bundler-1.11.2/lib/bundler/cli/init.rb0000644000004100000410000000165312652443364017535 0ustar www-datawww-datamodule Bundler class CLI::Init attr_reader :options def initialize(options) @options = options end def run if File.exist?("Gemfile") Bundler.ui.error "Gemfile already exists at #{SharedHelpers.pwd}/Gemfile" exit 1 end if options[:gemspec] gemspec = File.expand_path(options[:gemspec]) unless File.exist?(gemspec) Bundler.ui.error "Gem specification #{gemspec} doesn't exist" exit 1 end spec = Gem::Specification.load(gemspec) puts "Writing new Gemfile to #{SharedHelpers.pwd}/Gemfile" File.open("Gemfile", "wb") do |file| file << "# Generated from #{gemspec}\n" file << spec.to_gemfile end else puts "Writing new Gemfile to #{SharedHelpers.pwd}/Gemfile" FileUtils.cp(File.expand_path("../../templates/Gemfile", __FILE__), "Gemfile") end end end end bundler-1.11.2/lib/bundler/cli/install.rb0000644000004100000410000001676312652443364020250 0ustar www-datawww-datamodule Bundler class CLI::Install attr_reader :options def initialize(options) @options = options end def run Bundler.ui.level = "error" if options[:quiet] warn_if_root [:with, :without].each do |option| if options[option] options[option] = options[option].join(":").tr(" ", ":").split(":") end end if options[:without] && options[:with] conflicting_groups = options[:without] & options[:with] unless conflicting_groups.empty? Bundler.ui.error "You can't list a group in both, --with and --without." \ "The offending groups are: #{conflicting_groups.join(", ")}." exit 1 end end Bundler.settings.with = [] if options[:with] && options[:with].empty? Bundler.settings.without = [] if options[:without] && options[:without].empty? with = options.fetch("with", []) with |= Bundler.settings.with.map(&:to_s) with -= options[:without] if options[:without] without = options.fetch("without", []) without |= Bundler.settings.without.map(&:to_s) without -= options[:with] if options[:with] options[:with] = with options[:without] = without ENV["RB_USER_INSTALL"] = "1" if Bundler::FREEBSD # Just disable color in deployment mode Bundler.ui.shell = Thor::Shell::Basic.new if options[:deployment] if (options[:path] || options[:deployment]) && options[:system] Bundler.ui.error "You have specified both a path to install your gems to, \n" \ "as well as --system. Please choose." exit 1 end if options["trust-policy"] unless Bundler.rubygems.security_policies.keys.include?(options["trust-policy"]) Bundler.ui.error "Rubygems doesn't know about trust policy '#{options["trust-policy"]}'. " \ "The known policies are: #{Bundler.rubygems.security_policies.keys.join(", ")}." exit 1 end Bundler.settings["trust-policy"] = options["trust-policy"] else Bundler.settings["trust-policy"] = nil if Bundler.settings["trust-policy"] end if options[:deployment] || options[:frozen] unless Bundler.default_lockfile.exist? flag = options[:deployment] ? "--deployment" : "--frozen" raise ProductionError, "The #{flag} flag requires a #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}. Please make " \ "sure you have checked your #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} into version control " \ "before deploying." end options[:local] = true if Bundler.app_cache.exist? Bundler.settings[:frozen] = "1" end # When install is called with --no-deployment, disable deployment mode if options[:deployment] == false Bundler.settings.delete(:frozen) options[:system] = true end Bundler.settings[:path] = nil if options[:system] Bundler.settings[:path] = "vendor/bundle" if options[:deployment] Bundler.settings[:path] = options["path"] if options["path"] Bundler.settings[:path] ||= "bundle" if options["standalone"] Bundler.settings[:bin] = options["binstubs"] if options["binstubs"] Bundler.settings[:bin] = nil if options["binstubs"] && options["binstubs"].empty? Bundler.settings[:shebang] = options["shebang"] if options["shebang"] Bundler.settings[:jobs] = options["jobs"] if options["jobs"] Bundler.settings[:no_prune] = true if options["no-prune"] Bundler.settings[:no_install] = true if options["no-install"] Bundler.settings[:clean] = options["clean"] if options["clean"] Bundler.settings.without = options[:without] Bundler.settings.with = options[:with] Bundler::Fetcher.disable_endpoint = options["full-index"] Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? "1" : nil # rubygems plugins sometimes hook into the gem install process Gem.load_env_plugins if Gem.respond_to?(:load_env_plugins) definition = Bundler.definition definition.validate_ruby! Installer.install(Bundler.root, definition, options) Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.settings[:frozen] Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}." confirm_without_groups if Bundler.settings[:path] absolute_path = File.expand_path(Bundler.settings[:path]) relative_path = absolute_path.sub(File.expand_path("."), ".") Bundler.ui.confirm "Bundled gems are installed into #{relative_path}." else Bundler.ui.confirm "Use `bundle show [gemname]` to see where a bundled gem is installed." end unless Bundler.settings["ignore_messages"] Installer.post_install_messages.to_a.each do |name, msg| print_post_install_message(name, msg) unless Bundler.settings["ignore_messages.#{name}"] end end Installer.ambiguous_gems.to_a.each do |name, installed_from_uri, *also_found_in_uris| Bundler.ui.error "Warning: the gem '#{name}' was found in multiple sources." Bundler.ui.error "Installed from: #{installed_from_uri}" Bundler.ui.error "Also found in:" also_found_in_uris.each {|uri| Bundler.ui.error " * #{uri}" } Bundler.ui.error "You should add a source requirement to restrict this gem to your preferred source." Bundler.ui.error "For example:" Bundler.ui.error " gem '#{name}', :source => '#{installed_from_uri}'" Bundler.ui.error "Then uninstall the gem '#{name}' (or delete all bundled gems) and then install again." end if Bundler.settings[:clean] && Bundler.settings[:path] require "bundler/cli/clean" Bundler::CLI::Clean.new(options).run end rescue GemNotFound, VersionConflict => e if options[:local] && Bundler.app_cache.exist? Bundler.ui.warn "Some gems seem to be missing from your #{Bundler.settings.app_cache_path} directory." end unless Bundler.definition.has_rubygems_remotes? Bundler.ui.warn <<-WARN, :wrap => true Your Gemfile has no gem server sources. If you need gems that are \ not already on your machine, add a line like this to your Gemfile: source 'https://rubygems.org' WARN end raise e end private def warn_if_root return if Bundler.settings[:silence_root_warning] || Bundler::WINDOWS || !Process.uid.zero? Bundler.ui.warn "Don't run Bundler as root. Bundler can ask for sudo " \ "if it is needed, and installing your bundle as root will break this " \ "application for all non-root users on this machine.", :wrap => true end def confirm_without_groups if Bundler.settings.without.any? require "bundler/cli/common" Bundler.ui.confirm Bundler::CLI::Common.without_groups_message end end def dependencies_count_for(definition) count = definition.dependencies.count "#{count} Gemfile #{count == 1 ? "dependency" : "dependencies"}" end def gems_installed_for(definition) count = definition.specs.count "#{count} #{count == 1 ? "gem" : "gems"} now installed" end def print_post_install_message(name, msg) Bundler.ui.confirm "Post-install message from #{name}:" Bundler.ui.info msg end end end bundler-1.11.2/lib/bundler/cli/common.rb0000644000004100000410000000345612652443364020065 0ustar www-datawww-datamodule Bundler module CLI::Common def self.without_groups_message groups = Bundler.settings.without group_list = [groups[0...-1].join(", "), groups[-1..-1]]. reject {|s| s.to_s.empty? }.join(" and ") group_str = (groups.size == 1) ? "group" : "groups" "Gems in the #{group_str} #{group_list} were not installed." end def self.select_spec(name, regex_match = nil) specs = [] regexp = Regexp.new(name) if regex_match Bundler.definition.specs.each do |spec| return spec if spec.name == name specs << spec if regexp && spec.name =~ regexp end case specs.count when 0 raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies) when 1 specs.first else ask_for_spec_from(specs) end rescue RegexpError raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies) end def self.ask_for_spec_from(specs) if !$stdout.tty? && ENV["BUNDLE_SPEC_RUN"].nil? raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies) end specs.each_with_index do |spec, index| Bundler.ui.info "#{index.succ} : #{spec.name}", true end Bundler.ui.info "0 : - exit -", true num = Bundler.ui.ask("> ").to_i num > 0 ? specs[num - 1] : nil end def self.gem_not_found_message(missing_gem_name, alternatives) require "bundler/similarity_detector" message = "Could not find gem '#{missing_gem_name}'." alternate_names = alternatives.map {|a| a.respond_to?(:name) ? a.name : a } suggestions = SimilarityDetector.new(alternate_names).similar_word_list(missing_gem_name) message += "\nDid you mean #{suggestions}?" if suggestions message end end end bundler-1.11.2/lib/bundler/cli/config.rb0000644000004100000410000000536412652443364020042 0ustar www-datawww-datamodule Bundler class CLI::Config attr_reader :name, :options, :scope, :thor attr_accessor :args def initialize(options, args, thor) @options = options @args = args @thor = thor @name = peek = args.shift @scope = "global" if peek && peek =~ /^\-\-/ @name = args.shift @scope = $' end end def run unless name confirm_all return end unless valid_scope?(scope) Bundler.ui.error "Invalid scope --#{scope} given. Please use --local or --global." exit 1 end if scope == "delete" Bundler.settings.set_local(name, nil) Bundler.settings.set_global(name, nil) return end if args.empty? confirm(name) return end Bundler.ui.info(message) if message Bundler.settings.send("set_#{scope}", name, new_value) end private def confirm_all Bundler.ui.confirm "Settings are listed in order of priority. The top value will be used.\n" Bundler.settings.all.each do |setting| Bundler.ui.confirm "#{setting}" show_pretty_values_for(setting) Bundler.ui.confirm "" end end def confirm(name) Bundler.ui.confirm "Settings for `#{name}` in order of priority. The top value will be used" show_pretty_values_for(name) end def new_value pathname = Pathname.new(args.join(" ")) if name.match(/\Alocal\./) && pathname.directory? pathname.expand_path.to_s else args.join(" ") end end def message locations = Bundler.settings.locations(name) if scope == "global" if locations[:local] "Your application has set #{name} to #{locations[:local].inspect}. " \ "This will override the global value you are currently setting" elsif locations[:env] "You have a bundler environment variable for #{name} set to " \ "#{locations[:env].inspect}. This will take precedence over the global value you are setting" elsif locations[:global] && locations[:global] != args.join(" ") "You are replacing the current global value of #{name}, which is currently " \ "#{locations[:global].inspect}" end elsif scope == "local" && locations[:local] != args.join(" ") "You are replacing the current local value of #{name}, which is currently " \ "#{locations[:local].inspect}" end end def show_pretty_values_for(setting) thor.with_padding do Bundler.settings.pretty_values_for(setting).each do |line| Bundler.ui.info line end end end def valid_scope?(scope) %w(delete local global).include?(scope) end end end bundler-1.11.2/lib/bundler/cli/package.rb0000644000004100000410000000255512652443364020167 0ustar www-datawww-datamodule Bundler class CLI::Package attr_reader :options def initialize(options) @options = options end def run Bundler.ui.level = "error" if options[:quiet] Bundler.settings[:path] = File.expand_path(options[:path]) if options[:path] Bundler.settings[:cache_all_platforms] = options["all-platforms"] if options.key?("all-platforms") Bundler.settings[:cache_path] = options["cache-path"] if options.key?("cache-path") setup_cache_all install # TODO: move cache contents here now that all bundles are locked custom_path = Pathname.new(options[:path]) if options[:path] Bundler.load.cache(custom_path) end private def install require "bundler/cli/install" options = self.options.dup if Bundler.settings[:cache_all_platforms] options["local"] = false options["update"] = true end Bundler::CLI::Install.new(options).run end def setup_cache_all Bundler.settings[:cache_all] = options[:all] if options.key?("all") if Bundler.definition.has_local_dependencies? && !Bundler.settings[:cache_all] Bundler.ui.warn "Your Gemfile contains path and git dependencies. If you want " \ "to package them as well, please pass the --all flag. This will be the default " \ "on Bundler 2.0." end end end end bundler-1.11.2/lib/bundler/cli/platform.rb0000644000004100000410000000221312652443364020407 0ustar www-datawww-datamodule Bundler class CLI::Platform attr_reader :options def initialize(options) @options = options end def run platforms, ruby_version = Bundler.ui.silence do [Bundler.definition.platforms.map {|p| "* #{p}" }, Bundler.definition.ruby_version] end output = [] if options[:ruby] if ruby_version output << ruby_version else output << "No ruby version specified" end else output << "Your platform is: #{RUBY_PLATFORM}" output << "Your app has gems that work on these platforms:\n#{platforms.join("\n")}" if ruby_version output << "Your Gemfile specifies a Ruby version requirement:\n* #{ruby_version}" begin Bundler.definition.validate_ruby! output << "Your current platform satisfies the Ruby version requirement." rescue RubyVersionMismatch => e output << e.message end else output << "Your Gemfile does not specify a Ruby version requirement." end end Bundler.ui.info output.join("\n\n") end end end bundler-1.11.2/lib/bundler/cli/lock.rb0000644000004100000410000000156312652443364017522 0ustar www-datawww-datamodule Bundler class CLI::Lock attr_reader :options def initialize(options) @options = options end def run unless Bundler.default_gemfile Bundler.ui.error "Unable to find a Gemfile to lock" exit 1 end print = options[:print] ui = Bundler.ui Bundler.ui = UI::Silent.new if print gems = options[:update] if gems && !gems.empty? definition = Bundler.definition(:gems => gems) else definition = Bundler.definition(true) end definition.resolve_remotely! unless options[:local] if print puts definition.to_lock else file = options[:lockfile] file = file ? File.expand_path(file) : Bundler.default_lockfile puts "Writing lockfile to #{file}" definition.lock(file) end Bundler.ui = ui end end end bundler-1.11.2/lib/bundler/cli/gem.rb0000644000004100000410000001643512652443364017346 0ustar www-datawww-datarequire "pathname" module Bundler class CLI::Gem TEST_FRAMEWORK_VERSIONS = { "rspec" => "3.0", "minitest" => "5.0" } attr_reader :options, :gem_name, :thor, :name, :target def initialize(options, gem_name, thor) @options = options @gem_name = resolve_name(gem_name) @thor = thor @name = @gem_name @target = SharedHelpers.pwd.join(gem_name) validate_ext_name if options[:ext] end def run Bundler.ui.confirm "Creating gem '#{name}'..." underscored_name = name.tr("-", "_") namespaced_path = name.tr("-", "/") constant_name = name.gsub(/-[_-]*(?![_-]|$)/) { "::" }.gsub(/([_-]+|(::)|^)(.|$)/) { $2.to_s + $3.upcase } constant_array = constant_name.split("::") test_task = options[:test] == "minitest" ? "test" : "spec" git_user_name = `git config user.name`.chomp git_user_email = `git config user.email`.chomp config = { :name => name, :underscored_name => underscored_name, :namespaced_path => namespaced_path, :makefile_path => "#{underscored_name}/#{underscored_name}", :constant_name => constant_name, :constant_array => constant_array, :author => git_user_name.empty? ? "TODO: Write your name" : git_user_name, :email => git_user_email.empty? ? "TODO: Write your email address" : git_user_email, :test => options[:test], :test_task => test_task, :ext => options[:ext], :bin => options[:bin], :bundler_version => bundler_dependency_version } ensure_safe_gem_name(name, constant_array) templates = { "Gemfile.tt" => "Gemfile", "gitignore.tt" => ".gitignore", "lib/newgem.rb.tt" => "lib/#{namespaced_path}.rb", "lib/newgem/version.rb.tt" => "lib/#{namespaced_path}/version.rb", "newgem.gemspec.tt" => "#{name}.gemspec", "Rakefile.tt" => "Rakefile", "README.md.tt" => "README.md", "bin/console.tt" => "bin/console", "bin/setup.tt" => "bin/setup" } executables = %w( bin/console bin/setup ) if test_framework = ask_and_set_test_framework config[:test] = test_framework config[:test_framework_version] = TEST_FRAMEWORK_VERSIONS[test_framework] templates.merge!(".travis.yml.tt" => ".travis.yml") case test_framework when "rspec" templates.merge!( "rspec.tt" => ".rspec", "spec/spec_helper.rb.tt" => "spec/spec_helper.rb", "spec/newgem_spec.rb.tt" => "spec/#{namespaced_path}_spec.rb" ) when "minitest" templates.merge!( "test/test_helper.rb.tt" => "test/test_helper.rb", "test/newgem_test.rb.tt" => "test/#{namespaced_path}_test.rb" ) end end if ask_and_set(:mit, "Do you want to license your code permissively under the MIT license?", "This means that any other developer or company will be legally allowed to use your code " \ "for free as long as they admit you created it. You can read more about the MIT license " \ "at http://choosealicense.com/licenses/mit.") config[:mit] = true Bundler.ui.info "MIT License enabled in config" templates.merge!("LICENSE.txt.tt" => "LICENSE.txt") end if ask_and_set(:coc, "Do you want to include a code of conduct in gems you generate?", "Codes of conduct can increase contributions to your project by contributors who " \ "prefer collaborative, safe spaces. You can read more about the code of conduct at " \ "contributor-covenant.org. Having a code of conduct means agreeing to the responsibility " \ "of enforcing it, so be sure that you are prepared to do that. Be sure that your email " \ "address is specified as a contact in the generated code of conduct so that people know " \ "who to contact in case of a violation. For suggestions about " \ "how to enforce codes of conduct, see http://bit.ly/coc-enforcement.") config[:coc] = true Bundler.ui.info "Code of conduct enabled in config" templates.merge!("CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md") end templates.merge!("exe/newgem.tt" => "exe/#{name}") if options[:bin] if options[:ext] templates.merge!( "ext/newgem/extconf.rb.tt" => "ext/#{name}/extconf.rb", "ext/newgem/newgem.h.tt" => "ext/#{name}/#{underscored_name}.h", "ext/newgem/newgem.c.tt" => "ext/#{name}/#{underscored_name}.c" ) end templates.each do |src, dst| thor.template("newgem/#{src}", target.join(dst), config) end executables.each do |file| path = target.join(file) executable = (path.stat.mode | 0111) path.chmod(executable) end Bundler.ui.info "Initializing git repo in #{target}" Dir.chdir(target) do `git init` `git add .` end if options[:edit] # Open gemspec in editor thor.run("#{options["edit"]} \"#{target.join("#{name}.gemspec")}\"") end end private def resolve_name(name) SharedHelpers.pwd.join(name).basename.to_s end def ask_and_set(key, header, message) choice = options[key] choice = Bundler.settings["gem.#{key}"] if choice.nil? if choice.nil? Bundler.ui.confirm header choice = Bundler.ui.yes? "#{message} y/(n):" Bundler.settings.set_global("gem.#{key}", choice) end choice end def validate_ext_name return unless gem_name.index("-") Bundler.ui.error "You have specified a gem name which does not conform to the \n" \ "naming guidelines for C extensions. For more information, \n" \ "see the 'Extension Naming' section at the following URL:\n" \ "http://guides.rubygems.org/gems-with-extensions/\n" exit 1 end def ask_and_set_test_framework test_framework = options[:test] || Bundler.settings["gem.test"] if test_framework.nil? Bundler.ui.confirm "Do you want to generate tests with your gem?" result = Bundler.ui.ask "Type 'rspec' or 'minitest' to generate those test files now and " \ "in the future. rspec/minitest/(none):" if result =~ /rspec|minitest/ test_framework = result else test_framework = false end end if Bundler.settings["gem.test"].nil? Bundler.settings.set_global("gem.test", test_framework) end test_framework end def bundler_dependency_version v = Gem::Version.new(Bundler::VERSION) req = v.segments[0..1] req << "a" if v.prerelease? req.join(".") end def ensure_safe_gem_name(name, constant_array) if name =~ /^\d/ Bundler.ui.error "Invalid gem name #{name} Please give a name which does not start with numbers." exit 1 elsif constant_array.inject(Object) {|c, s| (c.const_defined?(s) && c.const_get(s)) || break } Bundler.ui.error "Invalid gem name #{name} constant #{constant_array.join("::")} is already in use. Please choose another gem name." exit 1 end end end end bundler-1.11.2/lib/bundler/cli/open.rb0000644000004100000410000000125612652443364017532 0ustar www-datawww-datarequire "bundler/cli/common" require "shellwords" module Bundler class CLI::Open attr_reader :options, :name def initialize(options, name) @options = options @name = name end def run editor = [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? } return Bundler.ui.info("To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR") unless editor path = Bundler::CLI::Common.select_spec(name, :regex_match).full_gem_path Dir.chdir(path) do command = Shellwords.split(editor) + [path] system(*command) || Bundler.ui.info("Could not run '#{command.join(" ")}'") end end end end bundler-1.11.2/lib/bundler/cli/outdated.rb0000644000004100000410000000611312652443364020377 0ustar www-datawww-datarequire "bundler/cli/common" module Bundler class CLI::Outdated attr_reader :options, :gems def initialize(options, gems) @options = options @gems = gems end def run sources = Array(options[:source]) gems.each do |gem_name| Bundler::CLI::Common.select_spec(gem_name) end Bundler.definition.validate_ruby! current_specs = Bundler.ui.silence { Bundler.load.specs } current_dependencies = {} Bundler.ui.silence { Bundler.load.dependencies.each {|dep| current_dependencies[dep.name] = dep } } if gems.empty? && sources.empty? # We're doing a full update definition = Bundler.definition(true) else definition = Bundler.definition(:gems => gems, :sources => sources) end options["local"] ? definition.resolve_with_cache! : definition.resolve_remotely! Bundler.ui.info "" out_count = 0 # Loop through the current specs gemfile_specs, dependency_specs = current_specs.partition {|spec| current_dependencies.key? spec.name } [gemfile_specs.sort_by(&:name), dependency_specs.sort_by(&:name)].flatten.each do |current_spec| next if !gems.empty? && !gems.include?(current_spec.name) dependency = current_dependencies[current_spec.name] if options["strict"] active_spec = definition.specs.detect {|spec| spec.name == current_spec.name } else active_spec = definition.index[current_spec.name].sort_by(&:version) if !current_spec.version.prerelease? && !options[:pre] && active_spec.size > 1 active_spec = active_spec.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? } end active_spec = active_spec.last end next if active_spec.nil? gem_outdated = Gem::Version.new(active_spec.version) > Gem::Version.new(current_spec.version) git_outdated = current_spec.git_version != active_spec.git_version if gem_outdated || git_outdated if out_count == 0 if options["pre"] Bundler.ui.info "Outdated gems included in the bundle (including pre-releases):" else Bundler.ui.info "Outdated gems included in the bundle:" end end spec_version = "#{active_spec.version}#{active_spec.git_version}" current_version = "#{current_spec.version}#{current_spec.git_version}" dependency_version = %(, requested #{dependency.requirement}) if dependency && dependency.specific? if dependency groups = dependency.groups.join(", ") pl = (dependency.groups.length > 1) ? "s" : "" groups = " in group#{pl} \"#{groups}\"" end Bundler.ui.info " * #{active_spec.name} (newest #{spec_version}, installed #{current_version}#{dependency_version})#{groups}".rstrip out_count += 1 end Bundler.ui.debug "from #{active_spec.loaded_from}" end if out_count.zero? Bundler.ui.info "Bundle up to date!\n" else exit 1 end end end end bundler-1.11.2/lib/bundler/ruby_version.rb0000644000004100000410000000610112652443364020542 0ustar www-datawww-datamodule Bundler class RubyVersion attr_reader :version, :patchlevel, :engine, :engine_version def initialize(version, patchlevel, engine, engine_version) # The parameters to this method must satisfy the # following constraints, which are verified in # the DSL: # # * If an engine is specified, an engine version # must also be specified # * If an engine version is specified, an engine # must also be specified # * If the engine is "ruby", the engine version # must not be specified, or the engine version # specified must match the version. @version = version @engine = engine || "ruby" # keep track of the engine specified by the user @input_engine = engine @engine_version = engine_version || version @patchlevel = patchlevel end def to_s output = "ruby #{version}" output << "p#{patchlevel}" if patchlevel output << " (#{engine} #{engine_version})" unless engine == "ruby" output end def ==(other) version == other.version && engine == other.engine && engine_version == other.engine_version && patchlevel == other.patchlevel end # Returns a tuple of these things: # [diff, this, other] # The priority of attributes are # 1. engine # 2. ruby_version # 3. engine_version def diff(other) if engine != other.engine && @input_engine [:engine, engine, other.engine] elsif version != other.version [:version, version, other.version] elsif engine_version != other.engine_version && @input_engine [:engine_version, engine_version, other.engine_version] elsif patchlevel != other.patchlevel && @patchlevel [:patchlevel, patchlevel, other.patchlevel] end end def host @host ||= [ RbConfig::CONFIG["host_cpu"], RbConfig::CONFIG["host_vendor"], RbConfig::CONFIG["host_os"] ].join("-") end end # A subclass of RubyVersion that implements version, # engine and engine_version based upon the current # information in the system. It can be used anywhere # a RubyVersion object is expected, and can be # compared with a RubyVersion object. class SystemRubyVersion < RubyVersion def initialize(*) # override the default initialize, because # we will implement version, engine and # engine_version dynamically end def version RUBY_VERSION.dup end def gem_version @gem_version ||= Gem::Version.new(version) end def engine if defined?(RUBY_ENGINE) RUBY_ENGINE.dup else # not defined in ruby 1.8.7 "ruby" end end def engine_version case engine when "ruby" RUBY_VERSION.dup when "rbx" Rubinius::VERSION.dup when "jruby" JRUBY_VERSION.dup else raise BundlerError, "RUBY_ENGINE value #{RUBY_ENGINE} is not recognized" end end def patchlevel RUBY_PATCHLEVEL.to_s end end end bundler-1.11.2/lib/bundler/gem_remote_fetcher.rb0000644000004100000410000000266712652443364021654 0ustar www-datawww-datarequire "rubygems/remote_fetcher" module Bundler # Adds support for setting custom HTTP headers when fetching gems from the # server. # # TODO: Get rid of this when and if gemstash only supports RubyGems versions # that contain https://github.com/rubygems/rubygems/commit/3db265cc20b2f813. class GemRemoteFetcher < Gem::RemoteFetcher attr_accessor :headers # Extracted from RubyGems 2.4. def fetch_http(uri, last_modified = nil, head = false, depth = 0) fetch_type = head ? Net::HTTP::Head : Net::HTTP::Get # beginning of change response = request uri, fetch_type, last_modified do |req| headers.each {|k, v| req.add_field(k, v) } if headers end # end of change case response when Net::HTTPOK, Net::HTTPNotModified then response.uri = uri if response.respond_to? :uri head ? response : response.body when Net::HTTPMovedPermanently, Net::HTTPFound, Net::HTTPSeeOther, Net::HTTPTemporaryRedirect then raise FetchError.new("too many redirects", uri) if depth > 10 location = URI.parse response["Location"] if https?(uri) && !https?(location) raise FetchError.new("redirecting to non-https resource: #{location}", uri) end fetch_http(location, last_modified, head, depth + 1) else raise FetchError.new("bad response #{response.message} #{response.code}", uri) end end end end bundler-1.11.2/lib/bundler/capistrano.rb0000644000004100000410000000126212652443364020162 0ustar www-datawww-data# Capistrano task for Bundler. # # Just add "require 'bundler/capistrano'" in your Capistrano deploy.rb, and # Bundler will be activated after each new deployment. require "bundler/deployment" require "capistrano/version" if defined?(Capistrano::Version) && Gem::Version.new(Capistrano::Version).release >= Gem::Version.new("3.0") raise "For Capistrano 3.x integration, please use http://github.com/capistrano/bundler" end Capistrano::Configuration.instance(:must_exist).load do before "deploy:finalize_update", "bundle:install" Bundler::Deployment.define_task(self, :task, :except => { :no_release => true }) set :rake, lambda { "#{fetch(:bundle_cmd, "bundle")} exec rake" } end bundler-1.11.2/lib/bundler/gem_helpers.rb0000644000004100000410000000156612652443364020320 0ustar www-datawww-datamodule Bundler module GemHelpers GENERIC_CACHE = {} GENERICS = [ [Gem::Platform.new("java"), Gem::Platform.new("java")], [Gem::Platform.new("mswin32"), Gem::Platform.new("mswin32")], [Gem::Platform.new("mswin64"), Gem::Platform.new("mswin64")], [Gem::Platform.new("universal-mingw32"), Gem::Platform.new("universal-mingw32")], [Gem::Platform.new("x64-mingw32"), Gem::Platform.new("x64-mingw32")], [Gem::Platform.new("x86_64-mingw32"), Gem::Platform.new("x64-mingw32")], [Gem::Platform.new("mingw32"), Gem::Platform.new("x86-mingw32")] ] def generic(p) return p if p == Gem::Platform::RUBY GENERIC_CACHE[p] ||= begin _, found = GENERICS.find do |match, _generic| p.os == match.os && (!match.cpu || p.cpu == match.cpu) end found || Gem::Platform::RUBY end end end end bundler-1.11.2/lib/bundler/settings.rb0000644000004100000410000001503012652443364017655 0ustar www-datawww-datarequire "uri" module Bundler class Settings BOOL_KEYS = %w(frozen cache_all no_prune disable_local_branch_check ignore_messages gem.mit gem.coc silence_root_warning).freeze NUMBER_KEYS = %w(retry timeout redirect ssl_verify_mode).freeze DEFAULT_CONFIG = { :retry => 3, :timeout => 10, :redirect => 5 } def initialize(root = nil) @root = root @local_config = load_config(local_config_file) @global_config = load_config(global_config_file) end def [](name) key = key_for(name) value = (@local_config[key] || ENV[key] || @global_config[key] || DEFAULT_CONFIG[name]) case when value.nil? nil when is_bool(name) || value == "false" to_bool(value) when is_num(name) value.to_i else value end end def []=(key, value) local_config_file || raise(GemfileNotFound, "Could not locate Gemfile") set_key(key, value, @local_config, local_config_file) end alias_method :set_local, :[]= def delete(key) @local_config.delete(key_for(key)) end def set_global(key, value) set_key(key, value, @global_config, global_config_file) end def all env_keys = ENV.keys.select {|k| k =~ /BUNDLE_.*/ } keys = @global_config.keys | @local_config.keys | env_keys keys.map do |key| key.sub(/^BUNDLE_/, "").gsub(/__/, ".").downcase end end def local_overrides repos = {} all.each do |k| repos[$'] = self[k] if k =~ /^local\./ end repos end def mirror_for(uri) uri = URI(uri.to_s) unless uri.is_a?(URI) # Settings keys are all downcased normalized_key = normalize_uri(uri.to_s.downcase) gem_mirrors[normalized_key] || uri end def credentials_for(uri) self[uri.to_s] || self[uri.host] end def gem_mirrors all.inject({}) do |h, k| if k =~ /^mirror\./ uri = normalize_uri($') h[uri] = normalize_uri(self[k]) end h end end def locations(key) key = key_for(key) locations = {} locations[:local] = @local_config[key] if @local_config.key?(key) locations[:env] = ENV[key] if ENV[key] locations[:global] = @global_config[key] if @global_config.key?(key) locations[:default] = DEFAULT_CONFIG[key] if DEFAULT_CONFIG.key?(key) locations end def pretty_values_for(exposed_key) key = key_for(exposed_key) locations = [] if @local_config.key?(key) locations << "Set for your local app (#{local_config_file}): #{@local_config[key].inspect}" end if value = ENV[key] locations << "Set via #{key}: #{value.inspect}" end if @global_config.key?(key) locations << "Set for the current user (#{global_config_file}): #{@global_config[key].inspect}" end return ["You have not configured a value for `#{exposed_key}`"] if locations.empty? locations end def without=(array) set_array(:without, array) end def with=(array) set_array(:with, array) end def without get_array(:without) end def with get_array(:with) end # @local_config["BUNDLE_PATH"] should be prioritized over ENV["BUNDLE_PATH"] def path key = key_for(:path) path = ENV[key] || @global_config[key] return path if path && !@local_config.key?(key) if path = self[:path] "#{path}/#{Bundler.ruby_scope}" else Bundler.rubygems.gem_dir end end def allow_sudo? !@local_config.key?(key_for(:path)) end def ignore_config? ENV["BUNDLE_IGNORE_CONFIG"] end def app_cache_path @app_cache_path ||= begin path = self[:cache_path] || "vendor/cache" raise InvalidOption, "Cache path must be relative to the bundle path" if path.start_with?("/") path end end private def key_for(key) key = normalize_uri(key).to_s if key.is_a?(String) && /https?:/ =~ key key = key.to_s.gsub(".", "__").upcase "BUNDLE_#{key}" end def parent_setting_for(name) split_specfic_setting_for(name)[0] end def specfic_gem_for(name) split_specfic_setting_for(name)[1] end def split_specfic_setting_for(name) name.split(".") end def is_bool(name) BOOL_KEYS.include?(name.to_s) || BOOL_KEYS.include?(parent_setting_for(name.to_s)) end def to_bool(value) !(value.nil? || value == "" || value =~ /^(false|f|no|n|0)$/i || value == false) end def is_num(value) NUMBER_KEYS.include?(value.to_s) end def get_array(key) self[key] ? self[key].split(":").map(&:to_sym) : [] end def set_array(key, array) self[key] = (array.empty? ? nil : array.join(":")) if array end def set_key(key, value, hash, file) key = key_for(key) unless hash[key] == value hash[key] = value hash.delete(key) if value.nil? SharedHelpers.filesystem_access(file) do |p| FileUtils.mkdir_p(p.dirname) require "bundler/psyched_yaml" File.open(p, "w") {|f| f.puts YAML.dump(hash) } end end value end def global_config_file file = ENV["BUNDLE_CONFIG"] || File.join(Bundler.rubygems.user_home, ".bundle/config") Pathname.new(file) end def local_config_file Pathname.new(@root).join("config") if @root end def load_config(config_file) valid_file = config_file && config_file.exist? && !config_file.size.zero? if !ignore_config? && valid_file config_regex = /^(BUNDLE_.+): (['"]?)(.*(?:\n(?!BUNDLE).+)?)\2$/ raise PermissionError.new(config_file, :read) unless config_file.readable? config_pairs = config_file.read.scan(config_regex).map do |m| key, _, value = m [convert_to_backward_compatible_key(key), value.gsub(/\s+/, " ").tr('"', "'")] end Hash[config_pairs] else {} end end def convert_to_backward_compatible_key(key) key = "#{key}/" if key =~ /https?:/i && key !~ %r{/\Z} key = key.gsub(".", "__") if key.include?(".") key end # TODO: duplicates Rubygems#normalize_uri # TODO: is this the correct place to validate mirror URIs? def normalize_uri(uri) uri = uri.to_s uri = "#{uri}/" unless uri =~ %r{/\Z} uri = URI(uri) unless uri.absolute? raise ArgumentError, "Gem sources must be absolute. You provided '#{uri}'." end uri end end end bundler-1.11.2/lib/bundler/dep_proxy.rb0000644000004100000410000000133612652443364020032 0ustar www-datawww-datamodule Bundler class DepProxy attr_reader :__platform, :dep def initialize(dep, platform) @dep = dep @__platform = platform end def hash @hash ||= dep.hash end def ==(other) dep == other.dep && __platform == other.__platform end alias_method :eql?, :== def type @dep.type end def name @dep.name end def requirement @dep.requirement end def to_s s = name.dup s << " (#{requirement})" unless requirement == Gem::Requirement.default s << " #{__platform}" unless __platform == Gem::Platform::RUBY s end private def method_missing(*args, &blk) @dep.send(*args, &blk) end end end bundler-1.11.2/lib/bundler/dsl.rb0000644000004100000410000004041412652443364016603 0ustar www-datawww-datarequire "bundler/dependency" require "bundler/ruby_dsl" module Bundler class Dsl include RubyDsl def self.evaluate(gemfile, lockfile, unlock) builder = new builder.eval_gemfile(gemfile) builder.to_definition(lockfile, unlock) end VALID_PLATFORMS = Bundler::Dependency::PLATFORM_MAP.keys.freeze attr_reader :gemspecs attr_accessor :dependencies def initialize @source = nil @sources = SourceList.new @git_sources = {} @dependencies = [] @groups = [] @install_conditionals = [] @optional_groups = [] @platforms = [] @env = nil @ruby_version = nil @gemspecs = [] add_git_sources end def eval_gemfile(gemfile, contents = nil) contents ||= Bundler.read_file(gemfile.to_s) instance_eval(contents, gemfile.to_s, 1) rescue Exception => e message = "There was an error " \ "#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \ "`#{File.basename gemfile.to_s}`: #{e.message}" raise DSLError.new(message, gemfile, e.backtrace, contents) end def gemspec(opts = nil) path = opts && opts[:path] || "." glob = opts && opts[:glob] name = opts && opts[:name] || "{,*}" development_group = opts && opts[:development_group] || :development expanded_path = File.expand_path(path, Bundler.default_gemfile.dirname) gemspecs = Dir[File.join(expanded_path, "#{name}.gemspec")] case gemspecs.size when 1 spec = Bundler.load_gemspec(gemspecs.first) unless spec raise InvalidOption, "There was an error loading the gemspec at " \ "#{file}. Make sure you can build the gem, then try again" end gem spec.name, :path => path, :glob => glob group(development_group) do spec.development_dependencies.each do |dep| gem dep.name, *(dep.requirement.as_list + [:type => :development]) end end @gemspecs << gemspecs.first when 0 raise InvalidOption, "There are no gemspecs at #{expanded_path}" else raise InvalidOption, "There are multiple gemspecs at #{expanded_path}. " \ "Please use the :name option to specify which one should be used" end end def gem(name, *args) options = args.last.is_a?(Hash) ? args.pop.dup : {} version = args || [">= 0"] normalize_options(name, version, options) dep = Dependency.new(name, version, options) # if there's already a dependency with this name we try to prefer one if current = @dependencies.find {|d| d.name == dep.name } if current.requirement != dep.requirement if current.type == :development @dependencies.delete current elsif dep.type == :development return else raise GemfileError, "You cannot specify the same gem twice with different version requirements.\n" \ "You specified: #{current.name} (#{current.requirement}) and #{dep.name} (#{dep.requirement})" end else Bundler.ui.warn "Your Gemfile lists the gem #{current.name} (#{current.requirement}) more than once.\n" \ "You should probably keep only one of them.\n" \ "While it's not a problem now, it could cause errors if you change the version of just one of them later." end if current.source != dep.source if current.type == :development @dependencies.delete current elsif dep.type == :development return else raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \ "You specified that #{dep.name} (#{dep.requirement}) should come from " \ "#{current.source || "an unspecified source"} and #{dep.source}\n" end end end @dependencies << dep end def source(source, &blk) source = normalize_source(source) if block_given? with_source(@sources.add_rubygems_source("remotes" => source), &blk) else check_primary_source_safety(@sources) @sources.add_rubygems_remote(source) end end def git_source(name, &block) unless block_given? raise InvalidOption, "You need to pass a block to #git_source" end if valid_keys.include?(name.to_s) raise InvalidOption, "You cannot use #{name} as a git source. It " \ "is a reserved key. Reserved keys are: #{valid_keys.join(", ")}" end @git_sources[name.to_s] = block end def path(path, options = {}, &blk) with_source(@sources.add_path_source(normalize_hash(options).merge("path" => Pathname.new(path))), &blk) end def git(uri, options = {}, &blk) unless block_given? msg = "You can no longer specify a git source by itself. Instead, \n" \ "either use the :git option on a gem, or specify the gems that \n" \ "bundler should find in the git source by passing a block to \n" \ "the git method, like: \n\n" \ " git 'git://github.com/rails/rails.git' do\n" \ " gem 'rails'\n" \ " end" raise DeprecatedError, msg end with_source(@sources.add_git_source(normalize_hash(options).merge("uri" => uri)), &blk) end def github(repo, options = {}) raise ArgumentError, "Github sources require a block" unless block_given? github_uri = @git_sources["github"].call(repo) git_options = normalize_hash(options).merge("uri" => github_uri) git_source = @sources.add_git_source(git_options) with_source(git_source) { yield } end def to_definition(lockfile, unlock) Definition.new(lockfile, @dependencies, @sources, unlock, @ruby_version, @optional_groups) end def group(*args, &blk) opts = Hash === args.last ? args.pop.dup : {} normalize_group_options(opts, args) @groups.concat args if opts["optional"] optional_groups = args - @optional_groups @optional_groups.concat optional_groups end yield ensure args.each { @groups.pop } end def install_if(*args, &blk) @install_conditionals.concat args blk.call ensure args.each { @install_conditionals.pop } end def platforms(*platforms) @platforms.concat platforms yield ensure platforms.each { @platforms.pop } end alias_method :platform, :platforms def env(name) old = @env @env = name yield ensure @env = old end def method_missing(name, *args) raise GemfileError, "Undefined local variable or method `#{name}' for Gemfile" end private def add_git_sources git_source(:github) do |repo_name| # It would be better to use https instead of the git protocol, but this # can break deployment of existing locked bundles when switching between # different versions of Bundler. The change will be made in 2.0, which # does not guarantee compatibility with the 1.x series. # # See https://github.com/bundler/bundler/pull/2569 for discussion # # This can be overridden by adding this code to your Gemfiles: # # git_source(:github) do |repo_name| # repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") # "https://github.com/#{repo_name}.git" # end repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") "git://github.com/#{repo_name}.git" end git_source(:gist) {|repo_name| "https://gist.github.com/#{repo_name}.git" } git_source(:bitbucket) do |repo_name| user_name, repo_name = repo_name.split "/" repo_name ||= user_name "https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git" end end def with_source(source) old_source = @source if block_given? @source = source yield end source ensure @source = old_source end def normalize_hash(opts) opts.keys.each do |k| opts[k.to_s] = opts.delete(k) unless k.is_a?(String) end opts end def valid_keys @valid_keys ||= %w(group groups git path glob name branch ref tag require submodules platform platforms type source install_if) end def normalize_options(name, version, opts) if name.is_a?(Symbol) raise GemfileError, %(You need to specify gem names as Strings. Use 'gem "#{name}"' instead) end if name =~ /\s/ raise GemfileError, %('#{name}' is not a valid gem name because it contains whitespace) end normalize_hash(opts) git_names = @git_sources.keys.map(&:to_s) validate_keys("gem '#{name}'", opts, valid_keys + git_names) groups = @groups.dup opts["group"] = opts.delete("groups") || opts["group"] groups.concat Array(opts.delete("group")) groups = [:default] if groups.empty? install_if = @install_conditionals.dup install_if.concat Array(opts.delete("install_if")) install_if = install_if.reduce(true) do |memo, val| memo && (val.respond_to?(:call) ? val.call : val) end platforms = @platforms.dup opts["platforms"] = opts["platform"] || opts["platforms"] platforms.concat Array(opts.delete("platforms")) platforms.map!(&:to_sym) platforms.each do |p| next if VALID_PLATFORMS.include?(p) raise GemfileError, "`#{p}` is not a valid platform. The available options are: #{VALID_PLATFORMS.inspect}" end # Save sources passed in a key if opts.key?("source") source = normalize_source(opts["source"]) opts["source"] = @sources.add_rubygems_source("remotes" => source) end git_name = (git_names & opts.keys).last if @git_sources[git_name] opts["git"] = @git_sources[git_name].call(opts[git_name]) end %w(git path).each do |type| next unless param = opts[type] if version.first && version.first =~ /^\s*=?\s*(\d[^\s]*)\s*$/ options = opts.merge("name" => name, "version" => $1) else options = opts.dup end source = send(type, param, options) {} opts["source"] = source end opts["source"] ||= @source opts["env"] ||= @env opts["platforms"] = platforms.dup opts["group"] = groups opts["should_include"] = install_if end def normalize_group_options(opts, groups) normalize_hash(opts) groups = groups.map {|group| ":#{group}" }.join(", ") validate_keys("group #{groups}", opts, %w(optional)) opts["optional"] ||= false end def validate_keys(command, opts, valid_keys) invalid_keys = opts.keys - valid_keys if invalid_keys.any? message = "You passed #{invalid_keys.map {|k| ":" + k }.join(", ")} " message << if invalid_keys.size > 1 "as options for #{command}, but they are invalid." else "as an option for #{command}, but it is invalid." end message << " Valid options are: #{valid_keys.join(", ")}" raise InvalidOption, message end end def normalize_source(source) case source when :gemcutter, :rubygems, :rubyforge Bundler.ui.warn "The source :#{source} is deprecated because HTTP " \ "requests are insecure.\nPlease change your source to 'https://" \ "rubygems.org' if possible, or 'http://rubygems.org' if not." "http://rubygems.org" when String source else raise GemfileError, "Unknown source '#{source}'" end end def check_primary_source_safety(source) return unless source.rubygems_primary_remotes.any? if Bundler.settings[:disable_multisource] raise GemspecError, "Warning: this Gemfile contains multiple primary sources. " \ "Each source after the first must include a block to indicate which gems " \ "should come from that source. To downgrade this error to a warning, run " \ "`bundle config --delete disable_multisource`" else Bundler.ui.warn "Warning: this Gemfile contains multiple primary sources. " \ "Using `source` more than once without a block is a security risk, and " \ "may result in installing unexpected gems. To resolve this warning, use " \ "a block to indicate which gems should come from the secondary source. " \ "To upgrade this warning to an error, run `bundle config " \ "disable_multisource true`." end end class DSLError < GemfileError # @return [String] the description that should be presented to the user. # attr_reader :description # @return [String] the path of the dsl file that raised the exception. # attr_reader :dsl_path # @return [Exception] the backtrace of the exception raised by the # evaluation of the dsl file. # attr_reader :backtrace # @param [Exception] backtrace @see backtrace # @param [String] dsl_path @see dsl_path # def initialize(description, dsl_path, backtrace, contents = nil) @status_code = $!.respond_to?(:status_code) && $!.status_code @description = description @dsl_path = dsl_path @backtrace = backtrace @contents = contents end def status_code @status_code || super end # @return [String] the contents of the DSL that cause the exception to # be raised. # def contents @contents ||= begin dsl_path && File.exist?(dsl_path) && File.read(dsl_path) end end # The message of the exception reports the content of podspec for the # line that generated the original exception. # # @example Output # # Invalid podspec at `RestKit.podspec` - undefined method # `exclude_header_search_paths=' for # # # from spec-repos/master/RestKit/0.9.3/RestKit.podspec:36 # ------------------------------------------- # # because it would break: #import # > ns.exclude_header_search_paths = 'Code/RestKit.h' # end # ------------------------------------------- # # @return [String] the message of the exception. # def to_s @to_s ||= begin trace_line, description = parse_line_number_from_description m = "\n[!] " m << description m << ". Bundler cannot continue.\n" return m unless backtrace && dsl_path && contents trace_line = backtrace.find {|l| l.include?(dsl_path.to_s) } || trace_line return m unless trace_line line_numer = trace_line.split(":")[1].to_i - 1 return m unless line_numer lines = contents.lines.to_a indent = " # " indicator = indent.tr('#', ">") first_line = (line_numer.zero?) last_line = (line_numer == (lines.count - 1)) m << "\n" m << "#{indent}from #{trace_line.gsub(/:in.*$/, "")}\n" m << "#{indent}-------------------------------------------\n" m << "#{indent}#{lines[line_numer - 1]}" unless first_line m << "#{indicator}#{lines[line_numer]}" m << "#{indent}#{lines[line_numer + 1]}" unless last_line m << "\n" unless m.end_with?("\n") m << "#{indent}-------------------------------------------\n" end end private def parse_line_number_from_description description = self.description if dsl_path && description =~ /((#{Regexp.quote File.expand_path(dsl_path)}|#{Regexp.quote dsl_path.to_s}):\d+)/ trace_line = Regexp.last_match[1] description = description.sub(/#{Regexp.quote trace_line}:\s*/, "").sub("\n", " - ") end [trace_line, description] end end end end bundler-1.11.2/lib/bundler.rb0000644000004100000410000003145012652443364016021 0ustar www-datawww-datarequire "fileutils" require "pathname" require "rbconfig" require "thread" require "bundler/gem_path_manipulation" require "bundler/gem_remote_fetcher" require "bundler/rubygems_ext" require "bundler/rubygems_integration" require "bundler/version" require "bundler/constants" require "bundler/current_ruby" require "bundler/errors" module Bundler preserve_gem_path ORIGINAL_ENV = ENV.to_hash SUDO_MUTEX = Mutex.new autoload :Definition, "bundler/definition" autoload :Dependency, "bundler/dependency" autoload :DepProxy, "bundler/dep_proxy" autoload :Deprecate, "bundler/deprecate" autoload :Dsl, "bundler/dsl" autoload :EndpointSpecification, "bundler/endpoint_specification" autoload :Environment, "bundler/environment" autoload :Env, "bundler/env" autoload :Fetcher, "bundler/fetcher" autoload :GemHelper, "bundler/gem_helper" autoload :GemHelpers, "bundler/gem_helpers" autoload :RubyGemsGemInstaller, "bundler/rubygems_gem_installer" autoload :Graph, "bundler/graph" autoload :Index, "bundler/index" autoload :Installer, "bundler/installer" autoload :Injector, "bundler/injector" autoload :LazySpecification, "bundler/lazy_specification" autoload :LockfileParser, "bundler/lockfile_parser" autoload :MatchPlatform, "bundler/match_platform" autoload :RemoteSpecification, "bundler/remote_specification" autoload :Resolver, "bundler/resolver" autoload :Retry, "bundler/retry" autoload :RubyVersion, "bundler/ruby_version" autoload :RubyDsl, "bundler/ruby_dsl" autoload :Runtime, "bundler/runtime" autoload :Settings, "bundler/settings" autoload :SharedHelpers, "bundler/shared_helpers" autoload :SpecSet, "bundler/spec_set" autoload :StubSpecification, "bundler/stub_specification" autoload :Source, "bundler/source" autoload :SourceList, "bundler/source_list" autoload :SystemRubyVersion, "bundler/ruby_version" autoload :UI, "bundler/ui" class << self attr_writer :bundle_path def configure @configured ||= configure_gem_home_and_path end def ui (defined?(@ui) && @ui) || (self.ui = UI::Silent.new) end def ui=(ui) Bundler.rubygems.ui = ui ? UI::RGProxy.new(ui) : nil @ui = ui end # Returns absolute path of where gems are installed on the filesystem. def bundle_path @bundle_path ||= Pathname.new(settings.path).expand_path(root) end # Returns absolute location of where binstubs are installed to. def bin_path @bin_path ||= begin path = settings[:bin] || "bin" path = Pathname.new(path).expand_path(root).expand_path SharedHelpers.filesystem_access(path) {|p| FileUtils.mkdir_p(p) } path end end def setup(*groups) # Just return if all groups are already loaded return @setup if defined?(@setup) definition.validate_ruby! if groups.empty? # Load all groups, but only once @setup = load.setup else load.setup(*groups) end end def require(*groups) setup(*groups).require(*groups) end def load @load ||= Runtime.new(root, definition) end def environment Bundler::Environment.new(root, definition) end # Returns an instance of Bundler::Definition for given Gemfile and lockfile # # @param unlock [Hash, Boolean, nil] Gems that have been requested # to be updated or true if all gems should be updated # @return [Bundler::Definition] def definition(unlock = nil) @definition = nil if unlock @definition ||= begin configure upgrade_lockfile Definition.build(default_gemfile, default_lockfile, unlock) end end def locked_gems return @locked_gems if defined?(@locked_gems) if Bundler.default_lockfile.exist? lock = Bundler.read_file(Bundler.default_lockfile) @locked_gems = LockfileParser.new(lock) else @locked_gems = nil end end def ruby_scope "#{Bundler.rubygems.ruby_engine}/#{Bundler.rubygems.config_map[:ruby_version]}" end def user_bundle_path Pathname.new(Bundler.rubygems.user_home).join(".bundler") end def home bundle_path.join("bundler") end def install_path home.join("gems") end def specs_path bundle_path.join("specifications") end def cache bundle_path.join("cache/bundler") end def root @root ||= begin default_gemfile.dirname.expand_path rescue GemfileNotFound bundle_dir = default_bundle_dir raise GemfileNotFound, "Could not locate Gemfile or .bundle/ directory" unless bundle_dir Pathname.new(File.expand_path("..", bundle_dir)) end end def app_config_path if ENV["BUNDLE_APP_CONFIG"] Pathname.new(ENV["BUNDLE_APP_CONFIG"]).expand_path(root) else root.join(".bundle") end end def app_cache(custom_path = nil) path = custom_path || root path.join(settings.app_cache_path) end def tmp(name = Process.pid.to_s) Pathname.new(Dir.mktmpdir(["bundler", name])) end def rm_rf(path) FileUtils.remove_entry_secure(path) if path && File.exist?(path) end def settings return @settings if defined?(@settings) @settings = Settings.new(app_config_path) rescue GemfileNotFound @settings = Settings.new(Pathname.new(".bundle").expand_path) end def with_original_env bundled_env = ENV.to_hash ENV.replace(ORIGINAL_ENV) yield ensure ENV.replace(bundled_env.to_hash) end def with_clean_env with_original_env do ENV["MANPATH"] = ENV["BUNDLE_ORIG_MANPATH"] ENV.delete_if {|k, _| k[0, 7] == "BUNDLE_" } if ENV.key?("RUBYOPT") ENV["RUBYOPT"] = ENV["RUBYOPT"].sub "-rbundler/setup", "" end if ENV.key?("RUBYLIB") rubylib = ENV["RUBYLIB"].split(File::PATH_SEPARATOR) rubylib.delete(File.expand_path("..", __FILE__)) ENV["RUBYLIB"] = rubylib.join(File::PATH_SEPARATOR) end yield end end def clean_system(*args) with_clean_env { Kernel.system(*args) } end def clean_exec(*args) with_clean_env { Kernel.exec(*args) } end def default_gemfile SharedHelpers.default_gemfile end def default_lockfile SharedHelpers.default_lockfile end def default_bundle_dir SharedHelpers.default_bundle_dir end def system_bindir # Gem.bindir doesn't always return the location that Rubygems will install # system binaries. If you put '-n foo' in your .gemrc, Rubygems will # install binstubs there instead. Unfortunately, Rubygems doesn't expose # that directory at all, so rather than parse .gemrc ourselves, we allow # the directory to be set as well, via `bundle config bindir foo`. Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir end def requires_sudo? return @requires_sudo if defined?(@requires_sudo_ran) sudo_present = which "sudo" if settings.allow_sudo? if sudo_present # the bundle path and subdirectories need to be writable for Rubygems # to be able to unpack and install gems without exploding path = bundle_path path = path.parent until path.exist? # bins are written to a different location on OS X bin_dir = Pathname.new(Bundler.system_bindir) bin_dir = bin_dir.parent until bin_dir.exist? # if any directory is not writable, we need sudo files = [path, bin_dir] | Dir[path.join("build_info/*").to_s] | Dir[path.join("*").to_s] sudo_needed = files.any? {|f| !File.writable?(f) } end @requires_sudo_ran = true @requires_sudo = settings.allow_sudo? && sudo_present && sudo_needed end def mkdir_p(path) if requires_sudo? sudo "mkdir -p '#{path}'" unless File.exist?(path) else SharedHelpers.filesystem_access(path, :write) do |p| FileUtils.mkdir_p(p) end end end def which(executable) if File.file?(executable) && File.executable?(executable) executable elsif ENV["PATH"] path = ENV["PATH"].split(File::PATH_SEPARATOR).find do |p| abs_path = File.join(p, executable) File.file?(abs_path) && File.executable?(abs_path) end path && File.expand_path(executable, path) end end def sudo(str) SUDO_MUTEX.synchronize do prompt = "\n\n" + <<-PROMPT.gsub(/^ {6}/, "").strip + " " Your user account isn't allowed to install to the system Rubygems. You can cancel this installation and run: bundle install --path vendor/bundle to install the gems into ./vendor/bundle/, or you can enter your password and install the bundled gems to Rubygems using sudo. Password: PROMPT `sudo -p "#{prompt}" #{str}` end end def read_file(file) File.open(file, "rb", &:read) end def load_marshal(data) Marshal.load(data) rescue => e raise MarshalError, "#{e.class}: #{e.message}" end def load_gemspec(file, validate = false) @gemspec_cache ||= {} key = File.expand_path(file) @gemspec_cache[key] ||= load_gemspec_uncached(file, validate) # Protect against caching side-effected gemspecs by returning a # new instance each time. @gemspec_cache[key].dup if @gemspec_cache[key] end def load_gemspec_uncached(file, validate = false) path = Pathname.new(file) # Eval the gemspec from its parent directory, because some gemspecs # depend on "./" relative paths. SharedHelpers.chdir(path.dirname.to_s) do contents = path.read if contents[0..2] == "---" # YAML header spec = eval_yaml_gemspec(path, contents) else spec = eval_gemspec(path, contents) end Bundler.rubygems.validate(spec) if spec && validate spec end rescue Gem::InvalidSpecificationException => e UI::Shell.new.warn "The gemspec at #{file} is not valid. " \ "The validation error was '#{e.message}'" nil end def clear_gemspec_cache @gemspec_cache = {} end def git_present? return @git_present if defined?(@git_present) @git_present = Bundler.which("git") || Bundler.which("git.exe") end def ruby_version @ruby_version ||= SystemRubyVersion.new end def reset! @definition = nil end private def eval_yaml_gemspec(path, contents) # If the YAML is invalid, Syck raises an ArgumentError, and Psych # raises a Psych::SyntaxError. See psyched_yaml.rb for more info. Gem::Specification.from_yaml(contents) rescue YamlLibrarySyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception eval_gemspec(path, contents) end def eval_gemspec(path, contents) eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s) rescue ScriptError, StandardError => e original_line = e.backtrace.find {|line| line.include?(path.to_s) } msg = "There was a #{e.class} while loading #{path.basename}: \n#{e.message}" msg << " from\n #{original_line}" if original_line msg << "\n" if e.is_a?(LoadError) && RUBY_VERSION >= "1.9" msg << "\nDoes it try to require a relative path? That's been removed in Ruby 1.9." end raise GemspecError, msg end def configure_gem_home_and_path blank_home = ENV["GEM_HOME"].nil? || ENV["GEM_HOME"].empty? if settings[:disable_shared_gems] ENV["GEM_PATH"] = "" elsif blank_home || Bundler.rubygems.gem_dir != bundle_path.to_s possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path] paths = possibles.flatten.compact.uniq.reject(&:empty?) ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR) end configure_gem_home bundle_path end def configure_gem_home # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602) begin FileUtils.mkdir_p bundle_path.to_s rescue nil end ENV["GEM_HOME"] = File.expand_path(bundle_path, root) Bundler.rubygems.clear_paths end def upgrade_lockfile lockfile = default_lockfile if lockfile.exist? && lockfile.read(3) == "---" Bundler.ui.warn "Detected Gemfile.lock generated by 0.9, deleting..." lockfile.rmtree end end end end bundler-1.11.2/.rubocop.yml0000644000004100000410000000336012652443364015544 0ustar www-datawww-datainherit_from: - .rubocop_todo.yml AllCops: Exclude: - tmp/**/* - lib/bundler/vendor/**/* DisplayCopNames: true # Lint # They are idiomatic Lint/AssignmentInCondition: Enabled: false Lint/EndAlignment: AlignWith: variable Lint/UnusedMethodArgument: Enabled: false # Style Style/AccessModifierIndentation: EnforcedStyle: outdent Style/AlignParameters: EnforcedStyle: with_fixed_indentation Style/MultilineBlockChain: Enabled: false Style/MultilineOperationIndentation: EnforcedStyle: indented Style/PerlBackrefs: Enabled: false Style/SingleLineBlockParams: Enabled: false Style/SpaceInsideBlockBraces: SpaceBeforeBlockParameters: false Style/TrivialAccessors: Enabled: false # We adopted raise instead of fail. Style/SignalException: EnforcedStyle: only_raise Style/StringLiterals: EnforcedStyle: double_quotes Style/StringLiteralsInInterpolation: EnforcedStyle: double_quotes # Having these make it easier to *not* forget to add one when adding a new # value and you can simply copy the previous line. Style/TrailingComma: EnforcedStyleForMultiline: comma Style/TrailingUnderscoreVariable: Enabled: false # 1.8.7 support Style/HashSyntax: EnforcedStyle: hash_rockets Style/Lambda: Enabled: false Style/DotPosition: EnforcedStyle: trailing Style/EachWithObject: Enabled: false Style/SpecialGlobalVars: Enabled: false Style/TrailingComma: Enabled: false # Metrics # We've chosen to use Rubocop only for style, and not for complexity or quality checks. Metrics/ClassLength: Enabled: false Metrics/ModuleLength: Enabled: false Metrics/MethodLength: Enabled: false Metrics/BlockNesting: Enabled: false Metrics/AbcSize: Enabled: false Metrics/CyclomaticComplexity: Enabled: false bundler-1.11.2/metadata.yml0000644000004100000410000002547212652443364015605 0ustar www-datawww-data--- !ruby/object:Gem::Specification name: bundler version: !ruby/object:Gem::Version version: 1.11.2 platform: ruby authors: - André Arko - Terence Lee - Carl Lerche - Yehuda Katz autorequire: bindir: exe cert_chain: [] date: 2015-12-16 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: automatiek requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: 0.1.0 type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: 0.1.0 - !ruby/object:Gem::Dependency name: mustache requirement: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version version: 0.99.6 type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - '=' - !ruby/object:Gem::Version version: 0.99.6 - !ruby/object:Gem::Dependency name: rake requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '10.0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '10.0' - !ruby/object:Gem::Dependency name: rdiscount requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '1.6' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '1.6' - !ruby/object:Gem::Dependency name: ronn requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: 0.7.3 type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: 0.7.3 - !ruby/object:Gem::Dependency name: rspec requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '3.0' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: '3.0' description: Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably email: - andre.arko+terence.lee@gmail.com executables: - bundle - bundler extensions: [] extra_rdoc_files: [] files: - ".gitignore" - ".rspec" - ".rubocop.yml" - ".rubocop_todo.yml" - ".travis.yml" - CHANGELOG.md - CODE_OF_CONDUCT.md - CONTRIBUTING.md - DEVELOPMENT.md - ISSUES.md - LICENSE.md - README.md - Rakefile - bin/rake - bin/rspec - bin/rubocop - bundler.gemspec - exe/bundle - exe/bundle_ruby - exe/bundler - lib/bundler.rb - lib/bundler/capistrano.rb - lib/bundler/cli.rb - lib/bundler/cli/binstubs.rb - lib/bundler/cli/cache.rb - lib/bundler/cli/check.rb - lib/bundler/cli/clean.rb - lib/bundler/cli/common.rb - lib/bundler/cli/config.rb - lib/bundler/cli/console.rb - lib/bundler/cli/exec.rb - lib/bundler/cli/gem.rb - lib/bundler/cli/init.rb - lib/bundler/cli/inject.rb - lib/bundler/cli/install.rb - lib/bundler/cli/lock.rb - lib/bundler/cli/open.rb - lib/bundler/cli/outdated.rb - lib/bundler/cli/package.rb - lib/bundler/cli/platform.rb - lib/bundler/cli/show.rb - lib/bundler/cli/update.rb - lib/bundler/cli/viz.rb - lib/bundler/constants.rb - lib/bundler/current_ruby.rb - lib/bundler/definition.rb - lib/bundler/dep_proxy.rb - lib/bundler/dependency.rb - lib/bundler/deployment.rb - lib/bundler/deprecate.rb - lib/bundler/dsl.rb - lib/bundler/endpoint_specification.rb - lib/bundler/env.rb - lib/bundler/environment.rb - lib/bundler/errors.rb - lib/bundler/fetcher.rb - lib/bundler/fetcher/base.rb - lib/bundler/fetcher/dependency.rb - lib/bundler/fetcher/downloader.rb - lib/bundler/fetcher/index.rb - lib/bundler/friendly_errors.rb - lib/bundler/gem_helper.rb - lib/bundler/gem_helpers.rb - lib/bundler/gem_path_manipulation.rb - lib/bundler/gem_remote_fetcher.rb - lib/bundler/gem_tasks.rb - lib/bundler/graph.rb - lib/bundler/index.rb - lib/bundler/injector.rb - lib/bundler/inline.rb - lib/bundler/installer.rb - lib/bundler/installer/gem_installer.rb - lib/bundler/installer/parallel_installer.rb - lib/bundler/installer/standalone.rb - lib/bundler/lazy_specification.rb - lib/bundler/lockfile_parser.rb - lib/bundler/man/bundle - lib/bundler/man/bundle-config - lib/bundler/man/bundle-config.txt - lib/bundler/man/bundle-exec - lib/bundler/man/bundle-exec.txt - lib/bundler/man/bundle-gem - lib/bundler/man/bundle-gem.txt - lib/bundler/man/bundle-install - lib/bundler/man/bundle-install.txt - lib/bundler/man/bundle-lock - lib/bundler/man/bundle-lock.txt - lib/bundler/man/bundle-package - lib/bundler/man/bundle-package.txt - lib/bundler/man/bundle-platform - lib/bundler/man/bundle-platform.txt - lib/bundler/man/bundle-update - lib/bundler/man/bundle-update.txt - lib/bundler/man/bundle.txt - lib/bundler/man/gemfile.5 - lib/bundler/man/gemfile.5.txt - lib/bundler/match_platform.rb - lib/bundler/psyched_yaml.rb - lib/bundler/remote_specification.rb - lib/bundler/resolver.rb - lib/bundler/retry.rb - lib/bundler/ruby_dsl.rb - lib/bundler/ruby_version.rb - lib/bundler/rubygems_ext.rb - lib/bundler/rubygems_gem_installer.rb - lib/bundler/rubygems_integration.rb - lib/bundler/runtime.rb - lib/bundler/settings.rb - lib/bundler/setup.rb - lib/bundler/shared_helpers.rb - lib/bundler/similarity_detector.rb - lib/bundler/source.rb - lib/bundler/source/git.rb - lib/bundler/source/git/git_proxy.rb - lib/bundler/source/path.rb - lib/bundler/source/path/installer.rb - lib/bundler/source/rubygems.rb - lib/bundler/source/rubygems/remote.rb - lib/bundler/source_list.rb - lib/bundler/spec_set.rb - lib/bundler/ssl_certs/.document - lib/bundler/ssl_certs/AddTrustExternalCARoot-2048.pem - lib/bundler/ssl_certs/AddTrustExternalCARoot.pem - lib/bundler/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem - lib/bundler/ssl_certs/DigiCertHighAssuranceEVRootCA.pem - lib/bundler/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem - lib/bundler/ssl_certs/GeoTrustGlobalCA.pem - lib/bundler/ssl_certs/certificate_manager.rb - lib/bundler/stub_specification.rb - lib/bundler/templates/Executable - lib/bundler/templates/Executable.standalone - lib/bundler/templates/Gemfile - lib/bundler/templates/newgem/.travis.yml.tt - lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt - lib/bundler/templates/newgem/Gemfile.tt - lib/bundler/templates/newgem/LICENSE.txt.tt - lib/bundler/templates/newgem/README.md.tt - lib/bundler/templates/newgem/Rakefile.tt - lib/bundler/templates/newgem/bin/console.tt - lib/bundler/templates/newgem/bin/setup.tt - lib/bundler/templates/newgem/exe/newgem.tt - lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt - lib/bundler/templates/newgem/ext/newgem/newgem.c.tt - lib/bundler/templates/newgem/ext/newgem/newgem.h.tt - lib/bundler/templates/newgem/gitignore.tt - lib/bundler/templates/newgem/lib/newgem.rb.tt - lib/bundler/templates/newgem/lib/newgem/version.rb.tt - lib/bundler/templates/newgem/newgem.gemspec.tt - lib/bundler/templates/newgem/rspec.tt - lib/bundler/templates/newgem/spec/newgem_spec.rb.tt - lib/bundler/templates/newgem/spec/spec_helper.rb.tt - lib/bundler/templates/newgem/test/newgem_test.rb.tt - lib/bundler/templates/newgem/test/test_helper.rb.tt - lib/bundler/ui.rb - lib/bundler/ui/rg_proxy.rb - lib/bundler/ui/shell.rb - lib/bundler/ui/silent.rb - lib/bundler/vendor/molinillo/lib/molinillo.rb - lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb - lib/bundler/vendor/molinillo/lib/molinillo/errors.rb - lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb - lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb - lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb - lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb - lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb - lib/bundler/vendor/molinillo/lib/molinillo/state.rb - lib/bundler/vendor/net/http/faster.rb - lib/bundler/vendor/net/http/persistent.rb - lib/bundler/vendor/net/http/persistent/ssl_reuse.rb - lib/bundler/vendor/thor/lib/thor.rb - lib/bundler/vendor/thor/lib/thor/actions.rb - lib/bundler/vendor/thor/lib/thor/actions/create_file.rb - lib/bundler/vendor/thor/lib/thor/actions/create_link.rb - lib/bundler/vendor/thor/lib/thor/actions/directory.rb - lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb - lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb - lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb - lib/bundler/vendor/thor/lib/thor/base.rb - lib/bundler/vendor/thor/lib/thor/command.rb - lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb - lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb - lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb - lib/bundler/vendor/thor/lib/thor/error.rb - lib/bundler/vendor/thor/lib/thor/group.rb - lib/bundler/vendor/thor/lib/thor/invocation.rb - lib/bundler/vendor/thor/lib/thor/line_editor.rb - lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb - lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb - lib/bundler/vendor/thor/lib/thor/parser.rb - lib/bundler/vendor/thor/lib/thor/parser/argument.rb - lib/bundler/vendor/thor/lib/thor/parser/arguments.rb - lib/bundler/vendor/thor/lib/thor/parser/option.rb - lib/bundler/vendor/thor/lib/thor/parser/options.rb - lib/bundler/vendor/thor/lib/thor/rake_compat.rb - lib/bundler/vendor/thor/lib/thor/runner.rb - lib/bundler/vendor/thor/lib/thor/shell.rb - lib/bundler/vendor/thor/lib/thor/shell/basic.rb - lib/bundler/vendor/thor/lib/thor/shell/color.rb - lib/bundler/vendor/thor/lib/thor/shell/html.rb - lib/bundler/vendor/thor/lib/thor/util.rb - lib/bundler/vendor/thor/lib/thor/version.rb - lib/bundler/vendored_molinillo.rb - lib/bundler/vendored_persistent.rb - lib/bundler/vendored_thor.rb - lib/bundler/version.rb - lib/bundler/vlad.rb - lib/bundler/worker.rb - man/bundle-config.ronn - man/bundle-exec.ronn - man/bundle-gem.ronn - man/bundle-install.ronn - man/bundle-lock.ronn - man/bundle-package.ronn - man/bundle-platform.ronn - man/bundle-update.ronn - man/bundle.ronn - man/gemfile.5.ronn - man/index.txt homepage: http://bundler.io licenses: - MIT metadata: {} post_install_message: rdoc_options: [] require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 1.8.7 required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 1.3.6 requirements: [] rubyforge_project: rubygems_version: 2.4.8 signing_key: specification_version: 4 summary: The best way to manage your application's dependencies test_files: [] bundler-1.11.2/man/0000755000004100000410000000000012652443364014043 5ustar www-datawww-databundler-1.11.2/man/index.txt0000644000004100000410000000042112652443364015710 0ustar www-datawww-dataGemfile(5) gemfile.5 bundle-install bundle-install.1 bundle-update bundle-update.1 bundle-package bundle-package.1 bundle-exec bundle-exec.1 bundle-config bundle-config.1 bundle-platform bundle-platform.1 bundle-gem bundle-gem.1 bundler-1.11.2/man/bundle-package.ronn0000644000004100000410000000517012652443364017606 0ustar www-datawww-databundle-package(1) -- Package your needed `.gem` files into your application =========================================================================== ## SYNOPSIS `bundle package` ## DESCRIPTION Copy all of the `.gem` files needed to run the application into the `vendor/cache` directory. In the future, when running [bundle install(1)][bundle-install], use the gems in the cache in preference to the ones on `rubygems.org`. ## GIT AND PATH GEMS Since Bundler 1.2, the `bundle package` command can also package `:git` and `:path` dependencies besides .gem files. This needs to be explicitly enabled via the `--all` option. Once used, the `--all` option will be remembered. ## SUPPORT FOR MULTIPLE PLATFORMS When using gems that have different packages for different platforms, Bundler 1.8 and newer support caching of gems for other platforms in `vendor/cache`. This needs to be enabled via the `--all-platforms` option. This setting will be remembered in your local bundler configuration. ## REMOTE FETCHING By default, if you simply run [bundle install(1)][bundle-install] after running [bundle package(1)][bundle-package], bundler will still connect to `rubygems.org` to check whether a platform-specific gem exists for any of the gems in `vendor/cache`. For instance, consider this Gemfile(5): source "https://rubygems.org" gem "nokogiri" If you run `bundle package` under C Ruby, bundler will retrieve the version of `nokogiri` for the `"ruby"` platform. If you deploy to JRuby and run `bundle install`, bundler is forced to check to see whether a `"java"` platformed `nokogiri` exists. Even though the `nokogiri` gem for the Ruby platform is _technically_ acceptable on JRuby, it actually has a C extension that does not run on JRuby. As a result, bundler will, by default, still connect to `rubygems.org` to check whether it has a version of one of your gems more specific to your platform. This problem is also not just limited to the `"java"` platform. A similar (common) problem can happen when developing on Windows and deploying to Linux, or even when developing on OSX and deploying to Linux. If you know for sure that the gems packaged in `vendor/cache` are appropriate for the platform you are on, you can run `bundle install --local` to skip checking for more appropriate gems, and just use the ones in `vendor/cache`. One way to be sure that you have the right platformed versions of all your gems is to run `bundle package` on an identical machine and check in the gems. For instance, you can run `bundle package` on an identical staging box during your staging process, and check in the `vendor/cache` before deploying to production. bundler-1.11.2/man/bundle-exec.ronn0000644000004100000410000001202012652443364017127 0ustar www-datawww-databundle-exec(1) -- Execute a command in the context of the bundle ================================================================ ## SYNOPSIS `bundle exec` [--keep-file-descriptors] ## DESCRIPTION This command executes the command, making all gems specified in the `Gemfile(5)` available to `require` in Ruby programs. Essentially, if you would normally have run something like `rspec spec/my_spec.rb`, and you want to use the gems specified in the `Gemfile(5)` and installed via [bundle install(1)][bundle-install], you should run `bundle exec rspec spec/my_spec.rb`. Note that `bundle exec` does not require that an executable is available on your shell's `$PATH`. ## OPTIONS * `--keep-file-descriptors`: Exec in Ruby 2.0 began discarding non-standard file descriptors. When this flag is passed, exec will revert to the 1.9 behaviour of passing all file descriptors to the new process. ## BUNDLE INSTALL --BINSTUBS If you use the `--binstubs` flag in [bundle install(1)][bundle-install], Bundler will automatically create a directory (which defaults to `app_root/bin`) containing all of the executables available from gems in the bundle. After using `--binstubs`, `bin/rspec spec/my_spec.rb` is identical to `bundle exec rspec spec/my_spec.rb`. ## ENVIRONMENT MODIFICATIONS `bundle exec` makes a number of changes to the shell environment, then executes the command you specify in full. * make sure that it's still possible to shell out to `bundle` from inside a command invoked by `bundle exec` (using `$BUNDLE_BIN_PATH`) * put the directory containing executables (like `rails`, `rspec`, `rackup`) for your bundle on `$PATH` * make sure that if bundler is invoked in the subshell, it uses the same `Gemfile` (by setting `BUNDLE_GEMFILE`) * add `-rbundler/setup` to `$RUBYOPT`, which makes sure that Ruby programs invoked in the subshell can see the gems in the bundle It also modifies Rubygems: * disallow loading additional gems not in the bundle * modify the `gem` method to be a no-op if a gem matching the requirements is in the bundle, and to raise a `Gem::LoadError` if it's not * Define `Gem.refresh` to be a no-op, since the source index is always frozen when using bundler, and to prevent gems from the system leaking into the environment * Override `Gem.bin_path` to use the gems in the bundle, making system executables work * Add all gems in the bundle into Gem.loaded_specs ### Shelling out Any Ruby code that opens a subshell (like `system`, backticks, or `%x{}`) will automatically use the current Bundler environment. If you need to shell out to a Ruby command that is not part of your current bundle, use the `with_clean_env` method with a block. Any subshells created inside the block will be given the environment present before Bundler was activated. For example, Homebrew commands run Ruby, but don't work inside a bundle: Bundler.with_clean_env do `brew install wget` end Using `with_clean_env` is also necessary if you are shelling out to a different bundle. Any Bundler commands run in a subshell will inherit the current Gemfile, so commands that need to run in the context of a different bundle also need to use `with_clean_env`. Bundler.with_clean_env do Dir.chdir "/other/bundler/project" do `bundle exec ./script` end end Bundler provides convenience helpers that wrap `system` and `exec`, and they can be used like this: Bundler.clean_system('brew install wget') Bundler.clean_exec('brew install wget') ## RUBYGEMS PLUGINS At present, the Rubygems plugin system requires all files named `rubygems_plugin.rb` on the load path of _any_ installed gem when any Ruby code requires `rubygems.rb`. This includes executables installed into the system, like `rails`, `rackup`, and `rspec`. Since Rubygems plugins can contain arbitrary Ruby code, they commonly end up activating themselves or their dependencies. For instance, the `gemcutter 0.5` gem depended on `json_pure`. If you had that version of gemcutter installed (even if you _also_ had a newer version without this problem), Rubygems would activate `gemcutter 0.5` and `json_pure `. If your Gemfile(5) also contained `json_pure` (or a gem with a dependency on `json_pure`), the latest version on your system might conflict with the version in your Gemfile(5), or the snapshot version in your `Gemfile.lock`. If this happens, bundler will say: You have already activated json_pure 1.4.6 but your Gemfile requires json_pure 1.4.3. Consider using bundle exec. In this situation, you almost certainly want to remove the underlying gem with the problematic gem plugin. In general, the authors of these plugins (in this case, the `gemcutter` gem) have released newer versions that are more careful in their plugins. You can find a list of all the gems containing gem plugins by running ruby -rubygems -e "puts Gem.find_files('rubygems_plugin.rb')" At the very least, you should remove all but the newest version of each gem plugin, and also remove all gem plugins that you aren't using (`gem uninstall gem_name`). bundler-1.11.2/man/bundle.ronn0000644000004100000410000000473312652443364016221 0ustar www-datawww-databundle(1) -- Ruby Dependency Management ======================================= ## SYNOPSIS `bundle` COMMAND [--no-color] [--verbose] [ARGS] ## DESCRIPTION Bundler manages an `application's dependencies` through its entire life across many machines systematically and repeatably. See [the bundler website](http://bundler.io) for information on getting started, and Gemfile(5) for more information on the `Gemfile` format. ## OPTIONS * `--no-color`: Prints all output without color * `--verbose`: Prints out additional logging information ## BUNDLE COMMANDS We divide `bundle` subcommands into primary commands and utilities. ## PRIMARY COMMANDS * [bundle install(1)][bundle-install]: Install the gems specified by the `Gemfile` or `Gemfile.lock` * [bundle update(1)][bundle-update]: Update dependencies to their latest versions * [bundle package(1)][bundle-package]: Package the .gem files required by your application into the `vendor/cache` directory * [bundle exec(1)][bundle-exec]: Execute a script in the context of the current bundle * [bundle config(1)][bundle-config]: Specify and read configuration options for bundler * `bundle help(1)`: Displays detailed help for each subcommand ## UTILITIES * `bundle check(1)`: Determine whether the requirements for your application are installed and available to bundler * `bundle list(1)`: Show all of the gems in the current bundle * `bundle show(1)`: Show the source location of a particular gem in the bundle * `bundle outdated(1)`: Show all of the outdated gems in the current bundle * `bundle console(1)`: Start an IRB session in the context of the current bundle * `bundle open(1)`: Open an installed gem in the editor * `bundle lock(1)`: Generate a lockfile for your dependencies * `bundle viz(1)`: Generate a visual representation of your dependencies * `bundle init(1)`: Generate a simple `Gemfile`, placed in the current directory * [bundle gem(1)][bundle-gem]: Create a simple gem, suitable for development with bundler * [bundle platform(1)][bundle-platform]: Displays platform compatibility information * `bundle clean(1)`: Cleans up unused gems in your bundler directory ## PLUGINS When running a command that isn't listed in PRIMARY COMMANDS or UTILITIES, Bundler will try to find an executable on your path named `bundler-` and execute it, passing down any extra arguments to it. ## OBSOLETE These commands are obsolete and should no longer be used * `bundle cache(1)` bundler-1.11.2/man/bundle-platform.ronn0000644000004100000410000000220212652443364020030 0ustar www-datawww-databundle-platform(1) -- Displays platform compatibility information ================================================================= ## SYNOPSIS `bundle platform` [--ruby] ## DESCRIPTION `platform` will display information from your Gemfile, Gemfile.lock, and Ruby VM about your platform. For instance, using this Gemfile(5): source "https://rubygems.org" ruby "1.9.3" gem "rack" If you run `bundle platform` on Ruby 1.9.3, it will display the following output: Your platform is: x86_64-linux Your app has gems that work on these platforms: * ruby Your Gemfile specifies a Ruby version requirement: * ruby 1.9.3 Your current platform satisfies the Ruby version requirement. `platform` will list all the platforms in your `Gemfile.lock` as well as the `ruby` directive if applicable from your Gemfile(5). It will also let you know if the `ruby` directive requirement has been met. If `ruby` directive doesn't match the running Ruby VM, it will tell you what part does not. ## OPTIONS * `--ruby`: It will just display the ruby directive information, so you don't have to parse it from the Gemfile(5). bundler-1.11.2/man/bundle-config.ronn0000644000004100000410000002020612652443364017455 0ustar www-datawww-databundle-config(1) -- Set bundler configuration options ===================================================== ## SYNOPSIS `bundle config` [ []] ## DESCRIPTION This command allows you to interact with bundler's configuration system. Bundler retrieves its configuration from the local application (`app/.bundle/config`), environment variables, and the user's home directory (`~/.bundle/config`), in that order of priority. Executing `bundle config` with no parameters will print a list of all bundler configuration for the current bundle, and where that configuration was set. Executing `bundle config ` will print the value of that configuration setting, and where it was set. Executing `bundle config ` will set that configuration to the value specified for all bundles executed as the current user. The configuration will be stored in `~/.bundle/config`. If already is set, will be overridden and user will be warned. Executing `bundle config --global ` works the same as above. Executing `bundle config --local ` will set that configuration to the local application. The configuration will be stored in `app/.bundle/config`. Executing `bundle config --delete ` will delete the configuration in both local and global sources. Not compatible with --global or --local flag. Executing bundle with the `BUNDLE_IGNORE_CONFIG` environment variable set will cause it to ignore all configuration. Executing `bundle config disable_multisource true` upgrades the warning about the Gemfile containing multiple primary sources to an error. Executing `bundle config --delete disable_multisource` downgrades this error to a warning. ## BUILD OPTIONS You can use `bundle config` to give bundler the flags to pass to the gem installer every time bundler tries to install a particular gem. A very common example, the `mysql` gem, requires Snow Leopard users to pass configuration flags to `gem install` to specify where to find the `mysql_config` executable. gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config Since the specific location of that executable can change from machine to machine, you can specify these flags on a per-machine basis. bundle config build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config After running this command, every time bundler needs to install the `mysql` gem, it will pass along the flags you specified. ## CONFIGURATION KEYS Configuration keys in bundler have two forms: the canonical form and the environment variable form. For instance, passing the `--without` flag to [bundle install(1)][bundle-install] prevents Bundler from installing certain groups specified in the Gemfile(5). Bundler persists this value in `app/.bundle/config` so that calls to `Bundler.setup` do not try to find gems from the `Gemfile` that you didn't install. Additionally, subsequent calls to [bundle install(1)][bundle-install] remember this setting and skip those groups. The canonical form of this configuration is `"without"`. To convert the canonical form to the environment variable form, capitalize it, and prepend `BUNDLE_`. The environment variable form of `"without"` is `BUNDLE_WITHOUT`. Any periods in the configuration keys must be replaced with two underscores when setting it via environment variables. The configuration key `local.rack` becomes the environment variable `BUNDLE_LOCAL__RACK`. ## LIST OF AVAILABLE KEYS The following is a list of all configuration keys and their purpose. You can learn more about their operation in [bundle install(1)][bundle-install]. * `path` (`BUNDLE_PATH`): The location on disk where all gems in your bundle will be located regardless of `$GEM_HOME` or `$GEM_PATH` values. Bundle gems not found in this location will be installed by `bundle install`. Defaults to `Gem.dir`. When --deployment is used, defaults to vendor/bundle. * `frozen` (`BUNDLE_FROZEN`): Disallow changes to the `Gemfile`. Defaults to `true` when `--deployment` is used. * `without` (`BUNDLE_WITHOUT`): A `:`-separated list of groups whose gems bundler should not install * `bin` (`BUNDLE_BIN`): Install executables from gems in the bundle to the specified directory. Defaults to `false`. * `gemfile` (`BUNDLE_GEMFILE`): The name of the file that bundler should use as the `Gemfile`. This location of this file also sets the root of the project, which is used to resolve relative paths in the `Gemfile`, among other things. By default, bundler will search up from the current working directory until it finds a `Gemfile`. * `ssl_ca_cert` (`BUNDLE_SSL_CA_CERT`): Path to a designated CA certificate file or folder containing multiple certificates for trusted CAs in PEM format. * `ssl_client_cert` (`BUNDLE_SSL_CLIENT_CERT`): Path to a designated file containing a X.509 client certificate and key in PEM format. * `cache_path` (`BUNDLE_CACHE_PATH`): The directory that bundler will place cached gems in when running bundle package, and that bundler will look in when installing gems. * `disable_multisource` (`BUNDLE_DISABLE_MULTISOURCE`): When set, Gemfiles containing multiple sources will produce errors instead of warnings. Use `bundle config --delete disable_multisource` to unset. * `ignore_messages` (`BUNDLE_IGNORE_MESSAGES`): When set, no post install messages will be printed. To silence a single gem, use dot notation like `ignore_messages.httparty true`. In general, you should set these settings per-application by using the applicable flag to the [bundle install(1)][bundle-install] or [bundle package(1)][bundle-package] command. You can set them globally either via environment variables or `bundle config`, whichever is preferable for your setup. If you use both, environment variables will take preference over global settings. ## LOCAL GIT REPOS Bundler also allows you to work against a git repository locally instead of using the remote version. This can be achieved by setting up a local override: bundle config local.GEM_NAME /path/to/local/git/repository For example, in order to use a local Rack repository, a developer could call: bundle config local.rack ~/Work/git/rack Now instead of checking out the remote git repository, the local override will be used. Similar to a path source, every time the local git repository change, changes will be automatically picked up by Bundler. This means a commit in the local git repo will update the revision in the `Gemfile.lock` to the local git repo revision. This requires the same attention as git submodules. Before pushing to the remote, you need to ensure the local override was pushed, otherwise you may point to a commit that only exists in your local machine. Bundler does many checks to ensure a developer won't work with invalid references. Particularly, we force a developer to specify a branch in the `Gemfile` in order to use this feature. If the branch specified in the `Gemfile` and the current branch in the local git repository do not match, Bundler will abort. This ensures that a developer is always working against the correct branches, and prevents accidental locking to a different branch. Finally, Bundler also ensures that the current revision in the `Gemfile.lock` exists in the local git repository. By doing this, Bundler forces you to fetch the latest changes in the remotes. ## MIRRORS OF GEM SOURCES Bundler supports overriding gem sources with mirrors. This allows you to configure rubygems.org as the gem source in your Gemfile while still using your mirror to fetch gems. bundle config mirror.SOURCE_URL MIRROR_URL For example, to use a mirror of rubygems.org hosted at bundle config mirror.http://rubygems.org http://rubygems-mirror.org ## CREDENTIALS FOR GEM SOURCES Bundler allows you to configure credentials for any gem source, which allows you to avoid putting secrets into your Gemfile. bundle config SOURCE_HOSTNAME USERNAME:PASSWORD For example, to save the credentials of user `claudette` for the gem source at `gems.longerous.com`, you would run: bundle config gems.longerous.com claudette:s00pers3krit Or you can set the credentials as an environment variable like this: export BUNDLE_GEMS__LONGEROUS__COM="claudette:s00pers3krit" bundler-1.11.2/man/bundle-lock.ronn0000644000004100000410000000303212652443364017136 0ustar www-datawww-databundle-lock(1) -- Creates / Updates a lockfile without installing ================================================================= ## SYNOPSIS `bundle lock` [--update] [--local] [--print] [--lockfile=PATH] ## DESCRIPTION Lock the gems specified in Gemfile. ## OPTIONS * `--update=<*gems>`: Ignores the existing lockfile. Resolve then updates lockfile. Taking a list of gems or updating all gems if no list is given. * `--local`: Do not attempt to connect to `rubygems.org`. Instead, Bundler will use the gems already present in Rubygems' cache or in `vendor/cache`. Note that if a appropriate platform-specific gem exists on `rubygems.org` it will not be found. * `--print`: Prints the lockfile to STDOUT instead of writing to the file system. * `--lockfile=`: The path where the lockfile should be written to. ## UPDATING ALL GEMS If you run `bundle lock` with `--update` option without list of gems, bundler will ignore any previously installed gems and resolve all dependencies again based on the latest versions of all gems available in the sources. ## UPDATING A LIST OF GEMS Sometimes, you want to update a single gem in the Gemfile(5), and leave the rest of the gems that you specified locked to the versions in the `Gemfile.lock`. For instance, you only want to update `nokogiri`, run `bundle lock --update nokogiri`. Bundler will update `nokogiri` and any of its dependencies, but leave the rest of the gems that you specified locked to the versions in the `Gemfile.lock`. bundler-1.11.2/man/bundle-install.ronn0000644000004100000410000003761312652443364017670 0ustar www-datawww-databundle-install(1) -- Install the dependencies specified in your Gemfile ======================================================================= ## SYNOPSIS `bundle install` [--binstubs[=DIRECTORY]] [--clean] [--full-index] [--gemfile=GEMFILE] [--jobs=NUMBER] [--local] [--deployment] [--force] [--no-cache] [--no-prune] [--path PATH] [--system] [--quiet] [--retry=NUMBER] [--shebang] [--standalone[=GROUP[ GROUP...]]] [--trust-policy=POLICY] [--without=GROUP[ GROUP...]] [--with=GROUP[ GROUP...]] ## DESCRIPTION Install the gems specified in your Gemfile(5). If this is the first time you run bundle install (and a `Gemfile.lock` does not exist), Bundler will fetch all remote sources, resolve dependencies and install all needed gems. If a `Gemfile.lock` does exist, and you have not updated your Gemfile(5), Bundler will fetch all remote sources, but use the dependencies specified in the `Gemfile.lock` instead of resolving dependencies. If a `Gemfile.lock` does exist, and you have updated your Gemfile(5), Bundler will use the dependencies in the `Gemfile.lock` for all gems that you did not update, but will re-resolve the dependencies of gems that you did update. You can find more information about this update process below under [CONSERVATIVE UPDATING][]. ## OPTIONS * `--binstubs[=]`: Creates a directory (defaults to `~/bin`) and place any executables from the gem there. These executables run in Bundler's context. If used, you might add this directory to your environment's `PATH` variable. For instance, if the `rails` gem comes with a `rails` executable, this flag will create a `bin/rails` executable that ensures that all referred dependencies will be resolved using the bundled gems. * `--clean`: On finishing the installation Bundler is going to remove any gems not present in the current Gemfile(5). Don't worry, gems currently in use will not be removed. * `--full-index`: Bundler will not call Rubygems' API endpoint (default) but download and cache a (currently big) index file of all gems. Performance can be improved for large bundles that seldomly change by enabling this option. * `--gemfile=`: The location of the Gemfile(5) which Bundler should use. This defaults to a Gemfile(5) in the current working directory. In general, Bundler will assume that the location of the Gemfile(5) is also the project's root and will try to find `Gemfile.lock` and `vendor/cache` relative to this location. * `--jobs=[]`: The maximum number of parallel download and install jobs. The default is `1`. * `--local`: Do not attempt to connect to `rubygems.org`. Instead, Bundler will use the gems already present in Rubygems' cache or in `vendor/cache`. Note that if a appropriate platform-specific gem exists on `rubygems.org` it will not be found. * `--deployment`: In [deployment mode][DEPLOYMENT MODE], Bundler will 'roll-out' the bundle for production or CI use. Please check carefully if you want to have this option enabled in your development environment. * `--force`: Force download every gem, even if the required versions are already available locally. * `--system`: Installs the gems specified in the bundle to the system's Rubygems location. This overrides any previous [remembered][REMEMBERED OPTIONS] use of `--path`. * `--no-cache`: Do not update the cache in `vendor/cache` with the newly bundled gems. This does not remove any gems in the cache but keeps the newly bundled gems from being cached during the install. * `--no-prune`: Don't remove stale gems from the cache when the installation finishes. * `--path=`: The location to install the specified gems to. This defaults to Rubygems' setting. Bundler shares this location with Rubygems, `gem install ...` will have gem installed there, too. Therefore, gems installed without a `--path ...` setting will show up by calling `gem list`. Accodingly, gems installed to other locations will not get listed. This setting is a [remembered option][REMEMBERED OPTIONS]. * `--quiet`: Do not print progress information to the standard output. Instead, Bundler will exit using a status code (`$?`). * `--retry=[]`: Retry failed network or git requests for times. * `--shebang=`: Uses the specified ruby executable (usually `ruby`) to execute the scripts created with `--binstubs`. In addition, if you use `--binstubs` together with `--shebang jruby` these executables will be changed to execute `jruby` instead. * `--standalone[=]`: Makes a bundle that can work without depending on Rubygems or Bundler at runtime. A space separated list of groups to install has to be specified. Bundler creates a directory named `bundle` and installs the bundle there. It also generates a `bundle/bundler/setup.rb` file to replace Bundler's own setup in the manner required. Using this option implicitly sets `path`, which is a [remembered option][REMEMBERED OPTIONS]. * `--trust-policy=[]`: Apply the Rubygems security policy , where policy is one of `HighSecurity`, `MediumSecurity`, `LowSecurity`, `AlmostNoSecurity`, or `NoSecurity`. For more details, please see the Rubygems signing documentation linked below in [SEE ALSO][]. * `--without=`: A space-separated list of groups referencing gems to skip during installation. If a group is given that is in the remembered list of groups given to --with, it is removed from that list. This is a [remembered option][REMEMBERED OPTIONS]. * `--with=`: A space-separated list of groups referencing gems to install. If an optional group is given it is installed. If a group is given that is in the remembered list of groups given to --without, it is removed from that list. This is a [remembered option][REMEMBERED OPTIONS]. ## DEPLOYMENT MODE Bundler's defaults are optimized for development. To switch to defaults optimized for deployment and for CI, use the `--deployment` flag. Do not activate deployment mode on development machines, as it will cause an error when the Gemfile(5) is modified. 1. A `Gemfile.lock` is required. To ensure that the same versions of the gems you developed with and tested with are also used in deployments, a `Gemfile.lock` is required. This is mainly to ensure that you remember to check your `Gemfile.lock` into version control. 2. The `Gemfile.lock` must be up to date In development, you can modify your Gemfile(5) and re-run `bundle install` to [conservatively update][CONSERVATIVE UPDATING] your `Gemfile.lock` snapshot. In deployment, your `Gemfile.lock` should be up-to-date with changes made in your Gemfile(5). 3. Gems are installed to `vendor/bundle` not your default system location In development, it's convenient to share the gems used in your application with other applications and other scripts run on the system. In deployment, isolation is a more important default. In addition, the user deploying the application may not have permission to install gems to the system, or the web server may not have permission to read them. As a result, `bundle install --deployment` installs gems to the `vendor/bundle` directory in the application. This may be overridden using the `--path` option. ## SUDO USAGE By default, Bundler installs gems to the same location as `gem install`. In some cases, that location may not be writable by your Unix user. In that case, Bundler will stage everything in a temporary directory, then ask you for your `sudo` password in order to copy the gems into their system location. From your perspective, this is identical to installing them gems directly into the system. You should never use `sudo bundle install`. This is because several other steps in `bundle install` must be performed as the current user: * Updating your `Gemfile.lock` * Updating your `vendor/cache`, if necessary * Checking out private git repositories using your user's SSH keys Of these three, the first two could theoretically be performed by `chown`ing the resulting files to `$SUDO_USER`. The third, however, can only be performed by actually invoking the `git` command as the current user. Therefore, git gems are downloaded and installed into `~/.bundle` rather than $GEM_HOME or $BUNDLE_PATH. As a result, you should run `bundle install` as the current user, and Bundler will ask for your password if it is needed to put the gems into their final location. ## INSTALLING GROUPS By default, `bundle install` will install all gems in all groups in your Gemfile(5), except those declared for a different platform. However, you can explicitly tell Bundler to skip installing certain groups with the `--without` option. This option takes a space-separated list of groups. While the `--without` option will skip _installing_ the gems in the specified groups, it will still _download_ those gems and use them to resolve the dependencies of every gem in your Gemfile(5). This is so that installing a different set of groups on another machine (such as a production server) will not change the gems and versions that you have already developed and tested against. `Bundler offers a rock-solid guarantee that the third-party code you are running in development and testing is also the third-party code you are running in production. You can choose to exclude some of that code in different environments, but you will never be caught flat-footed by different versions of third-party code being used in different environments.` For a simple illustration, consider the following Gemfile(5): source 'https://rubygems.org' gem 'sinatra' group :production do gem 'rack-perftools-profiler' end In this case, `sinatra` depends on any version of Rack (`>= 1.0`), while `rack-perftools-profiler` depends on 1.x (`~> 1.0`). When you run `bundle install --without production` in development, we look at the dependencies of `rack-perftools-profiler` as well. That way, you do not spend all your time developing against Rack 2.0, using new APIs unavailable in Rack 1.x, only to have Bundler switch to Rack 1.2 when the `production` group _is_ used. This should not cause any problems in practice, because we do not attempt to `install` the gems in the excluded groups, and only evaluate as part of the dependency resolution process. This also means that you cannot include different versions of the same gem in different groups, because doing so would result in different sets of dependencies used in development and production. Because of the vagaries of the dependency resolution process, this usually affects more than just the gems you list in your Gemfile(5), and can (surprisingly) radically change the gems you are using. ## REMEMBERED OPTIONS Some options (marked above in the [OPTIONS][] section) are remembered between calls to `bundle install`, and by the Bundler runtime. For instance, if you run `bundle install --without test`, a subsequent call to `bundle install` that does not include a `--without` flag will remember your previous choice. In addition, a call to `Bundler.setup` will not attempt to make the gems in those groups available on the Ruby load path, as they were not installed. The settings that are remembered are: * `--deployment`: At runtime, this remembered setting will also result in Bundler raising an exception if the `Gemfile.lock` is out of date. * `--path`: Subsequent calls to `bundle install` will install gems to the directory originally passed to `--path`. The Bundler runtime will look for gems in that location. You can revert this option by running `bundle install --system`. * `--binstubs`: Bundler will update the executables every subsequent call to `bundle install`. * `--without`: As described above, Bundler will skip the gems specified by `--without` in subsequent calls to `bundle install`. The Bundler runtime will also not try to make the gems in the skipped groups available. ## THE GEMFILE.LOCK When you run `bundle install`, Bundler will persist the full names and versions of all gems that you used (including dependencies of the gems specified in the Gemfile(5)) into a file called `Gemfile.lock`. Bundler uses this file in all subsequent calls to `bundle install`, which guarantees that you always use the same exact code, even as your application moves across machines. Because of the way dependency resolution works, even a seemingly small change (for instance, an update to a point-release of a dependency of a gem in your Gemfile(5)) can result in radically different gems being needed to satisfy all dependencies. As a result, you `SHOULD` check your `Gemfile.lock` into version control. If you do not, every machine that checks out your repository (including your production server) will resolve all dependencies again, which will result in different versions of third-party code being used if `any` of the gems in the Gemfile(5) or any of their dependencies have been updated. ## CONSERVATIVE UPDATING When you make a change to the Gemfile(5) and then run `bundle install`, Bundler will update only the gems that you modified. In other words, if a gem that you `did not modify` worked before you called `bundle install`, it will continue to use the exact same versions of all dependencies as it used before the update. Let's take a look at an example. Here's your original Gemfile(5): source 'https://rubygems.org' gem 'actionpack', '2.3.8' gem 'activemerchant' In this case, both `actionpack` and `activemerchant` depend on `activesupport`. The `actionpack` gem depends on `activesupport 2.3.8` and `rack ~> 1.1.0`, while the `activemerchant` gem depends on `activesupport >= 2.3.2`, `braintree >= 2.0.0`, and `builder >= 2.0.0`. When the dependencies are first resolved, Bundler will select `activesupport 2.3.8`, which satisfies the requirements of both gems in your Gemfile(5). Next, you modify your Gemfile(5) to: source 'https://rubygems.org' gem 'actionpack', '3.0.0.rc' gem 'activemerchant' The `actionpack 3.0.0.rc` gem has a number of new dependencies, and updates the `activesupport` dependency to `= 3.0.0.rc` and the `rack` dependency to `~> 1.2.1`. When you run `bundle install`, Bundler notices that you changed the `actionpack` gem, but not the `activemerchant` gem. It evaluates the gems currently being used to satisfy its requirements: * `activesupport 2.3.8`: also used to satisfy a dependency in `activemerchant`, which is not being updated * `rack ~> 1.1.0`: not currently being used to satisfy another dependency Because you did not explicitly ask to update `activemerchant`, you would not expect it to suddenly stop working after updating `actionpack`. However, satisfying the new `activesupport 3.0.0.rc` dependency of actionpack requires updating one of its dependencies. Even though `activemerchant` declares a very loose dependency that theoretically matches `activesupport 3.0.0.rc`, Bundler treats gems in your Gemfile(5) that have not changed as an atomic unit together with their dependencies. In this case, the `activemerchant` dependency is treated as `activemerchant 1.7.1 + activesupport 2.3.8`, so `bundle install` will report that it cannot update `actionpack`. To explicitly update `actionpack`, including its dependencies which other gems in the Gemfile(5) still depend on, run `bundle update actionpack` (see `bundle update(1)`). `Summary`: In general, after making a change to the Gemfile(5) , you should first try to run `bundle install`, which will guarantee that no other gems in the Gemfile(5) are impacted by the change. If that does not work, run [bundle update(1)][bundle-update]. ## SEE ALSO * Gem install docs: http://guides.rubygems.org/rubygems-basics/#installing-gems * Rubygems signing docs: http://guides.rubygems.org/security/ bundler-1.11.2/man/bundle-gem.ronn0000644000004100000410000000525712652443364016771 0ustar www-datawww-databundle-gem(1) -- Generate a project skeleton for creating a rubygem ==================================================================== ## SYNOPSIS `bundle gem` [OPTIONS] ## DESCRIPTION Generates a directory named `GEM_NAME` with a `Rakefile`, `GEM_NAME.gemspec`, and other supporting files and directories that can be used to develop a rubygem with that name. Run `rake -T` in the resulting project for a list of Rake tasks that can used to test and publish the gem to rubygems.org. The generated project skeleton can be customized with OPTIONS, as explained below. Note that these options can also be specified via Bundler's global configuration file using the following names: * `gem.coc` * `gem.mit` * `gem.test` ## OPTIONS * `-b` or `--bin`: Specify that Bundler should create a binary (as `exe/GEM_NAME`) in the generated rubygem project. This binary will also be added to the `GEM_NAME.gemspec` manifest. This behavior is disabled by default. * `--no-bin`: Do not create a binary (overrides `--bin` specified in the global config). * `--coc`: Add a `CODE_OF_CONDUCT.md` file to the root of the generated project. If this option is unspecified, an interactive prompt will be displayed and the answer will be saved in Bundler's global config for future `bundle gem` use. * `--no-coc`: Do not create a `CODE_OF_CONDUCT.md` (overrides `--coc` specified in the global config). * `--ext`: Add boilerplate for C extension code to the generated project. This behavior is disabled by default. * `--no-ext`: Do not add C extension code (overrides `--ext` specified in the global config). * `--mit`: Add an MIT license to a `LICENSE.txt` file in the root of the generated project. Your name from the global git config is used for the copyright statement. If this option is unspecified, an interactive prompt will be displayed and the answer will be saved in Bundler's global config for future `bundle gem` use. * `--no-mit`: Do not create a `LICENSE.txt` (overrides `--mit` specified in the global config). * `-t`, `--test=minitest`, `--test=rspec`: Specify the test framework that Bundler should use when generating the project. Acceptable values are `minitest` and `rspec`. The `GEM_NAME.gemspec` will be configured and a skeleton test/spec directory will be created based on this option. If this option is unspecified, an interactive prompt will be displayed and the answer will be saved in Bundler's global config for future `bundle gem` use. * `-e`, `--edit[=EDITOR]`: Open the resulting GEM_NAME.gemspec in EDITOR, or the default editor if not specified. The default is `$BUNDLER_EDITOR`, `$VISUAL`, or `$EDITOR`. ## SEE ALSO * bundle-config(1) bundler-1.11.2/man/bundle-update.ronn0000644000004100000410000001557012652443364017502 0ustar www-datawww-databundle-update(1) -- Update your gems to the latest available versions ===================================================================== ## SYNOPSIS `bundle update` <*gems> [--group=NAME] [--source=NAME] [--local] ## DESCRIPTION Update the gems specified (all gems, if none are specified), ignoring the previously installed gems specified in the `Gemfile.lock`. In general, you should use [bundle install(1)][bundle-install] to install the same exact gems and versions across machines. You would use `bundle update` to explicitly update the version of a gem. ## OPTIONS * `--group=`: Only update the gems in the specified group. For instance, you can update all gems in the development group with `bundle update --group development`. You can also call `bundle update rails --group test` to update the rails gem and all gems in the test group, for example. * `--source=`: The name of a `:git` or `:path` source used in the Gemfile(5). For instance, with a `:git` source of `http://github.com/rails/rails.git`, you would call `bundle update --source rails` * `--local`: Do not attempt to fetch gems remotely and use the gem cache instead. ## UPDATING ALL GEMS If you run `bundle update` with no parameters, bundler will ignore any previously installed gems and resolve all dependencies again based on the latest versions of all gems available in the sources. Consider the following Gemfile(5): source "https://rubygems.org" gem "rails", "3.0.0.rc" gem "nokogiri" When you run [bundle install(1)][bundle-install] the first time, bundler will resolve all of the dependencies, all the way down, and install what you need: Fetching gem metadata from https://rubygems.org/......... Resolving dependencies... Installing builder 2.1.2 Installing abstract 1.0.0 Installing rack 1.2.8 Using bundler 1.7.6 Installing rake 10.4.0 Installing polyglot 0.3.5 Installing mime-types 1.25.1 Installing i18n 0.4.2 Installing mini_portile 0.6.1 Installing tzinfo 0.3.42 Installing rack-mount 0.6.14 Installing rack-test 0.5.7 Installing treetop 1.4.15 Installing thor 0.14.6 Installing activesupport 3.0.0.rc Installing erubis 2.6.6 Installing activemodel 3.0.0.rc Installing arel 0.4.0 Installing mail 2.2.20 Installing activeresource 3.0.0.rc Installing actionpack 3.0.0.rc Installing activerecord 3.0.0.rc Installing actionmailer 3.0.0.rc Installing railties 3.0.0.rc Installing rails 3.0.0.rc Installing nokogiri 1.6.5 Bundle complete! 2 Gemfile dependencies, 26 gems total. Use `bundle show [gemname]` to see where a bundled gem is installed. As you can see, even though you have just two gems in the Gemfile(5), your application actually needs 26 different gems in order to run. Bundler remembers the exact versions it installed in `Gemfile.lock`. The next time you run [bundle install(1)][bundle-install], bundler skips the dependency resolution and installs the same gems as it installed last time. After checking in the `Gemfile.lock` into version control and cloning it on another machine, running [bundle install(1)][bundle-install] will _still_ install the gems that you installed last time. You don't need to worry that a new release of `erubis` or `mail` changes the gems you use. However, from time to time, you might want to update the gems you are using to the newest versions that still match the gems in your Gemfile(5). To do this, run `bundle update`, which will ignore the `Gemfile.lock`, and resolve all the dependencies again. Keep in mind that this process can result in a significantly different set of the 25 gems, based on the requirements of new gems that the gem authors released since the last time you ran `bundle update`. ## UPDATING A LIST OF GEMS Sometimes, you want to update a single gem in the Gemfile(5), and leave the rest of the gems that you specified locked to the versions in the `Gemfile.lock`. For instance, in the scenario above, imagine that `nokogiri` releases version `1.4.4`, and you want to update it _without_ updating Rails and all of its dependencies. To do this, run `bundle update nokogiri`. Bundler will update `nokogiri` and any of its dependencies, but leave alone Rails and its dependencies. ## OVERLAPPING DEPENDENCIES Sometimes, multiple gems declared in your Gemfile(5) are satisfied by the same second-level dependency. For instance, consider the case of `thin` and `rack-perftools-profiler`. source "https://rubygems.org" gem "thin" gem "rack-perftools-profiler" The `thin` gem depends on `rack >= 1.0`, while `rack-perftools-profiler` depends on `rack ~> 1.0`. If you run bundle install, you get: Fetching source index for https://rubygems.org/ Installing daemons (1.1.0) Installing eventmachine (0.12.10) with native extensions Installing open4 (1.0.1) Installing perftools.rb (0.4.7) with native extensions Installing rack (1.2.1) Installing rack-perftools_profiler (0.0.2) Installing thin (1.2.7) with native extensions Using bundler (1.0.0.rc.3) In this case, the two gems have their own set of dependencies, but they share `rack` in common. If you run `bundle update thin`, bundler will update `daemons`, `eventmachine` and `rack`, which are dependencies of `thin`, but not `open4` or `perftools.rb`, which are dependencies of `rack-perftools_profiler`. Note that `bundle update thin` will update `rack` even though it's _also_ a dependency of `rack-perftools_profiler`. `In short`, when you update a gem using `bundle update`, bundler will update all dependencies of that gem, including those that are also dependencies of another gem. In this scenario, updating the `thin` version manually in the Gemfile(5), and then running [bundle install(1)][bundle-install] will only update `daemons` and `eventmachine`, but not `rack`. For more information, see the `CONSERVATIVE UPDATING` section of [bundle install(1)][bundle-install]. ## RECOMMENDED WORKFLOW In general, when working with an application managed with bundler, you should use the following workflow: * After you create your Gemfile(5) for the first time, run $ bundle install * Check the resulting `Gemfile.lock` into version control $ git add Gemfile.lock * When checking out this repository on another development machine, run $ bundle install * When checking out this repository on a deployment machine, run $ bundle install --deployment * After changing the Gemfile(5) to reflect a new or update dependency, run $ bundle install * Make sure to check the updated `Gemfile.lock` into version control $ git add Gemfile.lock * If [bundle install(1)][bundle-install] reports a conflict, manually update the specific gems that you changed in the Gemfile(5) $ bundle update rails thin * If you want to update all the gems to the latest possible versions that still match the gems listed in the Gemfile(5), run $ bundle update bundler-1.11.2/man/gemfile.5.ronn0000644000004100000410000004355212652443364016525 0ustar www-datawww-dataGemfile(5) -- A format for describing gem dependencies for Ruby programs ======================================================================== ## SYNOPSIS A `Gemfile` describes the gem dependencies required to execute associated Ruby code. Place the `Gemfile` in the root of the directory containing the associated code. For instance, in a Rails application, place the `Gemfile` in the same directory as the `Rakefile`. ## SYNTAX A `Gemfile` is evaluated as Ruby code, in a context which makes available a number of methods used to describe the gem requirements. ## GLOBAL SOURCES (#source) At the top of the `Gemfile`, add a line for the `Rubygems` source that contains the gems listed in the `Gemfile`. source "https://rubygems.org" It is possible, but not recommended as of Bundler 1.7, to add multiple global `source` lines. Each of these `source`s `MUST` be a valid Rubygems repository. Sources are checked for gems following the heuristics described in [SOURCE PRIORITY][]. If a gem is found in more than one global source, Bundler will print a warning after installing the gem indicating which source was used, and listing the other sources where the gem is available. A specific source can be selected for gems that need to use a non-standard repository, suppressing this warning, by using the [`:source` option](#SOURCE-source-) or a [`source` block](#BLOCK-FORM-OF-SOURCE-GIT-PATH-GROUP-and-PLATFORMS). ### CREDENTIALS (#credentials) Some gem sources require a username and password. Use `bundle config` to set the username and password for any sources that need it. The command must be run once on each computer that will install the Gemfile, but this keeps the credentials from being stored in plain text in version control. bundle config gems.example.com user:password For some sources, like a company Gemfury account, it may be easier to simply include the credentials in the Gemfile as part of the source URL. source "https://user:password@gems.example.com" Credentials in the source URL will take precedence over credentials set using `config`. ## RUBY (#ruby) If your application requires a specific Ruby version or engine, specify your requirements using the `ruby` method, with the following arguments. All parameters are `OPTIONAL` unless otherwise specified. ### VERSION (required) The version of Ruby that your application requires. If your application requires an alternate Ruby engine, such as JRuby or Rubinius, this should be the Ruby version that the engine is compatible with. ruby "1.9.3" ### ENGINE (:engine) Each application _may_ specify a Ruby engine. If an engine is specified, an engine version _must_ also be specified. ### ENGINE VERSION (:engine_version) Each application _may_ specify a Ruby engine version. If an engine version is specified, an engine _must_ also be specified. If the engine is "ruby" the engine version specified _must_ match the Ruby version. ruby "1.8.7", :engine => "jruby", :engine_version => "1.6.7" ### PATCHLEVEL (:patchlevel) Each application _may_ specify a Ruby patchlevel. ruby "2.0.0", :patchlevel => "247" ## GEMS (#gem) Specify gem requirements using the `gem` method, with the following arguments. All parameters are `OPTIONAL` unless otherwise specified. ### NAME (required) For each gem requirement, list a single _gem_ line. gem "nokogiri" ### VERSION Each _gem_ `MAY` have one or more version specifiers. gem "nokogiri", ">= 1.4.2" gem "RedCloth", ">= 4.1.0", "< 4.2.0" ### REQUIRE AS (:require) Each _gem_ `MAY` specify files that should be used when autorequiring via `Bundler.require`. You may pass an array with multiple files or `true` if file you want `required` has same name as _gem_ or `false` to prevent any file from being autorequired. gem "redis", :require => ["redis/connection/hiredis", "redis"] gem "webmock", :require => false gem "debugger", :require => true The argument defaults to the name of the gem. For example, these are identical: gem "nokogiri" gem "nokogiri", :require => "nokogiri" gem "nokogiri", :require => true ### GROUPS (:group or :groups) Each _gem_ `MAY` specify membership in one or more groups. Any _gem_ that does not specify membership in any group is placed in the `default` group. gem "rspec", :group => :test gem "wirble", :groups => [:development, :test] The Bundler runtime allows its two main methods, `Bundler.setup` and `Bundler.require`, to limit their impact to particular groups. # setup adds gems to Ruby's load path Bundler.setup # defaults to all groups require "bundler/setup" # same as Bundler.setup Bundler.setup(:default) # only set up the _default_ group Bundler.setup(:test) # only set up the _test_ group (but `not` _default_) Bundler.setup(:default, :test) # set up the _default_ and _test_ groups, but no others # require requires all of the gems in the specified groups Bundler.require # defaults to just the _default_ group Bundler.require(:default) # identical Bundler.require(:default, :test) # requires the _default_ and _test_ groups Bundler.require(:test) # requires just the _test_ group The Bundler CLI allows you to specify a list of groups whose gems `bundle install` should not install with the `--without` option. To specify multiple groups to ignore, specify a list of groups separated by spaces. bundle install --without test bundle install --without development test After running `bundle install --without test`, bundler will remember that you excluded the test group in the last installation. The next time you run `bundle install`, without any `--without option`, bundler will recall it. Also, calling `Bundler.setup` with no parameters, or calling `require "bundler/setup"` will setup all groups except for the ones you excluded via `--without` (since they are obviously not available). Note that on `bundle install`, bundler downloads and evaluates all gems, in order to create a single canonical list of all of the required gems and their dependencies. This means that you cannot list different versions of the same gems in different groups. For more details, see [Understanding Bundler](http://bundler.io/rationale.html). ### PLATFORMS (:platforms) If a gem should only be used in a particular platform or set of platforms, you can specify them. Platforms are essentially identical to groups, except that you do not need to use the `--without` install-time flag to exclude groups of gems for other platforms. There are a number of `Gemfile` platforms: * `ruby`: C Ruby (MRI) or Rubinius, but `NOT` Windows * `ruby_18`: _ruby_ `AND` version 1.8 * `ruby_19`: _ruby_ `AND` version 1.9 * `ruby_20`: _ruby_ `AND` version 2.0 * `ruby_21`: _ruby_ `AND` version 2.1 * `ruby_22`: _ruby_ `AND` version 2.2 * `ruby_23`: _ruby_ `AND` version 2.3 * `mri`: Same as _ruby_, but not Rubinius * `mri_18`: _mri_ `AND` version 1.8 * `mri_19`: _mri_ `AND` version 1.9 * `mri_20`: _mri_ `AND` version 2.0 * `mri_21`: _mri_ `AND` version 2.1 * `mri_22`: _mri_ `AND` version 2.2 * `mri_23`: _mri_ `AND` version 2.3 * `rbx`: Same as _ruby_, but only Rubinius (not MRI) * `jruby`: JRuby * `mswin`: Windows * `mingw`: Windows 32 bit 'mingw32' platform (aka RubyInstaller) * `mingw_18`: _mingw_ `AND` version 1.8 * `mingw_19`: _mingw_ `AND` version 1.9 * `mingw_20`: _mingw_ `AND` version 2.0 * `mingw_21`: _mingw_ `AND` version 2.1 * `mingw_22`: _mingw_ `AND` version 2.2 * `mingw_23`: _mingw_ `AND` version 2.3 * `x64_mingw`: Windows 64 bit 'mingw32' platform (aka RubyInstaller x64) * `x64_mingw_20`: _x64_mingw_ `AND` version 2.0 * `x64_mingw_21`: _x64_mingw_ `AND` version 2.1 * `x64_mingw_22`: _x64_mingw_ `AND` version 2.2 * `x64_mingw_23`: _x64_mingw_ `AND` version 2.3 As with groups, you can specify one or more platforms: gem "weakling", :platforms => :jruby gem "ruby-debug", :platforms => :mri_18 gem "nokogiri", :platforms => [:mri_18, :jruby] All operations involving groups (`bundle install`, `Bundler.setup`, `Bundler.require`) behave exactly the same as if any groups not matching the current platform were explicitly excluded. ### SOURCE (:source) You can select an alternate Rubygems repository for a gem using the ':source' option. gem "some_internal_gem", :source => "https://gems.example.com" This forces the gem to be loaded from this source and ignores any global sources declared at the top level of the file. If the gem does not exist in this source, it will not be installed. Bundler will search for child dependencies of this gem by first looking in the source selected for the parent, but if they are not found there, it will fall back on global sources using the ordering described in [SOURCE PRIORITY][]. Selecting a specific source repository this way also suppresses the ambiguous gem warning described above in [GLOBAL SOURCES (#source)](#GLOBAL-SOURCES-source-). ### GIT (:git) If necessary, you can specify that a gem is located at a particular git repository using the `:git` parameter. The repository can be accessed via several protocols: * `HTTP(S)`: gem "rails", :git => "https://github.com/rails/rails.git" * `SSH`: gem "rails", :git => "git@github.com:rails/rails.git" * `git`: gem "rails", :git => "git://github.com/rails/rails.git" If using SSH, the user that you use to run `bundle install` `MUST` have the appropriate keys available in their `$HOME/.ssh`. `NOTE`: `http://` and `git://` URLs should be avoided if at all possible. These protocols are unauthenticated, so a man-in-the-middle attacker can deliver malicious code and compromise your system. HTTPS and SSH are strongly preferred. The `group`, `platforms`, and `require` options are available and behave exactly the same as they would for a normal gem. A git repository `SHOULD` have at least one file, at the root of the directory containing the gem, with the extension `.gemspec`. This file `MUST` contain a valid gem specification, as expected by the `gem build` command. If a git repository does not have a `.gemspec`, bundler will attempt to create one, but it will not contain any dependencies, executables, or C extension compilation instructions. As a result, it may fail to properly integrate into your application. If a git repository does have a `.gemspec` for the gem you attached it to, a version specifier, if provided, means that the git repository is only valid if the `.gemspec` specifies a version matching the version specifier. If not, bundler will print a warning. gem "rails", "2.3.8", :git => "https://github.com/rails/rails.git" # bundle install will fail, because the .gemspec in the rails # repository's master branch specifies version 3.0.0 If a git repository does `not` have a `.gemspec` for the gem you attached it to, a version specifier `MUST` be provided. Bundler will use this version in the simple `.gemspec` it creates. Git repositories support a number of additional options. * `branch`, `tag`, and `ref`: You `MUST` only specify at most one of these options. The default is `:branch => "master"` * `submodules`: Specify `:submodules => true` to cause bundler to expand any submodules included in the git repository If a git repository contains multiple `.gemspecs`, each `.gemspec` represents a gem located at the same place in the file system as the `.gemspec`. |~rails [git root] | |-rails.gemspec [rails gem located here] |~actionpack | |-actionpack.gemspec [actionpack gem located here] |~activesupport | |-activesupport.gemspec [activesupport gem located here] |... To install a gem located in a git repository, bundler changes to the directory containing the gemspec, runs `gem build name.gemspec` and then installs the resulting gem. The `gem build` command, which comes standard with Rubygems, evaluates the `.gemspec` in the context of the directory in which it is located. ### GIT SOURCE (:git_source) A custom git source can be defined via the `git_source` method. Provide the source's name as an argument, and a block which receives a single argument and interpolates it into a string to return the full repo address: git_source(:stash){ |repo_name| "https://stash.corp.acme.pl/#{repo_name}.git" } gem 'rails', :stash => 'forks/rails' In addition, if you wish to choose a specific branch: gem "rails", :stash => "forks/rails", :branch => "branch_name" ### GITHUB (:github) `NOTE`: This shorthand should be avoided until Bundler 2.0, since it currently expands to an insecure `git://` URL. This allows a man-in-the-middle attacker to compromise your system. If the git repository you want to use is hosted on GitHub and is public, you can use the :github shorthand to specify just the github username and repository name (without the trailing ".git"), separated by a slash. If both the username and repository name are the same, you can omit one. gem "rails", :github => "rails/rails" gem "rails", :github => "rails" Are both equivalent to gem "rails", :git => "git://github.com/rails/rails.git" Since the `github` method is a specialization of `git_source`, it accepts a `:branch` named argument. ### GIST (:gist) If the git repository you want to use is hosted as a Github Gist and is public, you can use the :gist shorthand to specify just the gist identifier (without the trailing ".git"). gem "the_hatch", :gist => "4815162342" Is equivalent to: gem "the_hatch", :git => "https://gist.github.com/4815162342.git" Since the `gist` method is a specialization of `git_source`, it accepts a `:branch` named argument. ### BITBUCKET (:bitbucket) If the git repository you want to use is hosted on Bitbucket and is public, you can use the :bitbucket shorthand to specify just the bitbucket username and repository name (without the trailing ".git"), separated by a slash. If both the username and repository name are the same, you can omit one. gem "rails", :bitbucket => "rails/rails" gem "rails", :bitbucket => "rails" Are both equivalent to gem "rails", :git => "https://rails@bitbucket.org/rails/rails.git" Since the `bitbucket` method is a specialization of `git_source`, it accepts a `:branch` named argument. ### PATH (:path) You can specify that a gem is located in a particular location on the file system. Relative paths are resolved relative to the directory containing the `Gemfile`. Similar to the semantics of the `:git` option, the `:path` option requires that the directory in question either contains a `.gemspec` for the gem, or that you specify an explicit version that bundler should use. Unlike `:git`, bundler does not compile C extensions for gems specified as paths. gem "rails", :path => "vendor/rails" If you would like to use multiple local gems directly from the filesystem, you can set a global `path` option to the path containing the gem's files. This will automatically load gemspec files from subdirectories. path 'components' do gem 'admin_ui' gem 'public_ui' end ## BLOCK FORM OF SOURCE, GIT, PATH, GROUP and PLATFORMS The `:source`, `:git`, `:path`, `:group`, and `:platforms` options may be applied to a group of gems by using block form. source "https://gems.example.com" do gem "some_internal_gem" gem "another_internal_gem" end git "https://github.com/rails/rails.git" do gem "activesupport" gem "actionpack" end platforms :ruby do gem "ruby-debug" gem "sqlite3" end group :development, :optional => true do gem "wirble" gem "faker" end In the case of the group block form the :optional option can be given to prevent a group from being installed unless listed in the `--with` option given to the `bundle install` command. In the case of the `git` block form, the `:ref`, `:branch`, `:tag`, and `:submodules` options may be passed to the `git` method, and all gems in the block will inherit those options. ## INSTALL_IF (#install_if) The `install_if` method allows gems to be installed based on a proc or lambda. This is especially useful for optional gems that can only be used if certain software is installed or some other conditions are met. install_if -> { RUBY_PLATFORM =~ /darwin/ } do gem "pasteboard" end ## GEMSPEC (#gemspec) If you wish to use Bundler to help install dependencies for a gem while it is being developed, use the `gemspec` method to pull in the dependencies listed in the `.gemspec` file. The `gemspec` method adds any runtime dependencies as gem requirements in the default group. It also adds development dependencies as gem requirements in the `development` group. Finally, it adds a gem requirement on your project (`:path => '.'`). In conjunction with `Bundler.setup`, this allows you to require project files in your test code as you would if the project were installed as a gem; you need not manipulate the load path manually or require project files via relative paths. The `gemspec` method supports optional `:path`, `:glob`, `:name`, and `:development_group` options, which control where bundler looks for the `.gemspec`, the glob it uses to look for the gemspec (defaults to: "{,*,*/*}.gemspec"), what named `.gemspec` it uses (if more than one is present), and which group development dependencies are included in. ## SOURCE PRIORITY When attempting to locate a gem to satisfy a gem requirement, bundler uses the following priority order: 1. The source explicitly attached to the gem (using `:source`, `:path`, or `:git`) 2. For implicit gems (dependencies of explicit gems), any source, git, or path repository declared on the parent. This results in bundler prioritizing the ActiveSupport gem from the Rails git repository over ones from `rubygems.org` 3. The sources specified via global `source` lines, searching each source in your `Gemfile` from last added to first added. bundler-1.11.2/.gitignore0000644000004100000410000000064412652443364015264 0ustar www-datawww-data# Please do not submit patches for including directives to ignore IDE/editor # generated files. Use a global gitignore as described in # https://help.github.com/articles/ignoring-files and find useful gitignore # samples at https://github.com/github/gitignore # files created by running the specs /tmp/ # gems built by `rake build` /pkg/ # output from ronn /lib/bundler/man/ # output from ci_reporter /spec/reports/ bundler-1.11.2/ISSUES.md0000644000004100000410000001053312652443364014627 0ustar www-datawww-data# Bundler Issues So! You're having problems with Bundler. This file is here to help. If you're running into an error, try reading the rest of this file for help. If you can't figure out how to solve your problem, there are also instructions on how to report a bug. **Please use the [Bundler Features](https://github.com/bundler/bundler-features) repo to suggest and discuss features. The bundler issue tracker is only for bugs.** ## Documentation Instructions for common Bundler uses can be found on the [Bundler documentation site](http://bundler.io/). Detailed information about each Bundler command, including help with common problems, can be found in the [Bundler man pages](http://bundler.io/man/bundle.1.html). ## Troubleshooting ### Heroku errors Please open a ticket with Heroku if you're having trouble deploying. They have a professional support team who can help you resolve Heroku issues far better than the Bundler team can. If the problem that you are having turns out to be a bug in Bundler itself, Heroku support can get the exact details to us. ### Other problems First, figure out exactly what it is that you're trying to do. Then, go to the [Bundler documentation website](http://bundler.io) and see if we have instructions on how to do that. Second, check [the compatibility list](http://bundler.io/compatibility.html), and make sure that the version of Bundler that you are using works with the versions of Ruby and Rubygems that you are using. If the instructions don't work, or you can't find any instructions, you can try these troubleshooting steps: # remove user-specific gems and git repos rm -rf ~/.bundle/ ~/.gem/bundler/ ~/.gems/cache/bundler/ # remove system-wide git repos and git checkouts rm -rf $GEM_HOME/bundler/ $GEM_HOME/cache/bundler/ # remove project-specific settings rm -rf .bundle/ # remove project-specific cached gems and repos rm -rf vendor/cache/ # remove the saved resolve of the Gemfile rm -rf Gemfile.lock # uninstall the rubygems-bundler and open_gem gems rvm gemset use global # if using rvm gem uninstall rubygems-bundler open_gem # try to install one more time bundle install ## Reporting unresolved problems Hopefully the troubleshooting steps above resolved your problem. If things still aren't working the way you expect them to, please let us know so that we can diagnose and hopefully fix the problem you're having. **The best way to report a bug is by providing a reproduction script.** See these examples: * [Git environment variables causing install to fail.](https://gist.github.com/xaviershay/6207550) * [Multiple gems in a repository cannot be updated independently.](https://gist.github.com/xaviershay/6295889) A half working script with comments for the parts you were unable to automate is still appreciated. If you are unable to do that, please include the following information in your report: - What you're trying to accomplish - The command you ran - What you expected to happen - What actually happened - The exception backtrace(s), if any - Everything output by running `bundle env` If your version of Bundler does not have the `bundle env` command, then please include: - Your Gemfile - Your Gemfile.lock - Your Bundler configuration settings (run `bundle config`) - What version of bundler you are using (run `bundle -v`) - What version of Ruby you are using (run `ruby -v`) - What version of Rubygems you are using (run `gem -v`) - Whether you are using RVM, and if so what version (run `rvm -v`) - Whether you have the `rubygems-bundler` gem, which can break gem executables (run `gem list rubygems-bundler`) - Whether you have the `open_gem` gem, which can cause rake activation conflicts (run `gem list open_gem`) If you are using Rails 2.3, please also include: - Your boot.rb file - Your preinitializer.rb file - Your environment.rb file If you have either `rubygems-bundler` or `open_gem` installed, please try removing them and then following the troubleshooting steps above before opening a new ticket. [Create a gist](https://gist.github.com) containing all of that information, then visit the [Bundler issue tracker](https://github.com/bundler/bundler/issues) and [create a ticket](https://github.com/bundler/bundler/issues/new) describing your problem and linking to your gist. Thanks for reporting issues and helping make Bundler better! bundler-1.11.2/CONTRIBUTING.md0000644000004100000410000000455512652443364015532 0ustar www-datawww-data# Contributing Bundler welcomes contributions from *everyone*. While contributing, please follow the project [code of conduct](http://bundler.io/conduct.html), so that everyone can be included. If you'd like to help make Bundler better, you totally rock! Here are some ways you can contribute: - by using prerelease versions (run `gem install bundler --pre`) - by [reporting bugs you encounter](https://github.com/bundler/bundler/issues/new) - by [suggesting new features](https://github.com/bundler/bundler-features/issues/new) - by adding to or editing [the Bundler documentation website](http://bundler.io) and [Bundler man pages](http://bundler.io/man/bundle.1.html) - by [checking issues for completeness](https://github.com/bundler/bundler/blob/master/DEVELOPMENT.md#bug-triage) - by closing issues that are not complete - by adding a failing test for reproducible [reported bugs](https://github.com/bundler/bundler/issues) - by reviewing [pull requests](https://github.com/bundler/bundler/pulls) and suggesting improvements - by improving existing code, including [suggestions from PullReview](https://www.pullreview.com/github/bundler/bundler/reviews/master) - by [writing code](https://github.com/bundler/bundler/blob/master/DEVELOPMENT.md) (no patch is too small! fix typos or bad whitespace) If you need help getting started, check out the [DEVELOPMENT](https://github.com/bundler/bundler/blob/master/DEVELOPMENT.md) file for steps that will get you up and running. Thanks for helping us make Bundler better. # Troubleshooting If you're having a problem, please see [ISSUES](https://github.com/bundler/bundler/blob/master/ISSUES.md) for troubleshooting steps and a guide for how to submit a ticket that will help us solve the problem you are having as quickly as possible. # Requesting Features Head on over to the [Bundler features](https://github.com/bundler/bundler-features) project, or any of the lists or channels listed below. Feature-wise we consider Bundler stable, so the core team does not tend to work on feature suggestions. Pull requests welcome though! # Discussing Bundler If you'd like to discuss features, ask questions, or just engage in general Bundler-focused discussion, please see the [#bundler](irc://irc.freenode.net/#bundler) IRC channel on Freenode, and the [Bundler mailing list](http://groups.google.com/group/ruby-bundler) on Google Groups. bundler-1.11.2/bundler.gemspec0000644000004100000410000000261512652443364016274 0ustar www-datawww-data# coding: utf-8 lib = File.expand_path("../lib/", __FILE__) $:.unshift lib unless $:.include?(lib) require "bundler/version" Gem::Specification.new do |s| s.name = "bundler" s.version = Bundler::VERSION s.licenses = ["MIT"] s.authors = ["André Arko", "Terence Lee", "Carl Lerche", "Yehuda Katz"] s.email = ["andre.arko+terence.lee@gmail.com"] s.homepage = "http://bundler.io" s.summary = "The best way to manage your application's dependencies" s.description = "Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably" s.required_ruby_version = ">= 1.8.7" s.required_rubygems_version = ">= 1.3.6" s.add_development_dependency "automatiek", "~> 0.1.0" s.add_development_dependency "mustache", "0.99.6" s.add_development_dependency "rake", "~> 10.0" s.add_development_dependency "rdiscount", "~> 1.6" s.add_development_dependency "ronn", "~> 0.7.3" s.add_development_dependency "rspec", "~> 3.0" s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) } # we don't check in man pages, but we need to ship them because # we use them to generate the long-form help for each command. s.files += Dir.glob("lib/bundler/man/**/*") s.bindir = "exe" s.executables = %w(bundle bundler) s.require_paths = ["lib"] end bundler-1.11.2/CHANGELOG.md0000644000004100000410000022205212652443364015104 0ustar www-datawww-data## 1.11.2 (2015-12-15) Bugfixes: - _really_ stop calling `required_ruby_version` on nil @specifications (#4147, @indirect) ## 1.11.1 (2015-12-15) Bugfixes: - lazy-load Psych, again (#4149, @indirect) - allow gemspec gems on other platforms (#4150, @indirect) - fix --no-coc and --no-mit flags on `gem` (#4148, @RochesterinNYC) - stop calling `required_ruby_version` on nil @specifications (#4147, @indirect) ## 1.11.0 (2015-12-12) (this space intentionally left blank) ## 1.11.0.pre.2 (2015-12-06) Bugfixes: - fail gracefully when trying to execute a non-executable file (#4081, @fotanus) - fix a crash when pushing a gem via `rake release` (@segiddins) ## 1.11.0.pre.1 (2015-11-29) Features: - actual Gemfile and lockfile filenames are used in messages (#3672, @segiddins) - the git remote for `rake release` is now customizable (@skateman) - file access permissions errors are now much more friendly (#3703, #3735, #3858, #3988, #4009 @repinel, @Elffers, @segiddins, @agis-) - add support for showing help for plugin commands (@tf) - send `X-Gemfile-Source` header to source mirrors (@agis-) - show what version upstream dependencies were resolved to in conflict messages (@segiddins) - add support for using bundler setting to add private access credentials for git sources (@frsyuki) - take into consideration HTTP proxy settings in `.gemrc` (@PG-kura) - allow specifying a gem host to push to in the `GEM_HOST` environment variable (@pmenglund) - when gempec `required_ruby_version` is available and the Gemfile specifies a ruby version, resolve for the given ruby version (@segiddins) - allow setting a `silence_root_warning` setting to silence the warning when `bundle install` is run as root (@blackxored) - update the `bundle gem` code of conduct template to Contributor Covenant v1.3.0 (@CoralineAda) - add support for specifying gems to update when running `bundle lock` via `--update gem1 gem2` (@JuanitoFatas) - added support for MRI 2.3 (@amatsuda) - show a helpful message when requiring a file in `bundler require` fails (#3960, @agis-) - include git revision hash when printing a git source (#3433, @agis-) - improve hint when a resolution conflict occurs (@seanlinsley) - show a friendly error when a git ref is not found (#3879, @agis-) - improve error message when sources are not absolute URIs (#3925, @agis-) - add `pkg` to rake's clobber list (#3676, @jasonkarns) - retry fetching specs when fetching version metadata fails (@jingweno) Bugfixes: - avoid showing bundler version warning messages twice (@fotanus) - fix running `bundle check` with `--path` when the gems are only installed globally (@akihiro17) - fix `bin/setup` from `bundle gem` assuming `bash` is in `/bin` - fail more gracefully when an HTTP remote is unreachable (#3765, @steverob) - fix a warning running `bundle exec` on jruby 9.0.0.0 (@deivid-rodriguez, @mastfish) - fix the `bundle gem` readme when no tests are generated (@roseweixel) - the dependencies on test gems in `bundle gem` are now locked to major versions (#3811, @indirect) - fix the paths for native extensions generated by `--standalone` (#3813, @AlexanderPavlenko) - fix trying to cache a gem that has no source (@EduardoBautista) - fix `--source` option to `bundle update` causing incorrect gem unlocking (#3759, #3761, @neoeno) - fix handling an empty `BUNDLE_GEMFILE` environment variables (#3678, @agis-) - avoid cleaning up gem extension directory in `bundle clean` (@Sirupsen) - fix the `ssl_verify_mode` setting not being treated as a number (@goughy000) - fix not retrying on zlib errors (#4047, @andremedeiros) - fix a warning being shown for using `URI.encode` (@EduardoBautista) - fix handling of fatal HTTP errors (#3830, @indirect) - ensure all `sudo` access is done in a thread-safe manner (#3910, @agis-) - fix caching gems with a path with the same prefix as the bundled application (@indirect) - fix showing gemspec validation errors on `bundle exec` (#3895, @agis-) - distinguish Gemfile syntax and evaluation errors (#3783, @agis-) - fix nested Gemfile sources not restoring the previous source (#3974, @agis-) - fix the `RUBYLIB` environment variable not being cleaned (#3982, @agis-) - fix handling a dependency missing from `Gemfile.lock` so parallel installation does not deadlock (#4012, @lukaso) - also print gemspecs in `bundle env` output (@agis-) - fix handling when a `path` source does not have a gemspec but a lockfile says there is (#4004, @segiddins) - show a warning when the `RUBYGEMS_GEMDEPS` environment variable is set (#3656, @agis-) - fix handling invalid RubyGems configuration files (#4042, @agis-) - fix `bundle console` falling back to `irb` when the preferred console is unavailable (@felixbuenemann) - restrict platforms when referencing a `gemspec` in the `Gemfile` to those defined in the gemspec (#4102, @smellsblue) Performance: - speed up dependency resolution in pathological cases by 25x (#3803, @segiddins) - drop string allocations when searching for gems (@jrafanie) ## 1.10.6 (2015-07-22) Workarounds: - only warn on invalid gemspecs (@indirect) Bugfixes: - fix installing dependencies in the correct order (#3799, @pducks32) - fix sorting of mixed DependencyLists (#3762, @tony-spataro-rs) - fix `install_if` conditionals when using the block form (@danieltdt) ## 1.10.5 (2015-06-24) Workarounds: - don't add or update BUNDLED WITH during `install` with no changes (@segiddins) Bugfixes: - fix sorting of mixed DependencyLists with RubyGems >= 2.23 (#3762, @tony-spataro-rs) - speed up resolver for path and git gems (@segiddins) - fix `install --force` to not reinstall Bundler (#3743, @karlo57) ## 1.10.4 (2015-06-16) Workarounds: - don't add BUNDLED WITH to the lock when Spring runs `check` over and over (@indirect) Bugfixes: - display "with native extensions" log output correctly (@ivantsepp) - alias `i` to `install`, `c` to `check`, and `e` to `exec` (@indirect) ## 1.10.3 (2015-06-03) Bugfixes: - allow missing gemspec files when validating path and git gems (#3686, #3698, @segiddins) - fix regression in `rake install` (#3701, #3705, @segiddins) - fix regression when calling `gem` with `bundle exec` or `-rbundler/setup` (#3699, @segiddins) - fix `bundler/inline` requiring a newly-installed gem (#3693, @indirect, @segiddins) ## 1.10.2 (2015-05-29) Bugfixes: - fix regression in `bundle update GEM` performance introduced in 1.10.0 (#3687, @segiddins) ## 1.10.1 (2015-05-28) Bugfixes: - silence ruby warning when running CLI commands (@segiddins) - validate gemspecs in non-packaging mode (#3681, @segiddins) - ensure the same chdir mutex as RubyGems is used (#3680, @segiddins) ## 1.10.0 (2015-05-28) (this space intentionally left blank) ## 1.10.0.rc (2015-05-16) Features: - dramatically speed up resolving some slow Gemfiles (#3635, @segiddins) - track CI platforms running Bundler (#3646, @fotanus) Bugfixes: - allow `viz` to work with prereleases (#3621, #3217, @aprescott) - validate gemspecs used in path and git gems (#3639, @segiddins, @indirect) - stop printing config warnings when config is unchanged (#3649, @fotanus, @indirect) ## 1.10.0.pre.2 (2015-05-07) Bugfixes: - make BUNDLED WITH backwards compatible (#3623, @segiddins) ## 1.10.0.pre.1 (2015-05-05) Bugfixes: - always clean up tmp dirs (#3277, @hone, @indirect, @segiddins) ## 1.10.0.pre (2015-05-03) Features: - support gem extensions built into any directory on RubyGems 2.2+ (#3582, @voxik) - add 'bundler/inline' which provides a `gemfile` method (#3440, @segiddins) - improved error reports for Gemfile errors (#3480, @segiddins) - `lock` command (#3437, @segiddins) - add `ignore_messages` config to suppress post-install text (#3510, @pducks32) - improve `gem` minitest template (#3513, #3515, @arthurnn) - add `install --force` to re-install installed gems (#3519, @segiddins) - show more `outdated` information, including groups (@smlance, @indirect) - add optional groups to the Gemfile (#3531, @jhass) - accept glob argument to `gemspec` in Gemfile (#3464, @pjump) - make timeouts and retries configurable via `config` (#3601, @pducks32) - add `install_if` Gemfile method for conditional installs (#3611, @segiddins) Bugfixes: - standalone mode now uses builtin gems correctly (#3610, @segiddins) - fix `rake spec:deps` on MinGW Ruby 2.0+ (#3487, @marutosi) - remember all y/n answers when generating gems (#3579, @pducks32) Performance: - use RubyGems stub specifications when possible (#3580, @segiddins) Deprecations: - deprecated the (never enabled) `bundle_ruby` binary (@smlance) ## 1.9.10 (2015-06-22) Features: - the `BUNDLED WITH` section of lockfiles generated by 1.10+ will be preserved (@segiddins) ## 1.9.9 (2015-05-16) Bugfixes: - read mirror and credential settings from older versions (#3557, @Strech) ## 1.9.8 (2015-05-12) Bugfixes: - fix regression in sudo mode introduced by 1.9.7 (#3642, @segiddins) ## 1.9.7 (2015-05-11) Bugfixes: - always clean up tmp dirs (#3277, @hone, @indirect, @segiddins) ## 1.9.6 (2015-05-02) Bugfixes: - use RubyGems spec stubs if available (@segiddins) - allow creating gems with names containing two dashes (#3483, @janlelis) - allow creating gems with names extending constants (#3603, @amatsuda) ## 1.9.5 (2015-04-29) Bugfixes: - respect Gemfile sources when installing a gem present in two sources (#3585, @tmoore) ## 1.9.4 (2015-04-13) Bugfixes: - fix regression in installing x86 and universal gems (#3565, @jdmundrawala) - improve error when gems are missing (#3564, @sealocal) ## 1.9.3 (2015-04-12) Bugfixes: - handle removal of `specs` from rubygems/rubygems@620910 (#3558, @indirect) - install 'universal' gems on Windows (#3066, @jdmundrawala) - stop passing --local during `rake install` task (#3236, @indirect) - guard against all possible accidental public gem pushes (#3533, @indirect) ## 1.9.2 (2015-03-30) Bugfixes: - ensure gem executables are executable (#3517, #3511, @indirect) - fix warnings in Molinillo (#3516, @segiddins) - ensure duplicate dependencies do not propagate (#3522, @segiddins) - keep gems locked when updating another gem from the same source (#3520, @indirect) - resolve race that could build gems without saved arguments (#3404, @indirect) ## 1.9.1 (2015-03-21) Bugfixes: - avoid exception in 'bundler/gem_tasks' (#3492, @segiddins) ## 1.9.0 (2015-03-20) ## 1.9.0.rc (2015-03-13) Bugfixes: - make Bundler.which stop finding directories (@nohoho) - handle Bundler prereleases correctly (#3470, @segiddins) - add before_install to .travis.yml template for new gems (@kodnin) ## 1.9.0.pre.1 (2015-03-11) Bugfixes: - make `gem` command work again (@arthurnn) ## 1.9.0.pre (2015-03-11) Features: - prefer gemspecs closest to the directory root (#3428, @segiddins) - debug log for API request limits (#3452, @neerfri) "Features": - Molinillo resolver, shared with CocoaPods (@segiddins) - updated Thor to v0.19.1 (@segiddins) ## 1.8.9 (2015-05-02) Bugfixes: - Use RubyGems spec stubs if available (@segiddins) ## 1.8.8 (2015-04-29) Bugfixes: - Respect Gemfile sources when installing a gem present in two sources (#3585, @tmoore) ## 1.8.7 (2015-04-07) Bugfixes: - stop suppressing errors inside gems that get required (#3549, @indirect) ## 1.8.6 (2015-03-30) Bugfixes: - keep gems locked when updating another gem from the same source (#3250, @indirect) - resolve race that could build gems without saved arguments (#3404, @indirect) ## 1.8.5 (2015-03-11) Bugfixes: - remove MIT license from gemspec when removing license file (@indirect) - respect 'no' immediately as well as saving it in `gem` config (@kirs) ## 1.8.4 (2015-03-05) Bugfixes: - document --all-platforms option (#3449, @moeffju) - find gems from all sources on exec after install (#3450, @TimMoore) ## 1.8.3 (2015-02-24) Bugfixes: - handle boolean values for gem settings (@EduardoBautista) - stop always looking for updated `path` gems (#3414, #3417, #3429, @TimMoore) ## 1.8.2 (2015-02-14) Bugfixes: - allow config settings for gems with 'http' in the name again (#3398, @TimMoore) ## 1.8.1 (2015-02-13) Bugfixes: - synchronize building git gem native extensions (#3385, @antifuchs & @indirect) - set gemspec bindir correctly (#3392, @TimMoore) - request lockfile deletion when it is malformed (#3396, @indirect) - explain problem when mirror config is missing (#3386, @indirect) - explain problem when caching causes permission error (#3390, @indirect) - normalize URLs in config keys (#3391, @indirect) ## 1.8.0 (2015-02-10) Bugfixes: - gemfile `github` blocks now work (#3379, @indirect) Bugfixes from v1.7.13: - look up installed gems in remote sources (#3300, #3368, #3377, #3380, #3381, @indirect) - look up gems across all sources to satisfy dependencies (#3365, @keiths-osc) - request dependencies for no more than 100 gems at a time (#3367, @segiddins) ## 1.8.0.rc (2015-01-26) Features: - add `config disable_multisource` option to ensure sources can't compete (@indirect) Bugfixes: - don't add extra quotes around long, quoted config values (@aroben, #3338) Security: - warn when more than one top-level source is present (@indirect) ## 1.8.0.pre (2015-01-26) Features: - add metadata allowed_push_host to new gem template (#3002, @juanitofatas) - adds a `--no-install` flag to `bundle package` (@d-reinhold) - add `bundle config auto_install true` to install automatically (@smashwilson) - add `bundle viz --without` to exclude gem groups from resulting graph (@fnichol) - prevent whitespace in gem declarations with clear messaging (@benlakey) - tries to find a `bundler-` executable on your path for non-bundler commands (@andremedeiros) - tries to find `gems.rb` and it's new counterpart, `gems.locked` (@andremedeiros) - change the initial version of new gems from `0.0.1` to `0.1.0` (@petedmarsh) - add `package --all-platforms` to cache gems for each known platform (@ccutrer) - speed up `exec` when running commands on the $PATH (@kirs) - add gem code of conduct file and option (@kirs) - add config settings for gem license and tests (@kirs) - add `bin/setup` and `bin/console` to new gems (@indirect) - include configured user-agent in network requests (@indirect) - support `github`, `gist`, and `bitbucket` options on git gems (@indirect) - add `package --cache-path` and `config cache_path` for cache location (@jnraine) - allow `config` to work even when a Gemfile is not present (@dholdren) - add `config gemfile /path` for other Gemfile locations (@dholdren) - add `github` method alonside the `git` method (@BenMorganIO) Bugfixes: - reduce memory usage with threaded parallel workers (@Who828) - support read-only git gems (@pmahoney) - various resolver performance improvements (@dubek) - untaint git gem paths for Rubygems compatibility (@tdtds) Documentation: - add missing Gemfile global `path` explanation (@agenteo) ## 1.7.15 (2015-04-29) Bugfixes: - Respect Gemfile sources when installing a gem present in two sources (#3585, @tmoore) ## 1.7.14 (2015-03-30) Bugfixes: - Keep gems locked when updating another gem from the same source (#3250, @indirect) - Don't add extra quotes around long, quoted config values (@aroben, #3338) ## 1.7.13 (2015-02-07) Bugfixes: - Look up installed gems in remote sources (#3300, #3368, #3377, #3380, #3381, @indirect) - Look up gems across all sources to satisfy dependencies (#3365, @keiths-osc) - Request dependencies for no more than 100 gems at a time (#3367, @segiddins) ## 1.7.12 (2015-01-08) Bugfixes: - Always send credentials for sources, fixing private Gemfury gems (#3342, @TimMoore) ## 1.7.11 (2015-01-04) Bugfixes: - Recognize `:mri_22` and `:mingw_22`, rather than just `:ruby_22` (#3328, @myabc) ## 1.7.10 (2014-12-29) Bugfixes: - Fix source blocks sometimes causing deployment mode to fail wrongly (#3298, @TimMoore) Features(?): - Support `platform :mri_22` and related version bits (#3309, @thomasfedb) ## 1.7.9 (2014-12-09) Bugfixes: - Fix an issue where bundler sometime spams one gem in Gemfile.lock (#3216, @Who828) - Ensure bundle update installs the newer version of the gem (#3089, @Who828) - Fix an regression which stopped Bundler from resolving some Gemfiles (#3059, #3248, @Who828) ## 1.7.8 (2014-12-06) Bugfixes: - Hide credentials while warning about gems with ambiguous sources (#3256, @TimMoore) ## 1.7.7 (2014-11-19) Bugfixes: - Ensure server credentials stored in config or ENV will be used (#3180, @arronmabrey) - Fix race condition causing errors while installing git-based gems (#3174, @Who828) - Use single quotes in config so YAML won't add more quotes (#3261, @indirect) ## 1.7.6 (2014-11-11) Bugfixes: - CA certificates that work with all OpenSSLs (@luislavena, @indirect) ## 1.7.5 (2014-11-10) Bugfixes: - Fix --deployment with source blocks and non-alphabetical gems (#3224, @TimMoore) - Vendor CA chain to validate new rubygems.org HTTPS certificate (@indirect) ## 1.7.4 (2014-10-19) Bugfixes: - Allow --deployment after `pack` while using source blocks (#3167, @TimMoore) - Use dependency API even when HTTP credentials are in ENV (#3191, @fvaleur) - Silence warnings (including root warning) in --quiet mode (#3186, @indirect) - Stop asking gem servers for gems already found locally (#2909, @dubek) ## 1.7.3 (2014-09-14) Bugfixes: - `extconf.rb` is now generated with the right path for `create_makefile` (@andremedeiros) - Fix various Ruby warnings (@piotrsanarki, @indirect) ## 1.7.2 (2014-08-23) Bugfixes: - Revert gem source sorting in lock files (@indirect) ## 1.7.1 (2014-08-20) Bugfixes: - Install gems from one source needed by gems in another source (@indirect) - Install the same gem versions even after some are installed (@TimMoore) - Download specs only when installing from servers (@indirect) ## 1.7.0 (2014-08-13) Security: - Fix for CVE-2013-0334, installing gems from an unexpected source (@TimMoore) Features: - Gemfile `source` calls now take a block containing gems from that source (@TimMoore) - Added the `:source` option to `gem` to specify a source (@TimMoore) Bugfixes: - Warn on ambiguous gems available from more than one source (@TimMoore) ## 1.6.7 (2014-10-19) Features: - warn to upgrade when using useless source blocks (@danfinnie) Documentation: - explain how to use gem server credentials via ENV (@hwartig) ## 1.6.6 (2014-08-23) Bugfixes: - restore Gemfile credentials to Gemfile.lock (@indirect) ## 1.6.5 (2014-07-23) Bugfixes: - require openssl explicitly to fix rare HTTPS request failures (@indirect, #3107) ## 1.6.4 (2014-07-17) Bugfixes: - fix undefined constant error when can't find gem during binstubs (#3095, @jetaggart) - work when installed git gems are not writable (#3092, @pmahoney) - don't store configured source credentials in Gemfile.lock (#3045, @lhz) - don't include config source credentials in the lockfile (Lars Haugseth) - use threads for jobs on Rubinius (@YorickPeterse) - skip dependencies from other platforms (@mvz) - work when Rubygems was built without SSL (@andremedeiros) ## 1.6.3 (2014-06-16) Bugfixes: - fix regression when resolving many conflicts (#2994, @Who828) - use local gemspec for builtin gems during install --local (#3041, @Who828) - don't warn about sudo when installing on Windows (#2984, @indirect) - shell escape `bundle open` arguments (@indirect) ## 1.6.2 (2014-04-13) Bugfixes: - fix an exception when using builtin gems (#2915, #2963, @gnufied) - cache gems that are built in to the running ruby (#2975, @indirect) - re-allow deploying cached git gems without git installed (#2968, @aughr) - keep standalone working even with builtin gems (@indirect) - don't update vendor/cache in deployment mode (#2921, @indirect) Features: - warn informatively when `bundle install` is run as root (#2936, @1337807) ## 1.6.1 (2014-04-02) Bugfixes: - update C extensions when git gem versions change (#2948, @dylanahsmith) Features: - add support for C extensions in sudo mode on Rubygems 2.2 ## 1.6.0 (2014-03-28) Bugfixes: - many Gemfiles that caused incorrect errors now resolve correctly (@Who828) - redirects across hosts now work on rubies without OpenSSL (#2686, @grddev) - gemspecs now handle filenames with newlines (#2634, @jasonmp85) - support escaped characters in usernames and passwords (@punkie) - no more exception on `update GEM` without lock file (@simi) - allow long config values (#2823, @kgrz) - cache successfully even locked to gems shipped with Ruby (#2869, @aughr) - respect NO_PROXY even if a proxy is configured (#2878, @stlay) - only retry git commands that hit the network (#2899, @timmoore) - fix NameError regression when OpenSSL is not available (#2898, @timmoore) - handle exception installing when build_info owned by root (@Who828) - skip HTTP redirects from rubygems.org, huge speed boost (@Who828) Features: - resolver rewritten to avoid recursion (@Who828) - add `git_source` for custom options like :github and :gist (@strzalek) - HTTP auth may now be stored in `bundle config` (@smashwilson) - some complex Gemfiles are resolved up to 10x faster (@Who828) - add support for IRB alternatives such as Pry and Ripl (@joallard, @postmodern) - highlight installed or updated gems (#2722, #2741, @yaotti, @simi) - display the `post_install_message` for gems installed via :git (@phallstrom) - `bundle outdated --strict` now only reports allowed updates (@davidblondeau) - `bundle show --verbose` Add gem summary to the output (@lardcanoe) - `bundle gem GEM --ext` now generates a skeleton for a C extension (@superdealloc) - Avoid using threequals operator where possible (@as-cii) - Add `bundle update --group` to update specific group (#2731 @banyan) Documentation: - Add missing switches for bundle-install(1) and bundle-update(1) (@as-cii) ## 1.5.3 (2014-02-06) Bugfixes: - find "missing" gems that are actually present (#2780, #2818, #2854) - use n-1 cores when given n jobs for parallel install (@jdickey) ## 1.5.2 (2014-01-10) Bugfixes: - fix integration with Rubygems 1.8.0-1.8.19 - handle ENETDOWN exception during network requests - gracefully shut down after interrupt during parallel install (@Who828) - allow Rails to run Thor without debug mode (@rafaelfranca) - set git binstub permissions by umask (@v-yarotsky) - remove parallel install debug log ## 1.5.1 (2013-12-28) Bugfixes: - correctly find gems installed with Ruby by default ## 1.5.0 (2013-12-26) Features: - install missing gems if their specs are present (@hone) Bugfixes: - use print for "Installing…" so messages are thread-safe (@TimMoore) ## 1.5.0.rc.2 (2013-12-18) "Features": - Support threaded installation on Rubygems 2.0.7+ - Debug installation logs in .bundle/install.log "Bugfixes": - Try to catch gem installation race conditions ## 1.5.0.rc.1 (2013-11-09) Features: - bundle update also accepts --jobs (#2692, @mrkn) - add fork URL to README for new `bundle gem` (#2665, @zzak) - add `bundle outdated --strict` (#2685, @davidblondeau) - warn if same gem/version is added twice (#2679, @jendiamond) - don't redownload installed specs for `bundle install` (#2680, @cainlevy) - override gem sources with mirrors (#2650, @danielsdeleo, @mkristian) Bugfixes: - fix sharing same SSL socket when forking workers for parallel install (#2632) - fix msg typo in GitNotAllowedError (#2654, @joyicecloud) - fix Bundler.which for directories (#2697, @rhysd) - properly require `Capistrano::Version` (#2690, @steveklabnik) - search for git.exe and git - fix the bug that downloads every spec when API fetcher encouters an error - only retry network requests ## 1.4.0.rc.1 (2013-09-29) Features: - add support for the x64-mingw32 platform (#2356, #2590, @larskanis) - add :patchlevel option to ruby DSL - add `bundler` bin (#2598, @kirs) - friendly ambiguous error messages (#2581, #2550, @jlsuttles, @jendiamond, @joyicecloud) - add `:jruby_18` and `:jruby_19` platform options (@mcfiredrill) - add X.509 client certificates for auth without passwords (@snackbandit) - add `exec --keep-file-descriptors` for Ruby 1.9-like behavior on 2.0 (@steved555) - print a better error when git is not installed (@joyicecloud) - exit non-zero when `outdated` is run with an unknown gem (@joyicecloud) - add `:ruby_21` platform option (@brandonblack) - add `--retry` to retry failed network and git commands (@schneems) - include command and versions in User-Agent (@indirect, @joyicecloud) Bugfixes: - allow passwordless Basic Auth (#2606, @rykov) - don't suggest `gem install foo` when `foo` is a git gem that fails (@kirs) - revert #2569, staying compatible with git: instead of https: for :github gems - handle exceptions while installing gems in parallel (@gnufied) ## 1.4.0.pre.1 (2013-08-04) Features: - retry network requests while installing gems (#2561, @ascherger) - faster installs using gemspecs from the local system cache (#2497, @mipearson) - add `bundle install -jN` for N parallel gem installations (#2481, @eagletmt) - add `ENV['DEBUG_RESOLVER_TREE']` outputs resolver tree (@dblock) - set $MANPATH so `bundle exec man name` works (#1624, @sunaku) - use `man` instead of `groff` (#2579, @ixti, @simi) - add Gemfile dependency info to bundle outdated output (#2487, @rahearn) - allow `require: true` as an alias for `require: ` (#2538, @ndbroadbent) - rescue and report Thor errors (#2478, @pjvds) - detect cyclic dependencies (#2564, @gnufied) - support multiple gems in `binstubs` (#2576, @lucasmazza) - use https instead of git for :github gems (#2569, @fuadsaud) - add quiet option to `bundle package` (#2573, @shtirlic) - use RUBYLIB instead of RUBYOPT for better Windows support (#2536, @equinux) Bugfixes: - reduce stack size while resolving to fix JRuby overflow (#2510, @headius) - display GitErrors while loading specs in --verbose mode (#2461) - allow the same options hash to be passed to multiple gems (#2447) - handle missing binaries without an exception (#2019, @luismreis) ## 1.3.6 (8 January 2014) Bugfixes: - make gemspec path option preserve relative paths in lock file (@bwillis) - use umask when creating binstubs (#1618, @v-yarotsky) - warn if graphviz is not installed (#2435, @Agis-) - show git errors while loading gemspecs - don't mutate gem method options hash (#2447) - print Thor errors (#2478, @pjvds) - print Rubygems system exit errors (James Cook) - more Pathnames into Strings for MacRuby (@kml) - preserve original gemspec path (@bwillis) - remove warning about deps with :git (#1651, @ixti) - split git files on null (#2634, @jasonmp85) - handle cross-host redirects without SSL (#2686, @grddev) - handle Rubygems 2 security exception (@zzak) - reinstall gems if they are missing with spec present - set binstub permissions using umask (#1618, @v-yarotsky) ## 1.3.5 (3 April 2013) Features: - progress indicator while resolver is running (@chief) Bugfixes: - update local overrides with orphaned revisions (@jamesferguson) - revert to working quoting of RUBYOPT on Windows (@ogra) - use basic auth even when SSL is not available (@jayniz) - installing git gems without dependencies in deployment now works ## 1.3.4 (15 March 2013) Bugfixes: - load YAML on Rubygems versions that define module YAML - fix regression that broke --without on ruby 1.8.7 ## 1.3.3 (13 March 2013) Features: - compatible with Rubygems 2.0.2 (higher and lower already work) - mention skipped groups in bundle install and bundle update output (@simi) - `gem` creates rake tasks for minitest (@coop) and rspec Bugfixes: - require rbconfig for standalone mode ## 1.3.2 (7 March 2013) Features: - include rubygems.org CA chain Bugfixes: - don't store --dry-run as a Bundler setting ## 1.3.1 (3 March 2013) Bugfixes: - include manpages in gem, restoring many help pages - handle more SSL certificate verification failures - check for the full version of SSL, which we need (@alup) - gem rake task 'install' now depends on task 'build' (@sunaku) ## 1.3.0 (24 February 2013) Features: - raise a useful error when the lockfile contains a merge conflict (@zofrex) - ensure `rake release` checks for uncommitted as well as unstaged (@benmoss) - allow environment variables to be negated with 'false' and '0' (@brettporter) - set $MANPATH inside `exec` for gems with man pages (@sunaku) - partial gem names for `open` and `update` now return a list (@takkanm) Bugfixes: - `update` now (again) finds gems that aren't listed in the Gemfile - `install` now (again) updates cached gems that aren't in the Gemfile - install Gemfiles with HTTP sources even without OpenSSL present - display CerficateFailureError message in full ## 1.3.0.pre.8 (12 February 2013) Security: - validate SSL certificate chain during HTTPS network requests - don't send HTTP Basic Auth creds when redirected to other hosts (@perplexes) - add `--trust-policy` to `install`, like `gem install -P` (@CosmicCat, #2293) Features: - optimize resolver when too new of a gem is already activated (@rykov, #2248) - update Net::HTTP::Persistent for SSL cert validation and no_proxy ENV - explain SSL cert validation failures - generate gemspecs when installing git repos, removing shellouts - add pager selection (@csgui) - add `licenses` command (@bryanwoods, #1898) - sort output from `outdated` (@richardkmichael, #1896) - add a .travis.yml to `gem -t` (@ndbroadbent, #2143) - inform users when the resolver starts - disable reverse DNS to speed up API requests (@raggi) Bugfixes: - raise errors while requiring dashed gems (#1807) - quote the Bundler path on Windows (@jgeiger, #1862, #1856) - load gemspecs containing unicode (@gaffneyc, #2301) - support any ruby version in --standalone - resolve some ruby -w warnings (@chastell, #2193) - don't scare users with an error message during API fallback - `install --binstubs` is back to overwriting. thanks, SemVer. ## 1.3.0.pre.7 (22 January 2013) Bugfixes: - stubs for gems with dev deps no longer cause exceptions (#2272) - don't suggest binstubs to --binstubs users ## 1.3.0.pre.6 (22 January 2013) Features: - `binstubs` lists child gem bins if a gem has no binstubs - `bundle gem --edit` will open the new gemspec (@ndbroadbent) - `bundle gem --test rspec` now makes working tests (@tricknotes) - `bundle env` prints info about bundler's environment (@peeja) - add `BUNDLE_IGNORE_CONFIG` environment variable support (@richo) Bugfixes: - don't overwrite custom binstubs during `install --binstubs` - don't throw an exception if `binstubs` gem doesn't exist - `bundle config` now works in directories without a Gemfile ## 1.3.0.pre.5 (Jan 9, 2013) Features: - make `--standalone` require lines ruby engine/version agnostic - add `--dry-run` to `bundle clean` (@wfarr, #2237) Bugfixes: - don't skip writing binstubs when doing `bundle install` - distinguish between ruby 1.9/2.0 when using :platforms (@spastorino) ## 1.3.0.pre.4 (Jan 3, 2013) Features: - `bundle binstubs ` to setup individual binstubs - `bundle install --binstubs ""` will remove binstubs option - `bundle clean --dry-run` will print out gems instead of removing them Bugfixes: - Avoid stack traces when Ctrl+C during bundle command (@mitchellh) - fix YAML parsing in in ruby-preview2 ## 1.3.0.pre.3 (Dec 21, 2012) Features: - pushing gems during `rake release` can be disabled (@trans) - installing gems with `rake install` is much faster (@utkarshkukreti) - added platforms :ruby_20 and :mri_20, since the ABI has changed - added '--edit' option to open generated gemspec in editor Bugfixes: - :git gems with extensions now work with Rubygems >= 2.0 (@jeremy) - revert SemVer breaking change to :github - `outdated` exits non-zero if outdated gems found (@rohit, #2021) - https Gist URLs for compatibility with Gist 2.0 (@NARKOZ) - namespaced gems no longer generate a superfluous directory (@banyan) ## 1.3.0.pre.2 (Dec 9, 2012) Features: - `config` expands local overrides like `local.rack .` (@gkop, #2205) - `gem` generates files correctly for names like `jquery-rails` (@banyan, #2201) - use gems from gists with the :gist option in the Gemfile (@jgaskins) Bugfixes: - Gemfile sources other than rubygems.org work even when .gemrc contains sources - caching git gems now caches specs, fixing e.g. git ls-files (@bison, #2039) - `show GEM` now warns if the directory has been deleted (@rohit, #2070) - git output hidden when running in --quiet mode (@rohit) ## 1.3.0.pre (Nov 29, 2012) Features: - compatibile with Ruby 2.0.0-preview2 - compatibile with Rubygems 2.0.0.preview2 (@drbrain, @evanphx) - ruby 2.0 added to the `:ruby19` ABI-compatible platform - lazy load YAML, allowing Psych to be specified in the Gemfile - significant performance improvements (@cheald, #2181) - `inject` command for scripted Gemfile additions (Engine Yard) - :github option uses slashless arguements as repo owner (@rking) - `open` suggests gem names for typos (@jdelStrother) - `update` reports non-existent gems (@jdelStrother) - `gem` option --test can generate rspec stubs (@MafcoCinco) - `gem` option --test can generate minitest stubs (@kcurtin) - `gem` command generates MIT license (@BrentWheeldon) - gem rake task 'release' resuses existing tags (@shtirlic) Bugfixes: - JRuby new works with HTTPS gem sources (@davidcelis) - `install` installs both rake rake-built gems at once (@crowbot, #2107) - handle Errno::ETIMEDOUT errors (@jmoses) - handle Errno::EAGAIN errors on JRuby - disable ANSI coloring when output is redirected (@tomykaira) - raise LoadErrors correctly during Bundler.require (@Empact) - do not swallow --verbose on `bundle exec` (@sol, #2102) - `gem` generates gemspecs that block double-requires - `gem` generates gemspecs that admit they depend on rake ## 1.2.5 (Feb 24, 2013) Bugfixes: - install Gemfiles with HTTP sources even without OpenSSL present - display CerficateFailureError message in full ## 1.2.4 (Feb 12, 2013) Features: - warn about Ruby 2.0 and Rubygems 2.0 - inform users when the resolver starts - disable reverse DNS to speed up API requests (@raggi) Bugfixes: - don't send user/pass when redirected to another host (@perplexes) - load gemspecs containing unicode (@gaffneyc, #2301) - support any ruby version in --standalone - resolve some ruby -w warnings (@chastell, #2193) - don't scare users with an error message during API fallback ## 1.2.3 (Nov 29, 2012) Bugfixes: - fix exceptions while loading some gemspecs ## 1.2.2 (Nov 14, 2012) Bugfixes: - support new Psych::SyntaxError for Ruby 2.0.0 (@tenderlove, @sol) - `bundle viz` works with git gems again (@hirochachacha) - recognize more cases when OpenSSL is not present ## 1.2.1 (Sep 19, 2012) Bugfixes: - `bundle clean` now works with BUNDLE_WITHOUT groups again - have a net/http read timeout around the Gemcutter API Endpoint ## 1.2.0 (Aug 30, 2012) Bugfixes: - raise original error message from LoadError's Documentation: - `platform` man pages ## 1.2.0.rc.2 (Aug 8, 2012) Bugfixes: - `clean` doesn't remove gems that are included in the lockfile ## 1.2.0.rc (Jul 17, 2012) Features: - `check` now has a `--dry-run` option (@svenfuchs, #1811) - loosen ruby directive for engines - prune git/path directories inside vendor/cache (@josevalim, #1988) - update vendored thor to 0.15.2 (@sferik) - add .txt to LICENSE (@postmodern, #2001) - add `config disable_local_branch_check` (@josevalim, #1985) - fall back on the full index when experiencing syck errors (#1419) - handle syntax errors in Ruby gemspecs (#1974) Bugfixes: - fix `pack`/`cache` with `--all` (@josevalim, #1989) - don't display warning message when `cache_all` is set - check for `nil` PATH (#2006) - Always try to keep original GEM_PATH (@drogus, #1920) ## 1.2.0.pre.1 (May 27, 2012) Features: - Git gems import submodules of submodules recursively (@nwwatson, #1935) Bugfixes: - Exit from `check` with a non-zero status when frozen with no lock - Use `latest_release` in Capistrano and Vlad integration (#1264) - Work around a Ruby 1.9.3p194 bug in Psych when config files are empty Documentation: - Add instructions for local git repos to the `config` manpage - Update the `Gemfile` manpage to include ruby versions (@stevenh512) - When OpenSSL is missing, provide instructions for fixing (#1776 etc.) - Unknown exceptions now link to ISSUES for help instead of a new ticket - Correct inline help for `clean --force` (@dougbarth, #1911) ## 1.2.0.pre (May 4, 2012) Features: - bundle package now accepts --all to package git and path dependencies - bundle config now accepts --local, --global and --delete options - It is possible to override a git repository via configuration. For instance, if you have a git dependency on rack, you can force it to use a local repo with `bundle config local.rack ~/path/to/rack` - Cache gemspec loads for performance (@dekellum, #1635) - add --full-index flag to `bundle update` (@fluxx, #1829) - add --quiet flag to `bundle update` (@nashby, #1654) - Add Bundler::GemHelper.gemspec (@knu, #1637) - Graceful handling of Gemfile syntax errors (@koraktor, #1661) - `bundle platform` command - add ruby to DSL, to specify version of ruby - error out if the ruby version doesn't match Performance: - bundle exec shouldn't run Bundler.setup just setting the right rubyopts options is enough (@spastorino, #1598) Bugfixes: - Avoid passing RUBYOPT changes in with_clean_env block (@eric1234, #1604) - Use the same ruby to run subprocesses as is running rake (@brixen) Documentation: - Add :github documentation in DSL (@zofrex, #1848, #1851, #1852) - Add docs for the --no-cache option (@fluxx, #1796) - Add basic documentation for bin_path and bundle_path (@radar) - Add documentation for the run method in Bundler::Installer ## 1.1.5 (Jul 17, 2012) Features: - Special case `ruby` directive from 1.2.0, so you can install Gemfiles that use it ## 1.1.4 (May 27, 2012) Bugfixes: - Use `latest_release` in Capistrano and Vlad integration (#1264) - Unknown exceptions now link to ISSUES for help instead of a new ticket - When OpenSSL is missing, provide instructions for fixing (#1776 etc.) - Correct inline help for `clean --force` (@dougbarth, #1911) - Work around a Ruby 1.9.3p194 bug in Psych when config files are empty ## 1.1.3 (March 23, 2012) Bugfixes: - escape the bundler root path (@tenderlove, #1789) ## 1.1.2 (March 20, 2012) Bugfixes: - Fix --deployment for multiple PATH sections of the same source (#1782) ## 1.1.1 (March 14, 2012) Bugfixes: - Rescue EAGAIN so the fetcher works on JRuby on Windows - Stop asking users to report gem installation errors - Clarify "no sources" message - Use $\ so `bundle gem` gemspecs work on Windows (@postmodern) - URI-encode gem names for dependency API (@rohit, #1672) - Fix `cache` edge case in rubygems 1.3.7 (#1202) Performance: - Reduce invocation of git ls-files in `bundle gem` gemspecs (@knu) ## 1.1.0 (Mar 7, 2012) Bugfixes: - Clean up corrupted lockfiles on bundle installs - Prevent duplicate GIT sources - Fix post_install_message when uing the endpoint API ## 1.1.rc.8 (Mar 3, 2012) Performance: - don't resolve if the Gemfile.lock and Gemfile haven't changed Bugfixes: - Load gemspecs from git even when a released gem has the same version (#1609) - Declare an accurate Ruby version requirement of 1.8.7 or newer (#1619) - handle gemspec development dependencies correctly (@raggi, #1639) - Avoid passing RUBYOPT changes in with_clean_env block. (eric1234, #1604) ## 1.1.rc.7 (Dec 29, 2011) Bugfixes: - Fix bug where `clean` would break when using :path with no gemspec ## 1.1.rc.6 (Dec 22, 2011) Bugfixes: - Fix performance regression from 1.0 (@spastorino, #1511, #1591, #1592) - Load gems correctly when GEM_HOME is blank - Refresh gems so Bundler works from inside a bundle - Handle empty .bundle/config files without an error ## 1.1.rc.5 (Dec 14, 2011) Bugfixes: - Fix ASCII encoding errors with gem (rerelease with ruby 1.8) ## 1.1.rc.4 (Dec 14, 2011) Features: - `bundle viz` has the option to output a DOT file instead of a PNG (@hirochachacha, #683) Bugfixes: - Ensure binstubs generated when using --standalone point to the standalonde bundle (@cowboyd, #1588) - fix `bundle viz` (@hirochachacha, #1586) ## 1.1.rc.3 (Dec 8, 2011) Bugfixes: - fix relative_path so it checks Bundler.root is actually in the beginning of the path (#1582) - fix bundle outdated doesn't list all gems (@joelmoss, #1521) ## 1.1.rc.2 (Dec 6, 2011) Features: - Added README.md to `newgem` (@ognevsky, #1574) - Added LICENSE (MIT) to newgem (@ognevsky, #1571) Bugfixes: - only auto-namespace requires for implied requires (#1531) - fix bundle clean output for git repos (#1473) - use Gem.bindir for bundle clean (#1544, #1532) - use `Gem.load_env_plugins` instead of `Gem.load_env_plugins` (#1500, #1543) - differentiate Ruby 2.0 (trunk) from Ruby 1.9 (@tenderlove, #1539) - `bundle clean` handles 7 length git hash for bundle clean (#1490, #1491) - fix Psych loading issues - Search $PATH for a binary rather than shelling out to `which` (@tenderlove, #1573) - do not clear RG cache unless we actually modify GEM_PATH and GEM_HOME- use `Gem.load_env_plugins` instead of `Gem.load_env_plugins` (#1500, #1543) - `newgem` now uses https://rubygems.org (#1562) - `bundle init` now uses https://rubygems.org (@jjb, #1522) - `bundle install/update` does not autoclean when using --path for semver Documentation: - added documentation for --shebang option for `bundle install` (@lunks, #1475, #1558) ## 1.1.rc (Oct 3, 2011) Features: - add `--shebang` option to bundle install (@bensie, #1467) - build passes on ruby 1.9.3rc1 (#1458, #1469) - hide basic auth credentials for custom sources (#1440, #1463) Bugfixes: - fix index search result caching (#1446, #1466) - fix fetcher prints multiple times during install (#1445, #1462) - don't mention API errors from non-rubygems.org sources - fix autoclean so it doesn't remove bins that are used (#1459, #1460) Documentation: - add :require => [...] to the gemfile(5) manpage (@nono, #1468) ## 1.1.pre.10 (Sep 27, 2011) Features: - `config system_bindir foo` added, works like "-n foo" in your .gemrc file ## 1.1.pre.9 (Sep 18, 2011) Features: - `clean` will now clean up all old .gem and .gemspec files, cleaning up older pres - `clean` will be automatically run after bundle install and update when using `--path` (#1420, #1425) - `clean` now takes a `--force` option (#1247, #1426) - `clean` will clean up cached git dirs in bundle clean (#1390) - remove deprecations from DSL (#1119) - autorequire tries directories for gems with dashed names (#1205) - adds a `--paths` flag to `bundle show` to list all the paths of bundled gems (@tiegz, #1360) - load rubygems plugins in the bundle binary (@tpope, #1364) - make `--standalone` respect `--path` (@cowboyd, #1361) Bugfixes: - Fix `clean` to handle nested gems in a git repo (#1329) - Fix conflict from revert of benchmark tool (@boffbowsh, #1355) - Fix fatal error when unable to connect to gem source (#1269) - Fix `outdated` to find pre-release gems that are installed. (#1359) - Fix color for ui. (#1374) - Fix installing to user-owned system gems on OS X - Fix caching issue in the resolver (#1353, #1421) - Fix :github DSL option ## 1.1.pre.8 (Aug 13, 2011) Bugfixes: - Fix `bundle check` to not print fatal error message (@cldwalker, #1347) - Fix require_sudo when Gem.bindir isn't writeable (#1352) - Fix not asking Gemcutter API for dependency chain of git gems in --deployment (#1254) - Fix `install --binstubs` when using --path (#1332) ## 1.1.pre.7 (Aug 8, 2011) Bugfixes: - Fixed invalid byte sequence error while installing gem on Ruby 1.9 (#1341) - Fixed exception when sudo was needed to install gems (@spastorino) ## 1.1.pre.6 (Aug 8, 2011) Bugfixes: - Fix cross repository dependencies (#1138) - Fix git dependency fetching from API endpoint (#1254) - Fixes for bundle outdated (@joelmoss, #1238) - Fix bundle standalone when using the endpoint (#1240) Features: - Implement `to_ary` to avoid calls to method_missing (@tenderlove, #1274) - bundle clean removes old .gem files (@cldwalker, #1293) - Correcly identify missing child dependency in error message - Run pre-install, post-build, and post-install gem hooks for git gems (@warhammerkid, #1120) - create Gemfile.lock for empty Gemfile (#1218) ## 1.1.pre.5 (June 11, 2011) Bugfixes: - Fix LazySpecification on Ruby 1.9 (@dpiddy, #1232) - Fix HTTP proxy support (@leobessa, #878) Features: - Speed up `install --deployment` by using the API endpoint - Support Basic HTTP Auth for the API endpoint (@dpiddy, #1229) - Add `install --full-index` to disable the API endpoint, just in case - Significantly speed up install by removing unneeded gemspec fetches - `outdated` command shows outdated gems (@joelmoss, #1130) - Print gem post install messages (@csquared, #1155) - Reduce memory use by removing Specification.new inside method_missing (@tenderlove, #1222) - Allow `check --path` ## 1.1.pre.4 (May 5, 2011) Bugfixes: - Fix bug that could prevent installing new gems ## 1.1.pre.3 (May 4, 2011) Features: - Add `bundle outdated` to show outdated gems (@joelmoss) - Remove BUNDLE_* from `Bundler.with_clean_env` (@wuputah) - Add Bundler.clean_system, and clean_exec (@wuputah) - Use git config for gem author name and email (@krekoten) Bugfixes: - Fix error calling Bundler.rubygems.gem_path - Fix error when Gem.path returns Gem::FS instead of String ## 1.1.pre.2 (April 28, 2011) Features: - Add :github option to Gemfile DSL for easy git repos - Merge all fixes from 1.0.12 and 1.0.13 ## 1.1.pre.1 (February 2, 2011) Bugfixes: - Compatibility with changes made by Rubygems 1.5 ## 1.1.pre (January 21, 2011) Features: - Add bundle clean. Removes unused gems from --path directory - Initial Gemcutter Endpoint API work, BAI Fetching source index - Added bundle install --standalone - Ignore Gemfile.lock when buliding new gems - Make it possible to override a .gemspec dependency's source in the Gemfile Removed: - Removed bundle lock - Removed bundle install - Removed bundle install --production - Removed bundle install --disable-shared-gems ## 1.0.21 (September 30, 2011) - No changes from RC ## 1.0.21.rc (September 29, 2011) Bugfixes: - Load Psych unless Syck is defined, because 1.9.2 defines YAML ## 1.0.20 (September 27, 2011) Features: - Add platform :maglev (@timfel, #1444) Bugfixes: - Ensure YAML is required even if Psych is found - Handle directory names that contain invalid regex characters ## 1.0.20.rc (September 18, 2011) Features: - Rescue interrupts to `bundle` while loading bundler.rb (#1395) - Allow clearing without groups by passing `--without ''` (#1259) Bugfixes: - Manually sort requirements in the lockfile (#1375) - Remove several warnings generated by ruby -w (@stephencelis) - Handle trailing slashes on names passed to `gem` (#1372) - Name modules for gems like 'test-foo_bar' correctly (#1303) - Don't require Psych if Syck is already loaded (#1239) ## 1.0.19.rc (September 13, 2011) Features: - Compatability with Rubygems 1.8.10 installer changes - Report gem installation failures clearly (@rwilcox, #1380) - Useful error for cap and vlad on first deploy (@nexmat, @kirs) Bugfixes: - `exec` now works when the command contains 'exec' - Only touch lock after changes on Windows (@robertwahler, #1358) - Keep load paths when #setup is called multiple times (@radsaq, #1379) ## 1.0.18 (August 16, 2011) Bugfixes: - Fix typo in DEBUG_RESOLVER (@geemus) - Fixes rake 0.9.x warning (@mtylty, #1333) - Fix `bundle cache` again for rubygems 1.3.x Features: - Run the bundle install earlier in a Capistrano deployment (@cgriego, #1300) - Support hidden gemspec (@trans, @cldwalker, #827) - Make fetch_specs faster (@zeha, #1294) - Allow overriding development deps loaded by #gemspec (@lgierth, #1245) ## 1.0.17 (August 8, 2011) Bugfixes: - Fix rake issues with rubygems 1.3.x (#1342) - Fixed invalid byte sequence error while installing gem on Ruby 1.9 (#1341) ## 1.0.16 (August 8, 2011) Features: - Performance fix for MRI 1.9 (@efficientcloud, #1288) - Shortcuts (like `bundle i`) for all commands (@amatsuda) - Correcly identify missing child dependency in error message Bugfixes: - Allow Windows network share paths with forward slashes (@mtscout6, #1253) - Check for rubygems.org credentials so `rake release` doesn't hang (#980) - Find cached prerelease gems on rubygems 1.3.x (@dburt, #1202) - Fix `bundle install --without` on kiji (@tmm1, #1287) - Get rid of warning in ruby 1.9.3 (@smartinez87, #1231) Documentation: - Documentation for `gem ..., :require => false` (@kmayer, #1292) - Gems provide "executables", they are rarely also binaries (@fxn, #1242) ## 1.0.15 (June 9, 2011) Features: - Improved Rubygems integration, removed many deprecation notices Bugfixes: - Escape URL arguments to git correctly on Windows (1.0.14 regression) ## 1.0.14 (May 27, 2011) Features: - Rubinius platform :rbx (@rkbodenner) - Include gem rake tasks with "require 'bundler/gem_tasks" (@indirect) - Include user name and email from git config in new gemspec (@ognevsky) Bugfixes: - Set file permissions after checking out git repos (@tissak) - Remove deprecated call to Gem::SourceIndex#all_gems (@mpj) - Require the version file in new gemspecs (@rubiii) - Allow relative paths from the Gemfile in gems with no gemspec (@mbirk) - Install gems that contain 'bundler', e.g. guard-bundler (@hone) - Display installed path correctly on Windows (@tadman) - Escape quotes in git URIs (@mheffner) - Improve Rake 0.9 support (@quix) - Handle certain directories already existing (@raggi) - Escape filenames containing regex characters (@indirect) ## 1.0.13 (May 4, 2011) Features: - Compatibility with Rubygems master (soon to be v1.8) (@evanphx) - Informative error when --path points to a broken symlink - Support Rake 0.9 and greater (@e2) - Output full errors for non-TTYs e.g. pow (@josh) Bugfixes: - Allow spaces in gem path names for gem tasks (@rslifka) - Have cap run bundle install from release_path (@martinjagusch) - Quote git refspec so zsh doesn't expand it (@goneflyin) ## 1.0.12 (April 8, 2011) Features: - Add --no-deployment option to `install` for disabling it on dev machines - Better error message when git fails and cache is present (@parndt) - Honor :bundle_cmd in cap `rake` command (@voidlock, @cgriego) Bugfixes: - Compatibility with Rubygems 1.7 and Rails 2.3 and vendored gems (@evanphx) - Fix changing gem order in lock (@gucki) - Remove color escape sequences when displaying man pages (@bgreenlee) - Fix creating GEM_HOME on both JRuby 1.5 and 1.6 (@nickseiger) - Fix gems without a gemspec and directories in bin/ (@epall) - Fix --no-prune option for `bundle install` (@cmeiklejohn) ## 1.0.11 (April 1, 2011) Features: - Compatibility with Rubygems 1.6 and 1.7 - Better error messages when a git command fails Bugfixes: - Don't always update gemspec gems (@carllerche) - Remove ivar warnings (@jackdempsey) - Fix occasional git failures in zsh (@jonah-carbonfive) - Consistent lock for gems with double deps like Cap (@akahn) ## 1.0.10 (February 1, 2011) Bugfixes: - Fix a regression loading YAML gemspecs from :git and :path gems - Requires, namespaces, etc. to work with changes in Rubygems 1.5 ## 1.0.9 (January 19, 2011) Bugfixes: - Fix a bug where Bundler.require could remove gems from the load path. In Rails apps with a default application.rb, this removed all gems in groups other than :default and Rails.env ## 1.0.8 (January 18, 2011) Features: - Allow overriding gemspec() deps with :git deps - Add --local option to `bundle update` - Ignore Gemfile.lock in newly generated gems - Use `less` as help pager instead of `more` - Run `bundle exec rake` instead of `rake` in Capistrano tasks Bugfixes: - Fix --no-cache option for `bundle install` - Allow Vlad deploys to work without Capistrano gem installed - Fix group arguments to `bundle console` - Allow groups to be loaded even if other groups were loaded - Evaluate gemspec() gemspecs in their directory not the cwd - Count on Rake to chdir to the right place in GemHelper - Change Pathnames to Strings for MacRuby - Check git process exit status correctly - Fix some warnings in 1.9.3-trunk (thanks tenderlove) ## 1.0.7 (November 17, 2010) Bugfixes: - Remove Bundler version from the lockfile because it broke backwards compatibility with 1.0.0-1.0.5. Sorry. :( ## 1.0.6 (November 16, 2010) Bugfixes: - Fix regression in `update` that caused long/wrong results - Allow git gems on other platforms while installing (#579) Features: - Speed up `install` command using various optimizations - Significantly increase performance of resolver - Use upcoming Rubygems performance improvements (@tmm1) - Warn if the lockfile was generated by a newer version - Set generated gems' homepage to "", so Rubygems will warn ## 1.0.5 (November 13, 2010) Bugfixes: - Fix regression disabling all operations that employ sudo ## 1.0.4 (November 12, 2010) Bugfixes: - Expand relative :paths from Bundler.root (eg ./foogem) - Allow git gems in --without groups while --frozen - Allow gem :ref to be a symbol as well as a string - Fix exception when Gemfile needs a newer Bundler version - Explanation when the current Bundler version conflicts - Explicit error message if Gemfile needs newer Bundler - Ignore an empty string BUNDLE_GEMFILE - Skeleton gemspec now works with older versions of git - Fix shell quoting and ref fetching in GemHelper - Disable colored output in --deployment - Preserve line endings in lock file Features: - Add support for 'mingw32' platform (aka RubyInstaller) - Large speed increase when Gemfile.lock is already present - Huge speed increase when many (100+) system gems are present - Significant expansion of ISSUES, man pages, and docs site - Remove Open3 from GemHelper (now it works on Windows™®©) - Allow setting roles in built-in cap and vlad tasks ## 1.0.3 (October 15, 2010) Bugfixes: - Use bitwise or in #hash to reduce the chance of overflow - `bundle update` now works with :git + :tag updates - Record relative :path options in the Gemfile.lock - :groups option on gem method in Gemfile now works - Add #platform method and :platform option to Gemfile DSL - --without now accepts a quoted, space-separated list - Installing after --deployment with no lock is now possible - Binstubs can now be symlinked - Print warning if cache for --local install is missing gems - Improve output when installing to a path - The tests all pass! Yay! ## 1.0.2 (October 2, 2010) Bugfix: - Actually include the man pages in the gem, so help works ## 1.0.1 (October 1, 2010) Features: - Vlad deployment recipe, `require 'bundler/vlad'` - Prettier bundle graphs - Improved gem skeleton for `bundle gem` - Prompt on file clashes when generating a gem - Option to generate binary with gem skeleton - Allow subclassing of GemHelper for custom tasks - Chdir to gem directory during `bundle open` Bugfixes: - Allow gemspec requirements with a list of versions - Accept lockfiles with windows line endings - Respect BUNDLE_WITHOUT env var - Allow `gem "foo", :platform => :jruby` - Specify loaded_from path in fake gemspec - Flesh out gem_helper tasks, raise errors correctly - Respect RBConfig::CONFIG['ruby_install_name'] in binstubs ## 1.0.0 (August 29, 2010) Features: - You can now define `:bundle_cmd` in the capistrano task Bugfixes: - Various bugfixes to the built-in rake helpers - Fix a bug where shortrefs weren't unique enough and were therfore colliding - Fix a small bug involving checking whether a local git clone is up to date - Correctly handle explicit '=' dependencies with gems pinned to a git source - Fix an issue with Windows-generated lockfiles by reading and writing the lockfile in binary mode - Fix an issue with shelling out to git in Windows by using double quotes around paths - Detect new Rubygems sources in the Gemfile and update the lockfile ## 1.0.0.rc.6 (August 23, 2010) Features: - Much better documentation for most of the commands and Gemfile format Bugfixes: - Don't attempt to create directories if they already exist - Fix the capistrano task so that it actually runs - Update the Gemfile template to reference rubygems.org instead of :gemcutter - bundle exec should exit with a non zero exit code when the gem binary does not exist or the file is not executable. - Expand paths in Gemfile relative to the Gemfile and not the current working directory. ## 1.0.0.rc.5 (August 10, 2010) Features: - Make the Capistrano task more concise. Bugfixes: - Fix a regression with determining whether or not to use sudo - Allow using the --gemfile flag with the --deployment flag ## 1.0.0.rc.4 (August 9, 2010) Features: - `bundle gem NAME` command to generate a new gem with Gemfile - Bundle config file location can be specified by BUNDLE_APP_CONFIG - Add --frozen to disable updating the Gemfile.lock at runtime (default with --deployment) - Basic Capistrano task now added as 'bundler/capistrano' Bugfixes: - Multiple bundler process no longer share a tmp directory - `bundle update GEM` always updates dependencies of GEM as well - Deleting the cache directory no longer causes errors - Moving the bundle after installation no longer causes git errors - Bundle path is now correctly remembered on a read-only filesystem - Gem binaries are installed to Gem.bindir, not #{Gem.dir}/bin - Fetch gems from vendor/cache, even without --local - Sort lockfile by platform as well as spec ## 1.0.0.rc.3 (August 3, 2010) Features: - Deprecate --production flag for --deployment, since the former was causing confusion with the :production group - Add --gemfile option to `bundle check` - Reduce memory usage of `bundle install` by 2-4x - Improve message from `bundle check` under various conditions - Better error when a changed Gemfile conflicts with Gemfile.lock Bugfixes: - Create bin/ directory if it is missing, then install binstubs - Error nicely on the edge case of a pinned gem with no spec - Do not require gems for other platforms - Update git sources along with the gems they contain ## 1.0.0.rc.2 (July 29, 2010) - `bundle install path` was causing confusion, so we now print a clarifying warning. The preferred way to install to a path (which will not print the warning) is `bundle install --path path/to/install`. - `bundle install --system` installs to the default system location ($BUNDLE_PATH or $GEM_HOME) even if you previously used `bundle install --path` - completely remove `--disable-shared-gems`. If you install to system, you will not be isolated, while if you install to another path, you will be isolated from gems installed to the system. This was mostly an internal option whose naming and semantics were extremely confusing. - Add a `--production` option to `bundle install`: - by default, installs to `vendor/bundle`. This can be overridden with the `--path` option - uses `--local` if `vendor/cache` is found. This will guarantee that Bundler does not attempt to connect to Rubygems and will use the gems cached in `vendor/cache` instead - Raises an exception if a Gemfile.lock is not found - Raises an exception if you modify your Gemfile in development but do not check in an updated Gemfile.lock - Fixes a bug where switching a source from Rubygems to git would always say "the git source is not checked out" when running `bundle install` NOTE: We received several reports of "the git source has not been checked out. Please run bundle install". As far as we can tell, these problems have two possible causes: 1. `bundle install ~/.bundle` in one user, but actually running the application as another user. Never install gems to a directory scoped to a user (`~` or `$HOME`) in deployment. 2. A bug that happened when changing a gem to a git source. To mitigate several common causes of `(1)`, please use the new `--production` flag. This flag is simply a roll-up of the best practices we have been encouraging people to use for deployment. If you want to share gems across deployments, and you use Capistrano, symlink release_path/current/vendor/bundle to release_path/shared/bundle. This will keep deployments snappy while maintaining the benefits of clean, deploy-time isolation. ## 1.0.0.rc.1 (July 26, 2010) - Fixed a bug with `bundle install` on multiple machines and git ## 1.0.0.beta.10 (July 25, 2010) - Last release before 1.0.0.rc.1 - Added :mri as a valid platform (platforms :mri { gem "ruby-debug" }) - Fix `bundle install` immediately after modifying the :submodule option - Don't write to Gemfile.lock if nothing has changed, fixing situations where bundle install was run with a different user than the app itself - Fix a bug where other platforms were being wiped on `bundle update` - Don't ask for root password on `bundle install` if not needed - Avoid setting `$GEM_HOME` where not needed - First solid pass of `bundle config` - Add build options - `bundle config build.mysql --with-mysql-config=/path/to/config` ## 1.0.0.beta.9 (July 21, 2010) - Fix install failure when switching from a path to git source - Fix `bundle exec bundle *` in a bundle with --disable-shared-gems - Fix `bundle *` from inside a bundle with --disable-shared-gem - Shim Gem.refresh. This is used by Unicorn - Fix install failure when a path's dependencies changed ## 1.0.0.beta.8 (July 20, 2010) - Fix a Beta 7 bug involving Ruby 1.9 ## 1.0.0.beta.7 (July 20, 2010, yanked) - Running `bundle install` twice in a row with a git source always crashed ## 1.0.0.beta.6 (July 20, 2010, yanked) - Create executables with bundle install --binstubs - You can customize the location (default is app/bin) with --binstubs other/location - Fix a bug where the Gemfile.lock would be deleted even if the update was exited - Fix a bug where cached gems for other platforms were sometimes deleted - Clean up output when nothing was deleted from cache (it previously said "Removing outdated gems ...") - Improve performance of bundle install if the git gem was already checked out, and the revision being used already exists locally - Fix bundle show bundler in some cases - Fix bugs with bundle update - Don't ever run git commands at runtime (fixes a number of common passenger issues) - Fixes an obscure bug where switching the source of a gem could fail to correctly change the source of its dependencies - Support multiple version dependencies in the Gemfile (gem "rails", ">= 3.0.0.beta1", "<= 3.0.0") - Raise an exception for ambiguous uses of multiple declarations of the same gem (for instance, with different versions or sources). - Fix cases where the same dependency appeared several times in the Gemfile.lock - Fix a bug where require errors were being swallowed during Bundler.require ## 1.0.0.beta.1 - No `bundle lock` command. Locking happens automatically on install or update - No .bundle/environment.rb. Require 'bundler/setup' instead. - $BUNDLE_HOME defaults to $GEM_HOME instead of ~/.bundle - Remove lockfiles generated by 0.9 ## 0.9.26 Features: - error nicely on incompatible 0.10 lockfiles ## 0.9.25 (May 3, 2010) Bugfixes: - explicitly coerce Pathname objects to Strings for Ruby 1.9 - fix some newline weirdness in output from install command ## 0.9.24 (April 22, 2010) Features: - fetch submodules for git sources - limit the bundled version of bundler to the same as the one installing - force relative paths in git gemspecs to avoid raising Gem::NameTooLong - serialize GemCache sources correctly, so locking works - raise Bundler::GemNotFound instead of calling exit! inside library code - Rubygems 1.3.5 compatibility for the adventurous, not supported by me :) Bugfixes: - don't try to regenerate environment.rb if it is read-only - prune outdated gems with the platform "ruby" - prune cache without errors when there are directories or non-gem files - don't re-write environment.rb if running after it has been loaded - do not monkeypatch Specification#load_paths twice when inside a bundle ## 0.9.23 (April 20, 2010) Bugfixes: - cache command no longer prunes gems created by an older rubygems version - cache command no longer prunes gems that are for other platforms ## 0.9.22 (April 20, 2010) Features: - cache command now prunes stale .gem files from vendor/cache - init --gemspec command now generates development dependencies - handle Polyglot's changes to Kernel#require with Bundler::ENV_LOADED (#287) - remove .gem files generated after installing a gem from a :path (#286) - improve install/lock messaging (#284) Bugfixes: - ignore cached gems that are for another platform (#288) - install Windows gems that have no architecture set, like rcov (#277) - exec command while locked now includes the bundler lib in $LOAD_PATH (#293) - fix the `rake install` task - add GemspecError so it can be raised without (further) error (#292) - create a parent directory before cloning for git 1.5 compatibility (#285) ## 0.9.21 (April 16, 2010) Bugfixes: - don't raise 'omg wtf' when lockfile is outdated ## 0.9.20 (April 15, 2010) Features: - load YAML format gemspecs - no backtraces when calling Bundler.setup if gems are missing - no backtraces when trying to exec a file without the executable bit Bugfixes: - fix infinite recursion in Bundler.setup after loading a bundled Bundler gem - request install instead of lock when env.rb is out of sync with Gemfile.lock ## 0.9.19 (April 12, 2010) Features: - suggest `bundle install --relock` when the Gemfile has changed (#272) - source support for Rubygems servers without prerelease gem indexes (#262) Bugfixes: - don't set up all groups every time Bundler.setup is called while locked (#263) - fix #full_gem_path for git gems while locked (#268) - eval gemspecs at the top level, not inside the Bundler class (#269) ## 0.9.18 (April 8, 2010) Features: - console command that runs irb with bundle (and optional group) already loaded Bugfixes: - Bundler.setup now fully disables system gems, even when unlocked (#266, #246) - fixes Yard, which found plugins in Gem.source_index that it could not load - makes behaviour of `Bundler.require` consistent between locked and unlocked loads ## 0.9.17 (April 7, 2010) Features: - Bundler.require now calls Bundler.setup automatically - Gem::Specification#add_bundler_dependencies added for gemspecs Bugfixes: - Gem paths are not longer duplicated while loading bundler - exec no longer duplicates RUBYOPT if it is already set correctly ## 0.9.16 (April 3, 2010) Features: - exit gracefully on INT signal - resolver output now indicates whether remote sources were checked - print error instead of backtrace when exec cannot find a binary (#241) Bugfixes: - show, check, and open commands work again while locked (oops) - show command for git gems - outputs branch names other than master - gets the correct sha from the checkout - doesn't print sha twice if :ref is set - report errors from bundler/setup.rb without backtraces (#243) - fix Gem::Spec#git_version to not error on unloaded specs - improve deprecation, Gemfile, and command error messages (#242) ## 0.9.15 (April 1, 2010) Features: - use the env_file if possible instead of doing a runtime resolve - huge speedup when calling Bundler.setup while locked - ensures bundle exec is fast while locked - regenerates env_file if it was generated by an older version - update cached/packed gems when you update gems via bundle install Bugfixes: - prep for Rubygems 1.3.7 changes - install command now pulls git branches correctly (#211) - raise errors on invalid options in the Gemfile ## 0.9.14 (March 30, 2010) Features: - install command output vastly improved - installation message now accurate, with 'using' and 'installing' - bundler gems no longer listed as 'system gems' - show command output now includes sha and branch name for git gems - init command now takes --gemspec option for bootstrapping gem Gemfiles - Bundler.with_clean_env for shelling out to ruby scripts - show command now aliased as 'list' - VISUAL env var respected for GUI editors Bugfixes: - exec command now finds binaries from gems with no gemspec - note source of Gemfile resolver errors - don't blow up if git urls are changed ## 0.9.13 (March 23, 2010) Bugfixes: - exec command now finds binaries from gems installed via :path - gem dependencies are pulled in even if their type is nil - paths with spaces have double-quotes to work on Windows - set GEM_PATH in environment.rb so generators work with Rails 2 ## 0.9.12 (March 17, 2010) - refactoring, internal cleanup, more solid specs Features: - check command takes a --without option - check command exits 1 if the check fails Bugfixes: - perform a topological sort on resolved gems (#191) - gems from git work even when paths or repos have spaces (#196) - Specification#loaded_from returns a String, like Gem::Specification (#197) - specs eval from inside the gem directory, even when locked - virtual gemspecs are now saved in environment.rb for use when loading - unify the Installer's local index and the runtime index (#204) ## 0.9.11 (March 9, 2010) - added roadmap with future development plans Features: - install command can take the path to the gemfile with --gemfile (#125) - unknown command line options are now rejected (#163) - exec command hugely sped up while locked (#177) - show command prints the install path if you pass it a gem name (#148) - open command edits an installed gem with $EDITOR (#148) - Gemfile allows assigning an array of groups to a gem (#114) - Gemfile allows :tag option on :git sources - improve backtraces when a gemspec is invalid - improve performance by installing gems from the cache if present Bugfixes: - normalize parameters to Bundler.require (#153) - check now checks installed gems rather than cached gems (#162) - don't update the gem index when installing after locking (#169) - bundle parenthesises arguments for 1.8.6 (#179) - gems can now be assigned to multiple groups without problems (#135) - fix the warning when building extensions for a gem from git with Rubygems 1.3.6 - fix a Dependency.to_yaml error due to accidentally including sources and groups - don't reinstall packed gems - fix gems with git sources that are private repositories ## 0.9.10 (March 1, 2010) - depends on Rubygems 1.3.6 Bugfixes: - support locking after install --without - don't reinstall gems from the cache if they're already in the bundle - fixes for Ruby 1.8.7 and 1.9 ## 0.9.9 (February 25, 2010) Bugfixes: - don't die if GEM_HOME is an empty string - fixes for Ruby 1.8.6 and 1.9 ## 0.9.8 (February 23, 2010) Features: - pack command which both caches and locks - descriptive error if a cached gem is missing - remember the --without option after installing - expand paths given in the Gemfile via the :path option - add block syntax to the git and group options in the Gemfile - support gems with extensions that don't admit they depend on rake - generate gems using gem build gemspec so git gems can have native extensions - print a useful warning if building a gem fails - allow manual configuration via BUNDLE_PATH Bugfixes: - eval gemspecs in the gem directory so relative paths work - make default spec for git sources valid - don't reinstall gems that are already packed ## 0.9.7 (February 17, 2010) Bugfixes: - don't say that a gem from an excluded group is "installing" - improve crippling rubygems in locked scenarios ## 0.9.6 (February 16, 2010) Features: - allow String group names - a number of improvements in the documentation and error messages Bugfixes: - set SourceIndex#spec_dirs to solve a problem involving Rails 2.3 in unlocked mode - ensure Rubygems is fully loaded in Ruby 1.9 before patching it - fix `bundle install` for a locked app without a .bundle directory - require gems in the order that the resolver determines - make the tests platform agnostic so we can confirm that they're green on JRuby - fixes for Ruby 1.9 ## 0.9.5 (Feburary 12, 2010) Features: - added support for :path => "relative/path" - added support for older versions of git - added `bundle install --disable-shared-gems` - Bundler.require fails silently if a library does not have a file on the load path with its name - Basic support for multiple rubies by namespacing the default bundle path using the version and engine Bugfixes: - if the bundle is locked and .bundle/environment.rb is not present when Bundler.setup is called, generate it - same if it's not present with `bundle check` - same if it's not present with `bundle install` bundler-1.11.2/README.md0000644000004100000410000000452512652443364014555 0ustar www-datawww-data[![Version ](https://img.shields.io/gem/v/bundler.svg?style=flat)](https://rubygems.org/gems/bundler) [![Build Status](https://img.shields.io/travis/bundler/bundler/master.svg?style=flat)](https://travis-ci.org/bundler/bundler) [![Code Climate](https://img.shields.io/codeclimate/github/bundler/bundler.svg?style=flat)](https://codeclimate.com/github/bundler/bundler) [![Inline docs ](http://inch-ci.org/github/bundler/bundler.svg?style=flat)](http://inch-ci.org/github/bundler/bundler) # Bundler: a gem to bundle gems Bundler makes sure Ruby applications run the same code on every machine. It does this by managing the gems that the application depends on. Given a list of gems, it can automatically download and install those gems, as well as any other gems needed by the gems that are listed. Before installing gems, it checks the versions of every gem to make sure that they are compatible, and can all be loaded at the same time. After the gems have been installed, Bundler can help you update some or all of them when new versions become available. Finally, it records the exact versions that have been installed, so that others can install the exact same gems. ### Installation and usage ``` gem install bundler bundle init echo 'gem "rspec"' >> Gemfile bundle install bundle exec rspec ``` See [bundler.io](http://bundler.io) for the full documentation. ### Troubleshooting For help with common problems, see [ISSUES](https://github.com/bundler/bundler/blob/master/ISSUES.md). ### Other questions To see what has changed in recent versions of Bundler, see the [CHANGELOG](https://github.com/bundler/bundler/blob/master/CHANGELOG.md). Feel free to chat with the Bundler core team (and many other users) on IRC in the [#bundler](irc://irc.freenode.net/bundler) channel on Freenode, or via email on the [Bundler mailing list](http://groups.google.com/group/ruby-bundler). ### Contributing If you'd like to contribute to Bundler, that's awesome, and we <3 you. There's a guide to contributing to Bundler (both code and general help) over in [DEVELOPMENT](https://github.com/bundler/bundler/blob/master/DEVELOPMENT.md). ### Code of Conduct Everyone interacting in the Bundler project’s codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [Bundler code of conduct](https://github.com/bundler/bundler/blob/master/CODE_OF_CONDUCT.md).