class Quandl::Utility::ThorTasks::CI
Public Instance Methods
notify_slack(message = nil)
click to toggle source
# File lib/quandl/utility/thor_tasks/ci.rb, line 14 def notify_slack(message = nil) notification = message.nil? ? ci_build_message : "#{ci_build_message} - #{message}" Quandl::Slack::Ci.ping(notification, channel: slack_channel, icon_emoji: slack_emoji) end
Private Instance Methods
ci_build_message()
click to toggle source
current_project()
click to toggle source
# File lib/quandl/utility/thor_tasks/ci.rb, line 55 def current_project ENV['QUANDL_PROJECT'] end
error?()
click to toggle source
# File lib/quandl/utility/thor_tasks/ci.rb, line 77 def error? !(failed? || passed?) end
error_emoji()
click to toggle source
Return the emoji to use for an error build Can be overriden with environment variables in tddium.yml. Default is :warning:
Returns string
# File lib/quandl/utility/thor_tasks/ci.rb, line 99 def error_emoji ENV.fetch('SLACK_ERROR_EMOJI', ':warning:') end
fail_emoji()
click to toggle source
Return the emoji to use for a failed build Can be overriden with environment variables in tddium.yml. Default is :scream_cat:
Returns string
# File lib/quandl/utility/thor_tasks/ci.rb, line 108 def fail_emoji ENV.fetch('SLACK_FAIL_EMOJI', ':scream_cat:') end
failed?()
click to toggle source
Did the build end with failed status?
# File lib/quandl/utility/thor_tasks/ci.rb, line 68 def failed? ENV['TDDIUM_BUILD_STATUS'] == 'failed' end
git_branch()
click to toggle source
# File lib/quandl/utility/thor_tasks/ci.rb, line 59 def git_branch @git_branch ||= `git branch`.chomp.gsub(/\*/, '').strip end
git_user()
click to toggle source
# File lib/quandl/utility/thor_tasks/ci.rb, line 63 def git_user @git_user ||= `git --no-pager show -s --format='%an'`.chomp end
pass_emoji()
click to toggle source
Return the emoji to use for a successful build Can be overriden with environment variables in tddium.yml. Default is :thumbsup:
Returns string
# File lib/quandl/utility/thor_tasks/ci.rb, line 117 def pass_emoji ENV.fetch('SLACK_PASS_EMOJI', ':thumbsup:') end
passed?()
click to toggle source
Did the build end with success status?
# File lib/quandl/utility/thor_tasks/ci.rb, line 73 def passed? ENV['TDDIUM_BUILD_STATUS'] == 'passed' end
slack_channel()
click to toggle source
Which slack channel to send build status to. Defaults to ‘development’, but it can be overriden in tddium.yml
Returns string
# File lib/quandl/utility/thor_tasks/ci.rb, line 32 def slack_channel ENV.fetch('SLACK_CHANNEL', '#development') end
slack_emoji()
click to toggle source
Use different emojis for build statuses.
Returns string
# File lib/quandl/utility/thor_tasks/ci.rb, line 84 def slack_emoji if failed? fail_emoji elsif passed? pass_emoji else error_emoji end end
tddium_api_server()
click to toggle source
# File lib/quandl/utility/thor_tasks/ci.rb, line 47 def tddium_api_server ENV['TDDIUM_API_SERVER'] end
tddium_build_status()
click to toggle source
# File lib/quandl/utility/thor_tasks/ci.rb, line 43 def tddium_build_status ENV['TDDIUM_BUILD_STATUS'] end
tddium_report_url()
click to toggle source
The URL for the build that just ran
Returns string
# File lib/quandl/utility/thor_tasks/ci.rb, line 39 def tddium_report_url "https://#{tddium_api_server}/1/reports/#{tddium_session_id}" end
tddium_session_id()
click to toggle source
# File lib/quandl/utility/thor_tasks/ci.rb, line 51 def tddium_session_id ENV['TDDIUM_SESSION_ID'] end