Module: Texico::Git

Defined in:
lib/texico/git.rb

Class Method Summary collapse

Class Method Details

.init(target, initial_commit = false) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/texico/git.rb', line 6

def init(target, initial_commit = false)
  if initial_commit
    system "git init '#{target}' && git -C '#{target}' add . " \
           "&& git -C '#{target}' commit -m 'Initial commit'"
  else
    system "git init '#{target}'"
  end
end

.list_tags(target) ⇒ Object



21
22
23
24
25
# File 'lib/texico/git.rb', line 21

def list_tags(target)
  Open3.popen2 "git -C '#{target}' tag -l" do |_, stdout, _|
    stdout.each_line.map { |line| line.chomp }
  end
end

.tag(target, label, message) ⇒ Object



16
17
18
# File 'lib/texico/git.rb', line 16

def tag(target, label, message)
  system "git -C '#{target}' tag -a #{label} -m '#{message}'"
end