class Coauthor::Git::Template

Attributes

credentials[R]

Public Class Methods

call() click to toggle source
# File lib/coauthor/git/template.rb, line 14
def self.call
  credentials = Prompt.fetch_user_info(user_count: 2)
  return unless credentials
  new(credentials: credentials)
rescue SystemExit, Interrupt
  puts "\n...Template setup cancelled".colorize(:red)
end
new(credentials:) click to toggle source
# File lib/coauthor/git/template.rb, line 9
def initialize(credentials:)
  @credentials = credentials
  write_file
end

Private Instance Methods

write_file() click to toggle source
# File lib/coauthor/git/template.rb, line 24
def write_file
  File.open(PAIR_FILE_PATH, 'w+') do |file|
    credentials.each do |detail|
      file.write("\nCo-authored-by: #{detail['name']} <#{detail['email']}>")
    end
  end
  puts "...DONE! Coauthor file written to #{PAIR_CONFIG_FILE}\n".colorize(:green)
end