Class: Bookbinder::Commands::Punch

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

Instance Method Summary collapse

Methods included from Naming

#command_for?, #command_type, #flag?

Constructor Details

#initialize(streams, configuration_fetcher, version_control_system) ⇒ Punch

Returns a new instance of Punch.



9
10
11
12
13
# File 'lib/bookbinder/commands/punch.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(tag) ⇒ Object



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

def run((tag, *))
  raise CliError::InvalidArguments unless tag

  urls(config).each do |url|
    version_control_system.remote_tag(url, tag, 'HEAD')
  end

  streams[:success].puts 'Success!'
  streams[:out].puts "#{config.book_repo} and its sections were tagged with #{tag}"
  0
end

#usageObject



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

def usage
  ["punch <git tag>", "Apply the specified <git tag> to your book, sections, and layout repo"]
end