Class: Gemat::Fetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/fetcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dsl) ⇒ Fetcher

Returns a new instance of Fetcher.



7
8
9
10
# File 'lib/fetcher.rb', line 7

def initialize(dsl)
  @dsl = dsl
  @gems = []
end

Instance Attribute Details

#gemsObject

Returns the value of attribute gems.



5
6
7
# File 'lib/fetcher.rb', line 5

def gems
  @gems
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fetcher.rb', line 12

def run
  pb = ProgressBar.create(total: @dsl.dependencies.length)
  @dsl.dependencies.each_with_index do |dependency, idx|
    pb.increment

    response = fetch_rubygems(dependency)
    next unless response

    create_gem(response, idx)
    sleep 0.2
  end
end