github_status_notifier 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 335237a1a0833c5e40823e4901090f34bbe65721
|
4
|
+
data.tar.gz: 48b915442452a5ea83ff251d7fc199db83a3f9ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1508635fde07fd2b0f902ad535c7ed95cb0fa6fef817b0b2a02debbc6f5a6f00476cf21fe5f328ee5b61dfc505877b784244722eb3ce27922a9b05c63bce1fc5
|
7
|
+
data.tar.gz: 706a9adce5fe43ce6c00b164031dc91066ffe334378486500d3a779f75923ad636999d0cc54e644984cfb586ba8d663b6374f17435c2ff308782b6ee5ec551d0
|
data/README.md
CHANGED
@@ -5,8 +5,9 @@ module GithubStatusNotifier
|
|
5
5
|
ERROR = 'error'
|
6
6
|
FAILURE = 'failure'
|
7
7
|
ALLOWED_STATUS = [PENDING, SUCCESS, ERROR, FAILURE]
|
8
|
+
CONTEXT = 'github_status_notifier'
|
8
9
|
|
9
|
-
def notify(params)
|
10
|
+
def notify(params = {})
|
10
11
|
state = decide_state(params[:state], params[:exit_status])
|
11
12
|
repo_path = '.'
|
12
13
|
repo = Repository.new(repo_path)
|
@@ -20,22 +21,21 @@ module GithubStatusNotifier
|
|
20
21
|
rescue StandardError => e
|
21
22
|
logger.error e.message
|
22
23
|
logger.error e.backtrace
|
23
|
-
client.create_status(ERROR, pass_params)
|
24
24
|
end
|
25
25
|
|
26
26
|
def decide_context(text)
|
27
|
-
text ||
|
27
|
+
text || CONTEXT
|
28
28
|
end
|
29
29
|
|
30
30
|
def decide_state(state, exit_status)
|
31
31
|
if state
|
32
32
|
return state.downcase if ALLOWED_STATUS.include?(state.downcase)
|
33
|
-
fail
|
33
|
+
fail InvalidStateError, "state: #{state} is invalid. allowed #{ALLOWED_STATUS}"
|
34
34
|
elsif exit_status
|
35
35
|
return SUCCESS if exit_status.to_i == 0
|
36
36
|
return FAILURE
|
37
37
|
else
|
38
|
-
fail
|
38
|
+
fail ArgumentError, 'require state or exit-state'
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require 'logger'
|
2
2
|
require 'saddler/reporter/github'
|
3
|
-
require 'github_status_notifier/
|
3
|
+
require 'github_status_notifier/client'
|
4
|
+
require 'github_status_notifier/error'
|
4
5
|
require 'github_status_notifier/notifier'
|
6
|
+
require 'github_status_notifier/repository'
|
7
|
+
require 'github_status_notifier/version'
|
5
8
|
|
6
9
|
module GithubStatusNotifier
|
7
|
-
class Error < StandardError; end
|
8
|
-
|
9
10
|
def self.default_logger
|
10
11
|
logger = Logger.new(STDERR)
|
11
12
|
logger.progname = 'GithubStatusNotifier'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github_status_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sanemat
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- lib/github_status_notifier.rb
|
106
106
|
- lib/github_status_notifier/cli.rb
|
107
107
|
- lib/github_status_notifier/client.rb
|
108
|
+
- lib/github_status_notifier/error.rb
|
108
109
|
- lib/github_status_notifier/notifier.rb
|
109
110
|
- lib/github_status_notifier/repository.rb
|
110
111
|
- lib/github_status_notifier/version.rb
|