Sha256: b5470dfae9db872ea31094c93197c6ce9874b2550511a449c2edd56538c4ae70

Contents?: true

Size: 807 Bytes

Versions: 2

Compression:

Stored size: 807 Bytes

Contents

require 'observer'

module Space
  module Models
    class Repo
      class Bundle
        include Events, Shell

        commands check: 'bundle check',
                 list:  'bundle list'

        watch 'Gemfile',
              'Gemfile.lock'

        attr_reader :repo, :repos

        def initialize(repo, repos)
          @repo = repo
          @repos = repos
          super(repo.path)
        end

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

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

        def deps
          result(:list).scan(/\* ([\w-]+) \(.* ([\d|\w]+)\)/).map do |name, ref|
            Dependency.new(repos.find_by_name(name), ref) if repos.names.include?(name)
          end.compact
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
space-0.0.5 lib/space/models/repo/bundle.rb
space-0.0.4 lib/space/models/repo/bundle.rb