Class: GGem::CLI::TagCommand

Inherits:
Object
  • Object
show all
Includes:
ForceTagOptionCommand, GemspecCommand, GitRepoCommand
Defined in:
lib/ggem/cli/commands.rb

Instance Method Summary collapse

Instance Method Details

#helpObject



342
343
344
345
346
347
# File 'lib/ggem/cli/commands.rb', line 342

def help
  "Usage: ggem tag [options]\n\n" \
  "Options: #{@clirb}\n" \
  "Description:\n" \
  "  #{self.summary}"
end

#run(argv, *args) ⇒ Object



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
# File 'lib/ggem/cli/commands.rb', line 306

def run(argv, *args)
  super

  begin
    cmd{ @repo.run_validate_clean_cmd }
    cmd{ @repo.run_validate_committed_cmd }
  rescue GGem::GitRepo::CmdError => err
    @stderr.puts "There are files that need to be committed first."
    if self.clirb.opts["force-tag"]
      @stderr.puts "Forcing tag anyway..."
    else
      raise CommandExitError
    end
  end

  cmd{ @repo.run_add_version_tag_cmd(@spec.version, @spec.version_tag) }

  @stdout.puts "Tagged #{@spec.version_tag}."

  begin
    cmd{ @repo.run_push_cmd }
  rescue
    cmd{ @repo.run_rm_tag_cmd(@spec.version_tag) }
    raise
  end

  @stdout.puts "Pushed git commits and tags."
rescue GGem::GitRepo::CmdError => err
  @stderr.puts err.message
  raise CommandExitError
end

#summaryObject



338
339
340
# File 'lib/ggem/cli/commands.rb', line 338

def summary
  "Tag #{@spec.version_tag} and push git commits/tags"
end