Class: Shoes::Packager

Inherits:
Object
  • Object
show all
Defined in:
shoes-core/lib/shoes/packager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePackager

Returns a new instance of Packager.



7
8
9
10
11
12
# File 'shoes-core/lib/shoes/packager.rb', line 7

def initialize
  @backend = Shoes.backend_for(self)
  configure_gems
rescue ArgumentError
  # Packaging unsupported by this backend
end

Instance Attribute Details

#backendObject (readonly)

Returns the value of attribute backend.



5
6
7
# File 'shoes-core/lib/shoes/packager.rb', line 5

def backend
  @backend
end

Instance Method Details

#configure_gemsObject



27
28
29
30
31
32
33
34
35
36
# File 'shoes-core/lib/shoes/packager.rb', line 27

def configure_gems
  @backend.gems = []
  return unless defined?(::Bundler)

  @backend.gems = ::Bundler.environment.specs.map(&:name) - ["shoes"]
rescue Bundler::GemfileNotFound
  # Ok to be quiet since we didn't even have a Gemfile
rescue => e
  Shoes.logger.error "Looking up gems for packaging failed:\n#{e.message}"
end

#optionsObject



14
15
16
# File 'shoes-core/lib/shoes/packager.rb', line 14

def options
  @backend.options
end

#parse!(args) ⇒ Object



18
19
20
# File 'shoes-core/lib/shoes/packager.rb', line 18

def parse!(args)
  options.parse!(args)
end

#run(path) ⇒ Object



22
23
24
25
# File 'shoes-core/lib/shoes/packager.rb', line 22

def run(path)
  raise "Packaging unsupported by this backend" if @backend.nil?
  @backend.run(path)
end