class GitTopic::Commands::Start

this command starts topic to create branch

Public Class Methods

new(topic_name) click to toggle source
# File lib/git_topic/commands/start.rb, line 7
def initialize(topic_name)
  @topic_name = topic_name
end

Public Instance Methods

execute() click to toggle source
# File lib/git_topic/commands/start.rb, line 11
def execute
  create_branch
  summary = read_summary
  summary_to_branch summary
  puts "start `#{@topic_name}`"
end

Private Instance Methods

create_branch() click to toggle source
# File lib/git_topic/commands/start.rb, line 20
def create_branch
  command = "git checkout -b #{@topic_name}"
  system(command)
end
read_summary() click to toggle source
# File lib/git_topic/commands/start.rb, line 25
def read_summary
  command = "git config --get topic.#{@topic_name}"
  _stdin, stdout, _stderr, _wait_thr = *Open3.popen3(command)
  stdout.readline
end
summary_to_branch(summary) click to toggle source
# File lib/git_topic/commands/start.rb, line 31
def summary_to_branch(summary)
  system("git config --add branch.#{@topic_name}.description #{summary}")
end