quandl_utility 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e0a317c5ca3fcfbb52e0a4e5670b8819fa74cfc
4
- data.tar.gz: 82223f336ab0724873a07dd08e8726aea1689094
3
+ metadata.gz: 03eb516e16528dee425ec889bd77d73b0e0604d7
4
+ data.tar.gz: ea667879527199ab7de88114e2738f6ead865e35
5
5
  SHA512:
6
- metadata.gz: de91e6b285c28088fcd31d64c6d1935e583c87072118cd7414f35d7add24af393f6dcf45c5af17e0dfe4b128730cab7745b3bd7ef7a9693cd3765697f15f4526
7
- data.tar.gz: 4ef3bfd97190253dad46d999d05de83c499d35012add2114a95da5e408d82bb6e17d9242640887d354b4876b3c407ab4bbb01fd3cc247eeb4b18feb86047ca2d
6
+ metadata.gz: e41e9bc4c3ce32b732e0ac767b27eda9df474bad28d6bd6fb1f88db366a2ff36548d264a096aeb3da8a88a12f91af25e5b270b32dfbcfaf079142eed704c0587
7
+ data.tar.gz: 15119a4ad2fb787f720446983492e003688bc81c92055a126d426f8ca5de438bbdfd6efcfadb5dac8186142753ece40bd269ec1a0f73d9ace8ec9a5ebf3d1340
data/UPGRADE.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.2.1
2
+
3
+ * Add support for custom CI notification messages.
4
+ * Add support for error status from Solano.
5
+ * Default CI messages includes user who made commit.
6
+
1
7
  ## 0.2.0
2
8
 
3
9
  * Update Slack notification and lock slack-notifier
@@ -8,9 +8,10 @@ module Quandl
8
8
  namespace 'qutil:ci'
9
9
 
10
10
  desc 'notify_slack', 'Notify Quandl of build status of CI'
11
- def notify_slack
11
+ def notify_slack(message = nil)
12
+ notification = message.nil? ? ci_build_message : "#{ci_build_message} - #{message}"
12
13
  invoke 'qutil:notify:slack',
13
- [ci_build_message, slack_channel],
14
+ [notification, slack_channel],
14
15
  emoji: slack_emoji
15
16
  end
16
17
 
@@ -20,7 +21,7 @@ module Quandl
20
21
  #
21
22
  # Returns string
22
23
  def ci_build_message
23
- "*#{current_project}* (#{git_branch}) *#{tddium_build_status}* - #{tddium_report_url}"
24
+ "*#{current_project}* (#{git_branch}) *#{tddium_build_status}* - #{tddium_report_url} - (#{git_user})"
24
25
  end
25
26
 
26
27
  # Which slack channel to send build status to.
@@ -58,18 +59,44 @@ module Quandl
58
59
  @git_branch ||= `git branch`.chomp.gsub(/\*/, '').strip
59
60
  end
60
61
 
61
- # Use tddium environment variables to determine status of build
62
- #
63
- # Returns boolean
62
+ def git_user
63
+ @git_user ||= `git --no-pager show -s --format='%an'`.chomp
64
+ end
65
+
66
+ # Did the build end with failed status?
64
67
  def failed?
65
68
  ENV['TDDIUM_BUILD_STATUS'] == 'failed'
66
69
  end
67
70
 
71
+ # Did the build end with success status?
72
+ def passed?
73
+ ENV['TDDIUM_BUILD_STATUS'] == 'passed'
74
+ end
75
+
76
+ def error?
77
+ !(failed? || passed?)
78
+ end
79
+
68
80
  # Use different emojis for build statuses.
69
81
  #
70
82
  # Returns string
71
83
  def slack_emoji
72
- failed? ? fail_emoji : pass_emoji
84
+ if failed?
85
+ fail_emoji
86
+ elsif passed?
87
+ pass_emoji
88
+ else
89
+ error_emoji
90
+ end
91
+ end
92
+
93
+ # Return the emoji to use for an error build
94
+ # Can be overriden with environment variables in tddium.yml.
95
+ # Default is :warning:
96
+ #
97
+ # Returns string
98
+ def error_emoji
99
+ ENV.fetch('SLACK_ERROR_EMOJI', ':warning:')
73
100
  end
74
101
 
75
102
  # Return the emoji to use for a failed build
@@ -1,5 +1,5 @@
1
1
  module Quandl
2
2
  module Utility
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quandl_utility
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Hilscher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-10 00:00:00.000000000 Z
11
+ date: 2014-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport