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) ⇒ UpdateLocalDocRepos

Returns a new instance of UpdateLocalDocRepos.



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

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

Instance Method Details

#run(_) ⇒ Object



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

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



15
16
17
18
# File 'lib/bookbinder/commands/update_local_doc_repos.rb', line 15

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