Class: Source::FilesFromBundlerDirectoryProvider

Inherits:
FilesFromDirectoryProvider show all
Defined in:
lib/gpm/source/files_providers/files_from_bundler_directory_provider.rb

Instance Attribute Summary

Attributes inherited from FilesFromDirectoryProvider

#directory

Instance Method Summary collapse

Methods inherited from FilesFromDirectoryProvider

create_from_directory, create_from_glob

Methods inherited from FilesProvider

#files

Constructor Details

#initialize(gemfile, gemspec, vendored_gems_installer = nil) ⇒ FilesFromBundlerDirectoryProvider

Returns a new instance of FilesFromBundlerDirectoryProvider.



8
9
10
11
12
13
14
# File 'lib/gpm/source/files_providers/files_from_bundler_directory_provider.rb', line 8

def initialize(gemfile,gemspec,vendored_gems_installer = nil)
  raise "Must give me a Gemfile, not #{gemfile.inspect}" unless File.basename(gemfile)=="Gemfile"
  @vendored_gems_installer = vendored_gems_installer || Source::VendoredGemsInstaller.new(gemfile)
  @installed = false

  super(File.dirname(gemfile), [File.basename(gemfile),File.basename(gemspec),'Gemfile.lock','.bundle/config'])
end

Instance Method Details

#file_contentsObject



23
24
25
26
27
28
29
# File 'lib/gpm/source/files_providers/files_from_bundler_directory_provider.rb', line 23

def file_contents
  unless @installed
    @vendored_gems_installer.install!
    @installed = true
  end
  super
end

#files_to_provideObject



15
16
17
18
19
20
21
# File 'lib/gpm/source/files_providers/files_from_bundler_directory_provider.rb', line 15

def files_to_provide
  bundled_files = nil
  Dir.chdir(directory) do
    bundled_files = Dir["vendor/bundle/**/*"]
  end
  super + bundled_files
end