Sha256: 6b431b721f77982f9eb4c4df10d18445c1ff063395ba325f56cdc1a454475540

Contents?: true

Size: 889 Bytes

Versions: 2

Compression:

Stored size: 889 Bytes

Contents

module Space
  class Bundle
    include Commands

    COMMANDS = {
      :check  => 'bundle check',
      :list   => 'bundle list',
      :config => 'bundle config'
    }

    def initialize(path)
      super(path)
    end

    def clean?
      info =~ /dependencies are satisfied/
    end

    def info
      result(:check).split("\n").first
    end

    def deps
      result(:list).split("\n").map do |dep|
        dep =~ /(#{App.name}.*) \(\d\.\d\.\d (.+)\)/
        Dependency.new($1, $2) if Repos.names.include?($1)
      end.compact
    end

    def local_repos
      config.keys.map do |key|
        key =~ /^local\.(.+)$/ && $1
      end.compact
    end

    def config
      lines  = result(:config).split("\n")[2..-1]
      values = lines.map_slice(3) do |name, value, _|
        [name, value =~ /: "(.*)"/ && $1]
      end
      Hash[*values.compact.flatten]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
space-0.0.3 lib/space/models/bundle.rb
space-0.0.2 lib/space/models/bundle.rb