Class: Moku::CachedBundle

Inherits:
Object
  • Object
show all
Defined in:
lib/moku/cached_bundle.rb

Overview

Moku's cache of gems for use with bundler

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ CachedBundle


11
12
13
14
# File 'lib/moku/cached_bundle.rb', line 11

def initialize(path)
  @path = path
  @paths = {}
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path


16
17
18
# File 'lib/moku/cached_bundle.rb', line 16

def path
  @path
end

Instance Method Details

#install(artifact) ⇒ Status

Use moku's cache of gems to install and artifact's bundle. Missing gems will be downloaded from the configured gem source (e.g. rubygems), and also added to this cache.


23
24
25
26
27
28
29
30
# File 'lib/moku/cached_bundle.rb', line 23

def install(artifact)
  Sequence.for([
    "rsync -r #{cache_path(artifact)}/. #{artifact.bundle_path}/",
    "bundle install --deployment '--without=development test'",
    "rsync -r #{artifact.bundle_path}/. #{cache_path(artifact)}/",
    "bundle clean"
  ]) {|command| artifact.run(command) }
end