Class: Bookwatch::Commands::UpdateLocalDocRepos

Inherits:
Object
  • Object
show all
Defined in:
lib/bookwatch/commands/update_local_doc_repos.rb

Instance Method Summary collapse

Constructor Details

#initialize(streams, configuration_fetcher, version_control_system) ⇒ UpdateLocalDocRepos

Returns a new instance of UpdateLocalDocRepos.



6
7
8
9
10
# File 'lib/bookwatch/commands/update_local_doc_repos.rb', line 6

def initialize(streams, configuration_fetcher, version_control_system)
  @streams = streams
  @configuration_fetcher = configuration_fetcher
  @version_control_system = version_control_system
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
# File 'lib/bookwatch/commands/update_local_doc_repos.rb', line 12

def run
  urls = configuration_fetcher.fetch_config.sections.map(&:repo_url)
  paths(urls).each do |path|
    streams[:out] << "\nUpdating #{path}:"
    report(version_control_system.update(path))
  end
  streams[:out].puts
  0
end