Class: VimPK::Commands::Update

Inherits:
Object
  • Object
show all
Includes:
VimPK::Colorizer
Defined in:
lib/vimpk/commands/update.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Update

Returns a new instance of Update.



8
9
10
11
12
13
14
# File 'lib/vimpk/commands/update.rb', line 8

def initialize(options)
  @pack_dir = File.expand_path(options.path)
  @logs = Queue.new
  @pool = ThreadPool.new
  @plugins = Dir.glob(File.join(@pack_dir, "*", "{start,opt}", "*", ".git")).sort.map(&File.method(:dirname))
  @jobs = []
end

Instance Attribute Details

#jobsObject (readonly)

Returns the value of attribute jobs.



6
7
8
# File 'lib/vimpk/commands/update.rb', line 6

def jobs
  @jobs
end

#logsObject (readonly)

Returns the value of attribute logs.



6
7
8
# File 'lib/vimpk/commands/update.rb', line 6

def logs
  @logs
end

#pluginsObject (readonly)

Returns the value of attribute plugins.



6
7
8
# File 'lib/vimpk/commands/update.rb', line 6

def plugins
  @plugins
end

Instance Method Details

#callObject



16
17
18
19
20
21
22
23
# File 'lib/vimpk/commands/update.rb', line 16

def call
  @jobs = @plugins.map do |dir|
    @pool.schedule Job.new(dir, @logs)
  end

  @pool.shutdown
  @logs.close
end