Class: Bookbinder::Commands::UpdateLocalDocRepos

Inherits:
Object
  • Object
show all
Includes:
Naming
Defined in:
lib/bookbinder/commands/update_local_doc_repos.rb

Instance Method Summary collapse

Methods included from Naming

#command_for?, #command_type, #flag?

Constructor Details

#initialize(streams, configuration_fetcher, version_control_system, filesystem) ⇒ UpdateLocalDocRepos

Returns a new instance of UpdateLocalDocRepos.



10
11
12
13
14
15
# File 'lib/bookbinder/commands/update_local_doc_repos.rb', line 10

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

Instance Method Details

#run(_) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/bookbinder/commands/update_local_doc_repos.rb', line 22

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

#usageObject



17
18
19
20
# File 'lib/bookbinder/commands/update_local_doc_repos.rb', line 17

def usage
  [command_name,
   "Run `git pull` on all sections that exist at the same directory level as your book directory"]
end