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: c3488a57eac600148a552af144350b9a4e08fe37
4
- data.tar.gz: a68580a46abef7cf495e8ed015d8b969613642ec
3
+ metadata.gz: 335237a1a0833c5e40823e4901090f34bbe65721
4
+ data.tar.gz: 48b915442452a5ea83ff251d7fc199db83a3f9ba
5
5
  SHA512:
6
- metadata.gz: f1b193113fe518e8177b9f1b84c103e6a5e581a696106822ac8cc95735391350c5470d1d6e98c7b3852c4053c7fed9b030b25f58039782a88555e6e5fd9230f9
7
- data.tar.gz: 844aef7d5d6da3768bfad5c3acf9e364e5550a65ddaa0adcd4ef7888d8f52aac33b28e546eaa6d141413d2f800dc3959e2015ae0604a74c7ad8964ecb5786777
6
+ metadata.gz: 1508635fde07fd2b0f902ad535c7ed95cb0fa6fef817b0b2a02debbc6f5a6f00476cf21fe5f328ee5b61dfc505877b784244722eb3ce27922a9b05c63bce1fc5
7
+ data.tar.gz: 706a9adce5fe43ce6c00b164031dc91066ffe334378486500d3a779f75923ad636999d0cc54e644984cfb586ba8d663b6374f17435c2ff308782b6ee5ec551d0
data/README.md CHANGED
@@ -74,7 +74,9 @@ Or install it yourself as:
74
74
 
75
75
  ## Setting
76
76
 
77
- require `GITHUB_ACCESS_TOKEN`
77
+ require setting `GITHUB_ACCESS_TOKEN` to your environment variable.
78
+
79
+
78
80
 
79
81
  ## Development
80
82
 
@@ -42,8 +42,7 @@ module GithubStatusNotifier
42
42
  context: options[:context]
43
43
  }
44
44
 
45
- notifier = Notifier.new
46
- notifier.notify(params)
45
+ Notifier.new.notify(params)
47
46
 
48
47
  if options[:keep_exit_status]
49
48
  exit options[:exit_status]
@@ -0,0 +1,5 @@
1
+ module GithubStatusNotifier
2
+ class GithubStatusNotifierError < StandardError; end
3
+ class ArgumentError < GithubStatusNotifierError; end
4
+ class InvalidStateError < GithubStatusNotifierError; end
5
+ end
@@ -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 || 'github_status_notifier'
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 Error("state: #{state} is invalid. allowed #{ALLOWED_STATUS}")
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 Error('require state or exit-state')
38
+ fail ArgumentError, 'require state or exit-state'
39
39
  end
40
40
  end
41
41
 
@@ -1,3 +1,3 @@
1
1
  module GithubStatusNotifier
2
- VERSION = '0.0.1'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -1,11 +1,12 @@
1
1
  require 'logger'
2
2
  require 'saddler/reporter/github'
3
- require 'github_status_notifier/version'
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.1
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