Sha256: 56ad57b9a9d042cf4f3f074643e27e9581a69e83bfdd84826bd83f690d838dad

Contents?: true

Size: 855 Bytes

Versions: 1

Compression:

Stored size: 855 Bytes

Contents

module Space
  module Model
    class Project
      autoload :Bundler, 'space/model/project/bundler'

      include Events

      attr_reader :name, :repos, :bundler, :config

      def initialize(name)
        @name    = name
        @config  = Config.load(name)
        @repos   = Repos.new(self, config.paths)
        @bundler = Bundler.new(self)
      end

      def local_repos
        bundler.config.keys.map do |key|
          key =~ /^local\.(.+)$/
          $1 if repos.names.include?($1)
        end.compact
      end

      def names
        @names ||= Tmux.windows || repos.names
      end

      def number(name)
        if number = names.index(name)
          number + 1
        else
          names << name
          number(name)
        end
      end

      def refresh
        [bundler, repos].each(&:refresh)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
space-0.0.6 lib/space/model/project.rb