summaryrefslogtreecommitdiff
path: root/lib/bundler08/gem_ext.rb
blob: 707f582608d5e7303a3c7fb0f30e7864dc3192e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module Gem
  class Installer
    remove_method(:app_script_text) if method_defined?(:app_script_text)

    def app_script_text(bin_file_name)
      path = @gem_home
      template = File.read(File.join(File.dirname(__FILE__), "templates", "app_script.erb"))
      erb = ERB.new(template, nil, '-')
      erb.result(binding)
    end
  end

  class Specification
    attr_accessor :source, :location, :no_bundle

    alias no_bundle? no_bundle

    remove_method(:specification_version) if method_defined?(:specification_version)

    # Hack to fix github's strange marshal file
    def specification_version
      @specification_version && @specification_version.to_i
    end

    alias full_gem_path_without_location full_gem_path
    def full_gem_path
      if defined?(@location) && @location
        @location
      else
        full_gem_path_without_location
      end
    end
  end
end