Object
# File lib/bundler/source.rb, line 309 309: def self.from_lock(options) 310: new(options.merge("path" => options.delete("remote"))) 311: end
# File lib/bundler/source.rb, line 285 285: def initialize(options) 286: @options = options 287: @glob = options["glob"] || DEFAULT_GLOB 288: 289: @allow_cached = false 290: @allow_remote = false 291: 292: if options["path"] 293: @path = Pathname.new(options["path"]) 294: @path = @path.expand_path(Bundler.root) unless @path.relative? 295: end 296: 297: @name = options["name"] 298: @version = options["version"] 299: end
# File lib/bundler/source.rb, line 420 420: def cache(spec) 421: unless path.expand_path(Bundler.root).to_s.index(Bundler.root.to_s) == 0 422: Bundler.ui.warn " * #{spec.name} at `#{path}` will not be cached." 423: end 424: end
# File lib/bundler/source.rb, line 305 305: def cached! 306: @allow_cached = true 307: end
# File lib/bundler/source.rb, line 328 328: def eql?(o) 329: o.instance_of?(Path) && 330: path.expand_path(Bundler.root) == o.path.expand_path(Bundler.root) && 331: version == o.version 332: end
# File lib/bundler/source.rb, line 324 324: def hash 325: self.class.hash 326: end
# File lib/bundler/source.rb, line 408 408: def install(spec) 409: Bundler.ui.info "Using #{spec.name} (#{spec.version}) from #{to_s} " 410: # Let's be honest, when we're working from a path, we can't 411: # really expect native extensions to work because the whole point 412: # is to just be able to modify what's in that path and go. So, let's 413: # not put ourselves through the pain of actually trying to generate 414: # the full gem. 415: Installer.new(spec).generate_bin 416: end
# File lib/bundler/source.rb, line 340 340: def load_spec_files 341: index = Index.new 342: 343: expanded_path = path.expand_path(Bundler.root) 344: 345: if File.directory?(expanded_path) 346: Dir["#{expanded_path}/#{@glob}"].each do |file| 347: spec = Bundler.load_gemspec(file) 348: if spec 349: spec.loaded_from = file.to_s 350: spec.source = self 351: index << spec 352: end 353: end 354: 355: if index.empty? && @name && @version 356: index << Gem::Specification.new do |s| 357: s.name = @name 358: s.source = self 359: s.version = Gem::Version.new(@version) 360: s.platform = Gem::Platform::RUBY 361: s.summary = "Fake gemspec for #{@name}" 362: s.relative_loaded_from = "#{@name}.gemspec" 363: s.authors = ["no one"] 364: if expanded_path.join("bin").exist? 365: binaries = expanded_path.join("bin").children 366: binaries.reject!{|p| File.directory?(p) } 367: s.executables = binaries.map{|c| c.basename.to_s } 368: end 369: end 370: end 371: else 372: raise PathError, "The path `#{expanded_path}` does not exist." 373: end 374: 375: index 376: end
# File lib/bundler/source.rb, line 378 378: def local_specs 379: @local_specs ||= load_spec_files 380: end
# File lib/bundler/source.rb, line 336 336: def name 337: File.basename(path.expand_path(Bundler.root).to_s) 338: end
# File lib/bundler/source.rb, line 301 301: def remote! 302: @allow_remote = true 303: end
# File lib/bundler/source.rb, line 436 436: def generate_bin(spec) 437: gem_dir = Pathname.new(spec.full_gem_path) 438: 439: # Some gem authors put absolute paths in their gemspec 440: # and we have to save them from themselves 441: spec.files = spec.files.map do |p| 442: next if File.directory?(p) 443: begin 444: Pathname.new(p).relative_path_from(gem_dir).to_s 445: rescue ArgumentError 446: p 447: end 448: end.compact 449: 450: gem_file = Dir.chdir(gem_dir){ Gem::Builder.new(spec).build } 451: 452: installer = Installer.new(spec, :env_shebang => false) 453: installer.build_extensions 454: installer.generate_bin 455: rescue Gem::InvalidSpecificationException => e 456: Bundler.ui.warn "\n#{spec.name} at #{spec.full_gem_path} did not have a valid gemspec.\n" "This prevents bundler from installing bins or native extensions, but " "that may not affect its functionality." 457: 458: if !spec.extensions.empty? && !spec.email.empty? 459: Bundler.ui.warn "If you need to use this package without installing it from a gem " "repository, please contact #{spec.email} and ask them " "to modify their .gemspec so it can work with `gem build`." 460: end 461: 462: Bundler.ui.warn "The validation message from Rubygems was:\n #{e.message}" 463: ensure 464: Dir.chdir(gem_dir){ FileUtils.rm_rf(gem_file) if gem_file && File.exist?(gem_file) } 465: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.