Flowdock
method

load_spec_files

Importance_0
v2_6_3 - Show latest stable - 0 notes - Class: Path
  • 1_8_6_287
  • 1_8_7_72
  • 1_8_7_330
  • 1_9_1_378
  • 1_9_2_180
  • 1_9_3_125
  • 1_9_3_392
  • 2_1_10
  • 2_2_9
  • 2_4_6
  • 2_5_5
  • 2_6_3 (0)
  • What's this?
load_spec_files() private

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/bundler/source/path.rb, line 160
      def load_spec_files
        index = Index.new

        if File.directory?(expanded_path)
          # We sort depth-first since `<<` will override the earlier-found specs
          Dir["#{expanded_path}/#{@glob}"].sort_by {|p| -p.split(File::SEPARATOR).size }.each do |file|
            next unless spec = load_gemspec(file)
            spec.source = self

            # Validation causes extension_dir to be calculated, which depends
            # on #source, so we validate here instead of load_gemspec
            validate_spec(spec)
            index << spec
          end

          if index.empty? && @name && @version
            index << Gem::Specification.new do |s|
              s.name     = @name
              s.source   = self
              s.version  = Gem::Version.new(@version)
              s.platform = Gem::Platform::RUBY
              s.summary  = "Fake gemspec for #{@name}"
              s.relative_loaded_from = "#{@name}.gemspec"
              s.authors = ["no one"]
              if expanded_path.join("bin").exist?
                executables = expanded_path.join("bin").children
                executables.reject! {|p| File.directory?(p) }
                s.executables = executables.map {|c| c.basename.to_s }
              end
            end
          end
        else
          message = String.new("The path `#{expanded_path}` ")
          message << if File.exist?(expanded_path)
                       "is not a directory."
                     else
                       "does not exist."
                     end
          raise PathError, message
        end

        index
      end
Register or log in to add new notes.