class AgileNotifier::Composer

Constants

SENTENCES_BLAME_COMMITTER
SENTENCES_PRAISE_COMMITTER
SENTENCES_WARN_COMMITTER
SENTENCES_WARN_WIP_LIMIT

Public Class Methods

blame_committer_of_a_commit(args) click to toggle source
# File lib/agile_notifier/composer.rb, line 138
def blame_committer_of_a_commit(args)
  committer_name = get_committer_name_of_a_commit(args)
  blame_committer(committer_name, args[:language])
end
praise_committer_of_a_commit(args) click to toggle source
# File lib/agile_notifier/composer.rb, line 148
def praise_committer_of_a_commit(args)
  committer_name = get_committer_name_of_a_commit(args)
  praise_committer(committer_name, args[:language])
end
warn_committer_of_a_commit(args) click to toggle source
# File lib/agile_notifier/composer.rb, line 143
def warn_committer_of_a_commit(args)
  committer_name = get_committer_name_of_a_commit(args)
  warn_committer(committer_name, args[:language])
end
warn_wip_limit(args) click to toggle source
# File lib/agile_notifier/composer.rb, line 134
def warn_wip_limit(args)
  random_picker(SENTENCES_WARN_WIP_LIMIT[args[:language]])
end

Private Class Methods

blame_committer(committer_name, language) click to toggle source
# File lib/agile_notifier/composer.rb, line 163
def blame_committer(committer_name, language)
  mention_committer(committer_name, SENTENCES_BLAME_COMMITTER[language])
end
get_committer_name_of_a_commit(args) click to toggle source
# File lib/agile_notifier/composer.rb, line 153
def get_committer_name_of_a_commit(args)
  repo = args[:repo]
  revision = args[:build].nil? ? args[:revision] : args[:build].revision
  if revision
    repo.get_committer_name_of_a_commit(revision)
  else
    'Someone'
  end
end
mention_committer(committer_name, sentences) click to toggle source
# File lib/agile_notifier/composer.rb, line 175
def mention_committer(committer_name, sentences)
  sentence = random_picker(sentences)
  sentence.gsub(/%\{committer_name\}/, committer_name)
end
praise_committer(committer_name, language) click to toggle source
# File lib/agile_notifier/composer.rb, line 171
def praise_committer(committer_name, language)
  mention_committer(committer_name, SENTENCES_PRAISE_COMMITTER[language])
end
random_picker(list) click to toggle source
# File lib/agile_notifier/composer.rb, line 180
def random_picker(list)
  random_number = rand(list.size)
  list[random_number]
end
warn_committer(committer_name, language) click to toggle source
# File lib/agile_notifier/composer.rb, line 167
def warn_committer(committer_name, language)
  mention_committer(committer_name, SENTENCES_WARN_COMMITTER[language])
end