Sha256: c991f239c0d3fda0aea2cd0e973d1e4079daddc1d6e73bc7039a2824d6e01519

Contents?: true

Size: 916 Bytes

Versions: 14

Compression:

Stored size: 916 Bytes

Contents

namespace :gems do
  desc "Install gems locally"
  task :sync => [:environment] do
    require 'bowline/dependencies/lib/ext/rubygems'
    
    conf = Bowline.configuration
    repo = Dependencies::Repository.new(
      conf.gem_path
    )

    conf.gems.each do |dep|
      gem = repo.gem(dep.name, dep.versions)
      next unless repo.search(gem).empty?
      repo.install(gem)
    end

    repo.reload_index!

    full_list = conf.gems.map do |dep|
      gem = repo.gem(dep.name, dep.versions)
      spec = repo.index.search(gem).last
      unless spec
        raise Exception.new("A required dependency #{gem} was not found")
      end
      deps = spec.recursive_dependencies(gem, repo.index)
      [spec] + deps
    end.flatten.uniq.map do |spec|
      "#{spec.name}-#{spec.version}"
    end

    (repo.installed - full_list).each do |g|
      /^(.*)\-(.*)$/ =~ g
      repo.uninstall($1, $2)
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
maccman-bowline-0.4.5 lib/bowline/tasks/gems.rake
maccman-bowline-0.4.6 lib/bowline/tasks/gems.rake
maccman-bowline-0.4.7 lib/bowline/tasks/gems.rake
maccman-bowline-0.4.8 lib/bowline/tasks/gems.rake
bowline-0.5.8 lib/bowline/tasks/gems.rake
bowline-0.5.7 lib/bowline/tasks/gems.rake
bowline-0.5.6 lib/bowline/tasks/gems.rake
bowline-0.5.5 lib/bowline/tasks/gems.rake
bowline-0.5.4 lib/bowline/tasks/gems.rake
bowline-0.5.3 lib/bowline/tasks/gems.rake
bowline-0.5.2 lib/bowline/tasks/gems.rake
bowline-0.5.1 lib/bowline/tasks/gems.rake
bowline-0.5.0 lib/bowline/tasks/gems.rake
bowline-0.4.6 lib/bowline/tasks/gems.rake