diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler.rb | 4 | ||||
-rw-r--r-- | lib/bundler/cli.rb | 5 | ||||
-rw-r--r-- | lib/bundler/cli/check.rb | 2 | ||||
-rw-r--r-- | lib/bundler/cli/doctor.rb | 48 | ||||
-rw-r--r-- | lib/bundler/cli/exec.rb | 5 | ||||
-rw-r--r-- | lib/bundler/cli/gem.rb | 4 | ||||
-rw-r--r-- | lib/bundler/cli/init.rb | 11 | ||||
-rw-r--r-- | lib/bundler/cli/install.rb | 4 | ||||
-rw-r--r-- | lib/bundler/cli/list.rb | 3 | ||||
-rw-r--r-- | lib/bundler/cli/outdated.rb | 2 | ||||
-rw-r--r-- | lib/bundler/compact_index_client/updater.rb | 2 | ||||
-rw-r--r-- | lib/bundler/current_ruby.rb | 1 | ||||
-rw-r--r-- | lib/bundler/definition.rb | 18 | ||||
-rw-r--r-- | lib/bundler/friendly_errors.rb | 2 | ||||
-rw-r--r-- | lib/bundler/injector.rb | 2 | ||||
-rw-r--r-- | lib/bundler/installer.rb | 4 | ||||
-rw-r--r-- | lib/bundler/installer/gem_installer.rb | 7 | ||||
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 6 | ||||
-rw-r--r-- | lib/bundler/runtime.rb | 12 | ||||
-rw-r--r-- | lib/bundler/source/rubygems.rb | 2 | ||||
-rw-r--r-- | lib/bundler/spec_set.rb | 5 | ||||
-rw-r--r-- | lib/bundler/templates/.document | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | lib/bundler/templates/Executable | 14 | ||||
-rw-r--r-- | lib/bundler/templates/newgem/lib/newgem.rb.tt | 1 |
24 files changed, 128 insertions, 37 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index e7ebf985c6..8fc8da6dcb 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -136,7 +136,7 @@ module Bundler end end - def frozen? + def frozen_bundle? frozen = settings[:deployment] frozen ||= settings[:frozen] unless feature_flag.deployment_means_frozen? frozen @@ -441,7 +441,7 @@ EOF def load_gemspec_uncached(file, validate = false) path = Pathname.new(file) - contents = path.read + contents = read_file(file) spec = if contents.start_with?("---") # YAML header eval_yaml_gemspec(path, contents) else diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 7744a6f801..33796ea9a6 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -233,6 +233,8 @@ module Bundler D method_option "full-index", :type => :boolean, :banner => "Fall back to using the single-file index of all gems" + method_option "gemfile", :type => :string, :banner => + "Use the specified gemfile instead of Gemfile" method_option "group", :aliases => "-g", :type => :array, :banner => "Update a specific group" method_option "jobs", :aliases => "-j", :type => :numeric, :banner => @@ -285,6 +287,7 @@ module Bundler if Bundler.feature_flag.list_command? desc "list", "List all gems in the bundle" method_option "name-only", :type => :boolean, :banner => "print only the gem names" + method_option "paths", :type => :boolean, :banner => "print the path to each gem in the bundle" def list require "bundler/cli/list" List.new(options).run @@ -718,6 +721,8 @@ module Bundler command_name = current_command.name return if PARSEABLE_COMMANDS.include?(command_name) + return unless SharedHelpers.md5_available? + latest = Fetcher::CompactIndex. new(nil, Source::Rubygems::Remote.new(URI("https://rubygems.org")), nil). send(:compact_index_client). diff --git a/lib/bundler/cli/check.rb b/lib/bundler/cli/check.rb index e572787dc4..19c0aaea06 100644 --- a/lib/bundler/cli/check.rb +++ b/lib/bundler/cli/check.rb @@ -26,7 +26,7 @@ module Bundler not_installed.each {|s| Bundler.ui.error " * #{s.name} (#{s.version})" } Bundler.ui.warn "Install missing gems with `bundle install`" exit 1 - elsif !Bundler.default_lockfile.file? && Bundler.frozen? + elsif !Bundler.default_lockfile.file? && Bundler.frozen_bundle? Bundler.ui.error "This bundle has been frozen, but there is no #{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)} present" exit 1 else diff --git a/lib/bundler/cli/doctor.rb b/lib/bundler/cli/doctor.rb index 7f28a5eb13..3e0898ff8a 100644 --- a/lib/bundler/cli/doctor.rb +++ b/lib/bundler/cli/doctor.rb @@ -78,6 +78,8 @@ module Bundler end end + permissions_valid = check_home_permissions + if broken_links.any? message = "The following gems are missing OS dependencies:" broken_links.map do |spec, paths| @@ -86,9 +88,53 @@ module Bundler end end.flatten.sort.each {|m| message += m } raise ProductionError, message - else + elsif !permissions_valid Bundler.ui.info "No issues found with the installed bundle" end end + + private + + def check_home_permissions + require "find" + files_not_readable_or_writable = [] + files_not_rw_and_owned_by_different_user = [] + files_not_owned_by_current_user_but_still_rw = [] + Find.find(Bundler.home.to_s).each do |f| + if !File.writable?(f) || !File.readable?(f) + if File.stat(f).uid != Process.uid + files_not_rw_and_owned_by_different_user << f + else + files_not_readable_or_writable << f + end + elsif File.stat(f).uid != Process.uid + files_not_owned_by_current_user_but_still_rw << f + end + end + + ok = true + if files_not_owned_by_current_user_but_still_rw.any? + Bundler.ui.warn "Files exist in the Bundler home that are owned by another " \ + "user, but are still readable/writable. These files are:\n - #{files_not_owned_by_current_user_but_still_rw.join("\n - ")}" + + ok = false + end + + if files_not_rw_and_owned_by_different_user.any? + Bundler.ui.warn "Files exist in the Bundler home that are owned by another " \ + "user, and are not readable/writable. These files are:\n - #{files_not_rw_and_owned_by_different_user.join("\n - ")}" + + ok = false + end + + if files_not_readable_or_writable.any? + Bundler.ui.warn "Files exist in the Bundler home that are not " \ + "readable/writable by the current user. These files are:\n - #{files_not_readable_or_writable.join("\n - ")}" + + ok = false + end + + ok + end end end diff --git a/lib/bundler/cli/exec.rb b/lib/bundler/cli/exec.rb index 2fdc614fbb..d6ac453676 100644 --- a/lib/bundler/cli/exec.rb +++ b/lib/bundler/cli/exec.rb @@ -6,7 +6,7 @@ module Bundler class CLI::Exec attr_reader :options, :args, :cmd - RESERVED_SIGNALS = %w[SEGV BUS ILL FPE VTALRM KILL STOP].freeze + TRAPPED_SIGNALS = %w[INT].freeze def initialize(options, args) @options = options @@ -70,8 +70,7 @@ module Bundler ui = Bundler.ui Bundler.ui = nil require "bundler/setup" - signals = Signal.list.keys - RESERVED_SIGNALS - signals.each {|s| trap(s, "DEFAULT") } + TRAPPED_SIGNALS.each {|s| trap(s, "DEFAULT") } Kernel.load(file) rescue SystemExit, SignalException raise diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index 885578e819..ebfaf75b8c 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -105,7 +105,7 @@ module Bundler if ask_and_set(:mit, "Do you want to license your code permissively under the MIT license?", "This means that any other developer or company will be legally allowed to use your code " \ "for free as long as they admit you created it. You can read more about the MIT license " \ - "at http://choosealicense.com/licenses/mit.") + "at https://choosealicense.com/licenses/mit.") config[:mit] = true Bundler.ui.info "MIT License enabled in config" templates.merge!("LICENSE.txt.tt" => "LICENSE.txt") @@ -118,7 +118,7 @@ module Bundler "of enforcing it, so be sure that you are prepared to do that. Be sure that your email " \ "address is specified as a contact in the generated code of conduct so that people know " \ "who to contact in case of a violation. For suggestions about " \ - "how to enforce codes of conduct, see http://bit.ly/coc-enforcement.") + "how to enforce codes of conduct, see https://bit.ly/coc-enforcement.") config[:coc] = true Bundler.ui.info "Code of conduct enabled in config" templates.merge!("CODE_OF_CONDUCT.md.tt" => "CODE_OF_CONDUCT.md") diff --git a/lib/bundler/cli/init.rb b/lib/bundler/cli/init.rb index 50e01f54fb..40df797269 100644 --- a/lib/bundler/cli/init.rb +++ b/lib/bundler/cli/init.rb @@ -13,6 +13,11 @@ module Bundler exit 1 end + unless File.writable?(Dir.pwd) + Bundler.ui.error "Can not create #{gemfile} as the current directory is not writable." + exit 1 + end + if options[:gemspec] gemspec = File.expand_path(options[:gemspec]) unless File.exist?(gemspec) @@ -36,11 +41,7 @@ module Bundler private def gemfile - @gemfile ||= begin - Bundler.default_gemfile - rescue GemfileNotFound - Bundler.feature_flag.init_gems_rb? ? "gems.rb" : "Gemfile" - end + @gemfile ||= Bundler.feature_flag.init_gems_rb? ? "gems.rb" : "Gemfile" end end end diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index d878081df7..b40e5f0e9e 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -23,7 +23,7 @@ module Bundler check_trust_policy - if options[:deployment] || options[:frozen] || Bundler.frozen? + if options[:deployment] || options[:frozen] || Bundler.frozen_bundle? unless Bundler.default_lockfile.exist? flag = "--deployment flag" if options[:deployment] flag ||= "--frozen flag" if options[:frozen] @@ -63,7 +63,7 @@ module Bundler definition.validate_runtime! installer = Installer.install(Bundler.root, definition, options) - Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen? + Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle? Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}." Bundler::CLI::Common.output_without_groups_message diff --git a/lib/bundler/cli/list.rb b/lib/bundler/cli/list.rb index b5e7c1e650..c92f05df07 100644 --- a/lib/bundler/cli/list.rb +++ b/lib/bundler/cli/list.rb @@ -8,7 +8,10 @@ module Bundler def run specs = Bundler.load.specs.reject {|s| s.name == "bundler" }.sort_by(&:name) + + raise InvalidOption, "The `--name-only` and `--paths` options cannot be used together" if @options["name-only"] && @options["paths"] return specs.each {|s| Bundler.ui.info s.name } if @options["name-only"] + return specs.each {|s| Bundler.ui.info s.full_gem_path } if @options["paths"] return Bundler.ui.info "No gems in the Gemfile" if specs.empty? Bundler.ui.info "Gems included by the bundle:" diff --git a/lib/bundler/cli/outdated.rb b/lib/bundler/cli/outdated.rb index d0639f0e74..e230163c68 100644 --- a/lib/bundler/cli/outdated.rb +++ b/lib/bundler/cli/outdated.rb @@ -213,7 +213,7 @@ module Bundler end def check_for_deployment_mode - return unless Bundler.frozen? + return unless Bundler.frozen_bundle? suggested_command = if Bundler.settings.locations("frozen")[:global] "bundle config --delete frozen" elsif Bundler.settings.locations("deployment").keys.&([:global, :local]).any? diff --git a/lib/bundler/compact_index_client/updater.rb b/lib/bundler/compact_index_client/updater.rb index 91ca653e8d..950306fee5 100644 --- a/lib/bundler/compact_index_client/updater.rb +++ b/lib/bundler/compact_index_client/updater.rb @@ -83,6 +83,8 @@ module Bundler "Bundler does not have write access to create a temp directory " \ "within #{Dir.tmpdir}. Bundler must have write access to your " \ "systems temp directory to function properly. " + rescue Zlib::GzipFile::Error + raise Bundler::HTTPError end def etag_for(path) diff --git a/lib/bundler/current_ruby.rb b/lib/bundler/current_ruby.rb index 31532d108d..220d638b87 100644 --- a/lib/bundler/current_ruby.rb +++ b/lib/bundler/current_ruby.rb @@ -18,6 +18,7 @@ module Bundler 2.3 2.4 2.5 + 2.6 ].freeze KNOWN_MAJOR_VERSIONS = KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 264a948d41..0349af39f2 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -76,6 +76,7 @@ module Bundler @lockfile_contents = String.new @locked_bundler_version = nil @locked_ruby_version = nil + @locked_specs_incomplete_for_platform = false if lockfile && File.exist?(lockfile) @lockfile_contents = Bundler.read_file(lockfile) @@ -112,7 +113,7 @@ module Bundler end @unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version) - add_current_platform unless Bundler.frozen? + add_current_platform unless Bundler.frozen_bundle? converge_path_sources_to_gemspec_sources @path_changes = converge_paths @@ -244,7 +245,7 @@ module Bundler def resolve @resolve ||= begin last_resolve = converge_locked_specs - if Bundler.frozen? + if Bundler.frozen_bundle? Bundler.ui.debug "Frozen, using resolution from the lockfile" last_resolve elsif !unlocking? && nothing_changed? @@ -335,10 +336,10 @@ module Bundler end end - preserve_unknown_sections ||= !updating_major && (Bundler.frozen? || !(unlocking? || @unlocking_bundler)) + preserve_unknown_sections ||= !updating_major && (Bundler.frozen_bundle? || !(unlocking? || @unlocking_bundler)) return if lockfiles_equal?(@lockfile_contents, contents, preserve_unknown_sections) - if Bundler.frozen? + if Bundler.frozen_bundle? Bundler.ui.error "Cannot write a changed lockfile while frozen." return end @@ -529,7 +530,7 @@ module Bundler private :sources def nothing_changed? - !@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes + !@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@locked_specs_incomplete_for_platform end def unlocking? @@ -556,6 +557,7 @@ module Bundler [@new_platform, "you added a new platform to your gemfile"], [@path_changes, "the gemspecs for path gems changed"], [@local_changes, "the gemspecs for git local gems changed"], + [@locked_specs_incomplete_for_platform, "the lockfile does not have all gems needed for the current platform"], ].select(&:first).map(&:last).join(", ") end @@ -681,7 +683,7 @@ module Bundler end def converge_dependencies - frozen = Bundler.frozen? + frozen = Bundler.frozen_bundle? (@dependencies + @locked_deps.values).each do |dep| locked_source = @locked_deps[dep.name] # This is to make sure that if bundler is installing in deployment mode and @@ -802,7 +804,9 @@ module Bundler end resolve = SpecSet.new(converged) - resolve = resolve.for(expand_dependencies(deps, true), @unlock[:gems], false, false, false) + expanded_deps = expand_dependencies(deps, true) + @locked_specs_incomplete_for_platform = !resolve.for(expanded_deps, @unlock[:gems], true, true) + resolve = resolve.for(expanded_deps, @unlock[:gems], false, false, false) diff = nil # Now, we unlock any sources that do not have anymore gems pinned to it diff --git a/lib/bundler/friendly_errors.rb b/lib/bundler/friendly_errors.rb index f624185773..ae3299a7c8 100644 --- a/lib/bundler/friendly_errors.rb +++ b/lib/bundler/friendly_errors.rb @@ -45,6 +45,8 @@ module Bundler "Alternatively, you can increase the amount of memory the JVM is able to use by running Bundler with jruby -J-Xmx1024m -S bundle (JRuby defaults to 500MB)." else request_issue_report_for(error) end + rescue + raise error end def exit_status(error) diff --git a/lib/bundler/injector.rb b/lib/bundler/injector.rb index 5654c04453..6f9669ae4f 100644 --- a/lib/bundler/injector.rb +++ b/lib/bundler/injector.rb @@ -13,7 +13,7 @@ module Bundler end def inject(gemfile_path, lockfile_path) - if Bundler.frozen? + if Bundler.frozen_bundle? # ensure the lock and Gemfile are synced Bundler.definition.ensure_equivalent_gemfile_and_lockfile(true) end diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index 71f79ab8c9..5082a6bffe 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -70,7 +70,7 @@ module Bundler create_bundle_path ProcessLock.lock do - if Bundler.frozen? + if Bundler.frozen_bundle? @definition.ensure_equivalent_gemfile_and_lockfile(options[:deployment]) end @@ -90,7 +90,7 @@ module Bundler end install(options) - lock unless Bundler.frozen? + lock unless Bundler.frozen_bundle? Standalone.new(options[:standalone], @definition).generate if options[:standalone] end end diff --git a/lib/bundler/installer/gem_installer.rb b/lib/bundler/installer/gem_installer.rb index 086b763d20..a38f8d95be 100644 --- a/lib/bundler/installer/gem_installer.rb +++ b/lib/bundler/installer/gem_installer.rb @@ -44,7 +44,12 @@ module Bundler end def gem_install_message - "Make sure that `gem install #{spec.name} -v '#{spec.version}'` succeeds before bundling." + remotes = spec.source.remotes + if remotes.size == 1 + "Make sure that `gem install #{spec.name} -v '#{spec.version}' --source '#{remotes.first}'` succeeds before bundling." + else + "Make sure that `gem install #{spec.name} -v '#{spec.version}'` succeeds before bundling." + end end def spec_settings diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 0f16b6231d..2d70eae7dc 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -570,8 +570,10 @@ module Bundler @replaced_methods.each do |(sym, klass), method| redefine_method(klass, sym, method) end - post_reset_hooks.reject! do |proc| - proc.binding.eval("__FILE__") == __FILE__ + if Binding.public_method_defined?(:source_location) + post_reset_hooks.reject! {|proc| proc.binding.source_location == __FILE__ } + else + post_reset_hooks.reject! {|proc| proc.binding.eval("__FILE__") == __FILE__ } end @replaced_methods.clear end diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb index f27597b854..acaae3cedf 100644 --- a/lib/bundler/runtime.rb +++ b/lib/bundler/runtime.rb @@ -10,7 +10,7 @@ module Bundler end def setup(*groups) - @definition.ensure_equivalent_gemfile_and_lockfile if Bundler.frozen? + @definition.ensure_equivalent_gemfile_and_lockfile if Bundler.frozen_bundle? groups.map!(&:to_sym) @@ -163,6 +163,7 @@ module Bundler gem_dirs = Dir["#{Gem.dir}/gems/*"] gem_files = Dir["#{Gem.dir}/cache/*.gem"] gemspec_files = Dir["#{Gem.dir}/specifications/*.gemspec"] + extension_dirs = Dir["#{Gem.dir}/extensions/*/*/*"] spec_gem_paths = [] # need to keep git sources around spec_git_paths = @definition.spec_git_paths @@ -170,6 +171,7 @@ module Bundler spec_gem_executables = [] spec_cache_paths = [] spec_gemspec_paths = [] + spec_extension_paths = [] specs.each do |spec| spec_gem_paths << spec.full_gem_path # need to check here in case gems are nested like for the rails git repo @@ -181,6 +183,7 @@ module Bundler end spec_cache_paths << spec.cache_file spec_gemspec_paths << spec.spec_file + spec_extension_paths << spec.extension_dir if spec.respond_to?(:extension_dir) spec_git_cache_dirs << spec.source.cache_path.to_s if spec.source.is_a?(Bundler::Source::Git) end spec_gem_paths.uniq! @@ -192,6 +195,7 @@ module Bundler stale_gem_dirs = gem_dirs - spec_gem_paths stale_gem_files = gem_files - spec_cache_paths stale_gemspec_files = gemspec_files - spec_gemspec_paths + stale_extension_dirs = extension_dirs - spec_extension_paths removed_stale_gem_dirs = stale_gem_dirs.collect {|dir| remove_dir(dir, dry_run) } removed_stale_git_dirs = stale_git_dirs.collect {|dir| remove_dir(dir, dry_run) } @@ -204,8 +208,10 @@ module Bundler FileUtils.rm(file) if File.exist?(file) end end - stale_git_cache_dirs.each do |cache_dir| - SharedHelpers.filesystem_access(cache_dir) do |dir| + + stale_dirs = stale_git_cache_dirs + stale_extension_dirs + stale_dirs.each do |stale_dir| + SharedHelpers.filesystem_access(stale_dir) do |dir| FileUtils.rm_rf(dir) if File.exist?(dir) end end diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index 3ba7641f84..72dbc0c588 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -144,6 +144,8 @@ module Bundler bin_path = Bundler.system_bindir end + Bundler.mkdir_p bin_path unless spec.executables.empty? || Bundler.rubygems.provides?(">= 2.7.5") + installed_spec = nil Bundler.rubygems.preserve_paths do installed_spec = Bundler::RubyGemsGemInstaller.at( diff --git a/lib/bundler/spec_set.rb b/lib/bundler/spec_set.rb index 4674936d39..e6c30603f0 100644 --- a/lib/bundler/spec_set.rb +++ b/lib/bundler/spec_set.rb @@ -38,7 +38,10 @@ module Bundler elsif check return false elsif raise_on_missing - raise "Unable to find a spec satisfying #{dep} in the set. Perhaps the lockfile is corrupted?" + others = lookup[dep.name] if match_current_platform + message = "Unable to find a spec satisfying #{dep} in the set. Perhaps the lockfile is corrupted?" + message += " Found #{others.join(", ")} that did not match the current platform." if others && !others.empty? + raise GemNotFound, message end end diff --git a/lib/bundler/templates/.document b/lib/bundler/templates/.document new file mode 100644 index 0000000000..fb66f13c33 --- /dev/null +++ b/lib/bundler/templates/.document @@ -0,0 +1 @@ +# Ignore all files in this directory diff --git a/lib/bundler/templates/Executable b/lib/bundler/templates/Executable index 9289debc26..414a75898d 100755..100644 --- a/lib/bundler/templates/Executable +++ b/lib/bundler/templates/Executable @@ -8,13 +8,21 @@ # this file is here to facilitate running it. # -bundle_binstub = File.expand_path("../bundle", __FILE__) -load(bundle_binstub) if File.file?(bundle_binstub) - require "pathname" ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../<%= relative_gemfile_path %>", Pathname.new(__FILE__).realpath) +bundle_binstub = File.expand_path("../bundle", __FILE__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/ + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + require "rubygems" require "bundler/setup" diff --git a/lib/bundler/templates/newgem/lib/newgem.rb.tt b/lib/bundler/templates/newgem/lib/newgem.rb.tt index 7d8ad90ab0..f441eab5f2 100644 --- a/lib/bundler/templates/newgem/lib/newgem.rb.tt +++ b/lib/bundler/templates/newgem/lib/newgem.rb.tt @@ -6,6 +6,7 @@ require "<%= config[:namespaced_path] %>/<%= config[:underscored_name] %>" <%- config[:constant_array].each_with_index do |c, i| -%> <%= " " * i %>module <%= c %> <%- end -%> +<%= " " * config[:constant_array].size %>class Error < StandardError; end %> <%= " " * config[:constant_array].size %># Your code goes here... <%- (config[:constant_array].size-1).downto(0) do |i| -%> <%= " " * i %>end |