diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index bd2a14341e8b78..e357e3ad2ee163 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -12,6 +12,7 @@ jobs: strategy: matrix: test_task: [ "check", "test-bundler", "test-bundled-gems" ] + fail-fast: false steps: - name: Disable Firewall run: | diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 118fe5108e0b5b..fe4eb6143cda5e 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -12,6 +12,7 @@ jobs: strategy: matrix: test_task: [ "test-bundler", "test-bundled-gems" ] + fail-fast: false steps: - name: Install libraries run: | diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 45f97284e9586d..984ac7011a7baf 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -18,6 +18,7 @@ jobs: vs: 2019 - os: windows-2019 vs: 2017 + fail-fast: false runs-on: ${{ matrix.os }} steps: - name: Install libraries with vcpkg diff --git a/defs/gmake.mk b/defs/gmake.mk index baea0dc02f74a3..c76c2549ca5e08 100644 --- a/defs/gmake.mk +++ b/defs/gmake.mk @@ -196,13 +196,13 @@ update-github: fetch-github curl -s $(if $(GITHUB_TOKEN),-H "Authorization: bearer $(GITHUB_TOKEN)") $(PULL_REQUEST_API) | \ $(BASERUBY) -rjson -e 'JSON.parse(STDIN.read)["head"].tap { |h| print "#{h["repo"]["full_name"]} #{h["ref"]}" }' \ )) - $(eval FORK_REPO := $(shell echo $(PULL_REQUEST_FORK_BRANCH) | cut -d' ' -f1)) - $(eval PR_BRANCH := $(shell echo $(PULL_REQUEST_FORK_BRANCH) | cut -d' ' -f2)) + $(eval FORK_REPO := $(word 1,$(PULL_REQUEST_FORK_BRANCH))) + $(eval PR_BRANCH := $(word 2,$(PULL_REQUEST_FORK_BRANCH))) $(eval GITHUB_UPDATE_WORKTREE := $(shell mktemp -d "$(srcdir)/gh-$(PR)-XXXXXX")) git -C "$(srcdir)" worktree add $(notdir $(GITHUB_UPDATE_WORKTREE)) "gh-$(PR)" git -C "$(GITHUB_UPDATE_WORKTREE)" merge master --no-edit - @$(BASERUBY) -e 'print "Are you sure to push this to PR=$(PR)? [Y/n]: "; exit(gets.chomp == "n" ? 1 : 0)' + @$(BASERUBY) -e 'print "Are you sure to push this to PR=$(PR)? [Y/n]: "; exit(gets.chomp != "n")' git -C "$(srcdir)" remote add fork-$(PR) git@github.com:$(FORK_REPO).git git -C "$(GITHUB_UPDATE_WORKTREE)" push fork-$(PR) gh-$(PR):$(PR_BRANCH) git -C "$(srcdir)" remote rm fork-$(PR) diff --git a/enum.c b/enum.c index e090a27c8e119b..ba47d348a4b7bf 100644 --- a/enum.c +++ b/enum.c @@ -4017,7 +4017,7 @@ int_range_sum(VALUE beg, VALUE end, int excl, VALUE init) * { 1 => 10, 2 => 20 }.sum {|k, v| k * v } #=> 50 * (1..10).sum #=> 55 * (1..10).sum {|v| v * 2 } #=> 110 - * [Object.new].each.sum #=> TypeError + * ('a'..'z').sum #=> TypeError * * This method can be used for non-numeric objects by * explicit init argument. diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c index 1054d0440d4da1..b59cc4900574ca 100644 --- a/ext/socket/raddrinfo.c +++ b/ext/socket/raddrinfo.c @@ -597,16 +597,21 @@ rsock_ipaddr(struct sockaddr *sockaddr, socklen_t sockaddrlen, int norevlookup) } #ifdef HAVE_SYS_UN_H -VALUE -rsock_unixpath_str(struct sockaddr_un *sockaddr, socklen_t len) +static long +unixsocket_len(const struct sockaddr_un *su, socklen_t socklen) { - char *s, *e; - s = sockaddr->sun_path; - e = (char *)sockaddr + len; + const char *s = su->sun_path, *e = (const char*)su + socklen; while (s < e && *(e-1) == '\0') e--; - if (s <= e) - return rb_str_new(s, e-s); + return e - s; +} + +VALUE +rsock_unixpath_str(struct sockaddr_un *sockaddr, socklen_t len) +{ + long n = unixsocket_len(sockaddr, len); + if (n >= 0) + return rb_str_new(sockaddr->sun_path, n); else return rb_str_new2(""); } @@ -985,6 +990,12 @@ init_unix_addrinfo(rb_addrinfo_t *rai, VALUE path, int socktype) init_addrinfo(rai, (struct sockaddr *)&un, len, PF_UNIX, socktype, 0, Qnil, Qnil); } + +static long +rai_unixsocket_len(const rb_addrinfo_t *rai) +{ + return unixsocket_len(&rai->addr.un, rai->sockaddr_len); +} #endif /* @@ -1232,16 +1243,15 @@ rsock_inspect_sockaddr(struct sockaddr *sockaddr_arg, socklen_t socklen, VALUE r { struct sockaddr_un *addr = &sockaddr->un; char *p, *s, *e; + long len = unixsocket_len(addr, socklen); s = addr->sun_path; - e = (char*)addr + socklen; - while (s < e && *(e-1) == '\0') - e--; - if (e < s) + if (len < 0) rb_str_cat2(ret, "too-short-AF_UNIX-sockaddr"); - else if (s == e) + else if (len == 0) rb_str_cat2(ret, "empty-path-AF_UNIX-sockaddr"); else { int printable_only = 1; + e = s + len; p = s; while (p < e) { printable_only = printable_only && ISPRINT(*p) && !ISSPACE(*p); @@ -1567,13 +1577,7 @@ addrinfo_mdump(VALUE self) #ifdef HAVE_SYS_UN_H case AF_UNIX: { - struct sockaddr_un *su = &rai->addr.un; - char *s, *e; - s = su->sun_path; - e = (char*)su + rai->sockaddr_len; - while (s < e && *(e-1) == '\0') - e--; - sockaddr = rb_str_new(s, e-s); + sockaddr = rb_str_new(rai->addr.un.sun_path, rai_unixsocket_len(rai)); break; } #endif @@ -2307,25 +2311,22 @@ addrinfo_unix_path(VALUE self) rb_addrinfo_t *rai = get_addrinfo(self); int family = ai_get_afamily(rai); struct sockaddr_un *addr; - char *s, *e; + long n; if (family != AF_UNIX) rb_raise(rb_eSocket, "need AF_UNIX address"); addr = &rai->addr.un; - s = addr->sun_path; - e = (char*)addr + rai->sockaddr_len; - if (e < s) + n = rai_unixsocket_len(rai); + if (n < 0) rb_raise(rb_eSocket, "too short AF_UNIX address: %"PRIuSIZE" bytes given for minimum %"PRIuSIZE" bytes.", - (size_t)rai->sockaddr_len, (size_t)(s - (char *)addr)); - if (addr->sun_path + sizeof(addr->sun_path) < e) + (size_t)rai->sockaddr_len, offsetof(struct sockaddr_un, sun_path)); + if ((long)sizeof(addr->sun_path) < n) rb_raise(rb_eSocket, "too long AF_UNIX path (%"PRIuSIZE" bytes given but %"PRIuSIZE" bytes max)", - (size_t)(e - addr->sun_path), sizeof(addr->sun_path)); - while (s < e && *(e-1) == '\0') - e--; - return rb_str_new(s, e-s); + (size_t)n, sizeof(addr->sun_path)); + return rb_str_new(addr->sun_path, n); } #endif diff --git a/lib/bundler/bundler.gemspec b/lib/bundler/bundler.gemspec index 5ffd717ea67fcb..50be960cab3b04 100644 --- a/lib/bundler/bundler.gemspec +++ b/lib/bundler/bundler.gemspec @@ -34,11 +34,8 @@ Gem::Specification.new do |s| s.required_ruby_version = ">= 2.3.0" s.required_rubygems_version = ">= 2.5.2" - # s.files = Dir.glob("{lib,exe}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) } + # s.files = Dir.glob("{lib,man,exe}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) } - # 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("man/**/*") # Include the CHANGELOG.md, LICENSE.md, README.md manually # s.files += %w[CHANGELOG.md LICENSE.md README.md] # include the gemspec itself because warbler breaks w/o it diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 2f35b83c3628e1..8b055dc902abc8 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -538,6 +538,7 @@ def viz :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 :git, :type => :boolean, :default => true, :desc => "Initialize a git repo inside your library." method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config set 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 set gem.test rspec`." diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index 3db1ec7843a679..5ae9ca4af84bf1 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -148,7 +148,7 @@ def run end end - if Bundler.git_present? + if Bundler.git_present? && options[:git] Bundler.ui.info "Initializing git repo in #{target}" Dir.chdir(target) do `git init` diff --git a/lib/bundler/plugin/api/source.rb b/lib/bundler/plugin/api/source.rb index b33926a1816d55..3a2ca2f04de56e 100644 --- a/lib/bundler/plugin/api/source.rb +++ b/lib/bundler/plugin/api/source.rb @@ -196,7 +196,7 @@ def cache(spec, custom_path = nil) # This shall check if two source object represent the same source. # # The comparison shall take place only on the attribute that can be - # inferred from the options passed from Gemfile and not on attibutes + # inferred from the options passed from Gemfile and not on attributes # that are used to pin down the gem to specific version (e.g. Git # sources should compare on branch and tag but not on commit hash) # diff --git a/lib/bundler/ruby_version.rb b/lib/bundler/ruby_version.rb index b981cba21d62c6..7e403ce6fc3270 100644 --- a/lib/bundler/ruby_version.rb +++ b/lib/bundler/ruby_version.rb @@ -103,18 +103,8 @@ def versions_string(versions) def self.system ruby_engine = RUBY_ENGINE.dup - # :sob: mocking RUBY_VERSION breaks stuff on 1.8.7 ruby_version = ENV.fetch("BUNDLER_SPEC_RUBY_VERSION") { RUBY_VERSION }.dup - ruby_engine_version = case ruby_engine - when "ruby" - ruby_version - when "rbx" - Rubinius::VERSION.dup - when "jruby" - JRUBY_VERSION.dup - else - RUBY_ENGINE_VERSION.dup - end + ruby_engine_version = RUBY_ENGINE_VERSION.dup patchlevel = RUBY_PATCHLEVEL.to_s @ruby_version ||= RubyVersion.new(ruby_version, patchlevel, ruby_engine, ruby_engine_version) diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index b7e2af29c4924e..af1836009f4677 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -133,8 +133,9 @@ def major_deprecation(major_version, message) return unless bundler_major_version >= major_version && prints_major_deprecations? @major_deprecation_ui ||= Bundler::UI::Shell.new("no-color" => true) - ui = Bundler.ui.is_a?(@major_deprecation_ui.class) ? Bundler.ui : @major_deprecation_ui - ui.warn("[DEPRECATED] #{message}") + with_major_deprecation_ui do |ui| + ui.warn("[DEPRECATED] #{message}") + end end def print_major_deprecations! @@ -211,6 +212,21 @@ def write_to_gemfile(gemfile_path, contents) private + def with_major_deprecation_ui(&block) + ui = Bundler.ui + + if ui.is_a?(@major_deprecation_ui.class) + yield ui + else + begin + Bundler.ui = @major_deprecation_ui + yield Bundler.ui + ensure + Bundler.ui = ui + end + end + end + def validate_bundle_path path_separator = Bundler.rubygems.path_separator return unless Bundler.bundle_path.to_s.split(path_separator).size > 1 diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb index c1d25fc4dadafe..f98f5155fb500a 100644 --- a/lib/bundler/source/path.rb +++ b/lib/bundler/source/path.rb @@ -20,11 +20,16 @@ def initialize(options) @allow_cached = false @allow_remote = false - @root_path = options["root_path"] || Bundler.root + @root_path = options["root_path"] || root if options["path"] @path = Pathname.new(options["path"]) - @path = expand(@path) unless @path.relative? + expanded_path = expand(@path) + @path = if @path.relative? + expanded_path.relative_path_from(root_path.expand_path) + else + expanded_path + end end @name = options["name"] @@ -136,7 +141,7 @@ def expand(somepath) def lockfile_path return relative_path(original_path) if original_path.absolute? - expand(original_path).relative_path_from(Bundler.root) + expand(original_path).relative_path_from(root) end def app_cache_path(custom_path = nil) diff --git a/lib/irb.rb b/lib/irb.rb index a08aa874c99fb4..a41d4e13be50de 100644 --- a/lib/irb.rb +++ b/lib/irb.rb @@ -10,6 +10,7 @@ # # require "e2mmap" +require "ripper" require "irb/init" require "irb/context" @@ -410,6 +411,35 @@ def IRB.irb_abort(irb, exception = Abort) end class Irb + ASSIGNMENT_NODE_TYPES = [ + # Local, instance, global, class, constant, instance, and index assignment: + # "foo = bar", + # "@foo = bar", + # "$foo = bar", + # "@@foo = bar", + # "::Foo = bar", + # "a::Foo = bar", + # "Foo = bar" + # "foo.bar = 1" + # "foo[1] = bar" + :assign, + + # Operation assignment: + # "foo += bar" + # "foo -= bar" + # "foo ||= bar" + # "foo &&= bar" + :opassign, + + # Multiple assignment: + # "foo, bar = 1, 2 + :massign, + ] + # Note: instance and index assignment expressions could also be written like: + # "foo.bar=(1)" and "foo.[]=(1, bar)", when expressed that way, the former + # be parsed as :assign and echo will be suppressed, but the latter is + # parsed as a :method_add_arg and the output won't be suppressed + # Creates a new irb session def initialize(workspace = nil, input_method = nil, output_method = nil) @context = Context.new(self, workspace, input_method, output_method) @@ -498,7 +528,7 @@ def eval_input begin line.untaint @context.evaluate(line, line_no, exception: exc) - output_value if @context.echo? + output_value if @context.echo? && (@context.echo_on_assignment? || !assignment_expression?(line)) rescue Interrupt => exc rescue SystemExit, SignalException raise @@ -717,6 +747,18 @@ def inspect format("#<%s: %s>", self.class, ary.join(", ")) end + def assignment_expression?(line) + # Try to parse the line and check if the last of possibly multiple + # expressions is an assignment type. + + # If the expression is invalid, Ripper.sexp should return nil which will + # result in false being returned. Any valid expression should return an + # s-expression where the second selement of the top level array is an + # array of parsed expressions. The first element of each expression is the + # expression's type. + ASSIGNMENT_NODE_TYPES.include?(Ripper.sexp(line)&.dig(1,-1,0)) + end + ATTR_TTY = "\e[%sm" def ATTR_TTY.[](*a) self % a.join(";"); end ATTR_PLAIN = "" diff --git a/lib/irb/context.rb b/lib/irb/context.rb index 9544a8aa1aac12..5d2336008fb24c 100644 --- a/lib/irb/context.rb +++ b/lib/irb/context.rb @@ -121,6 +121,11 @@ def initialize(irb, workspace = nil, input_method = nil, output_method = nil) if @echo.nil? @echo = true end + + @echo_on_assignment = IRB.conf[:ECHO_ON_ASSIGNMENT] + if @echo_on_assignment.nil? + @echo_on_assignment = false + end end # The top-level workspace, see WorkSpace#main @@ -236,6 +241,15 @@ def main # puts "omg" # # omg attr_accessor :echo + # Whether to echo for assignment expressions + # + # Uses IRB.conf[:ECHO_ON_ASSIGNMENT] if available, or defaults to +false+. + # + # a = "omg" + # IRB.CurrentContext.echo_on_assignment = true + # a = "omg" + # #=> omg + attr_accessor :echo_on_assignment # Whether verbose messages are displayed or not. # # A copy of the default IRB.conf[:VERBOSE] @@ -261,6 +275,7 @@ def main alias ignore_sigint? ignore_sigint alias ignore_eof? ignore_eof alias echo? echo + alias echo_on_assignment? echo_on_assignment # Returns whether messages are displayed or not. def verbose? diff --git a/lib/irb/init.rb b/lib/irb/init.rb index d7ee885665440c..5dd0c12c321a00 100644 --- a/lib/irb/init.rb +++ b/lib/irb/init.rb @@ -51,6 +51,7 @@ def IRB.init_config(ap_path) @CONF[:IGNORE_SIGINT] = true @CONF[:IGNORE_EOF] = false @CONF[:ECHO] = nil + @CONF[:ECHO_ON_ASSIGNMENT] = nil @CONF[:VERBOSE] = nil @CONF[:EVAL_HISTORY] = nil @@ -172,6 +173,10 @@ def IRB.parse_opts(argv: ::ARGV) @CONF[:ECHO] = true when "--noecho" @CONF[:ECHO] = false + when "--echo-on-assignment" + @CONF[:ECHO_ON_ASSIGNMENT] = true + when "--noecho-on-assignment" + @CONF[:ECHO_ON_ASSIGNMENT] = false when "--verbose" @CONF[:VERBOSE] = true when "--noverbose" diff --git a/lib/rdoc/markup/formatter_test_case.rb b/lib/rdoc/markup/formatter_test_case.rb index 076b7c81bb7b79..9f49dd0897c277 100644 --- a/lib/rdoc/markup/formatter_test_case.rb +++ b/lib/rdoc/markup/formatter_test_case.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest/unit' +require 'test/unit' ## # Test case for creating new RDoc::Markup formatters. See diff --git a/lib/rdoc/markup/parser.rb b/lib/rdoc/markup/parser.rb index 14f1f6c7198e91..600eb841ac3e5a 100644 --- a/lib/rdoc/markup/parser.rb +++ b/lib/rdoc/markup/parser.rb @@ -80,10 +80,6 @@ def initialize @binary_input = nil @current_token = nil @debug = false - @input = nil - @input_encoding = nil - @line = 0 - @line_pos = 0 @s = nil @tokens = [] end @@ -319,13 +315,6 @@ def build_verbatim margin verbatim end - ## - # The character offset for the input string at the given +byte_offset+ - - def char_pos byte_offset - @input.byteslice(0, byte_offset).length - end - ## # Pulls the next token from the stream. @@ -424,15 +413,54 @@ def peek_token token end + ## + # A simple wrapper of StringScanner that is aware of the current column and lineno + + class MyStringScanner + def initialize(input) + @line = @column = 0 + @s = StringScanner.new input + end + + def scan(re) + prev_pos = @s.pos + ret = @s.scan(re) + @column += ret.length if ret + ret + end + + def unscan(s) + @s.pos -= s.bytesize + @column -= s.length + end + + def pos + [@column, @line] + end + + def newline! + @column = 0 + @line += 1 + end + + def eos? + @s.eos? + end + + def matched + @s.matched + end + + def [](i) + @s[i] + end + end + ## # Creates the StringScanner def setup_scanner input - @line = 0 - @line_pos = 0 - @input = input.dup - - @s = StringScanner.new input + @s = MyStringScanner.new input end ## @@ -467,31 +495,30 @@ def tokenize input @tokens << case # [CR]LF => :NEWLINE when @s.scan(/\r?\n/) then - token = [:NEWLINE, @s.matched, *token_pos(pos)] - @line_pos = char_pos @s.pos - @line += 1 + token = [:NEWLINE, @s.matched, *pos] + @s.newline! token # === text => :HEADER then :TEXT when @s.scan(/(=+)(\s*)/) then level = @s[1].length - header = [:HEADER, level, *token_pos(pos)] + header = [:HEADER, level, *pos] if @s[2] =~ /^\r?\n/ then - @s.pos -= @s[2].length + @s.unscan(@s[2]) header else pos = @s.pos @s.scan(/.*/) @tokens << header - [:TEXT, @s.matched.sub(/\r$/, ''), *token_pos(pos)] + [:TEXT, @s.matched.sub(/\r$/, ''), *pos] end # --- (at least 3) and nothing else on the line => :RULE when @s.scan(/(-{3,}) *\r?$/) then - [:RULE, @s[1].length - 2, *token_pos(pos)] + [:RULE, @s[1].length - 2, *pos] # * or - followed by white space and text => :BULLET when @s.scan(/([*-]) +(\S)/) then - @s.pos -= @s[2].bytesize # unget \S - [:BULLET, @s[1], *token_pos(pos)] + @s.unscan(@s[2]) + [:BULLET, @s[1], *pos] # A. text, a. text, 12. text => :UALPHA, :LALPHA, :NUMBER when @s.scan(/([a-z]|\d+)\. +(\S)/i) then # FIXME if tab(s), the column will be wrong @@ -500,7 +527,7 @@ def tokenize input # before (and provide a check for that at least in debug # mode) list_label = @s[1] - @s.pos -= @s[2].bytesize # unget \S + @s.unscan(@s[2]) list_type = case list_label when /[a-z]/ then :LALPHA @@ -509,24 +536,24 @@ def tokenize input else raise ParseError, "BUG token #{list_label}" end - [list_type, list_label, *token_pos(pos)] + [list_type, list_label, *pos] # [text] followed by spaces or end of line => :LABEL when @s.scan(/\[(.*?)\]( +|\r?$)/) then - [:LABEL, @s[1], *token_pos(pos)] + [:LABEL, @s[1], *pos] # text:: followed by spaces or end of line => :NOTE when @s.scan(/(.*?)::( +|\r?$)/) then - [:NOTE, @s[1], *token_pos(pos)] + [:NOTE, @s[1], *pos] # >>> followed by end of line => :BLOCKQUOTE when @s.scan(/>>> *(\w+)?$/) then - [:BLOCKQUOTE, @s[1], *token_pos(pos)] + [:BLOCKQUOTE, @s[1], *pos] # anything else: :TEXT else @s.scan(/(.*?)( )?\r?$/) - token = [:TEXT, @s[1], *token_pos(pos)] + token = [:TEXT, @s[1], *pos] if @s[2] then @tokens << token - [:BREAK, @s[2], *token_pos(pos + @s[1].length)] + [:BREAK, @s[2], pos[0] + @s[1].length, pos[1]] else token end @@ -536,16 +563,6 @@ def tokenize input self end - ## - # Calculates the column (by character) and line of the current token based - # on +byte_offset+. - - def token_pos byte_offset - offset = char_pos byte_offset - - [offset - @line_pos, @line] - end - ## # Returns the current token to the token stream diff --git a/lib/rdoc/markup/to_html_crossref.rb b/lib/rdoc/markup/to_html_crossref.rb index 4a1350a73c0a99..9314f04fae04ca 100644 --- a/lib/rdoc/markup/to_html_crossref.rb +++ b/lib/rdoc/markup/to_html_crossref.rb @@ -153,7 +153,11 @@ def link name, text, code = true ref.sections.any? { |section| label == section.title } then path << "##{label}" else - path << "##{ref.aref}-label-#{label}" + if ref.respond_to?(:aref) + path << "##{ref.aref}-label-#{label}" + else + path << "#label-#{label}" + end end if label "#{text}" diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index 5cc009e499a062..82657123705577 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -324,12 +324,100 @@ def do_boot_defclass # Scans #content for rb_define_class, boot_defclass, rb_define_class_under # and rb_singleton_class - def do_classes - do_boot_defclass - do_define_class - do_define_class_under - do_singleton_class - do_struct_define_without_accessor + def do_classes_and_modules + do_boot_defclass if @file_name == "class.c" + + @content.scan( + %r( + (?[\w\.]+)\s* = + \s*rb_(?: + define_(?: + class(?: # rb_define_class(class_name_1, parent_name_1) + \s*\( + \s*"(?\w+)", + \s*(?\w+)\s* + \) + | + _under\s*\( # rb_define_class_under(class_under, class_name2, parent_name2...) + \s* (?\w+), + \s* "(?\w+)", + \s* + (?: + (?[\w\*\s\(\)\.\->]+) | + rb_path2class\("(?[\w:]+)"\) + ) + \s*\) + ) + | + module(?: # rb_define_module(module_name_1) + \s*\( + \s*"(?\w+)"\s* + \) + | + _under\s*\( # rb_define_module_under(module_under, module_name_1) + \s*(?\w+), + \s*"(?\w+)" + \s*\) + ) + ) + | + struct_define_without_accessor\s*\( # rb_struct_define_without_accessor(class_name_3, parent_name_3, ...) + \s*"(?\w+)", + \s*(?\w+), + \s*\w+, # Allocation function + (?:\s*"\w+",)* # Attributes + \s*NULL + \) + | + singleton_class\s*\( # rb_singleton_class(target_class_name) + \s*(?\w+) + \) + ) + )mx + ) do + class_name = $~[:class_name_1] + type = :class + if class_name + # rb_define_class(class_name_1, parent_name_1) + parent_name = $~[:parent_name_1] + #under = nil + else + class_name = $~[:class_name_2] + if class_name + # rb_define_class_under(class_under, class_name2, parent_name2...) + parent_name = $~[:parent_name_2] || $~[:path] + under = $~[:class_under] + else + class_name = $~[:class_name_3] + if class_name + # rb_struct_define_without_accessor(class_name_3, parent_name_3, ...) + parent_name = $~[:parent_name_3] + #under = nil + else + type = :module + class_name = $~[:module_name_1] + #parent_name = nil + if class_name + # rb_define_module(module_name_1) + #under = nil + else + class_name = $~[:module_name_2] + if class_name + # rb_define_module_under(module_under, module_name_1) + under = $~[:module_under] + else + # rb_singleton_class(target_class_name) + target_class_name = $~[:target_class_name] + handle_singleton $~[:var_name], target_class_name + next + end + end + end + end + end + + handle_class_module($~[:var_name], type, class_name, parent_name, under) + end end ## @@ -378,65 +466,6 @@ def do_constants end end - ## - # Scans #content for rb_define_class - - def do_define_class - # The '.' lets us handle SWIG-generated files - @content.scan(/([\w\.]+)\s* = \s*rb_define_class\s* - \( - \s*"(\w+)", - \s*(\w+)\s* - \)/mx) do |var_name, class_name, parent| - handle_class_module(var_name, :class, class_name, parent, nil) - end - end - - ## - # Scans #content for rb_define_class_under - - def do_define_class_under - @content.scan(/([\w\.]+)\s* = # var_name - \s*rb_define_class_under\s* - \( - \s* (\w+), # under - \s* "(\w+)", # class_name - \s* - (?: - ([\w\*\s\(\)\.\->]+) | # parent_name - rb_path2class\("([\w:]+)"\) # path - ) - \s* - \) - /mx) do |var_name, under, class_name, parent_name, path| - parent = path || parent_name - - handle_class_module var_name, :class, class_name, parent, under - end - end - - ## - # Scans #content for rb_define_module - - def do_define_module - @content.scan(/(\w+)\s* = \s*rb_define_module\s*\(\s*"(\w+)"\s*\)/mx) do - |var_name, class_name| - handle_class_module(var_name, :module, class_name, nil, nil) - end - end - - ## - # Scans #content for rb_define_module_under - - def do_define_module_under - @content.scan(/(\w+)\s* = \s*rb_define_module_under\s* - \( - \s*(\w+), - \s*"(\w+)" - \s*\)/mx) do |var_name, in_module, class_name| - handle_class_module(var_name, :module, class_name, nil, in_module) - end - end ## # Scans #content for rb_include_module @@ -518,42 +547,6 @@ def do_missing end end - ## - # Scans #content for rb_define_module and rb_define_module_under - - def do_modules - do_define_module - do_define_module_under - end - - ## - # Scans #content for rb_singleton_class - - def do_singleton_class - @content.scan(/([\w\.]+)\s* = \s*rb_singleton_class\s* - \( - \s*(\w+) - \s*\)/mx) do |sclass_var, class_var| - handle_singleton sclass_var, class_var - end - end - - ## - # Scans #content for struct_define_without_accessor - - def do_struct_define_without_accessor - @content.scan(/([\w\.]+)\s* = \s*rb_struct_define_without_accessor\s* - \( - \s*"(\w+)", # Class name - \s*(\w+), # Parent class - \s*\w+, # Allocation function - (\s*"\w+",)* # Attributes - \s*NULL - \)/mx) do |var_name, class_name, parent| - handle_class_module(var_name, :class, class_name, parent, nil) - end - end - ## # Finds the comment for an alias on +class_name+ from +new_name+ to # +old_name+ @@ -1247,8 +1240,7 @@ def remove_commented_out_lines def scan remove_commented_out_lines - do_modules - do_classes + do_classes_and_modules do_missing do_constants diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 8da19cf2e294f8..4d6c038deb23e5 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -1779,9 +1779,9 @@ def parse_statements(container, single = NORMAL, current_method = nil, while tk and (:on_comment == tk[:kind] or :on_embdoc == tk[:kind]) do comment_body = retrieve_comment_body(tk) comment += comment_body - comment += "\n" unless "\n" == comment_body.chars.to_a.last + comment << "\n" unless comment_body =~ /\n\z/ - if comment_body.size > 1 && "\n" == comment_body.chars.to_a.last then + if comment_body.size > 1 && comment_body =~ /\n\z/ then skip_tkspace_without_nl # leading spaces end tk = get_tk diff --git a/lib/rdoc/rdoc.gemspec b/lib/rdoc/rdoc.gemspec index 99bf3a63f58f29..a6777d68994efe 100644 --- a/lib/rdoc/rdoc.gemspec +++ b/lib/rdoc/rdoc.gemspec @@ -53,10 +53,4 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat s.required_ruby_version = Gem::Requirement.new(">= 2.2.2") s.rubygems_version = "2.5.2" s.required_rubygems_version = Gem::Requirement.new(">= 2.2") - - s.add_development_dependency("rake") - s.add_development_dependency("racc", "> 1.4.10") - s.add_development_dependency("kpeg") - s.add_development_dependency("minitest", "~> 5") - s.add_development_dependency("rubocop") end diff --git a/lib/rdoc/store.rb b/lib/rdoc/store.rb index f420fc2bd2af35..0f6cd06e3cf598 100644 --- a/lib/rdoc/store.rb +++ b/lib/rdoc/store.rb @@ -795,10 +795,8 @@ def save_cache return if @dry_run - marshal = Marshal.dump @cache - File.open cache_path, 'wb' do |io| - io.write marshal + Marshal.dump @cache, io end end @@ -871,10 +869,8 @@ def save_class klass FileUtils.rm_f to_delete - marshal = Marshal.dump klass - File.open path, 'wb' do |io| - io.write marshal + Marshal.dump klass, io end end @@ -896,10 +892,8 @@ def save_method klass, method return if @dry_run - marshal = Marshal.dump method - File.open method_file(full_name, method.full_name), 'wb' do |io| - io.write marshal + Marshal.dump method, io end end @@ -918,10 +912,8 @@ def save_page page return if @dry_run - marshal = Marshal.dump page - File.open path, 'wb' do |io| - io.write marshal + Marshal.dump page, io end end diff --git a/lib/rdoc/token_stream.rb b/lib/rdoc/token_stream.rb index dbe6c5ae85a568..f428e2400ce530 100644 --- a/lib/rdoc/token_stream.rb +++ b/lib/rdoc/token_stream.rb @@ -74,11 +74,16 @@ def self.to_html token_stream ## # Adds +tokens+ to the collected tokens - def add_tokens(*tokens) - tokens.flatten.each { |token| @token_stream << token } + def add_tokens(tokens) + @token_stream.concat(tokens) end - alias add_token add_tokens + ## + # Adds one +token+ to the collected tokens + + def add_token(token) + @token_stream.push(token) + end ## # Starts collecting tokens diff --git a/lib/rdoc/tom_doc.rb b/lib/rdoc/tom_doc.rb index 625a6b5cfaf354..e161fcf42f6efc 100644 --- a/lib/rdoc/tom_doc.rb +++ b/lib/rdoc/tom_doc.rb @@ -242,19 +242,18 @@ def tokenize text @tokens << case when @s.scan(/\r?\n/) then - token = [:NEWLINE, @s.matched, *token_pos(pos)] - @line_pos = char_pos @s.pos - @line += 1 + token = [:NEWLINE, @s.matched, *pos] + @s.newline! token when @s.scan(/(Examples|Signature)$/) then - @tokens << [:HEADER, 3, *token_pos(pos)] + @tokens << [:HEADER, 3, *pos] - [:TEXT, @s[1], *token_pos(pos)] + [:TEXT, @s[1], *pos] when @s.scan(/([:\w][\w\[\]]*)[ ]+- /) then - [:NOTE, @s[1], *token_pos(pos)] + [:NOTE, @s[1], *pos] else @s.scan(/.*/) - [:TEXT, @s.matched.sub(/\r$/, ''), *token_pos(pos)] + [:TEXT, @s.matched.sub(/\r$/, ''), *pos] end end diff --git a/lib/rubygems.rb b/lib/rubygems.rb index 84c1c741b44532..1e79e408fba619 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -1024,6 +1024,10 @@ def self.suffix_pattern @suffix_pattern ||= "{#{suffixes.join(',')}}" end + def self.suffix_regexp + @suffix_regexp ||= /#{Regexp.union(suffixes)}\z/ + end + ## # Suffixes for require-able paths. @@ -1274,8 +1278,6 @@ def register_default_spec(spec) prefix_pattern = /^(#{prefix_group})/ end - suffix_pattern = /#{Regexp.union(Gem.suffixes)}\z/ - spec.files.each do |file| if new_format file = file.sub(prefix_pattern, "") @@ -1283,7 +1285,7 @@ def register_default_spec(spec) end @path_to_default_spec_map[file] = spec - @path_to_default_spec_map[file.sub(suffix_pattern, "")] = spec + @path_to_default_spec_map[file.sub(suffix_regexp, "")] = spec end end @@ -1291,17 +1293,8 @@ def register_default_spec(spec) # Find a Gem::Specification of default gem from +path+ def find_unresolved_default_spec(path) - @path_to_default_spec_map[path] - end - - ## - # Remove needless Gem::Specification of default gem from - # unresolved default gem list - - def remove_unresolved_default_spec(spec) - spec.files.each do |file| - @path_to_default_spec_map.delete(file) - end + default_spec = @path_to_default_spec_map[path] + return default_spec if default_spec && loaded_specs[default_spec.name] != default_spec end ## diff --git a/lib/rubygems/bundler_version_finder.rb b/lib/rubygems/bundler_version_finder.rb index e74baca1ee677f..7f420e6fea7f6a 100644 --- a/lib/rubygems/bundler_version_finder.rb +++ b/lib/rubygems/bundler_version_finder.rb @@ -45,6 +45,11 @@ def self.filter!(specs) return unless bundler_version = self.bundler_version specs.reject! { |spec| spec.version.segments.first != bundler_version.segments.first } + + exact_match_index = specs.find_index { |spec| spec.version == bundler_version } + return unless exact_match_index + + specs.unshift(specs.delete_at(exact_match_index)) end def self.bundle_update_bundler_version diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb index 347b36cae6583e..ab683f0049b260 100644 --- a/lib/rubygems/command.rb +++ b/lib/rubygems/command.rb @@ -155,9 +155,8 @@ def execute ## # Display to the user that a gem couldn't be found and reasons why #-- - # TODO: replace +domain+ with a parameter to suppress suggestions - def show_lookup_failure(gem_name, version, errors, domain, required_by = nil) + def show_lookup_failure(gem_name, version, errors, suppress_suggestions = false, required_by = nil) gem = "'#{gem_name}' (#{version})" msg = String.new "Could not find a valid gem #{gem}" @@ -174,7 +173,7 @@ def show_lookup_failure(gem_name, version, errors, domain, required_by = nil) alert_error msg - unless domain == :local # HACK + unless suppress_suggestions suggestions = Gem::SpecFetcher.fetcher.suggest_gems_from_name gem_name unless suggestions.empty? diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb index 0085d68cf396e0..753ff33eb51ee5 100644 --- a/lib/rubygems/commands/install_command.rb +++ b/lib/rubygems/commands/install_command.rb @@ -218,6 +218,7 @@ def install_gems # :nodoc: gem_version ||= options[:version] domain = options[:domain] domain = :local unless options[:suggest_alternate] + supress_suggestions = (domain == :local) begin install_gem gem_name, gem_version @@ -225,11 +226,11 @@ def install_gems # :nodoc: alert_error "Error installing #{gem_name}:\n\t#{e.message}" exit_code |= 1 rescue Gem::GemNotFoundException => e - show_lookup_failure e.name, e.version, e.errors, domain + show_lookup_failure e.name, e.version, e.errors, supress_suggestions exit_code |= 2 rescue Gem::UnsatisfiableDependencyError => e - show_lookup_failure e.name, e.version, e.errors, domain, + show_lookup_failure e.name, e.version, e.errors, supress_suggestions, "'#{gem_name}' (#{gem_version})" exit_code |= 2 diff --git a/lib/rubygems/compatibility.rb b/lib/rubygems/compatibility.rb index 9238deee72c02e..f1d452ea04209a 100644 --- a/lib/rubygems/compatibility.rb +++ b/lib/rubygems/compatibility.rb @@ -13,6 +13,7 @@ # TODO remove at RubyGems 4 module Gem RubyGemsVersion = VERSION + deprecate_constant(:RubyGemsVersion) RbConfigPriorities = %w[ MAJOR @@ -29,6 +30,7 @@ module Gem ConfigMap = Hash.new do |cm, key| cm[key] = RbConfig::CONFIG[key.to_s] end + deprecate_constant(:ConfigMap) else RbConfigPriorities.each do |key| ConfigMap[key.to_sym] = RbConfig::CONFIG[key] diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb index 014090a16ef76f..8c85ef79fc77cf 100755 --- a/lib/rubygems/core_ext/kernel_require.rb +++ b/lib/rubygems/core_ext/kernel_require.rb @@ -37,7 +37,6 @@ def require(path) path = path.to_path if path.respond_to? :to_path if spec = Gem.find_unresolved_default_spec(path) - Gem.remove_unresolved_default_spec(spec) begin Kernel.send(:gem, spec.name, "#{Gem::Requirement.default}.a") rescue Exception diff --git a/lib/rubygems/gemcutter_utilities.rb b/lib/rubygems/gemcutter_utilities.rb index 1b89946cb700a1..2950d94dc12077 100644 --- a/lib/rubygems/gemcutter_utilities.rb +++ b/lib/rubygems/gemcutter_utilities.rb @@ -87,7 +87,7 @@ def rubygems_api_request(method, path, host = nil, allowed_push_host = nil, &blo unless (host_uri.scheme == allowed_host_uri.scheme) && (host_uri.host == allowed_host_uri.host) alert_error "#{self.host.inspect} is not allowed by the gemspec, which only allows #{allowed_push_host.inspect}" - terminate_interaction 1 + terminate_interaction(ERROR_CODE) end end diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb index b5e4635f392e21..e6f1b9243d3aef 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -811,7 +811,7 @@ def windows_stub_script(bindir, bin_file_name) # stub & ruby.exe withing same folder. Portable <<-TEXT @ECHO OFF -@"%~dp0ruby.exe" "%~dpn0" %* +@"%~dp0#{ruby_exe}" "%~dpn0" %* TEXT elsif bindir.downcase.start_with? rb_topdir.downcase # stub within ruby folder, but not standard bin. Portable @@ -821,14 +821,14 @@ def windows_stub_script(bindir, bin_file_name) rel = to.relative_path_from from <<-TEXT @ECHO OFF -@"%~dp0#{rel}/ruby.exe" "%~dpn0" %* +@"%~dp0#{rel}/#{ruby_exe}" "%~dpn0" %* TEXT else # outside ruby folder, maybe -user-install or bundler. Portable, but ruby # is dependent on PATH <<-TEXT @ECHO OFF -@ruby.exe "%~dpn0" %* +@#{ruby_exe} "%~dpn0" %* TEXT end end diff --git a/lib/rubygems/s3_uri_signer.rb b/lib/rubygems/s3_uri_signer.rb index 437fdbf3dc7f33..4caf07131f46e1 100644 --- a/lib/rubygems/s3_uri_signer.rb +++ b/lib/rubygems/s3_uri_signer.rb @@ -49,12 +49,12 @@ def sign(expiration = 86400) credential_info = "#{date}/#{s3_config.region}/s3/aws4_request" canonical_host = "#{uri.host}.s3.#{s3_config.region}.amazonaws.com" - uri.query = generate_canonical_query_params(s3_config, date_time, credential_info, expiration) - canonical_request = generate_canonical_request(canonical_host) + query_params = generate_canonical_query_params(s3_config, date_time, credential_info, expiration) + canonical_request = generate_canonical_request(canonical_host, query_params) string_to_sign = generate_string_to_sign(date_time, credential_info, canonical_request) signature = generate_signature(s3_config, date, string_to_sign) - URI.parse("https://#{canonical_host}#{uri.path}?#{uri.query}&X-Amz-Signature=#{signature}") + URI.parse("https://#{canonical_host}#{uri.path}?#{query_params}&X-Amz-Signature=#{signature}") end private @@ -76,11 +76,11 @@ def generate_canonical_query_params(s3_config, date_time, credential_info, expir end.join("&") end - def generate_canonical_request(canonical_host) + def generate_canonical_request(canonical_host, query_params) [ "GET", uri.path, - uri.query, + query_params, "host:#{canonical_host}", "", # empty params "host", @@ -131,11 +131,11 @@ def fetch_s3_config else id = auth[:id] || auth["id"] secret = auth[:secret] || auth["secret"] - raise ConfigurationError.new("s3_source for #{host} missing id or secret") unless id && secret - security_token = auth[:security_token] || auth["security_token"] end + raise ConfigurationError.new("s3_source for #{host} missing id or secret") unless id && secret + region = auth[:region] || auth["region"] || "us-east-1" S3Config.new(id, secret, security_token, region) end diff --git a/man/bundle-add.1 b/man/bundle-add.1 index c2663a6ea68882..892a09f5207a32 100644 --- a/man/bundle-add.1 +++ b/man/bundle-add.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-ADD" "1" "May 2019" "" "" +.TH "BUNDLE\-ADD" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install diff --git a/man/bundle-add.1.txt b/man/bundle-add.1.txt index 1a5223c41b9187..1d3723cb34822c 100644 --- a/man/bundle-add.1.txt +++ b/man/bundle-add.1.txt @@ -55,4 +55,4 @@ OPTIONS - May 2019 BUNDLE-ADD(1) + August 2019 BUNDLE-ADD(1) diff --git a/man/bundle-binstubs.1 b/man/bundle-binstubs.1 index 884d0dc5693bc1..7fe74d0a066e88 100644 --- a/man/bundle-binstubs.1 +++ b/man/bundle-binstubs.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-BINSTUBS" "1" "March 2019" "" "" +.TH "BUNDLE\-BINSTUBS" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-binstubs\fR \- Install the binstubs of the listed gems @@ -10,7 +10,7 @@ \fBbundle binstubs\fR \fIGEM_NAME\fR [\-\-force] [\-\-path PATH] [\-\-standalone] . .SH "DESCRIPTION" -Binstubs are scripts that wrap around executables\. Bundler creates a small Ruby file (a binstub) that loads Bundler, runs the command, and puts it into \fBbin/\fR\. Binstubs are a shortcut\-or alternative\- to always using \fBbundle exec\fR\. This gives you a file that can by run directly, and one that will always run the correct gem version used by the application\. +Binstubs are scripts that wrap around executables\. Bundler creates a small Ruby file (a binstub) that loads Bundler, runs the command, and puts it into \fBbin/\fR\. Binstubs are a shortcut\-or alternative\- to always using \fBbundle exec\fR\. This gives you a file that can be run directly, and one that will always run the correct gem version used by the application\. . .P For example, if you run \fBbundle binstubs rspec\-core\fR, Bundler will create the file \fBbin/rspec\fR\. That file will contain enough code to load Bundler, tell it to load the bundled gems, and then run rspec\. diff --git a/man/bundle-binstubs.1.txt b/man/bundle-binstubs.1.txt index 3000d538764f51..6dd50a5f74cf6c 100644 --- a/man/bundle-binstubs.1.txt +++ b/man/bundle-binstubs.1.txt @@ -12,7 +12,7 @@ DESCRIPTION Binstubs are scripts that wrap around executables. Bundler creates a small Ruby file (a binstub) that loads Bundler, runs the command, and puts it into bin/. Binstubs are a shortcut-or alternative- to always - using bundle exec. This gives you a file that can by run directly, and + using bundle exec. This gives you a file that can be run directly, and one that will always run the correct gem version used by the applica- tion. @@ -45,4 +45,4 @@ BUNDLE INSTALL --BINSTUBS - March 2019 BUNDLE-BINSTUBS(1) + August 2019 BUNDLE-BINSTUBS(1) diff --git a/man/bundle-check.1 b/man/bundle-check.1 index 1fedfb2c56ed44..12ee707b8cf6b6 100644 --- a/man/bundle-check.1 +++ b/man/bundle-check.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-CHECK" "1" "March 2019" "" "" +.TH "BUNDLE\-CHECK" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems diff --git a/man/bundle-check.1.txt b/man/bundle-check.1.txt index 02165ab885d57f..08ef075cb6d2b0 100644 --- a/man/bundle-check.1.txt +++ b/man/bundle-check.1.txt @@ -9,8 +9,8 @@ SYNOPSIS bundle check [--dry-run] [--gemfile=FILE] [--path=PATH] DESCRIPTION - 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 + 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. @@ -20,14 +20,14 @@ OPTIONS Locks the [Gemfile(5)][Gemfile(5)] before running the command. --gemfile - Use the specified gemfile instead of the [Gemfile(5)][Gem- + Use the specified gemfile instead of the [Gemfile(5)][Gem- file(5)]. - --path Specify a different path than the system default ($BUNDLE_PATH - or $GEM_HOME). Bundler will remember this value for future + --path Specify a different path than the system default ($BUNDLE_PATH + or $GEM_HOME). Bundler will remember this value for future installs on this machine. - March 2019 BUNDLE-CHECK(1) + August 2019 BUNDLE-CHECK(1) diff --git a/man/bundle-clean.1 b/man/bundle-clean.1 index 712b259372db50..d7813e29a31a0d 100644 --- a/man/bundle-clean.1 +++ b/man/bundle-clean.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-CLEAN" "1" "March 2019" "" "" +.TH "BUNDLE\-CLEAN" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory diff --git a/man/bundle-clean.1.txt b/man/bundle-clean.1.txt index 1cfda2150e151b..5f9412877f4fa2 100644 --- a/man/bundle-clean.1.txt +++ b/man/bundle-clean.1.txt @@ -23,4 +23,4 @@ OPTIONS - March 2019 BUNDLE-CLEAN(1) + August 2019 BUNDLE-CLEAN(1) diff --git a/man/bundle-config.1 b/man/bundle-config.1 index 14d2ebcf976326..c415763cbcf4e1 100644 --- a/man/bundle-config.1 +++ b/man/bundle-config.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-CONFIG" "1" "May 2019" "" "" +.TH "BUNDLE\-CONFIG" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-config\fR \- Set bundler configuration options @@ -60,7 +60,10 @@ Executing bundle with the \fBBUNDLE_IGNORE_CONFIG\fR environment variable set wi Executing \fBbundle config set disable_multisource true\fR upgrades the warning about the Gemfile containing multiple primary sources to an error\. Executing \fBbundle config unset disable_multisource\fR downgrades this error to a warning\. . .SH "REMEMBERING OPTIONS" -Flags passed to \fBbundle install\fR or the Bundler runtime, such as \fB\-\-path foo\fR or \fB\-\-without production\fR, are not remembered between commands\. If these options must be remembered, they must be set using \fBbundle config\fR (e\.g\., \fBbundle config set path foo\fR)\. +Flags passed to \fBbundle install\fR or the Bundler runtime, such as \fB\-\-path foo\fR or \fB\-\-without production\fR, are remembered between commands and saved to your local application\'s configuration (normally, \fB\./\.bundle/config\fR)\. +. +.P +However, this will be changed in bundler 3, so it\'s better not to rely on this behavior\. If these options must be remembered, it\'s better to set them using \fBbundle config\fR (e\.g\., \fBbundle config set path foo\fR)\. . .P The options that can be configured are: @@ -157,7 +160,7 @@ The following is a list of all configuration keys and their purpose\. You can le \fBcache_all_platforms\fR (\fBBUNDLE_CACHE_ALL_PLATFORMS\fR): Cache gems for all platforms\. . .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\. Defaults to \fBvendor/bundle\fR\. +\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\. Defaults to \fBvendor/cache\fR\. . .IP "\(bu" 4 \fBclean\fR (\fBBUNDLE_CLEAN\fR): Whether Bundler should run \fBbundle clean\fR automatically after \fBbundle install\fR\. @@ -184,9 +187,6 @@ The following is a list of all configuration keys and their purpose\. You can le \fBdisable_multisource\fR (\fBBUNDLE_DISABLE_MULTISOURCE\fR): When set, Gemfiles containing multiple sources will produce errors instead of warnings\. Use \fBbundle config unset disable_multisource\fR to unset\. . .IP "\(bu" 4 -\fBdisable_platform_warnings\fR (\fBBUNDLE_DISABLE_PLATFORM_WARNINGS\fR): Disable warnings during bundle install when a dependency is unused on the current platform\. -. -.IP "\(bu" 4 \fBdisable_shared_gems\fR (\fBBUNDLE_DISABLE_SHARED_GEMS\fR): Stop Bundler from accessing gems installed to RubyGems\' normal location\. . .IP "\(bu" 4 diff --git a/man/bundle-config.1.txt b/man/bundle-config.1.txt index a79cd311bc14a5..66a953b949da8c 100644 --- a/man/bundle-config.1.txt +++ b/man/bundle-config.1.txt @@ -62,29 +62,32 @@ DESCRIPTION REMEMBERING OPTIONS Flags passed to bundle install or the Bundler runtime, such as --path - foo or --without production, are not remembered between commands. If - these options must be remembered, they must be set using bundle config - (e.g., bundle config set path foo). + foo or --without production, are remembered between commands and saved + to your local application's configuration (normally, ./.bundle/config). + + However, this will be changed in bundler 3, so it's better not to rely + on this behavior. If these options must be remembered, it's better to + set them using bundle config (e.g., bundle config set path foo). The options that can be configured are: - bin Creates a directory (defaults to ~/bin) and place any executa- + bin 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 + 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 + that ensures that all referred dependencies will be resolved using the bundled gems. deployment - In deployment mode, Bundler will 'roll-out' the bundle for pro- - duction use. Please check carefully if you want to have this + In deployment mode, Bundler will 'roll-out' the bundle for pro- + duction use. Please check carefully if you want to have this option enabled in development or test environments. - 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 + 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. Accordingly, gems installed to other locations will not get listed. @@ -92,15 +95,15 @@ REMEMBERING OPTIONS A space-separated list of groups referencing gems to skip during installation. - with A space-separated list of groups referencing gems to include + with A space-separated list of groups referencing gems to include during installation. BUILD OPTIONS - You can use bundle config to give Bundler the flags to pass to the gem + 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 + 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. @@ -109,7 +112,7 @@ BUILD OPTIONS - Since the specific location of that executable can change from machine + Since the specific location of that executable can change from machine to machine, you can specify these flags on a per-machine basis. @@ -118,43 +121,43 @@ BUILD OPTIONS - After running this command, every time bundler needs to install the + 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 + 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 + 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- + 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- + 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- + 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 allow_bundler_dependency_conflicts (BUNDLE_ALLOW_BUNDLER_DEPEN- DENCY_CONFLICTS): Allow resolving to specifications that have - dependencies on bundler that are incompatible with the running + dependencies on bundler that are incompatible with the running Bundler version. o allow_deployment_source_credential_changes (BUNDLE_ALLOW_DEPLOY- - MENT_SOURCE_CREDENTIAL_CHANGES): When in deployment mode, allow - changing the credentials to a gem's source. Ex: + MENT_SOURCE_CREDENTIAL_CHANGES): When in deployment mode, allow + changing the credentials to a gem's source. Ex: https://some.host.com/gems/path/ -> https://user_name:pass- word@some.host.com/gems/path @@ -162,85 +165,81 @@ LIST OF AVAILABLE KEYS to use cached data when installing without network access. o auto_clean_without_path (BUNDLE_AUTO_CLEAN_WITHOUT_PATH): Automati- - cally run bundle clean after installing when an explicit path has + cally run bundle clean after installing when an explicit path has not been set and Bundler is not installing into the system gems. - o auto_install (BUNDLE_AUTO_INSTALL): Automatically run bundle + o auto_install (BUNDLE_AUTO_INSTALL): Automatically run bundle install when gems are missing. - o bin (BUNDLE_BIN): Install executables from gems in the bundle to + o bin (BUNDLE_BIN): Install executables from gems in the bundle to the specified directory. Defaults to false. - o cache_all (BUNDLE_CACHE_ALL): Cache all gems, including path and + o cache_all (BUNDLE_CACHE_ALL): Cache all gems, including path and git gems. - o cache_all_platforms (BUNDLE_CACHE_ALL_PLATFORMS): Cache gems for + o cache_all_platforms (BUNDLE_CACHE_ALL_PLATFORMS): Cache gems for all platforms. - 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. Defaults to vendor/bundle. + 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. Defaults to vendor/cache. o clean (BUNDLE_CLEAN): Whether Bundler should run bundle clean auto- matically after bundle install. - o console (BUNDLE_CONSOLE): The console that bundle console starts. + o console (BUNDLE_CONSOLE): The console that bundle console starts. Defaults to irb. o default_install_uses_path (BUNDLE_DEFAULT_INSTALL_USES_PATH): - Whether a bundle install without an explicit --path argument + Whether a bundle install without an explicit --path argument defaults to installing gems in .bundle. - o deployment (BUNDLE_DEPLOYMENT): Disallow changes to the Gemfile. - When the Gemfile is changed and the lockfile has not been updated, + o deployment (BUNDLE_DEPLOYMENT): Disallow changes to the Gemfile. + When the Gemfile is changed and the lockfile has not been updated, running Bundler commands will be blocked. o disable_checksum_validation (BUNDLE_DISABLE_CHECKSUM_VALIDATION): - Allow installing gems even if they do not match the checksum pro- + Allow installing gems even if they do not match the checksum pro- vided by RubyGems. o disable_exec_load (BUNDLE_DISABLE_EXEC_LOAD): Stop Bundler from using load to launch an executable in-process in bundle exec. o disable_local_branch_check (BUNDLE_DISABLE_LOCAL_BRANCH_CHECK): - Allow Bundler to use a local git override without a branch speci- + Allow Bundler to use a local git override without a branch speci- fied in the Gemfile. - o disable_multisource (BUNDLE_DISABLE_MULTISOURCE): When set, Gem- - files containing multiple sources will produce errors instead of + o disable_multisource (BUNDLE_DISABLE_MULTISOURCE): When set, Gem- + files containing multiple sources will produce errors instead of warnings. Use bundle config unset disable_multisource to unset. - o disable_platform_warnings (BUNDLE_DISABLE_PLATFORM_WARNINGS): Dis- - able warnings during bundle install when a dependency is unused on - the current platform. - o disable_shared_gems (BUNDLE_DISABLE_SHARED_GEMS): Stop Bundler from accessing gems installed to RubyGems' normal location. - o disable_version_check (BUNDLE_DISABLE_VERSION_CHECK): Stop Bundler - from checking if a newer Bundler version is available on + o disable_version_check (BUNDLE_DISABLE_VERSION_CHECK): Stop Bundler + from checking if a newer Bundler version is available on rubygems.org. - o force_ruby_platform (BUNDLE_FORCE_RUBY_PLATFORM): Ignore the cur- - rent machine's platform and install only ruby platform gems. As a + o force_ruby_platform (BUNDLE_FORCE_RUBY_PLATFORM): Ignore the cur- + rent machine's platform and install only ruby platform gems. As a result, gems with native extensions will be compiled from source. - o frozen (BUNDLE_FROZEN): Disallow changes to the Gemfile. When the - Gemfile is changed and the lockfile has not been updated, running - Bundler commands will be blocked. Defaults to true when --deploy- + o frozen (BUNDLE_FROZEN): Disallow changes to the Gemfile. When the + Gemfile is changed and the lockfile has not been updated, running + Bundler commands will be blocked. Defaults to true when --deploy- ment is used. - o gem.push_key (BUNDLE_GEM__PUSH_KEY): Sets the --key parameter for - gem push when using the rake release command with a private gem- + o gem.push_key (BUNDLE_GEM__PUSH_KEY): Sets the --key parameter for + gem push when using the rake release command with a private gem- stash server. - 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 + 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 + file, among other things. By default, bundler will search up from the current working directory until it finds a Gemfile. - o global_gem_cache (BUNDLE_GLOBAL_GEM_CACHE): Whether Bundler should + o global_gem_cache (BUNDLE_GLOBAL_GEM_CACHE): Whether Bundler should cache all gems globally, rather than locally to the installing Ruby installation. @@ -248,80 +247,80 @@ LIST OF AVAILABLE KEYS messages will be printed. To silence a single gem, use dot notation like ignore_messages.httparty true. - o init_gems_rb (BUNDLE_INIT_GEMS_RB) Generate a gems.rb instead of a + o init_gems_rb (BUNDLE_INIT_GEMS_RB) Generate a gems.rb instead of a Gemfile when running bundle init. - o jobs (BUNDLE_JOBS): The number of gems Bundler can install in par- + o jobs (BUNDLE_JOBS): The number of gems Bundler can install in par- allel. Defaults to 1. - o no_install (BUNDLE_NO_INSTALL): Whether bundle package should skip + o no_install (BUNDLE_NO_INSTALL): Whether bundle package should skip installing gems. - o no_prune (BUNDLE_NO_PRUNE): Whether Bundler should leave outdated + o no_prune (BUNDLE_NO_PRUNE): Whether Bundler should leave outdated gems unpruned when caching. o only_update_to_newer_versions (BUNDLE_ONLY_UPDATE_TO_NEWER_VER- SIONS): During bundle update, only resolve to newer versions of the gems in the lockfile. - o path (BUNDLE_PATH): The location on disk where all gems in your + 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 + 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 path.system (BUNDLE_PATH__SYSTEM): Whether Bundler will install + o path.system (BUNDLE_PATH__SYSTEM): Whether Bundler will install gems into the default system path (Gem.dir). - o path_relative_to_cwd (BUNDLE_PATH_RELATIVE_TO_CWD) Makes --path + o path_relative_to_cwd (BUNDLE_PATH_RELATIVE_TO_CWD) Makes --path relative to the CWD instead of the Gemfile. o plugins (BUNDLE_PLUGINS): Enable Bundler's experimental plugin sys- tem. - o prefer_patch (BUNDLE_PREFER_PATCH): Prefer updating only to next - patch version during updates. Makes bundle update calls equivalent + o prefer_patch (BUNDLE_PREFER_PATCH): Prefer updating only to next + patch version during updates. Makes bundle update calls equivalent to bundler update --patch. - o print_only_version_number (BUNDLE_PRINT_ONLY_VERSION_NUMBER) Print + o print_only_version_number (BUNDLE_PRINT_ONLY_VERSION_NUMBER) Print only version number from bundler --version. - o redirect (BUNDLE_REDIRECT): The number of redirects allowed for + o redirect (BUNDLE_REDIRECT): The number of redirects allowed for network requests. Defaults to 5. - o retry (BUNDLE_RETRY): The number of times to retry failed network + o retry (BUNDLE_RETRY): The number of times to retry failed network requests. Defaults to 3. o setup_makes_kernel_gem_public (BUNDLE_SETUP_MAKES_KERNEL_GEM_PUB- - LIC): Have Bundler.setup make the Kernel#gem method public, even + LIC): Have Bundler.setup make the Kernel#gem method public, even though RubyGems declares it as private. - o shebang (BUNDLE_SHEBANG): The program name that should be invoked - for generated binstubs. Defaults to the ruby install name used to + o shebang (BUNDLE_SHEBANG): The program name that should be invoked + for generated binstubs. Defaults to the ruby install name used to generate the binstub. o silence_deprecations (BUNDLE_SILENCE_DEPRECATIONS): Whether Bundler - should silence deprecation warnings for behavior that will be + should silence deprecation warnings for behavior that will be changed in the next major version. - o silence_root_warning (BUNDLE_SILENCE_ROOT_WARNING): Silence the + o silence_root_warning (BUNDLE_SILENCE_ROOT_WARNING): Silence the warning Bundler prints when installing gems as root. o skip_default_git_sources (BUNDLE_SKIP_DEFAULT_GIT_SOURCES): Whether Bundler should skip adding default git source shortcuts to the Gem- file DSL. - o specific_platform (BUNDLE_SPECIFIC_PLATFORM): Allow bundler to + o specific_platform (BUNDLE_SPECIFIC_PLATFORM): Allow bundler to resolve for the specific running platform and store it in the lock- file, instead of only using a generic platform. A specific platform - is the exact platform triple reported by Gem::Platform.local, such - as x86_64-darwin-16 or universal-java-1.8. On the other hand, - generic platforms are those such as ruby, mswin, or java. In this - example, x86_64-darwin-16 would map to ruby and universal-java-1.8 + is the exact platform triple reported by Gem::Platform.local, such + as x86_64-darwin-16 or universal-java-1.8. On the other hand, + generic platforms are those such as ruby, mswin, or java. In this + example, x86_64-darwin-16 would map to ruby and universal-java-1.8 to java. - o ssl_ca_cert (BUNDLE_SSL_CA_CERT): Path to a designated CA certifi- - cate file or folder containing multiple certificates for trusted + 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 @@ -331,44 +330,44 @@ LIST OF AVAILABLE KEYS Bundler uses when making HTTPS requests. Defaults to verify peer. o suppress_install_using_messages (BUNDLE_SUPPRESS_INSTALL_USING_MES- - SAGES): Avoid printing Using ... messages during installation when + SAGES): Avoid printing Using ... messages during installation when the version of a gem has not changed. - o system_bindir (BUNDLE_SYSTEM_BINDIR): The location where RubyGems + o system_bindir (BUNDLE_SYSTEM_BINDIR): The location where RubyGems installs binstubs. Defaults to Gem.bindir. o timeout (BUNDLE_TIMEOUT): The seconds allowed before timing out for network requests. Defaults to 10. o unlock_source_unlocks_spec (BUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC): - Whether running bundle update --source NAME unlocks a gem with the + Whether running bundle update --source NAME unlocks a gem with the given name. Defaults to true. - o update_requires_all_flag (BUNDLE_UPDATE_REQUIRES_ALL_FLAG) Require - passing --all to bundle update when everything should be updated, + o update_requires_all_flag (BUNDLE_UPDATE_REQUIRES_ALL_FLAG) Require + passing --all to bundle update when everything should be updated, and disallow passing no options to bundle update. - o user_agent (BUNDLE_USER_AGENT): The custom user agent fragment + o user_agent (BUNDLE_USER_AGENT): The custom user agent fragment Bundler includes in API requests. o with (BUNDLE_WITH): A :-separated list of groups whose gems bundler should install. - o without (BUNDLE_WITHOUT): A :-separated list of groups whose gems + o without (BUNDLE_WITHOUT): A :-separated list of groups whose gems bundler should not install. - 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- + 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- + 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 + 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: @@ -387,30 +386,30 @@ LOCAL GIT REPOS - 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 + 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 + 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. You'll also need to CGI + mit that only exists in your local machine. You'll also need to CGI escape your usernames and passwords as well. - 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 + 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 + 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 + 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. @@ -420,7 +419,7 @@ MIRRORS OF GEM SOURCES - For example, to use a mirror of rubygems.org hosted at rubygems-mir- + For example, to use a mirror of rubygems.org hosted at rubygems-mir- ror.org: @@ -429,8 +428,8 @@ MIRRORS OF GEM SOURCES - Each mirror also provides a fallback timeout setting. If the mirror - does not respond within the fallback timeout, Bundler will try to use + Each mirror also provides a fallback timeout setting. If the mirror + does not respond within the fallback timeout, Bundler will try to use the original server instead of the mirror. @@ -447,11 +446,11 @@ MIRRORS OF GEM SOURCES - The default fallback timeout is 0.1 seconds, but the setting can cur- + The default fallback timeout is 0.1 seconds, but the setting can cur- rently only accept whole seconds (for example, 1, 15, or 30). CREDENTIALS FOR GEM SOURCES - Bundler allows you to configure credentials for any gem source, which + Bundler allows you to configure credentials for any gem source, which allows you to avoid putting secrets into your Gemfile. @@ -460,7 +459,7 @@ CREDENTIALS FOR GEM SOURCES - For example, to save the credentials of user claudette for the gem + For example, to save the credentials of user claudette for the gem source at gems.longerous.com, you would run: @@ -494,7 +493,7 @@ CREDENTIALS FOR GEM SOURCES - This is especially useful for private repositories on hosts such as + This is especially useful for private repositories on hosts such as Github, where you can use personal OAuth tokens: @@ -504,9 +503,9 @@ CREDENTIALS FOR GEM SOURCES CONFIGURE BUNDLER DIRECTORIES - Bundler's home, config, cache and plugin directories are able to be - configured through environment variables. The default location for - Bundler's home directory is ~/.bundle, which all directories inherit + Bundler's home, config, cache and plugin directories are able to be + configured through environment variables. The default location for + Bundler's home directory is ~/.bundle, which all directories inherit from by default. The following outlines the available environment vari- ables and their default values @@ -522,4 +521,4 @@ CONFIGURE BUNDLER DIRECTORIES - May 2019 BUNDLE-CONFIG(1) + August 2019 BUNDLE-CONFIG(1) diff --git a/man/bundle-config.ronn b/man/bundle-config.ronn index ffecc12f694fea..069f3b95fd8b49 100644 --- a/man/bundle-config.ronn +++ b/man/bundle-config.ronn @@ -51,10 +51,13 @@ config unset disable_multisource` downgrades this error to a warning. ## REMEMBERING OPTIONS -Flags passed to `bundle install` or the Bundler runtime, -such as `--path foo` or `--without production`, are not remembered between commands. -If these options must be remembered, they must be set using `bundle config` -(e.g., `bundle config set path foo`). +Flags passed to `bundle install` or the Bundler runtime, such as `--path foo` or +`--without production`, are remembered between commands and saved to your local +application's configuration (normally, `./.bundle/config`). + +However, this will be changed in bundler 3, so it's better not to rely on this +behavior. If these options must be remembered, it's better to set them using +`bundle config` (e.g., `bundle config set path foo`). The options that can be configured are: diff --git a/man/bundle-doctor.1 b/man/bundle-doctor.1 index 3dcbaa18cb3102..9df8f2ae754c8c 100644 --- a/man/bundle-doctor.1 +++ b/man/bundle-doctor.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-DOCTOR" "1" "March 2019" "" "" +.TH "BUNDLE\-DOCTOR" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-doctor\fR \- Checks the bundle for common problems diff --git a/man/bundle-doctor.1.txt b/man/bundle-doctor.1.txt index e3efa3bcbe9da8..5357e29050a54f 100644 --- a/man/bundle-doctor.1.txt +++ b/man/bundle-doctor.1.txt @@ -41,4 +41,4 @@ OPTIONS - March 2019 BUNDLE-DOCTOR(1) + August 2019 BUNDLE-DOCTOR(1) diff --git a/man/bundle-exec.1 b/man/bundle-exec.1 index 4d0fb7dc3108e1..6070135156c35d 100644 --- a/man/bundle-exec.1 +++ b/man/bundle-exec.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-EXEC" "1" "March 2019" "" "" +.TH "BUNDLE\-EXEC" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-exec\fR \- Execute a command in the context of the bundle diff --git a/man/bundle-exec.1.txt b/man/bundle-exec.1.txt index 179c3a75776a6b..f01a0ce04abd09 100644 --- a/man/bundle-exec.1.txt +++ b/man/bundle-exec.1.txt @@ -175,4 +175,4 @@ RUBYGEMS PLUGINS - March 2019 BUNDLE-EXEC(1) + August 2019 BUNDLE-EXEC(1) diff --git a/man/bundle-gem.1 b/man/bundle-gem.1 index 08e544cd8a0e06..141190610dd6ae 100644 --- a/man/bundle-gem.1 +++ b/man/bundle-gem.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-GEM" "1" "March 2019" "" "" +.TH "BUNDLE\-GEM" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem diff --git a/man/bundle-gem.1.txt b/man/bundle-gem.1.txt index 806939df4fa722..63be495f75f5c2 100644 --- a/man/bundle-gem.1.txt +++ b/man/bundle-gem.1.txt @@ -77,8 +77,8 @@ OPTIONS -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. + editor if not specified. The default is $BUNDLER_EDITOR, $VIS- + UAL, or $EDITOR. SEE ALSO o bundle config(1) bundle-config.1.html @@ -88,4 +88,4 @@ SEE ALSO - March 2019 BUNDLE-GEM(1) + August 2019 BUNDLE-GEM(1) diff --git a/man/bundle-info.1 b/man/bundle-info.1 index d1db7aa70f059d..2f44774a736120 100644 --- a/man/bundle-info.1 +++ b/man/bundle-info.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-INFO" "1" "March 2019" "" "" +.TH "BUNDLE\-INFO" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-info\fR \- Show information for the given gem in your bundle diff --git a/man/bundle-info.1.txt b/man/bundle-info.1.txt index 70572491889efc..b8d1209c465df3 100644 --- a/man/bundle-info.1.txt +++ b/man/bundle-info.1.txt @@ -18,4 +18,4 @@ OPTIONS - March 2019 BUNDLE-INFO(1) + August 2019 BUNDLE-INFO(1) diff --git a/man/bundle-init.1 b/man/bundle-init.1 index 67bce690236c78..70aeaf974a9c20 100644 --- a/man/bundle-init.1 +++ b/man/bundle-init.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-INIT" "1" "April 2019" "" "" +.TH "BUNDLE\-INIT" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-init\fR \- Generates a Gemfile into the current working directory diff --git a/man/bundle-init.1.txt b/man/bundle-init.1.txt index 47c996944b4200..92b005815ebbd9 100644 --- a/man/bundle-init.1.txt +++ b/man/bundle-init.1.txt @@ -31,4 +31,4 @@ SEE ALSO - April 2019 BUNDLE-INIT(1) + August 2019 BUNDLE-INIT(1) diff --git a/man/bundle-inject.1 b/man/bundle-inject.1 index b88e01218235b9..a6fa00bca6091c 100644 --- a/man/bundle-inject.1 +++ b/man/bundle-inject.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-INJECT" "1" "March 2019" "" "" +.TH "BUNDLE\-INJECT" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile diff --git a/man/bundle-inject.1.txt b/man/bundle-inject.1.txt index 7baea1c9723051..249c330833c8e5 100644 --- a/man/bundle-inject.1.txt +++ b/man/bundle-inject.1.txt @@ -29,4 +29,4 @@ DESCRIPTION - March 2019 BUNDLE-INJECT(1) + August 2019 BUNDLE-INJECT(1) diff --git a/man/bundle-install.1 b/man/bundle-install.1 index dbb0d21c1c0f5f..e49da857d896cc 100644 --- a/man/bundle-install.1 +++ b/man/bundle-install.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-INSTALL" "1" "April 2019" "" "" +.TH "BUNDLE\-INSTALL" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-install\fR \- Install the dependencies specified in your Gemfile diff --git a/man/bundle-install.1.txt b/man/bundle-install.1.txt index 72499f3d2dc0a9..4d36427e18eaa5 100644 --- a/man/bundle-install.1.txt +++ b/man/bundle-install.1.txt @@ -193,14 +193,14 @@ DEPLOYMENT MODE SUDO USAGE - By default, Bundler installs gems to the same location as gem install. + 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 + 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 + ask you for your sudo password in order to copy the gems into their system location. - From your perspective, this is identical to installing the gems + From your perspective, this is identical to installing the gems directly into the system. You should never use sudo bundle install. This is because several other @@ -214,36 +214,36 @@ SUDO USAGE - 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 invoking the git command as the current user. - Therefore, git gems are downloaded and installed into ~/.bundle rather + 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 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 + 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 + 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 + 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 + 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 + (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 + 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. @@ -261,63 +261,63 @@ INSTALLING GROUPS - In this case, sinatra depends on any version of Rack (>= 1.0), while + 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 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 + 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 + 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 the gems you list in your Gemfile(5), and can (surprisingly) + vagaries of the dependency resolution process, this usually affects + more than the gems you list in your Gemfile(5), and can (surprisingly) radically change the gems you are using. 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 + 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 + 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 + 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, + As a result, you SHOULD check your Gemfile.lock into version control, in both applications and gems. 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 + 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. - When Bundler first shipped, the Gemfile.lock was included in the .git- + When Bundler first shipped, the Gemfile.lock was included in the .git- ignore file included with generated gems. Over time, however, it became - clear that this practice forces the pain of broken dependencies onto + clear that this practice forces the pain of broken dependencies onto new contributors, while leaving existing contributors potentially - unaware of the problem. Since bundle install is usually the first step - towards a contribution, the pain of broken dependencies would discour- - age new contributors from contributing. As a result, we have revised - our guidance for gem authors to now recommend checking in the lock for + unaware of the problem. Since bundle install is usually the first step + towards a contribution, the pain of broken dependencies would discour- + age new contributors from contributing. As a result, we have revised + our guidance for gem authors to now recommend checking in the lock for gems. CONSERVATIVE UPDATING - When you make a change to the Gemfile(5) and then run bundle install, + 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 + 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): @@ -331,13 +331,13 @@ CONSERVATIVE UPDATING - 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, + 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 + 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: @@ -351,44 +351,44 @@ CONSERVATIVE UPDATING - 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- + 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 + 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 + 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- + 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 + 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 + 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 + 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 + 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 gem in the Gemfile(5) is impacted by the change. If that does not work, run bundle update(1) bundle-update.1.html. SEE ALSO - o Gem install docs + o Gem install docs http://guides.rubygems.org/rubygems-basics/#installing-gems o Rubygems signing docs http://guides.rubygems.org/security/ @@ -398,4 +398,4 @@ SEE ALSO - April 2019 BUNDLE-INSTALL(1) + August 2019 BUNDLE-INSTALL(1) diff --git a/man/bundle-list.1 b/man/bundle-list.1 index d282228be2ecd1..74cd3b218a3f14 100644 --- a/man/bundle-list.1 +++ b/man/bundle-list.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-LIST" "1" "March 2019" "" "" +.TH "BUNDLE\-LIST" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-list\fR \- List all the gems in the bundle diff --git a/man/bundle-list.1.txt b/man/bundle-list.1.txt index 7ef2427608c6b9..f44c38a6ce0837 100644 --- a/man/bundle-list.1.txt +++ b/man/bundle-list.1.txt @@ -40,4 +40,4 @@ OPTIONS - March 2019 BUNDLE-LIST(1) + August 2019 BUNDLE-LIST(1) diff --git a/man/bundle-lock.1 b/man/bundle-lock.1 index bec1cb5200f574..224b8f417315ec 100644 --- a/man/bundle-lock.1 +++ b/man/bundle-lock.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-LOCK" "1" "March 2019" "" "" +.TH "BUNDLE\-LOCK" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-lock\fR \- Creates / Updates a lockfile without installing diff --git a/man/bundle-lock.1.txt b/man/bundle-lock.1.txt index 3da8b29ab320b4..7dada557531cb5 100644 --- a/man/bundle-lock.1.txt +++ b/man/bundle-lock.1.txt @@ -16,16 +16,16 @@ DESCRIPTION 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. + 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 + 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 + Prints the lockfile to STDOUT instead of writing to the file system. --lockfile= @@ -35,7 +35,7 @@ OPTIONS Fall back to using the single-file index of all gems. --add-platform - Add a new platform to the lockfile, re-resolving for the addi- + Add a new platform to the lockfile, re-resolving for the addi- tion of that platform. --remove-platform @@ -51,7 +51,7 @@ OPTIONS If updating, prefer updating to next major version (default). --strict - If updating, do not allow any gem to be updated past latest + If updating, do not allow any gem to be updated past latest --patch | --minor | --major. --conservative @@ -59,28 +59,28 @@ OPTIONS do not allow shared dependencies to be updated. 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 + 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 + 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 + 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- + rest of the gems that you specified locked to the versions in the Gem- file.lock. SUPPORTING OTHER PLATFORMS - If you want your bundle to support platforms other than the one you're + If you want your bundle to support platforms other than the one you're running locally, you can run bundle lock --add-platform PLATFORM to add - PLATFORM to the lockfile, force bundler to re-resolve and consider the - new platform when picking gems, all without needing to have a machine + PLATFORM to the lockfile, force bundler to re-resolve and consider the + new platform when picking gems, all without needing to have a machine that matches PLATFORM handy to install those platform-specific gems on. For a full explanation of gem platforms, see gem help platform. @@ -90,4 +90,4 @@ PATCH LEVEL OPTIONS - March 2019 BUNDLE-LOCK(1) + August 2019 BUNDLE-LOCK(1) diff --git a/man/bundle-open.1 b/man/bundle-open.1 index 9d8e390265e03b..d2d87b5a59b0ad 100644 --- a/man/bundle-open.1 +++ b/man/bundle-open.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-OPEN" "1" "March 2019" "" "" +.TH "BUNDLE\-OPEN" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-open\fR \- Opens the source directory for a gem in your bundle diff --git a/man/bundle-open.1.txt b/man/bundle-open.1.txt index ac289aa97de434..a63a23e7269628 100644 --- a/man/bundle-open.1.txt +++ b/man/bundle-open.1.txt @@ -26,4 +26,4 @@ DESCRIPTION - March 2019 BUNDLE-OPEN(1) + August 2019 BUNDLE-OPEN(1) diff --git a/man/bundle-outdated.1 b/man/bundle-outdated.1 index cbb88905ed1859..110a79384dfa9d 100644 --- a/man/bundle-outdated.1 +++ b/man/bundle-outdated.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-OUTDATED" "1" "March 2019" "" "" +.TH "BUNDLE\-OUTDATED" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-outdated\fR \- List installed gems with newer versions available diff --git a/man/bundle-outdated.1.txt b/man/bundle-outdated.1.txt index 493ded1646dc79..3dbdeb99c7b353 100644 --- a/man/bundle-outdated.1.txt +++ b/man/bundle-outdated.1.txt @@ -128,4 +128,4 @@ FILTERING OUTPUT - March 2019 BUNDLE-OUTDATED(1) + August 2019 BUNDLE-OUTDATED(1) diff --git a/man/bundle-package.1 b/man/bundle-package.1 index d3988935e5ebe6..8914fd45b4abb1 100644 --- a/man/bundle-package.1 +++ b/man/bundle-package.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-PACKAGE" "1" "March 2019" "" "" +.TH "BUNDLE\-PACKAGE" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-package\fR \- Package your needed \fB\.gem\fR files into your application diff --git a/man/bundle-package.1.txt b/man/bundle-package.1.txt index 140b7a97b42b70..c4b57f553d527d 100644 --- a/man/bundle-package.1.txt +++ b/man/bundle-package.1.txt @@ -76,4 +76,4 @@ REMOTE FETCHING - March 2019 BUNDLE-PACKAGE(1) + August 2019 BUNDLE-PACKAGE(1) diff --git a/man/bundle-platform.1 b/man/bundle-platform.1 index ed3ddc1bafb2b3..aa5480c8060882 100644 --- a/man/bundle-platform.1 +++ b/man/bundle-platform.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-PLATFORM" "1" "March 2019" "" "" +.TH "BUNDLE\-PLATFORM" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-platform\fR \- Displays platform compatibility information diff --git a/man/bundle-platform.1.txt b/man/bundle-platform.1.txt index 353b2dfe17be65..39647ed4971735 100644 --- a/man/bundle-platform.1.txt +++ b/man/bundle-platform.1.txt @@ -54,4 +54,4 @@ OPTIONS - March 2019 BUNDLE-PLATFORM(1) + August 2019 BUNDLE-PLATFORM(1) diff --git a/man/bundle-pristine.1 b/man/bundle-pristine.1 index bd6d2b2993a79d..9660a498350a75 100644 --- a/man/bundle-pristine.1 +++ b/man/bundle-pristine.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-PRISTINE" "1" "March 2019" "" "" +.TH "BUNDLE\-PRISTINE" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-pristine\fR \- Restores installed gems to their pristine condition diff --git a/man/bundle-pristine.1.txt b/man/bundle-pristine.1.txt index 25b6710d5fc934..c551c1222761b5 100644 --- a/man/bundle-pristine.1.txt +++ b/man/bundle-pristine.1.txt @@ -41,4 +41,4 @@ DESCRIPTION - March 2019 BUNDLE-PRISTINE(1) + August 2019 BUNDLE-PRISTINE(1) diff --git a/man/bundle-remove.1 b/man/bundle-remove.1 index 0b0279001cf0a3..4b58d1cfe0ddd4 100644 --- a/man/bundle-remove.1 +++ b/man/bundle-remove.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-REMOVE" "1" "March 2019" "" "" +.TH "BUNDLE\-REMOVE" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-remove\fR \- Removes gems from the Gemfile diff --git a/man/bundle-remove.1.txt b/man/bundle-remove.1.txt index 219c50f944df36..69052b47737848 100644 --- a/man/bundle-remove.1.txt +++ b/man/bundle-remove.1.txt @@ -31,4 +31,4 @@ OPTIONS - March 2019 BUNDLE-REMOVE(1) + August 2019 BUNDLE-REMOVE(1) diff --git a/man/bundle-show.1 b/man/bundle-show.1 index d3387dcc2f316a..62ca83264a1acc 100644 --- a/man/bundle-show.1 +++ b/man/bundle-show.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-SHOW" "1" "March 2019" "" "" +.TH "BUNDLE\-SHOW" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem diff --git a/man/bundle-show.1.txt b/man/bundle-show.1.txt index b2851ff06ec35c..d22c7d1f22cabd 100644 --- a/man/bundle-show.1.txt +++ b/man/bundle-show.1.txt @@ -24,4 +24,4 @@ OPTIONS - March 2019 BUNDLE-SHOW(1) + August 2019 BUNDLE-SHOW(1) diff --git a/man/bundle-update.1 b/man/bundle-update.1 index f980563732ad94..eb33656f6f263f 100644 --- a/man/bundle-update.1 +++ b/man/bundle-update.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-UPDATE" "1" "April 2019" "" "" +.TH "BUNDLE\-UPDATE" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-update\fR \- Update your gems to the latest available versions diff --git a/man/bundle-update.1.txt b/man/bundle-update.1.txt index 98df74b09c01ad..e20c159e023cb9 100644 --- a/man/bundle-update.1.txt +++ b/man/bundle-update.1.txt @@ -16,29 +16,29 @@ DESCRIPTION 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. + You would use bundle update to explicitly update the version of a gem. OPTIONS --all Update all gems specified in Gemfile. --group=, -g=[] - 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 + 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 + 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 + Do not attempt to fetch gems remotely and use the gem cache instead. - --ruby Update the locked version of Ruby to the current version of + --ruby Update the locked version of Ruby to the current version of Ruby. --bundler @@ -328,22 +328,22 @@ PATCH LEVEL EXAMPLES the dependency from foo 1.4.5 required it. In case 2, only foo is requested to be unlocked, but bar is also - allowed to move because it's not a declared dependency in the Gemfile. + allowed to move because it's not a declared dependency in the Gemfile. - In case 3, bar goes up a whole major release, because a minor increase - is preferred now for foo, and when it goes to 1.5.1, it requires 3.0.0 + In case 3, bar goes up a whole major release, because a minor increase + is preferred now for foo, and when it goes to 1.5.1, it requires 3.0.0 of bar. In case 4, foo is preferred up to a minor version, but 1.5.1 won't work - because the --strict flag removes bar 3.0.0 from consideration since + because the --strict flag removes bar 3.0.0 from consideration since it's a major increment. - In case 5, both foo and bar have any minor or major increments removed - from consideration because of the --strict flag, so the most they can + In case 5, both foo and bar have any minor or major increments removed + from consideration because of the --strict flag, so the most they can move is up to 1.4.4 and 2.0.4. RECOMMENDED WORKFLOW - In general, when working with an application managed with bundler, you + 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 @@ -354,7 +354,7 @@ RECOMMENDED WORKFLOW $ git add Gemfile.lock - o When checking out this repository on another development machine, + o When checking out this repository on another development machine, run $ bundle install @@ -363,7 +363,7 @@ RECOMMENDED WORKFLOW $ bundle install --deployment - o After changing the Gemfile(5) to reflect a new or update depen- + o After changing the Gemfile(5) to reflect a new or update depen- dency, run $ bundle install @@ -377,7 +377,7 @@ RECOMMENDED WORKFLOW $ bundle update rails thin - o If you want to update all the gems to the latest possible versions + 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 --all @@ -387,4 +387,4 @@ RECOMMENDED WORKFLOW - April 2019 BUNDLE-UPDATE(1) + August 2019 BUNDLE-UPDATE(1) diff --git a/man/bundle-viz.1 b/man/bundle-viz.1 index 3f4441f29f5e95..458b6e1a6595aa 100644 --- a/man/bundle-viz.1 +++ b/man/bundle-viz.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE\-VIZ" "1" "March 2019" "" "" +.TH "BUNDLE\-VIZ" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile diff --git a/man/bundle-viz.1.txt b/man/bundle-viz.1.txt index 045e8373626bb2..d9f68e0ecd14d0 100644 --- a/man/bundle-viz.1.txt +++ b/man/bundle-viz.1.txt @@ -36,4 +36,4 @@ OPTIONS - March 2019 BUNDLE-VIZ(1) + August 2019 BUNDLE-VIZ(1) diff --git a/man/bundle.1 b/man/bundle.1 index fd6343c7935fd4..2b1a1ab14dfed1 100644 --- a/man/bundle.1 +++ b/man/bundle.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BUNDLE" "1" "May 2019" "" "" +.TH "BUNDLE" "1" "August 2019" "" "" . .SH "NAME" \fBbundle\fR \- Ruby Dependency Management diff --git a/man/bundle.1.txt b/man/bundle.1.txt index f5c3d8ae7f0a5a..3bbf7692468128 100644 --- a/man/bundle.1.txt +++ b/man/bundle.1.txt @@ -36,7 +36,7 @@ PRIMARY COMMANDS Update dependencies to their latest versions bundle package(1) bundle-package.1.html - Package the .gem files required by your application into the + Package the .gem files required by your application into the vendor/cache directory bundle exec(1) bundle-exec.1.html @@ -56,7 +56,7 @@ UTILITIES Generate binstubs for executables in a gem bundle check(1) bundle-check.1.html - Determine whether the requirements for your application are + Determine whether the requirements for your application are installed and available to Bundler bundle show(1) bundle-show.1.html @@ -96,9 +96,9 @@ UTILITIES Removes gems from the Gemfile 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 + 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 @@ -113,4 +113,4 @@ OBSOLETE - May 2019 BUNDLE(1) + August 2019 BUNDLE(1) diff --git a/man/gemfile.5 b/man/gemfile.5 index 13fa60ee3d8b71..49e1186a65b578 100644 --- a/man/gemfile.5 +++ b/man/gemfile.5 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "GEMFILE" "5" "April 2019" "" "" +.TH "GEMFILE" "5" "August 2019" "" "" . .SH "NAME" \fBGemfile\fR \- A format for describing gem dependencies for Ruby programs @@ -158,7 +158,7 @@ Each \fIgem\fR \fBMAY\fR specify files that should be used when autorequiring vi gem "redis", :require => ["redis/connection/hiredis", "redis"] gem "webmock", :require => false -gem "debugger", :require => true +gem "byebug", :require => true . .fi . @@ -218,23 +218,23 @@ Bundler\.require(:test) # requires the _test_ group .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\. +The Bundler CLI allows you to specify a list of groups whose gems \fBbundle install\fR should not install with the \fBwithout\fR configuration\. +. +.P +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 +bundle config set without test +bundle config set 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 not available)\. . .P @@ -409,19 +409,16 @@ 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 -For example: +You \fBMUST\fR only specify at most one of these options\. The default is \fB:branch => "master"\fR\. For example: . .IP -git "https://github\.com/rails/rails\.git", :branch => "5\-0\-stable" do +gem "rails", :git => "https://github\.com/rails/rails\.git", :branch => "5\-0\-stable" . .IP -git "https://github\.com/rails/rails\.git", :tag => "v5\.0\.0" do +gem "rails", :git => "https://github\.com/rails/rails\.git", :tag => "v5\.0\.0" . .IP -git "https://github\.com/rails/rails\.git", :ref => "4aded" do +gem "rails", :git => "https://github\.com/rails/rails\.git", :ref => "4aded" . .TP \fBsubmodules\fR diff --git a/man/gemfile.5.ronn b/man/gemfile.5.ronn index 4bb7c2df0d6108..832577130cee14 100644 --- a/man/gemfile.5.ronn +++ b/man/gemfile.5.ronn @@ -126,7 +126,7 @@ prevent any file from being autorequired. gem "redis", :require => ["redis/connection/hiredis", "redis"] gem "webmock", :require => false - gem "debugger", :require => true + gem "byebug", :require => true The argument defaults to the name of the gem. For example, these are identical: @@ -159,15 +159,12 @@ The Bundler runtime allows its two main methods, `Bundler.setup` and Bundler.require(:test) # requires 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. +not install with the `without` configuration. - bundle install --without test - bundle install --without development test +To specify multiple groups to ignore, specify a list of groups separated by spaces. -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. + bundle config set without test + bundle config set without development test 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 diff --git a/man/gemfile.5.txt b/man/gemfile.5.txt index 40360728610ae7..a37e35aa07e071 100644 --- a/man/gemfile.5.txt +++ b/man/gemfile.5.txt @@ -99,13 +99,13 @@ RUBY exist. Some of the more well-known implementations include Rubinius https://rubinius.com/, and JRuby http://jruby.org/. Rubinius is an alternative implementation of Ruby written in Ruby. JRuby is an - implementation of Ruby on the JVM, short for Java Virtual Machine. + implementation of Ruby on the JVM, short for Java Virtual Machine. 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 + 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. @@ -147,20 +147,20 @@ GEMS REQUIRE AS - 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 + 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 + gem "byebug", :require => true - The argument defaults to the name of the gem. For example, these are + The argument defaults to the name of the gem. For example, these are identical: @@ -172,8 +172,8 @@ GEMS 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 + 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. @@ -183,7 +183,7 @@ GEMS - The Bundler runtime allows its two main methods, Bundler.setup and + The Bundler runtime allows its two main methods, Bundler.setup and Bundler.require, to limit their impact to particular groups. @@ -203,37 +203,33 @@ GEMS - 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. + The Bundler CLI allows you to specify a list of groups whose gems bun- + dle install should not install with the without configuration. + To specify multiple groups to ignore, specify a list of groups sepa- + rated by spaces. - bundle install --without test - bundle install --without development test + bundle config set without test + bundle config set 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 + 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 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 + 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 https://bundler.io/rationale.html. 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 + 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: @@ -256,7 +252,7 @@ GEMS mswin Windows - You can restrict further by platform and version for all platforms + You can restrict further by platform and version for all platforms except for rbx, jruby, truffleruby and mswin. To specify a version in addition to a platform, append the version num- @@ -290,12 +286,12 @@ GEMS - All operations involving groups (bundle install bundle-install.1.html, - Bundler.setup, Bundler.require) behave exactly the same as if any + All operations involving groups (bundle install bundle-install.1.html, + Bundler.setup, Bundler.require) behave exactly the same as if any groups not matching the current platform were explicitly excluded. SOURCE - You can select an alternate Rubygems repository for a gem using the + You can select an alternate Rubygems repository for a gem using the ':source' option. @@ -304,22 +300,22 @@ GEMS - 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 + 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 + it will fall back on global sources using the ordering described in SOURCE PRIORITY. - Selecting a specific source repository this way also suppresses the + Selecting a specific source repository this way also suppresses the ambiguous gem warning described above in GLOBAL SOURCES (#source). - Using the :source option for an individual gem will also make that - source available as a possible global source for any other gems which - do not specify explicit sources. Thus, when adding gems with explicit - sources, it is recommended that you also ensure all other gems in the + Using the :source option for an individual gem will also make that + source available as a possible global source for any other gems which + do not specify explicit sources. Thus, when adding gems with explicit + sources, it is recommended that you also ensure all other gems in the Gemfile are using explicit sources. GIT @@ -337,27 +333,27 @@ GEMS 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 + 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 + 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 + 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 + 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- + 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 + 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. @@ -368,34 +364,34 @@ GEMS - If a git repository does not have a .gemspec for the gem you attached + 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" + You MUST only specify at most one of these options. The default + is :branch => "master". For example: - For example: + gem "rails", :git => "https://github.com/rails/rails.git", + :branch => "5-0-stable" - git "https://github.com/rails/rails.git", :branch => "5-0-sta- - ble" do + gem "rails", :git => "https://github.com/rails/rails.git", :tag + => "v5.0.0" - git "https://github.com/rails/rails.git", :tag => "v5.0.0" do - - git "https://github.com/rails/rails.git", :ref => "4aded" do + gem "rails", :git => "https://github.com/rails/rails.git", :ref + => "4aded" submodules - For reference, a git submodule + For reference, a git submodule https://git-scm.com/book/en/v2/Git-Tools-Submodules lets you - have another git repository within a subfolder of your reposi- + have another git repository within a subfolder of your reposi- tory. Specify :submodules => true to cause bundler to expand any submodules 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- + 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. @@ -410,16 +406,16 @@ GEMS - To install a gem located in a git repository, bundler changes to the - directory containing the gemspec, runs gem build name.gemspec and then + 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 + with Rubygems, evaluates the .gemspec in the context of the directory in which it is located. 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 + 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: @@ -442,10 +438,10 @@ GEMS 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 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 + If the git repository you want to use is hosted on GitHub and is pub- + lic, you can use the :github shorthand to specify 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. @@ -468,7 +464,7 @@ GEMS 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 the gist identifier + public, you can use the :gist shorthand to specify the gist identifier (without the trailing ".git"). @@ -485,14 +481,14 @@ GEMS - Since the gist method is a specialization of git_source, it accepts a + Since the gist method is a specialization of git_source, it accepts a :branch named argument. BITBUCKET - If the git repository you want to use is hosted on Bitbucket and is - public, you can use the :bitbucket shorthand to specify 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 + If the git repository you want to use is hosted on Bitbucket and is + public, you can use the :bitbucket shorthand to specify 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. @@ -510,19 +506,19 @@ GEMS - Since the bitbucket method is a specialization of git_source, it + Since the bitbucket method is a specialization of git_source, it accepts a :branch named argument. PATH - You can specify that a gem is located in a particular location on the + 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, + 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 + Unlike :git, bundler does not compile C extensions for gems specified as paths. @@ -532,8 +528,8 @@ GEMS 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. + tem, you can set a global path option to the path containing the gem's + files. This will automatically load gemspec files from subdirectories. @@ -601,48 +597,48 @@ INSTALL_IF GEMSPEC - The .gemspec http://guides.rubygems.org/specification-reference/ file + The .gemspec http://guides.rubygems.org/specification-reference/ file is where you provide metadata about your gem to Rubygems. Some required - Gemspec attributes include the name, description, and homepage of your - gem. This is also where you specify the dependencies your gem needs to + Gemspec attributes include the name, description, and homepage of your + gem. This is also where you specify the dependencies your gem needs to run. 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- + 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- + 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 + 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 + 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. - When a gemspec dependency encounters version conflicts during resolu- - tion, the local version under development will always be selected -- - even if there are remote versions that better match other requirements + When a gemspec dependency encounters version conflicts during resolu- + tion, the local version under development will always be selected -- + even if there are remote versions that better match other requirements for the gemspec gem. SOURCE PRIORITY - When attempting to locate a gem to satisfy a gem requirement, bundler + 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 + 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 + 3. The sources specified via global source lines, searching each source in your Gemfile from last added to first added. @@ -650,4 +646,4 @@ SOURCE PRIORITY - April 2019 GEMFILE(5) + August 2019 GEMFILE(5) diff --git a/man/index.txt b/man/index.txt new file mode 100644 index 00000000000000..400eb0226786aa --- /dev/null +++ b/man/index.txt @@ -0,0 +1,25 @@ +Gemfile(5) gemfile.5 +bundle(1) bundle.1 +bundle-add(1) bundle-add.1 +bundle-binstubs(1) bundle-binstubs.1 +bundle-check(1) bundle-check.1 +bundle-clean(1) bundle-clean.1 +bundle-config(1) bundle-config.1 +bundle-doctor(1) bundle-doctor.1 +bundle-exec(1) bundle-exec.1 +bundle-gem(1) bundle-gem.1 +bundle-info(1) bundle-info.1 +bundle-init(1) bundle-init.1 +bundle-inject(1) bundle-inject.1 +bundle-install(1) bundle-install.1 +bundle-list(1) bundle-list.1 +bundle-lock(1) bundle-lock.1 +bundle-open(1) bundle-open.1 +bundle-outdated(1) bundle-outdated.1 +bundle-package(1) bundle-package.1 +bundle-platform(1) bundle-platform.1 +bundle-pristine(1) bundle-pristine.1 +bundle-remove(1) bundle-remove.1 +bundle-show(1) bundle-show.1 +bundle-update(1) bundle-update.1 +bundle-viz(1) bundle-viz.1 diff --git a/proc.c b/proc.c index 40628f1268e2be..810fe79c928aab 100644 --- a/proc.c +++ b/proc.c @@ -1935,8 +1935,10 @@ rb_mod_public_instance_method(VALUE mod, VALUE vid) * * Defines an instance method in the receiver. The _method_ * parameter can be a +Proc+, a +Method+ or an +UnboundMethod+ object. - * If a block is specified, it is used as the method body. This block - * is evaluated using #instance_eval. + * If a block is specified, it is used as the method body. + * If a block or the _method_ parameter has parameters, + * they're used as method parameters. + * This block is evaluated using #instance_eval. * * class A * def fred @@ -1946,6 +1948,7 @@ rb_mod_public_instance_method(VALUE mod, VALUE vid) * self.class.define_method(name, &block) * end * define_method(:wilma) { puts "Charge it!" } + * define_method(:flint) {|name| puts "I'm #{name}!"} * end * class B < A * define_method(:barney, instance_method(:fred)) @@ -1953,6 +1956,7 @@ rb_mod_public_instance_method(VALUE mod, VALUE vid) * a = B.new * a.barney * a.wilma + * a.flint('Dino') * a.create_method(:betty) { p self } * a.betty * @@ -1960,6 +1964,7 @@ rb_mod_public_instance_method(VALUE mod, VALUE vid) * * In Fred * Charge it! + * I'm Dino! * # */ @@ -2064,6 +2069,7 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod) * Defines a singleton method in the receiver. The _method_ * parameter can be a +Proc+, a +Method+ or an +UnboundMethod+ object. * If a block is specified, it is used as the method body. + * If a block or a method has parameters, they're used as method parameters. * * class A * class << self @@ -2080,6 +2086,10 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod) * guy = "Bob" * guy.define_singleton_method(:hello) { "#{self}: Hello there!" } * guy.hello #=> "Bob: Hello there!" + * + * chris = "Chris" + * chris.define_singleton_method(:greet) {|greeting| "#{greeting}, I'm Chris!" } + * chris.greet("Hi") #=> "Hi, I'm Chris!" */ static VALUE diff --git a/spec/bundler/bundler/build_metadata_spec.rb b/spec/bundler/bundler/build_metadata_spec.rb new file mode 100644 index 00000000000000..a28e25511a9132 --- /dev/null +++ b/spec/bundler/bundler/build_metadata_spec.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +require "bundler" +require "bundler/build_metadata" + +RSpec.describe Bundler::BuildMetadata do + describe "#built_at" do + it "returns %Y-%m-%d formatted time" do + expect(Bundler::BuildMetadata.built_at).to eq Time.now.strftime("%Y-%m-%d") + end + end + + describe "#release?" do + it "returns false as default" do + expect(Bundler::BuildMetadata.release?).to be_falsey + end + end + + describe "#git_commit_sha" do + context "if instance valuable is defined" do + before do + Bundler::BuildMetadata.instance_variable_set(:@git_commit_sha, "foo") + end + + after do + Bundler::BuildMetadata.remove_instance_variable(:@git_commit_sha) + end + + it "returns set value" do + expect(Bundler::BuildMetadata.git_commit_sha).to eq "foo" + end + end + end + + describe "#to_h" do + subject { Bundler::BuildMetadata.to_h } + + it "returns a hash includes Built At, Git SHA and Released Version" do + expect(subject["Built At"]).to eq Time.now.strftime("%Y-%m-%d") + expect(subject["Git SHA"]).to be_instance_of(String) + expect(subject["Released Version"]).to be_falsey + end + end +end diff --git a/spec/bundler/bundler/ruby_version_spec.rb b/spec/bundler/bundler/ruby_version_spec.rb index ef1a5fe57545fb..868d81088d0403 100644 --- a/spec/bundler/bundler/ruby_version_spec.rb +++ b/spec/bundler/bundler/ruby_version_spec.rb @@ -427,7 +427,7 @@ describe "#engine" do before { stub_const("RUBY_ENGINE", "jruby") } - before { stub_const("JRUBY_VERSION", "2.1.1") } + before { stub_const("RUBY_ENGINE_VERSION", "2.1.1") } it "should return a copy of the value of RUBY_ENGINE" do expect(subject.engine).to eq("jruby") @@ -438,37 +438,37 @@ describe "#engine_version" do context "engine is ruby" do before do - stub_const("RUBY_VERSION", "2.2.4") + stub_const("RUBY_ENGINE_VERSION", "2.2.4") stub_const("RUBY_ENGINE", "ruby") end - it "should return a copy of the value of RUBY_VERSION" do + it "should return a copy of the value of RUBY_ENGINE_VERSION" do expect(bundler_system_ruby_version.engine_versions).to eq(["2.2.4"]) - expect(bundler_system_ruby_version.engine_versions.first).to_not be(RUBY_VERSION) + expect(bundler_system_ruby_version.engine_versions.first).to_not be(RUBY_ENGINE_VERSION) end end context "engine is rbx" do before do stub_const("RUBY_ENGINE", "rbx") - stub_const("Rubinius::VERSION", "2.0.0") + stub_const("RUBY_ENGINE_VERSION", "2.0.0") end - it "should return a copy of the value of Rubinius::VERSION" do + it "should return a copy of the value of RUBY_ENGINE_VERSION" do expect(bundler_system_ruby_version.engine_versions).to eq(["2.0.0"]) - expect(bundler_system_ruby_version.engine_versions.first).to_not be(Rubinius::VERSION) + expect(bundler_system_ruby_version.engine_versions.first).to_not be(RUBY_ENGINE_VERSION) end end context "engine is jruby" do before do stub_const("RUBY_ENGINE", "jruby") - stub_const("JRUBY_VERSION", "2.1.1") + stub_const("RUBY_ENGINE_VERSION", "2.1.1") end - it "should return a copy of the value of JRUBY_VERSION" do + it "should return a copy of the value of RUBY_ENGINE_VERSION" do expect(subject.engine_versions).to eq(["2.1.1"]) - expect(bundler_system_ruby_version.engine_versions.first).to_not be(JRUBY_VERSION) + expect(bundler_system_ruby_version.engine_versions.first).to_not be(RUBY_ENGINE_VERSION) end end diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb index 44ab3f6016f2dc..bb13b1b0862fe9 100644 --- a/spec/bundler/commands/exec_spec.rb +++ b/spec/bundler/commands/exec_spec.rb @@ -840,23 +840,23 @@ def bin_path(a,b,c) end context "nested bundle exec" do - let(:system_gems_to_install) { super() << :bundler } - - context "with shared gems disabled" do + context "when bundle in a local path" do before do + system_gems :bundler + gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rack" G - bundle :install, :system_bundler => true, :path => "vendor/bundler" + bundle "config path vendor/bundler" + bundle! :install, :system_bundler => true end - it "overrides disable_shared_gems so bundler can be found", :ruby_repo do - system_gems :bundler + it "correctly shells out", :ruby_repo do file = bundled_app("file_that_bundle_execs.rb") create_file(file, <<-RB) #!#{Gem.ruby} - puts `#{system_bundle_bin_path} exec echo foo` + puts `bundle exec echo foo` RB file.chmod(0o777) bundle! "exec #{file}", :system_bundler => true diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb index 7b05bf3ed0ba8f..f4cd29edbcdf89 100644 --- a/spec/bundler/commands/newgem_spec.rb +++ b/spec/bundler/commands/newgem_spec.rb @@ -60,6 +60,42 @@ def gem_skeleton_assertions(gem_name) end end + describe "git repo initialization" do + let(:gem_name) { "test-gem" } + + shared_examples_for "a gem with an initial git repo" do + before do + execute_bundle_gem(gem_name, flags) + end + it "generates a gem skeleton with a .git folder" do + gem_skeleton_assertions(gem_name) + expect(bundled_app("test-gem/.git")).to exist + end + end + + context "when using the default" do + it_behaves_like "a gem with an initial git repo" do + let(:flags) { "" } + end + end + + context "when explicitly passing --git" do + it_behaves_like "a gem with an initial git repo" do + let(:flags) { "--git" } + end + end + + context "when passing --no-git" do + before do + execute_bundle_gem(gem_name, "--no-git") + end + it "generates a gem skeleton without a .git folder" do + gem_skeleton_assertions(gem_name) + expect(bundled_app("test-gem/.git")).not_to exist + end + end + end + shared_examples_for "--mit flag" do before do execute_bundle_gem(gem_name, "--mit") diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb index cfd85ac73f24b9..3f2e5bdfc30d61 100644 --- a/spec/bundler/install/gemfile/path_spec.rb +++ b/spec/bundler/install/gemfile/path_spec.rb @@ -83,6 +83,50 @@ end end + it "sorts paths consistently on install and update when they start with ./" do + build_lib "demo", :path => lib_path("demo") + build_lib "aaa", :path => lib_path("demo/aaa") + + gemfile = <<-G + gemspec + gem "aaa", :path => "./aaa" + G + + File.open(lib_path("demo/Gemfile"), "w") {|f| f.puts gemfile } + + lockfile = <<~L + PATH + remote: . + specs: + demo (1.0) + + PATH + remote: aaa + specs: + aaa (1.0) + + GEM + specs: + + PLATFORMS + #{lockfile_platforms} + + DEPENDENCIES + aaa! + demo! + + BUNDLED WITH + #{Bundler::VERSION} + L + + Dir.chdir(lib_path("demo")) do + bundle :install + expect(lib_path("demo/Gemfile.lock")).to have_lockfile(lockfile) + bundle :update, :all => true + expect(lib_path("demo/Gemfile.lock")).to have_lockfile(lockfile) + end + end + it "expands paths when comparing locked paths to Gemfile paths" do build_lib "foo", :path => bundled_app("foo-1.0") @@ -370,13 +414,13 @@ end it "works when the path does not have a gemspec but there is a lockfile" do - lockfile <<-L - PATH - remote: vendor/bar - specs: + lockfile <<~L + PATH + remote: vendor/bar + specs: - GEM - remote: http://rubygems.org + GEM + remote: http://rubygems.org L in_app_root { FileUtils.mkdir_p("vendor/bar") } diff --git a/spec/bundler/quality_spec.rb b/spec/bundler/quality_spec.rb index ebe85d17d2e4b3..7cd04fdc7541fa 100644 --- a/spec/bundler/quality_spec.rb +++ b/spec/bundler/quality_spec.rb @@ -105,7 +105,7 @@ def check_for_specific_pronouns(filename) end it "has no malformed whitespace" do - exempt = /\.gitmodules|\.marshal|fixtures|vendor|LICENSE|vcr_cassettes|rbreadline\.diff/ + exempt = /\.gitmodules|fixtures|vendor|LICENSE|vcr_cassettes|rbreadline\.diff|\.txt$/ error_messages = [] Dir.chdir(root) do files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler` : `git ls-files -z` @@ -132,7 +132,7 @@ def check_for_specific_pronouns(filename) end it "does not include any leftover debugging or development mechanisms" do - exempt = %r{quality_spec.rb|support/helpers|vcr_cassettes|\.md|\.ronn} + exempt = %r{quality_spec.rb|support/helpers|vcr_cassettes|\.md|\.ronn|\.txt|\.5|\.1} error_messages = [] Dir.chdir(root) do files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler` : `git ls-files -z` @@ -146,7 +146,7 @@ def check_for_specific_pronouns(filename) it "does not include any unresolved merge conflicts" do error_messages = [] - exempt = %r{lock/lockfile_(bundler_1_)?spec|quality_spec|vcr_cassettes|\.ronn|lockfile_parser\.rb} + exempt = %r{lock/lockfile_spec|quality_spec|vcr_cassettes|\.ronn|lockfile_parser\.rb} Dir.chdir(root) do files = ruby_core? ? `git ls-files -z -- lib/bundler lib/bundler.rb spec/bundler` : `git ls-files -z` files.split("\x0").each do |filename| @@ -253,9 +253,8 @@ def check_for_specific_pronouns(filename) it "ships the correct set of files", :ruby_repo do Dir.chdir(root) do - git_list = IO.popen("git ls-files -z", &:read).split("\x0").select {|f| f.match(%r{^(lib|exe)/}) } + git_list = IO.popen("git ls-files -z", &:read).split("\x0").select {|f| f.match(%r{^(lib|man|exe)/}) } git_list += %w[CHANGELOG.md LICENSE.md README.md bundler.gemspec] - git_list += Dir.glob("man/**/*") gem_list = Gem::Specification.load(gemspec.to_s).files diff --git a/spec/bundler/realworld/double_check_spec.rb b/spec/bundler/realworld/double_check_spec.rb index 6fee578a71ad51..07593ac4931202 100644 --- a/spec/bundler/realworld/double_check_spec.rb +++ b/spec/bundler/realworld/double_check_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "double checking sources", :realworld => true do +RSpec.describe "double checking sources", :realworld => true, :sometimes => true do it "finds already-installed gems" do create_file("rails.gemspec", <<-RUBY) Gem::Specification.new do |s| diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb index 995a269018f3f1..866f4862c58ca3 100644 --- a/spec/bundler/runtime/setup_spec.rb +++ b/spec/bundler/runtime/setup_spec.rb @@ -113,13 +113,8 @@ context "load order" do def clean_load_path(lp) without_bundler_load_path = ruby!("puts $LOAD_PATH").split("\n") - lp = lp - [ - bundler_path.to_s, - bundler_path.join("gems/bundler-#{Bundler::VERSION}/lib").to_s, - tmp("rubygems/lib").to_s, - root.join("../lib").expand_path.to_s, - ] - without_bundler_load_path - lp.map! {|p| p.sub(/^#{Regexp.union system_gem_path.to_s, default_bundle_path.to_s}/i, "") } + lp -= without_bundler_load_path + lp.map! {|p| p.sub(/^#{Regexp.union system_gem_path.to_s, default_bundle_path.to_s, bundler_path.to_s}/i, "") } end it "puts loaded gems after -I and RUBYLIB", :ruby_repo do @@ -147,6 +142,8 @@ def clean_load_path(lp) end it "orders the load path correctly when there are dependencies" do + system_gems :bundler + install_gemfile <<-G source "#{file_uri_for(gem_repo1)}" gem "rails" @@ -163,6 +160,7 @@ def clean_load_path(lp) expect(load_path).to start_with( "/gems/rails-2.3.2/lib", + "/gems/bundler-#{Bundler::VERSION}/lib", "/gems/activeresource-2.3.2/lib", "/gems/activerecord-2.3.2/lib", "/gems/actionpack-2.3.2/lib", diff --git a/spec/bundler/spec_helper.rb b/spec/bundler/spec_helper.rb index 182472ae34eed3..14df93a3da79d6 100644 --- a/spec/bundler/spec_helper.rb +++ b/spec/bundler/spec_helper.rb @@ -22,8 +22,6 @@ $debug = false -Spec::Manpages.setup unless Gem.win_platform? - module Gem def self.ruby=(ruby) @ruby = ruby @@ -73,8 +71,8 @@ def self.ruby=(ruby) config.filter_run_excluding :git => RequirementChecker.against(git_version) config.filter_run_excluding :bundler => RequirementChecker.against(Bundler::VERSION.split(".")[0]) config.filter_run_excluding :ruby_repo => !(ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]).nil? - config.filter_run_excluding :no_color_tty => Gem.win_platform? || !!ENV["GITHUB_ACTION"] - config.filter_run_excluding :github_action_linux => !!ENV["GITHUB_ACTION"] && (ENV["RUNNER_OS"] == "Linux") + config.filter_run_excluding :no_color_tty => Gem.win_platform? || !ENV["GITHUB_ACTION"].nil? + config.filter_run_excluding :github_action_linux => !ENV["GITHUB_ACTION"].nil? && (ENV["RUNNER_OS"] == "Linux") config.filter_run_when_matching :focus unless ENV["CI"] diff --git a/spec/bundler/support/artifice/endpoint.rb b/spec/bundler/support/artifice/endpoint.rb index fcced6ea3596da..d9e9e0ae0a577b 100644 --- a/spec/bundler/support/artifice/endpoint.rb +++ b/spec/bundler/support/artifice/endpoint.rb @@ -4,7 +4,8 @@ require Spec::Path.root.join("lib/bundler/deprecate") include Spec::Path -$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gems.join("gems/{artifice,rack,tilt,sinatra}-*/lib")].map(&:to_s)) +$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gems.join("gems/{artifice,mustermann,rack,tilt,sinatra}-*/lib")].map(&:to_s)) + require "artifice" require "sinatra/base" diff --git a/spec/bundler/support/artifice/endpoint_500.rb b/spec/bundler/support/artifice/endpoint_500.rb index 202ccfc8297778..ad51d58e67a625 100644 --- a/spec/bundler/support/artifice/endpoint_500.rb +++ b/spec/bundler/support/artifice/endpoint_500.rb @@ -3,7 +3,7 @@ require File.expand_path("../../path.rb", __FILE__) include Spec::Path -$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gems.join("gems/{artifice,rack,tilt,sinatra}-*/lib")].map(&:to_s)) +$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gems.join("gems/{artifice,mustermann,rack,tilt,sinatra}-*/lib")].map(&:to_s)) require "artifice" require "sinatra/base" diff --git a/spec/bundler/support/artifice/windows.rb b/spec/bundler/support/artifice/windows.rb index f39b2c6d53dc3e..0630798df03634 100644 --- a/spec/bundler/support/artifice/windows.rb +++ b/spec/bundler/support/artifice/windows.rb @@ -3,10 +3,8 @@ require File.expand_path("../../path.rb", __FILE__) include Spec::Path -$LOAD_PATH.unshift Dir[base_system_gems.join("gems/artifice*/lib")].first.to_s -$LOAD_PATH.unshift(*Dir[base_system_gems.join("gems/rack-*/lib")]) -$LOAD_PATH.unshift Dir[base_system_gems.join("gems/tilt*/lib")].first.to_s -$LOAD_PATH.unshift Dir[base_system_gems.join("gems/sinatra*/lib")].first.to_s +$LOAD_PATH.unshift(*Dir[Spec::Path.base_system_gems.join("gems/{artifice,mustermann,rack,tilt,sinatra}-*/lib")].map(&:to_s)) + require "artifice" require "sinatra/base" diff --git a/spec/bundler/support/hax.rb b/spec/bundler/support/hax.rb index 74daccc9dba0ae..4f8d9b89ec7c98 100644 --- a/spec/bundler/support/hax.rb +++ b/spec/bundler/support/hax.rb @@ -53,9 +53,7 @@ class Object remove_const :RUBY_ENGINE RUBY_ENGINE = ENV["BUNDLER_SPEC_RUBY_ENGINE"] - if RUBY_ENGINE == "jruby" - remove_const :JRUBY_VERSION if defined?(JRUBY_VERSION) - JRUBY_VERSION = ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"] - end + remove_const :RUBY_ENGINE_VERSION + RUBY_ENGINE_VERSION = ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"] end end diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb index 2445b566aac9a9..02ec3c790b8b7c 100644 --- a/spec/bundler/support/helpers.rb +++ b/spec/bundler/support/helpers.rb @@ -110,7 +110,7 @@ def bundle(cmd, options = {}) bundle_bin = options.delete("bundle_bin") || bindir.join("bundle") if system_bundler = options.delete(:system_bundler) - bundle_bin = system_bundle_bin_path + bundle_bin = system_gem_path.join("bin/bundler") end env = options.delete(:env) || {} diff --git a/spec/bundler/support/manpages.rb b/spec/bundler/support/manpages.rb deleted file mode 100644 index ce1f72cc497ade..00000000000000 --- a/spec/bundler/support/manpages.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -module Spec - module Manpages - def self.setup - man_path = Spec::Path.root.join("man") - return if man_path.children(false).select {|file| file.extname == ".ronn" }.all? do |man| - Dir[man_path.join("#{man.to_s[0..-6]}*.txt").to_s].any? - end - - system(Spec::Path.root.join("bin", "rake").to_s, "man:build") || raise("Failed building man pages") - end - end -end diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb index aa06a3f04746f6..b722ec498be043 100644 --- a/spec/bundler/support/path.rb +++ b/spec/bundler/support/path.rb @@ -100,10 +100,6 @@ def system_gem_path(*path) tmp("gems/system", *path) end - def system_bundle_bin_path - system_gem_path("bin/bundle") - end - def lib_path(*args) tmp("libs", *args) end diff --git a/spec/bundler/support/platforms.rb b/spec/bundler/support/platforms.rb index 153704e666ec23..f4d63c8dedad7a 100644 --- a/spec/bundler/support/platforms.rb +++ b/spec/bundler/support/platforms.rb @@ -71,16 +71,7 @@ def local_ruby_engine def local_engine_version return ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"] if ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"] - case local_ruby_engine - when "ruby" - RUBY_VERSION - when "rbx" - Rubinius::VERSION - when "jruby" - JRUBY_VERSION - else - RUBY_ENGINE_VERSION - end + RUBY_ENGINE_VERSION end def not_local_engine_version diff --git a/spec/bundler/support/rubygems_ext.rb b/spec/bundler/support/rubygems_ext.rb index b97b5278ce92d5..6ca51bee169c02 100644 --- a/spec/bundler/support/rubygems_ext.rb +++ b/spec/bundler/support/rubygems_ext.rb @@ -10,18 +10,17 @@ module Rubygems "automatiek" => "~> 0.2.0", "rake" => "~> 12.0", "ronn" => "~> 0.7.3", - "rspec" => "~> 3.6", + "rspec" => "~> 3.8", "rubocop" => "= 0.74.0", "rubocop-performance" => "= 1.4.0", }.freeze DEPS = { - # artifice doesn't support rack 2.x now. - "rack" => "< 2.0", + "rack" => "~> 2.0", "rack-test" => "~> 1.1", "artifice" => "~> 0.6.0", "compact_index" => "~> 0.11.0", - "sinatra" => "~> 1.4.7", + "sinatra" => "~> 2.0", # Rake version has to be consistent for tests to pass "rake" => "12.3.2", "builder" => "~> 3.2", diff --git a/test/irb/test_context.rb b/test/irb/test_context.rb index df9edcc63f0e8d..d58477c84eea8f 100644 --- a/test/irb/test_context.rb +++ b/test/irb/test_context.rb @@ -26,6 +26,10 @@ def eof? def encoding Encoding.default_external end + + def reset + @line_no = 0 + end end def setup @@ -84,5 +88,127 @@ def test_eval_input def test_default_config assert_equal(true, @context.use_colorize?) end + + def test_assignment_expression + input = TestInputMethod.new + irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new), input) + [ + "foo = bar", + "@foo = bar", + "$foo = bar", + "@@foo = bar", + "::Foo = bar", + "a::Foo = bar", + "Foo = bar", + "foo.bar = 1", + "foo[1] = bar", + "foo += bar", + "foo -= bar", + "foo ||= bar", + "foo &&= bar", + "foo, bar = 1, 2", + "foo.bar=(1)", + "foo; foo = bar", + "foo; foo = bar; ;\n ;", + "foo\nfoo = bar", + ].each do |exp| + assert( + irb.assignment_expression?(exp), + "#{exp.inspect}: should be an assignment expression" + ) + end + + [ + "foo", + "foo.bar", + "foo[0]", + "foo = bar; foo", + "foo = bar\nfoo", + ].each do |exp| + refute( + irb.assignment_expression?(exp), + "#{exp.inspect}: should not be an assignment expression" + ) + end + end + + def test_echo_on_assignment + input = TestInputMethod.new([ + "a = 1\n", + "a\n", + "a, b = 2, 3\n", + "a\n", + "b\n", + "b = 4\n", + "_\n" + ]) + irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new), input) + irb.context.return_format = "=> %s\n" + + # The default + irb.context.echo = true + irb.context.echo_on_assignment = false + out, err = capture_io do + irb.eval_input + end + assert_empty err + assert_equal("=> 1\n=> 2\n=> 3\n=> 4\n", out) + + # Everything is output, like before echo_on_assignment was introduced + input.reset + irb.context.echo = true + irb.context.echo_on_assignment = true + out, err = capture_io do + irb.eval_input + end + assert_empty err + assert_equal("=> 1\n=> 1\n=> [2, 3]\n=> 2\n=> 3\n=> 4\n=> 4\n", out) + + # Nothing is output when echo is false + input.reset + irb.context.echo = false + irb.context.echo_on_assignment = false + out, err = capture_io do + irb.eval_input + end + assert_empty err + assert_equal("", out) + + # Nothing is output when echo is false even if echo_on_assignment is true + input.reset + irb.context.echo = false + irb.context.echo_on_assignment = true + out, err = capture_io do + irb.eval_input + end + assert_empty err + assert_equal("", out) + end + + def test_echo_on_assignment_conf + # Default + IRB.conf[:ECHO] = nil + IRB.conf[:ECHO_ON_ASSIGNMENT] = nil + input = TestInputMethod.new() + irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new), input) + + assert(irb.context.echo?, "echo? should be true by default") + refute(irb.context.echo_on_assignment?, "echo_on_assignment? should be false by default") + + # Explicitly set :ECHO to false + IRB.conf[:ECHO] = false + irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new), input) + + refute(irb.context.echo?, "echo? should be false when IRB.conf[:ECHO] is set to false") + refute(irb.context.echo_on_assignment?, "echo_on_assignment? should be false by default") + + # Explicitly set :ECHO_ON_ASSIGNMENT to true + IRB.conf[:ECHO] = nil + IRB.conf[:ECHO_ON_ASSIGNMENT] = true + irb = IRB::Irb.new(IRB::WorkSpace.new(Object.new), input) + + assert(irb.context.echo?, "echo? should be true by default") + assert(irb.context.echo_on_assignment?, "echo_on_assignment? should be true when IRB.conf[:ECHO_ON_ASSIGNMENT] is set to true") + end end end diff --git a/test/irb/test_raise_no_backtrace_exception.rb b/test/irb/test_raise_no_backtrace_exception.rb index e92d8dc9705fa0..2174600082016c 100644 --- a/test/irb/test_raise_no_backtrace_exception.rb +++ b/test/irb/test_raise_no_backtrace_exception.rb @@ -7,6 +7,7 @@ def test_raise_exception bundle_exec = ENV.key?('BUNDLE_GEMFILE') ? ['-rbundler/setup'] : [] assert_in_out_err(bundle_exec + %w[-rirb -W0 -e IRB.start(__FILE__) -- -f --], <<-IRB, /Exception: foo/, []) e = Exception.new("foo") + puts e.inspect def e.backtrace; nil; end raise e IRB diff --git a/test/rdoc/minitest_helper.rb b/test/rdoc/helper.rb similarity index 94% rename from test/rdoc/minitest_helper.rb rename to test/rdoc/helper.rb index 50e41ebdd2b1c8..a9004919878426 100644 --- a/test/rdoc/minitest_helper.rb +++ b/test/rdoc/helper.rb @@ -1,13 +1,12 @@ # frozen_string_literal: true require 'bundler/errors' begin - gem 'minitest', '~> 5.0' + gem 'test-unit' rescue NoMethodError, Gem::LoadError, Bundler::GemfileNotFound # for ruby tests end -require 'minitest/autorun' -require 'minitest/benchmark' unless ENV['NOBENCHMARK'] +require 'test/unit' require 'fileutils' require 'pp' @@ -30,7 +29,7 @@ # * @pwd containing the current working directory # * FileUtils, pp, Tempfile, Dir.tmpdir and StringIO -class RDoc::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Unit::TestCase) +class RDoc::TestCase < Test::Unit::TestCase ## # Abstract test-case setup diff --git a/test/rdoc/test_rdoc_any_method.rb b/test/rdoc/test_rdoc_any_method.rb index 6dd46b0b462e83..615789dfb35b21 100644 --- a/test/rdoc/test_rdoc_any_method.rb +++ b/test/rdoc/test_rdoc_any_method.rb @@ -78,7 +78,7 @@ def test_markup_code ] @c2_a.collect_tokens - @c2_a.add_tokens(*tokens) + @c2_a.add_tokens(tokens) expected = 'CONSTANT' @@ -96,7 +96,7 @@ def test_markup_code_with_line_numbers ] @c2_a.collect_tokens - @c2_a.add_tokens(*tokens) + @c2_a.add_tokens(tokens) assert_equal <<-EXPECTED.chomp, @c2_a.markup_code # File xref_data.rb, line 1 diff --git a/test/rdoc/test_rdoc_attr.rb b/test/rdoc/test_rdoc_attr.rb index 5910c0fad331ab..cff52acf31b028 100644 --- a/test/rdoc/test_rdoc_attr.rb +++ b/test/rdoc/test_rdoc_attr.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocAttr < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_comment.rb b/test/rdoc/test_rdoc_comment.rb index 48d0042f16143d..d3c16bcecac269 100644 --- a/test/rdoc/test_rdoc_comment.rb +++ b/test/rdoc/test_rdoc_comment.rb @@ -1,7 +1,7 @@ # coding: us-ascii # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocComment < RDoc::TestCase @@ -294,7 +294,7 @@ def test_text_equals_no_text c = RDoc::Comment.new nil, @top_level c.document = @RM::Document.new - e = assert_raises RDoc::Error do + e = assert_raise RDoc::Error do c.text = 'other' end diff --git a/test/rdoc/test_rdoc_context_section.rb b/test/rdoc/test_rdoc_context_section.rb index ede676006730b7..c520ad05a56504 100644 --- a/test/rdoc/test_rdoc_context_section.rb +++ b/test/rdoc/test_rdoc_context_section.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocContextSection < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_encoding.rb b/test/rdoc/test_rdoc_encoding.rb index 02b31cf872b66e..58536b035e3a1a 100644 --- a/test/rdoc/test_rdoc_encoding.rb +++ b/test/rdoc/test_rdoc_encoding.rb @@ -1,7 +1,7 @@ # coding: US-ASCII # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocEncoding < RDoc::TestCase @@ -171,7 +171,7 @@ def test_class_set_encoding_bad assert_nil encoding - assert_raises ArgumentError do + assert_raise ArgumentError do s = RDoc::Encoding.detect_encoding "# -*- encoding: undecided -*-\n" end end diff --git a/test/rdoc/test_rdoc_generator_darkfish.rb b/test/rdoc/test_rdoc_generator_darkfish.rb index edabe4fad45616..f5858bce6e6dfb 100644 --- a/test/rdoc/test_rdoc_generator_darkfish.rb +++ b/test/rdoc/test_rdoc_generator_darkfish.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocGeneratorDarkfish < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_generator_json_index.rb b/test/rdoc/test_rdoc_generator_json_index.rb index 3281cac304161a..6a95acef73cf00 100644 --- a/test/rdoc/test_rdoc_generator_json_index.rb +++ b/test/rdoc/test_rdoc_generator_json_index.rb @@ -1,7 +1,7 @@ # coding: US-ASCII # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocGeneratorJsonIndex < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_generator_markup.rb b/test/rdoc/test_rdoc_generator_markup.rb index 5588d9c5f0b429..5491b7c61e6b21 100644 --- a/test/rdoc/test_rdoc_generator_markup.rb +++ b/test/rdoc/test_rdoc_generator_markup.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocGeneratorMarkup < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_generator_pot.rb b/test/rdoc/test_rdoc_generator_pot.rb index 26641345efd0c5..bafe9ecca56f9f 100644 --- a/test/rdoc/test_rdoc_generator_pot.rb +++ b/test/rdoc/test_rdoc_generator_pot.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocGeneratorPOT < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_generator_pot_po.rb b/test/rdoc/test_rdoc_generator_pot_po.rb index c50899d4469570..7696a1f5b1f1bb 100644 --- a/test/rdoc/test_rdoc_generator_pot_po.rb +++ b/test/rdoc/test_rdoc_generator_pot_po.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocGeneratorPOTPO < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_generator_pot_po_entry.rb b/test/rdoc/test_rdoc_generator_pot_po_entry.rb index f3bf329348bf21..d3d6271b233913 100644 --- a/test/rdoc/test_rdoc_generator_pot_po_entry.rb +++ b/test/rdoc/test_rdoc_generator_pot_po_entry.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocGeneratorPOTPOEntry < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_generator_ri.rb b/test/rdoc/test_rdoc_generator_ri.rb index a33f5ca2ac3da7..195c0d24821346 100644 --- a/test/rdoc/test_rdoc_generator_ri.rb +++ b/test/rdoc/test_rdoc_generator_ri.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocGeneratorRI < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_i18n_locale.rb b/test/rdoc/test_rdoc_i18n_locale.rb index c936a7219fc878..43fd7e2197674f 100644 --- a/test/rdoc/test_rdoc_i18n_locale.rb +++ b/test/rdoc/test_rdoc_i18n_locale.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocI18nLocale < RDoc::TestCase @@ -23,9 +23,9 @@ def test_name end def test_load_nonexistent_po - File.stub(:exist?, false) do - refute @locale.load('nonexsitent-locale') - end + locale = File.join(@locale_dir, 'nonexsitent-locale') + refute_file locale + refute @locale.load(locale) end def test_load_existent_po diff --git a/test/rdoc/test_rdoc_i18n_text.rb b/test/rdoc/test_rdoc_i18n_text.rb index beb9f307a7a8ce..89b7e97708a4a4 100644 --- a/test/rdoc/test_rdoc_i18n_text.rb +++ b/test/rdoc/test_rdoc_i18n_text.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocI18nText < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_markdown.rb b/test/rdoc/test_rdoc_markdown.rb index 8b58150f8a2b79..021d94297be014 100644 --- a/test/rdoc/test_rdoc_markdown.rb +++ b/test/rdoc/test_rdoc_markdown.rb @@ -1,7 +1,7 @@ # coding: UTF-8 # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' require 'rdoc/markup/block_quote' require 'rdoc/markdown' @@ -717,7 +717,7 @@ def test_parse_note_inline def test_parse_note_no_notes @parser.notes = false - assert_raises RDoc::Markdown::ParseError do + assert_raise RDoc::Markdown::ParseError do parse "Some text.[^1]" end end diff --git a/test/rdoc/test_rdoc_markdown_test.rb b/test/rdoc/test_rdoc_markdown_test.rb index 6445fb5e654792..fff68818b5f551 100644 --- a/test/rdoc/test_rdoc_markdown_test.rb +++ b/test/rdoc/test_rdoc_markdown_test.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' require 'pp' require 'rdoc' diff --git a/test/rdoc/test_rdoc_markup.rb b/test/rdoc/test_rdoc_markup.rb index 2812a2994f5996..b9bdafab2a43b0 100644 --- a/test/rdoc/test_rdoc_markup.rb +++ b/test/rdoc/test_rdoc_markup.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkup < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_markup_attribute_manager.rb b/test/rdoc/test_rdoc_markup_attribute_manager.rb index d6eccdf76f2bc2..024dcc18a1f302 100644 --- a/test/rdoc/test_rdoc_markup_attribute_manager.rb +++ b/test/rdoc/test_rdoc_markup_attribute_manager.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupAttributeManager < RDoc::TestCase @@ -75,7 +75,7 @@ def test_add_word_pair end def test_add_word_pair_angle - e = assert_raises ArgumentError do + e = assert_raise ArgumentError do @am.add_word_pair '<', '>', 'angles' end @@ -83,7 +83,7 @@ def test_add_word_pair_angle end def test_add_word_pair_invalid - assert_raises ArgumentError do + assert_raise ArgumentError do @am.add_word_pair("<", "<", :TEST) end end diff --git a/test/rdoc/test_rdoc_markup_attributes.rb b/test/rdoc/test_rdoc_markup_attributes.rb index e592fa7145d981..0dfd72bdb69586 100644 --- a/test/rdoc/test_rdoc_markup_attributes.rb +++ b/test/rdoc/test_rdoc_markup_attributes.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupAttributes < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_markup_document.rb b/test/rdoc/test_rdoc_markup_document.rb index 82029162386688..3db834b85d404a 100644 --- a/test/rdoc/test_rdoc_markup_document.rb +++ b/test/rdoc/test_rdoc_markup_document.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupDocument < RDoc::TestCase @@ -34,7 +34,7 @@ def test_append_string assert_empty @d - assert_raises ArgumentError do + assert_raise ArgumentError do @d << 'hi' end end diff --git a/test/rdoc/test_rdoc_markup_formatter.rb b/test/rdoc/test_rdoc_markup_formatter.rb index cdc5944cdf4df5..8702db379df7e9 100644 --- a/test/rdoc/test_rdoc_markup_formatter.rb +++ b/test/rdoc/test_rdoc_markup_formatter.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupFormatter < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_markup_hard_break.rb b/test/rdoc/test_rdoc_markup_hard_break.rb index 1d6c8927b5881b..adebfdc311d4eb 100644 --- a/test/rdoc/test_rdoc_markup_hard_break.rb +++ b/test/rdoc/test_rdoc_markup_hard_break.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupHardBreak < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_markup_heading.rb b/test/rdoc/test_rdoc_markup_heading.rb index 4508561a791815..05a8e005ba5c44 100644 --- a/test/rdoc/test_rdoc_markup_heading.rb +++ b/test/rdoc/test_rdoc_markup_heading.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupHeading < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_markup_include.rb b/test/rdoc/test_rdoc_markup_include.rb index 6b2d57028608a2..9126526b737617 100644 --- a/test/rdoc/test_rdoc_markup_include.rb +++ b/test/rdoc/test_rdoc_markup_include.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupInclude < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_markup_indented_paragraph.rb b/test/rdoc/test_rdoc_markup_indented_paragraph.rb index 06dcb2535776a2..7b5758998f523f 100644 --- a/test/rdoc/test_rdoc_markup_indented_paragraph.rb +++ b/test/rdoc/test_rdoc_markup_indented_paragraph.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupIndentedParagraph < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_markup_paragraph.rb b/test/rdoc/test_rdoc_markup_paragraph.rb index 00e4320119ab0d..ca89a74fc39855 100644 --- a/test/rdoc/test_rdoc_markup_paragraph.rb +++ b/test/rdoc/test_rdoc_markup_paragraph.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupParagraph < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_markup_parser.rb b/test/rdoc/test_rdoc_markup_parser.rb index 344d67df3981fc..6fccf09612ca54 100644 --- a/test/rdoc/test_rdoc_markup_parser.rb +++ b/test/rdoc/test_rdoc_markup_parser.rb @@ -1,7 +1,7 @@ # coding: utf-8 # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupParser < RDoc::TestCase @@ -22,15 +22,6 @@ def test_build_heading assert_equal @RM::Heading.new(3, 'heading three'), parser.build_heading(3) end - def test_char_pos - parser = @RMP.new - s = parser.setup_scanner 'cät' - - s.scan(/\S+/) - - assert_equal 3, parser.char_pos(s.pos) - end - def test_get parser = util_parser @@ -700,7 +691,6 @@ def test_parse_ualpha def test_parse_trailing_cr expected = [ @RM::Paragraph.new('Text') ] - # FIXME hangs the parser: assert_equal expected, @RMP.parse("Text\r").parts end @@ -1097,7 +1087,7 @@ def test_skip assert_equal [:NEWLINE, "\n", 9, 0], parser.peek_token - assert_raises RDoc::Markup::Parser::ParseError do + assert_raise RDoc::Markup::Parser::ParseError do parser.skip :NONE end @@ -1647,15 +1637,6 @@ def test_tokenize_verbatim_rule_fancy assert_equal expected, @RMP.tokenize(str) end - def test_token_pos - parser = @RMP.new - s = parser.setup_scanner 'cät' - - s.scan(/\S+/) - - assert_equal [3, 0], parser.token_pos(s.pos) - end - # HACK move to Verbatim test case def test_verbatim_normalize v = @RM::Verbatim.new "foo\n", "\n", "\n", "bar\n" @@ -1680,7 +1661,7 @@ def test_unget assert_equal [:HEADER, 1, 0, 0], parser.peek_token - assert_raises @RMP::Error do + assert_raise @RMP::Error do parser.unget end diff --git a/test/rdoc/test_rdoc_markup_pre_process.rb b/test/rdoc/test_rdoc_markup_pre_process.rb index 000268aee592d2..cc5bdc3abf390e 100644 --- a/test/rdoc/test_rdoc_markup_pre_process.rb +++ b/test/rdoc/test_rdoc_markup_pre_process.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupPreProcess < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_markup_raw.rb b/test/rdoc/test_rdoc_markup_raw.rb index 95de62208a4d09..c7795b24e1a9a9 100644 --- a/test/rdoc/test_rdoc_markup_raw.rb +++ b/test/rdoc/test_rdoc_markup_raw.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupRaw < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_markup_to_ansi.rb b/test/rdoc/test_rdoc_markup_to_ansi.rb index 4c312e797220f0..1d1fc7db467acd 100644 --- a/test/rdoc/test_rdoc_markup_to_ansi.rb +++ b/test/rdoc/test_rdoc_markup_to_ansi.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupToAnsi < RDoc::Markup::TextFormatterTestCase diff --git a/test/rdoc/test_rdoc_markup_to_bs.rb b/test/rdoc/test_rdoc_markup_to_bs.rb index f26979035724c0..7ebde481e63ba9 100644 --- a/test/rdoc/test_rdoc_markup_to_bs.rb +++ b/test/rdoc/test_rdoc_markup_to_bs.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupToBs < RDoc::Markup::TextFormatterTestCase diff --git a/test/rdoc/test_rdoc_markup_to_html.rb b/test/rdoc/test_rdoc_markup_to_html.rb index c30c89a7e3b0f9..fb94269064935b 100644 --- a/test/rdoc/test_rdoc_markup_to_html.rb +++ b/test/rdoc/test_rdoc_markup_to_html.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase diff --git a/test/rdoc/test_rdoc_markup_to_html_crossref.rb b/test/rdoc/test_rdoc_markup_to_html_crossref.rb index 3d80980791a342..bac2569f87840f 100644 --- a/test/rdoc/test_rdoc_markup_to_html_crossref.rb +++ b/test/rdoc/test_rdoc_markup_to_html_crossref.rb @@ -26,6 +26,11 @@ def test_convert_CROSSREF_label result end + def test_convert_CROSSREF_label_for_md + result = @to.convert 'EXAMPLE@foo' + assert_equal para("foo at EXAMPLE"), result + end + def test_convert_CROSSREF_label_period result = @to.convert 'C1@foo.' assert_equal para("foo at C1."), result diff --git a/test/rdoc/test_rdoc_markup_to_html_snippet.rb b/test/rdoc/test_rdoc_markup_to_html_snippet.rb index 7e01413ddacd75..94f58b652939bc 100644 --- a/test/rdoc/test_rdoc_markup_to_html_snippet.rb +++ b/test/rdoc/test_rdoc_markup_to_html_snippet.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupToHtmlSnippet < RDoc::Markup::FormatterTestCase diff --git a/test/rdoc/test_rdoc_markup_to_joined_paragraph.rb b/test/rdoc/test_rdoc_markup_to_joined_paragraph.rb index b4eed5f601b2e1..cbaf75a04e1bda 100644 --- a/test/rdoc/test_rdoc_markup_to_joined_paragraph.rb +++ b/test/rdoc/test_rdoc_markup_to_joined_paragraph.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupToJoinedParagraph < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_markup_to_label.rb b/test/rdoc/test_rdoc_markup_to_label.rb index b869745528d8b3..70ea7f0f1b6a41 100644 --- a/test/rdoc/test_rdoc_markup_to_label.rb +++ b/test/rdoc/test_rdoc_markup_to_label.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupToLabel < RDoc::Markup::FormatterTestCase diff --git a/test/rdoc/test_rdoc_markup_to_markdown.rb b/test/rdoc/test_rdoc_markup_to_markdown.rb index 9c5b6d3e574e8b..4d3a0053812955 100644 --- a/test/rdoc/test_rdoc_markup_to_markdown.rb +++ b/test/rdoc/test_rdoc_markup_to_markdown.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupToMarkdown < RDoc::Markup::TextFormatterTestCase diff --git a/test/rdoc/test_rdoc_markup_to_rdoc.rb b/test/rdoc/test_rdoc_markup_to_rdoc.rb index e81bc2f1adb2c8..1d833b156a0ce7 100644 --- a/test/rdoc/test_rdoc_markup_to_rdoc.rb +++ b/test/rdoc/test_rdoc_markup_to_rdoc.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupToRDoc < RDoc::Markup::TextFormatterTestCase diff --git a/test/rdoc/test_rdoc_markup_to_table_of_contents.rb b/test/rdoc/test_rdoc_markup_to_table_of_contents.rb index bfeb2d6f58baf5..11ab6f197bb08f 100644 --- a/test/rdoc/test_rdoc_markup_to_table_of_contents.rb +++ b/test/rdoc/test_rdoc_markup_to_table_of_contents.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupToTableOfContents < RDoc::Markup::FormatterTestCase diff --git a/test/rdoc/test_rdoc_markup_to_tt_only.rb b/test/rdoc/test_rdoc_markup_to_tt_only.rb index 856eb592c5635c..8508f823df75d9 100644 --- a/test/rdoc/test_rdoc_markup_to_tt_only.rb +++ b/test/rdoc/test_rdoc_markup_to_tt_only.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupToTtOnly < RDoc::Markup::FormatterTestCase diff --git a/test/rdoc/test_rdoc_markup_verbatim.rb b/test/rdoc/test_rdoc_markup_verbatim.rb index 88ca4906bbde95..1a650c44efab6f 100644 --- a/test/rdoc/test_rdoc_markup_verbatim.rb +++ b/test/rdoc/test_rdoc_markup_verbatim.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocMarkupVerbatim < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_options.rb b/test/rdoc/test_rdoc_options.rb index 9f417133123628..0bc6eaa9f1148c 100644 --- a/test/rdoc/test_rdoc_options.rb +++ b/test/rdoc/test_rdoc_options.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocOptions < RDoc::TestCase @@ -288,7 +288,7 @@ def test_parse_encoding_invalid end def test_parse_formatter - e = assert_raises OptionParser::InvalidOption do + e = assert_raise OptionParser::InvalidOption do @options.parse %w[--format darkfish --format ri] end @@ -297,7 +297,7 @@ def test_parse_formatter end def test_parse_formatter_ri - e = assert_raises OptionParser::InvalidOption do + e = assert_raise OptionParser::InvalidOption do @options.parse %w[--format darkfish --ri] end @@ -306,7 +306,7 @@ def test_parse_formatter_ri @options = RDoc::Options.new - e = assert_raises OptionParser::InvalidOption do + e = assert_raise OptionParser::InvalidOption do @options.parse %w[--format darkfish -r] end @@ -315,7 +315,7 @@ def test_parse_formatter_ri end def test_parse_formatter_ri_site - e = assert_raises OptionParser::InvalidOption do + e = assert_raise OptionParser::InvalidOption do @options.parse %w[--format darkfish --ri-site] end @@ -324,7 +324,7 @@ def test_parse_formatter_ri_site @options = RDoc::Options.new - e = assert_raises OptionParser::InvalidOption do + e = assert_raise OptionParser::InvalidOption do @options.parse %w[--format darkfish -R] end @@ -417,7 +417,7 @@ def test_parse_ignore_invalid_default def test_parse_ignore_invalid_no out, err = capture_output do - assert_raises SystemExit do + assert_raise SystemExit do @options.parse %w[--no-ignore-invalid --bogus=arg --bobogus --visibility=extended] end end @@ -430,7 +430,7 @@ def test_parse_ignore_invalid_no def test_parse_ignore_invalid_no_quiet out, err = capture_output do - assert_raises SystemExit do + assert_raise SystemExit do @options.parse %w[--quiet --no-ignore-invalid --bogus=arg --bobogus --visibility=extended] end end @@ -631,7 +631,7 @@ def test_parse_write_options FileUtils.mkdir_p tmpdir Dir.chdir tmpdir do - e = assert_raises SystemExit do + e = assert_raise SystemExit do @options.parse %w[--write-options] end diff --git a/test/rdoc/test_rdoc_parser.rb b/test/rdoc/test_rdoc_parser.rb index 45978ba56f4985..57b8e01a87b019 100644 --- a/test/rdoc/test_rdoc_parser.rb +++ b/test/rdoc/test_rdoc_parser.rb @@ -1,7 +1,7 @@ # -*- coding: us-ascii -*- # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocParser < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_parser_c.rb b/test/rdoc/test_rdoc_parser_c.rb index 863cec5838b6d5..6601d28f6068bf 100644 --- a/test/rdoc/test_rdoc_parser_c.rb +++ b/test/rdoc/test_rdoc_parser_c.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' =begin TODO: test call-seq parsing @@ -304,32 +304,6 @@ def test_do_aliases_singleton assert_equal 'This should show up as an alias', methods.last.comment.text end - def test_do_classes_boot_class - content = <<-EOF -/* Document-class: Foo - * this is the Foo boot class - */ -VALUE cFoo = boot_defclass("Foo", rb_cObject); - EOF - - klass = util_get_class content, 'cFoo' - assert_equal "this is the Foo boot class", klass.comment.text - assert_equal 'Object', klass.superclass - end - - def test_do_classes_boot_class_nil - content = <<-EOF -/* Document-class: Foo - * this is the Foo boot class - */ -VALUE cFoo = boot_defclass("Foo", 0); - EOF - - klass = util_get_class content, 'cFoo' - assert_equal "this is the Foo boot class", klass.comment.text - assert_nil klass.superclass - end - def test_do_aliases_missing_class content = <<-EOF void Init_Blah(void) { @@ -511,7 +485,7 @@ def test_do_constants @parser = util_parser content - @parser.do_classes + @parser.do_classes_and_modules @parser.do_constants klass = @parser.classes['cFoo'] @@ -581,8 +555,7 @@ def test_do_constants_curses @parser = util_parser content - @parser.do_modules - @parser.do_classes + @parser.do_classes_and_modules @parser.do_constants klass = @parser.classes['mCurses'] @@ -608,8 +581,7 @@ def test_do_constants_file @parser = util_parser content - @parser.do_modules - @parser.do_classes + @parser.do_classes_and_modules @parser.do_constants klass = @parser.classes['rb_mFConst'] diff --git a/test/rdoc/test_rdoc_parser_changelog.rb b/test/rdoc/test_rdoc_parser_changelog.rb index 18ea81b34e05c2..cb6406259c5509 100644 --- a/test/rdoc/test_rdoc_parser_changelog.rb +++ b/test/rdoc/test_rdoc_parser_changelog.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocParserChangeLog < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_parser_markdown.rb b/test/rdoc/test_rdoc_parser_markdown.rb index 30e66e2833bbd1..06c6700d966a54 100644 --- a/test/rdoc/test_rdoc_parser_markdown.rb +++ b/test/rdoc/test_rdoc_parser_markdown.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocParserMarkdown < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_parser_rd.rb b/test/rdoc/test_rdoc_parser_rd.rb index 15112fdb0e544d..bac9c655921439 100644 --- a/test/rdoc/test_rdoc_parser_rd.rb +++ b/test/rdoc/test_rdoc_parser_rd.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocParserRd < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_parser_ruby.rb b/test/rdoc/test_rdoc_parser_ruby.rb index 9164e82cbf2d0c..b2ea96868260b1 100644 --- a/test/rdoc/test_rdoc_parser_ruby.rb +++ b/test/rdoc/test_rdoc_parser_ruby.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocParserRuby < RDoc::TestCase @@ -100,7 +100,7 @@ def test_get_class_or_module assert_equal 'E', name_t[:text] assert_equal 'D::E', given_name - assert_raises RDoc::Error do + assert_raise RDoc::Error do util_parser("A::\nB").get_class_or_module ctxt end end diff --git a/test/rdoc/test_rdoc_parser_simple.rb b/test/rdoc/test_rdoc_parser_simple.rb index 5bde34b746a463..2f1ad00de404f5 100644 --- a/test/rdoc/test_rdoc_parser_simple.rb +++ b/test/rdoc/test_rdoc_parser_simple.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocParserSimple < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_rd.rb b/test/rdoc/test_rdoc_rd.rb index 70bb94d24b6fcd..83ee4234551715 100644 --- a/test/rdoc/test_rdoc_rd.rb +++ b/test/rdoc/test_rdoc_rd.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocRd < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_rd_block_parser.rb b/test/rdoc/test_rdoc_rd_block_parser.rb index 0f0bc4f891af37..22f432eaf415ef 100644 --- a/test/rdoc/test_rdoc_rd_block_parser.rb +++ b/test/rdoc/test_rdoc_rd_block_parser.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocRdBlockParser < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_rd_inline.rb b/test/rdoc/test_rdoc_rd_inline.rb index dbba164865fc19..13ab86d3d93a2f 100644 --- a/test/rdoc/test_rdoc_rd_inline.rb +++ b/test/rdoc/test_rdoc_rd_inline.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocRdInline < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_rd_inline_parser.rb b/test/rdoc/test_rdoc_rd_inline_parser.rb index 3673de48e1d0c0..9aff6139bc83ad 100644 --- a/test/rdoc/test_rdoc_rd_inline_parser.rb +++ b/test/rdoc/test_rdoc_rd_inline_parser.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocRdInlineParser < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_rdoc.rb b/test/rdoc/test_rdoc_rdoc.rb index 55a2ba060702b9..b549ba8dc85816 100644 --- a/test/rdoc/test_rdoc_rdoc.rb +++ b/test/rdoc/test_rdoc_rdoc.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocRDoc < RDoc::TestCase @@ -119,7 +119,7 @@ def test_load_options_invalid io.write "a: !ruby.yaml.org,2002:str |\nfoo" end - e = assert_raises RDoc::Error do + e = assert_raise RDoc::Error do @rdoc.load_options end @@ -463,7 +463,7 @@ def test_setup_output_dir_exists_empty_created_rid Dir.mktmpdir {|path| File.open @rdoc.output_flag_file(path), 'w' do end - e = assert_raises RDoc::Error do + e = assert_raise RDoc::Error do @rdoc.setup_output_dir path, false end @@ -475,7 +475,7 @@ def test_setup_output_dir_exists_file tf = Tempfile.open 'test_rdoc_rdoc' do |tempfile| path = tempfile.path - e = assert_raises RDoc::Error do + e = assert_raise RDoc::Error do @rdoc.setup_output_dir path, false end @@ -488,7 +488,7 @@ def test_setup_output_dir_exists_file def test_setup_output_dir_exists_not_rdoc Dir.mktmpdir do |dir| - e = assert_raises RDoc::Error do + e = assert_raise RDoc::Error do @rdoc.setup_output_dir dir, false end diff --git a/test/rdoc/test_rdoc_ri_driver.rb b/test/rdoc/test_rdoc_ri_driver.rb index 00df6fbb232ab6..fc51aeb87e7011 100644 --- a/test/rdoc/test_rdoc_ri_driver.rb +++ b/test/rdoc/test_rdoc_ri_driver.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocRIDriver < RDoc::TestCase @@ -751,7 +751,7 @@ def test_display_name_not_found_method def test_display_name_not_found_special util_store - assert_raises RDoc::RI::Driver::NotFoundError do + assert_raise RDoc::RI::Driver::NotFoundError do assert_equal false, @driver.display_name('Set#[]') end end @@ -887,7 +887,7 @@ def test_expand_class assert_equal 'Foo', @driver.expand_class('F') assert_equal 'Foo::Bar', @driver.expand_class('F::Bar') - assert_raises RDoc::RI::Driver::NotFoundError do + assert_raise RDoc::RI::Driver::NotFoundError do @driver.expand_class 'F::B' end end @@ -903,7 +903,7 @@ def test_expand_class_2 @store1.save @driver.stores = [@store1] - assert_raises RDoc::RI::Driver::NotFoundError do + assert_raise RDoc::RI::Driver::NotFoundError do @driver.expand_class 'F' end assert_equal 'Foo::Bar', @driver.expand_class('F::Bar') @@ -931,7 +931,7 @@ def test_expand_name assert_equal 'Foo', @driver.expand_name('F') assert_equal 'Foo::Bar#', @driver.expand_name('F::Bar#') - e = assert_raises RDoc::RI::Driver::NotFoundError do + e = assert_raise RDoc::RI::Driver::NotFoundError do @driver.expand_name 'Z' end @@ -942,7 +942,7 @@ def test_expand_name assert_equal 'ruby:README', @driver.expand_name('ruby:README') assert_equal 'ruby:', @driver.expand_name('ruby:') - e = assert_raises RDoc::RI::Driver::NotFoundError do + e = assert_raise RDoc::RI::Driver::NotFoundError do @driver.expand_name 'nonexistent_gem:' end @@ -1021,7 +1021,7 @@ def test_find_store assert_equal 'gem-1.0', @driver.find_store('gem-1.0') assert_equal 'gem-1.0', @driver.find_store('gem') - e = assert_raises RDoc::RI::Driver::NotFoundError do + e = assert_raise RDoc::RI::Driver::NotFoundError do @driver.find_store 'nonexistent' end @@ -1033,17 +1033,17 @@ def test_did_you_mean util_ancestors_store - e = assert_raises RDoc::RI::Driver::NotFoundError do + e = assert_raise RDoc::RI::Driver::NotFoundError do @driver.lookup_method 'Foo.i_methdo' end assert_equal "Nothing known about Foo.i_methdo\nDid you mean? i_method", e.message - e = assert_raises RDoc::RI::Driver::NotFoundError do + e = assert_raise RDoc::RI::Driver::NotFoundError do @driver.lookup_method 'Foo#i_methdo' end assert_equal "Nothing known about Foo#i_methdo\nDid you mean? i_method", e.message - e = assert_raises RDoc::RI::Driver::NotFoundError do + e = assert_raise RDoc::RI::Driver::NotFoundError do @driver.lookup_method 'Foo::i_methdo' end assert_equal "Nothing known about Foo::i_methdo\nDid you mean? c_method", e.message diff --git a/test/rdoc/test_rdoc_ri_paths.rb b/test/rdoc/test_rdoc_ri_paths.rb index eb9b7fc93c1f73..01ade58dadac6b 100644 --- a/test/rdoc/test_rdoc_ri_paths.rb +++ b/test/rdoc/test_rdoc_ri_paths.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocRIPaths < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_rubygems_hook.rb b/test/rdoc/test_rdoc_rubygems_hook.rb index b674aa6d481e9e..7d59577d974a79 100644 --- a/test/rdoc/test_rdoc_rubygems_hook.rb +++ b/test/rdoc/test_rdoc_rubygems_hook.rb @@ -132,8 +132,12 @@ def test_generate_configuration_rdoc_string def test_generate_default_gem Gem::Deprecate.skip_during do - @a.loaded_from = - File.join Gem::Specification.default_specifications_dir, 'a.gemspec' + if Gem.respond_to?(:default_specifications_dir) + klass = Gem + else + klass = Gem::Specification + end + @a.loaded_from = File.join klass.default_specifications_dir, 'a.gemspec' end @hook.generate diff --git a/test/rdoc/test_rdoc_servlet.rb b/test/rdoc/test_rdoc_servlet.rb index 0c3f2f8d986acc..ff64d5670f65da 100644 --- a/test/rdoc/test_rdoc_servlet.rb +++ b/test/rdoc/test_rdoc_servlet.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocServlet < RDoc::TestCase @@ -166,7 +166,7 @@ def test_do_GET_not_modified @req.header['if-modified-since'] = [(Time.now + 10).httpdate] @req.path = '/ruby/Missing.html' - assert_raises WEBrick::HTTPStatus::NotModified do + assert_raise WEBrick::HTTPStatus::NotModified do @s.do_GET @req, @res end end @@ -315,7 +315,7 @@ def test_if_modified_since_not_modified @req.header['if-modified-since'] = [(now + 10).httpdate] - assert_raises WEBrick::HTTPStatus::NotModified do + assert_raise WEBrick::HTTPStatus::NotModified do @s.if_modified_since @req, @res, '.' end @@ -490,7 +490,7 @@ def test_store_for_home def test_store_for_missing_documentation FileUtils.mkdir_p(File.join @gem_doc_dir, 'spec-1.0', 'ri') - e = assert_raises WEBrick::HTTPStatus::NotFound do + e = assert_raise WEBrick::HTTPStatus::NotFound do @s.store_for 'spec-1.0' end @@ -499,7 +499,7 @@ def test_store_for_missing_documentation end def test_store_for_missing_gem - e = assert_raises WEBrick::HTTPStatus::NotFound do + e = assert_raise WEBrick::HTTPStatus::NotFound do @s.store_for 'missing' end diff --git a/test/rdoc/test_rdoc_single_class.rb b/test/rdoc/test_rdoc_single_class.rb index e4123cb9bc5345..ee242d7bc9e4c1 100644 --- a/test/rdoc/test_rdoc_single_class.rb +++ b/test/rdoc/test_rdoc_single_class.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocSingleClass < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_stats.rb b/test/rdoc/test_rdoc_stats.rb index cac30d15aa53ef..b9918e4fd33b3b 100644 --- a/test/rdoc/test_rdoc_stats.rb +++ b/test/rdoc/test_rdoc_stats.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocStats < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_store.rb b/test/rdoc/test_rdoc_store.rb index 5a884c0b5f8970..8332d9233ed911 100644 --- a/test/rdoc/test_rdoc_store.rb +++ b/test/rdoc/test_rdoc_store.rb @@ -172,7 +172,7 @@ def test_all_classes_and_modules end def test_all_files - assert_equal %w[xref_data.rb], + assert_equal %w[EXAMPLE.md xref_data.rb], @store.all_files.map { |m| m.full_name }.sort end diff --git a/test/rdoc/test_rdoc_task.rb b/test/rdoc/test_rdoc_task.rb index 5f91ea2e8ba573..d9fc6664fd87b4 100644 --- a/test/rdoc/test_rdoc_task.rb +++ b/test/rdoc/test_rdoc_task.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' begin require 'rake' rescue LoadError @@ -131,7 +131,7 @@ def test_tasks_creation_with_custom_name_hash assert Rake::Task[:"rdoc"] assert Rake::Task[:"rdoc:clean"] assert Rake::Task[:"rdoc:force"] - assert_raises(RuntimeError) { Rake::Task[:clobber_rdoc] } + assert_raise(RuntimeError) { Rake::Task[:clobber_rdoc] } assert_equal options, rd.name end @@ -143,7 +143,7 @@ def test_tasks_creation_with_custom_name_hash_will_use_default_if_an_option_isnt end def test_tasks_creation_with_custom_name_hash_raises_exception_if_invalid_option_given - assert_raises(ArgumentError) do + assert_raise(ArgumentError) do RDoc::Task.new(:foo => "bar") end diff --git a/test/rdoc/test_rdoc_text.rb b/test/rdoc/test_rdoc_text.rb index 0ecd815ffa411a..59d63b29bd0da3 100644 --- a/test/rdoc/test_rdoc_text.rb +++ b/test/rdoc/test_rdoc_text.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' require 'timeout' class TestRDocText < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_token_stream.rb b/test/rdoc/test_rdoc_token_stream.rb index c946d0f1ef628c..cdfa615daec33b 100644 --- a/test/rdoc/test_rdoc_token_stream.rb +++ b/test/rdoc/test_rdoc_token_stream.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocTokenStream < RDoc::TestCase diff --git a/test/rdoc/test_rdoc_tom_doc.rb b/test/rdoc/test_rdoc_tom_doc.rb index 27a3e6f1782b00..ddecea4b21ca65 100644 --- a/test/rdoc/test_rdoc_tom_doc.rb +++ b/test/rdoc/test_rdoc_tom_doc.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest_helper' +require_relative 'helper' class TestRDocTomDoc < RDoc::TestCase diff --git a/test/rdoc/xref_test_case.rb b/test/rdoc/xref_test_case.rb index d42cf398e7f845..729e4a70b7439d 100644 --- a/test/rdoc/xref_test_case.rb +++ b/test/rdoc/xref_test_case.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true ENV['RDOC_TEST'] = 'yes' -require 'minitest_helper' +require_relative 'helper' require File.expand_path '../xref_data', __FILE__ class XrefTestCase < RDoc::TestCase @@ -22,8 +22,13 @@ def setup parser = RDoc::Parser::Ruby.new @xref_data, @file_name, XREF_DATA, @options, stats + + @example_md = @store.add_file 'EXAMPLE.md' + @example_md.parser = RDoc::Parser::Markdown + @top_levels = [] @top_levels.push parser.scan + @top_levels.push @example_md generator = Object.new def generator.class_dir() nil end diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index afb4784d00f17f..87d60e41a4d26e 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -2295,6 +2295,34 @@ def foo;end d end + class RefineInUsing + module M1 + refine RefineInUsing do + def foo + :ok + end + end + end + + module M2 + using M1 + refine RefineInUsing do + def call_foo + RefineInUsing.new.foo + end + end + end + + using M2 + def self.test + new.call_foo + end + end + + def test_refine_in_using + assert_equal(:ok, RefineInUsing.test) + end + private def eval_using(mod, s) diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb index f409453c1de4cd..b25068405d2a26 100644 --- a/test/rubygems/test_gem.rb +++ b/test/rubygems/test_gem.rb @@ -341,6 +341,40 @@ def test_activate_bin_path_gives_proper_error_for_bundler refute_includes e.message, "can't find gem bundler (>= 0.a) with executable bundle" end + def test_activate_bin_path_selects_exact_bundler_version_if_present + bundler_latest = util_spec 'bundler', '2.0.1' do |s| + s.executables = ['bundle'] + end + + bundler_previous = util_spec 'bundler', '2.0.0' do |s| + s.executables = ['bundle'] + end + + install_specs bundler_latest, bundler_previous + + File.open("Gemfile.lock", "w") do |f| + f.write <<-L.gsub(/ {8}/, "") + GEM + remote: https://rubygems.org/ + specs: + + PLATFORMS + ruby + + DEPENDENCIES + + BUNDLED WITH + 2.0.0 + L + end + + File.open("Gemfile", "w") { |f| f.puts('source "https://rubygems.org"') } + + load Gem.activate_bin_path("bundler", "bundle", ">= 0.a") + + assert_equal %w(bundler-2.0.0), loaded_spec_names + end + def test_self_bin_path_no_exec_name e = assert_raises ArgumentError do Gem.bin_path 'a' diff --git a/test/rubygems/test_gem_bundler_version_finder.rb b/test/rubygems/test_gem_bundler_version_finder.rb index 8e883bc719843a..34a451b64d399f 100644 --- a/test/rubygems/test_gem_bundler_version_finder.rb +++ b/test/rubygems/test_gem_bundler_version_finder.rb @@ -116,7 +116,7 @@ def test_filter assert_equal %w[1 1.0 1.0.1.1], util_filter_specs(specs).map(&:version).map(&:to_s) end bvf.stub(:bundler_version, v("2.a")) do - assert_equal %w[2 2.a 2.0 2.1.1], util_filter_specs(specs).map(&:version).map(&:to_s) + assert_equal %w[2.a 2 2.0 2.1.1], util_filter_specs(specs).map(&:version).map(&:to_s) end bvf.stub(:bundler_version, v("3")) do assert_equal %w[3 3.a 3.0 3.1.1], util_filter_specs(specs).map(&:version).map(&:to_s) diff --git a/test/rubygems/test_gem_command.rb b/test/rubygems/test_gem_command.rb index f3897c7102d601..d51371301e23b7 100644 --- a/test/rubygems/test_gem_command.rb +++ b/test/rubygems/test_gem_command.rb @@ -328,7 +328,7 @@ def test_show_lookup_failure_suggestions_remote end use_ui @ui do - @cmd.show_lookup_failure misspelled, Gem::Requirement.default, [], :remote + @cmd.show_lookup_failure misspelled, Gem::Requirement.default, [] end expected = <<-EXPECTED diff --git a/test/rubygems/test_gem_remote_fetcher.rb b/test/rubygems/test_gem_remote_fetcher.rb index 92ff350b26c2ce..76a66af867c4e5 100644 --- a/test/rubygems/test_gem_remote_fetcher.rb +++ b/test/rubygems/test_gem_remote_fetcher.rb @@ -675,6 +675,9 @@ def fetcher.s3_uri_signer(uri) def s3_uri_signer.ec2_metadata_credentials_json JSON.parse($instance_profile) end + # Running sign operation to make sure uri.query is not mutated + s3_uri_signer.sign + raise "URI query is not empty: #{uri.query}" unless uri.query.nil? s3_uri_signer end diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb index 7c86748a872829..330b56b43d951f 100644 --- a/test/rubygems/test_require.rb +++ b/test/rubygems/test_require.rb @@ -41,6 +41,10 @@ def assert_require(path) assert require(path), "'#{path}' was already required" end + def refute_require(path) + refute require(path), "'#{path}' was not yet required" + end + # Providing -I on the commandline should always beat gems def test_dash_i_beats_gems a1 = util_spec "a", "1", {"b" => "= 1"}, "lib/test_gem_require_a.rb" @@ -66,6 +70,7 @@ def test_dash_i_beats_gems assert_require 'test_gem_require_a' assert_require 'b/c' # this should be required from -I assert_equal "world", ::Object::HELLO + assert_equal %w(a-1 b-1), loaded_spec_names ensure $LOAD_PATH.replace lp Object.send :remove_const, :HELLO if Object.const_defined? :HELLO @@ -166,13 +171,21 @@ def test_activate_via_require_respects_loaded_files this test, somehow require will load the benchmark in b, and ignore that the stdlib one is already in $LOADED_FEATURES?. Reproducible by running the spaceship_specific_file test before this one" if java_platform? + + lp = $LOAD_PATH.dup + lib_dir = File.expand_path(File.join(File.dirname(__FILE__), "../../lib")) + if File.exist?(lib_dir) + $LOAD_PATH.delete lib_dir + $LOAD_PATH.push lib_dir + end + a1 = util_spec "a", "1", {"b" => ">= 1"}, "lib/test_gem_require_a.rb" b1 = util_spec "b", "1", nil, "lib/benchmark.rb" b2 = util_spec "b", "2", nil, "lib/benchmark.rb" install_specs b1, b2, a1 - require 'test_gem_require_a' + assert_require 'test_gem_require_a' assert_equal unresolved_names, ["b (>= 1)"] refute require('benchmark'), "benchmark should have already been loaded" @@ -183,6 +196,8 @@ def test_activate_via_require_respects_loaded_files # the same behavior as eager loading would have. assert_equal %w(a-1 b-2), loaded_spec_names + ensure + $LOAD_PATH.replace lp end def test_already_activated_direct_conflict @@ -300,6 +315,22 @@ def test_default_gem_only assert_equal %w(default-2.0.0.0), loaded_spec_names end + def test_default_gem_require_activates_just_once + default_gem_spec = new_default_spec("default", "2.0.0.0", + nil, "default/gem.rb") + install_default_specs(default_gem_spec) + + assert_require "default/gem" + + times_called = 0 + + Kernel.stub(:gem, ->(name, requirement) { times_called += 1 }) do + refute_require "default/gem" + end + + assert_equal 0, times_called + end + def test_realworld_default_gem begin gem 'json' diff --git a/version.h b/version.h index c75a10a04284fc..c408ded795b81b 100644 --- a/version.h +++ b/version.h @@ -6,7 +6,7 @@ #define RUBY_RELEASE_YEAR 2019 #define RUBY_RELEASE_MONTH 8 -#define RUBY_RELEASE_DAY 16 +#define RUBY_RELEASE_DAY 17 #include "ruby/version.h" diff --git a/vm_eval.c b/vm_eval.c index 222389ec08e8e6..a0f8e55f5d7310 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -634,9 +634,14 @@ NORETURN(static void raise_method_missing(rb_execution_context_t *ec, int argc, * def roman_to_int(str) * # ... * end - * def method_missing(methId) - * str = methId.id2name - * roman_to_int(str) + * + * def method_missing(symbol, *args) + * str = symbol.id2name + * begin + * roman_to_int(str) + * rescue + * super(symbol, *args) + * end * end * end * @@ -644,6 +649,7 @@ NORETURN(static void raise_method_missing(rb_execution_context_t *ec, int argc, * r.iv #=> 4 * r.xxiii #=> 23 * r.mm #=> 2000 + * r.foo #=> NoMethodError */ static VALUE diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 2d765e1e958787..d2982afdfa4ace 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -2604,39 +2604,37 @@ vm_call_method_each_type(rb_execution_context_t *ec, rb_control_frame_t *cfp, st case VM_METHOD_TYPE_REFINED: { const rb_cref_t *cref = vm_get_cref(cfp->ep); - VALUE refinements = cref ? CREF_REFINEMENTS(cref) : Qnil; - VALUE refinement; - const rb_callable_method_entry_t *ref_me; - refinement = find_refinement(refinements, cc->me->owner); + for (; cref; cref = CREF_NEXT(cref)) { + const rb_callable_method_entry_t *ref_me; + VALUE refinements = CREF_REFINEMENTS(cref); + VALUE refinement = find_refinement(refinements, cc->me->owner); + if (NIL_P(refinement)) continue; - if (NIL_P(refinement)) { - goto no_refinement_dispatch; - } - ref_me = rb_callable_method_entry(refinement, ci->mid); - - if (ref_me) { - if (cc->call == vm_call_super_method) { - const rb_control_frame_t *top_cfp = current_method_entry(ec, cfp); - const rb_callable_method_entry_t *top_me = rb_vm_frame_method_entry(top_cfp); - if (top_me && rb_method_definition_eq(ref_me->def, top_me->def)) { - goto no_refinement_dispatch; - } - } - if (cc->me->def->type != VM_METHOD_TYPE_REFINED || - cc->me->def != ref_me->def) { - cc->me = ref_me; + ref_me = rb_callable_method_entry(refinement, ci->mid); + + if (ref_me) { + if (cc->call == vm_call_super_method) { + const rb_control_frame_t *top_cfp = current_method_entry(ec, cfp); + const rb_callable_method_entry_t *top_me = rb_vm_frame_method_entry(top_cfp); + if (top_me && rb_method_definition_eq(ref_me->def, top_me->def)) { + continue; + } + } + if (cc->me->def->type != VM_METHOD_TYPE_REFINED || + cc->me->def != ref_me->def) { + cc->me = ref_me; + } + if (ref_me->def->type != VM_METHOD_TYPE_REFINED) { + return vm_call_method(ec, cfp, calling, ci, cc); + } } - if (ref_me->def->type != VM_METHOD_TYPE_REFINED) { - return vm_call_method(ec, cfp, calling, ci, cc); - } - } - else { - cc->me = NULL; - return vm_call_method_nome(ec, cfp, calling, ci, cc); - } + else { + cc->me = NULL; + return vm_call_method_nome(ec, cfp, calling, ci, cc); + } + } - no_refinement_dispatch: if (cc->me->def->body.refined.orig_me) { cc->me = refined_method_callable_without_refinement(cc->me); }