agile_notifier 2.0 → 2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +10 -10
- data/agile_notifier.gemspec +1 -1
- data/lib/agile_notifier/configuration.rb +13 -3
- data/lib/agile_notifier/github.rb +19 -5
- data/lib/agile_notifier/scm.rb +3 -2
- data/lib/agile_notifier.rb +1 -1
- metadata +2 -3
- data/Gemfile.lock +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6dab087af32f66ddcfc47df973466feee564490
|
4
|
+
data.tar.gz: 097165226c80d53eecc59b9043c9f7dcaa98af02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5b09f872f73a43807f151f77ac5b4fa05898d6efa9c54de10b7581a08a7d48572708b9c1c61c6bcee1887b332700cd5cef0b0a9e241555175117ed6043bb2fe
|
7
|
+
data.tar.gz: 58ca64e4c1b5c655a37f1d73aae00d7b0923ebf7f3dda83ad1a85fb7dfa7ac83736395e2fbd19459ce41d569b1e6d4b65984b7ac411aa210da7af98a595a8874
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -18,29 +18,29 @@ AgileNotifier::Configuration.set do
|
|
18
18
|
|
19
19
|
scm_url 'https://github.xyzcompany.com'
|
20
20
|
scm_repo user: 'your_user_name', repo: 'your_repository_name'
|
21
|
+
# scm_auth is optional, depends on if your github API access requires authentication
|
22
|
+
# if authentication is required, please choose either username & password or OAuth access token (latter one is recommended)
|
23
|
+
scm_auth username: 'github_login_username', password: 'github_login_password' # optional
|
24
|
+
scm_auth token: 'a1b2c3d4e5f6f0f0f0f0f0f0f0f0f6e5d4c3b2a1' # optional
|
21
25
|
scm_get 'Github', enterprise: true
|
22
26
|
|
23
27
|
# for non-enterprise version
|
24
28
|
# scm_url 'https://api.github.com'
|
25
29
|
# scm_repo user: 'your_user_name', repo: 'your_repository_name'
|
26
30
|
# scm_get 'Github'
|
27
|
-
|
28
|
-
speak 'en'
|
29
|
-
play 'Boing' # Mac OSX TTS voice name(optional field), unnecessary for other OS
|
30
|
-
|
31
|
-
alert_on_fail
|
32
|
-
alert_on_fix
|
33
|
-
alert_on_unstable
|
34
31
|
|
35
32
|
its_url 'https://jira.atlassian.com'
|
36
33
|
its_auth 'jira_username', 'jira_password'
|
37
34
|
its_get 'Jira'
|
38
35
|
its_set_wip 'BAM', 'project = BAM AND status = Resolved AND resolution = Unresolved', 3
|
39
36
|
its_set_wip 'XXX', 'project = XXX AND status = Resolved AND resolution = Unresolved', 5
|
40
|
-
|
37
|
+
|
41
38
|
speak 'en'
|
42
|
-
play '
|
43
|
-
|
39
|
+
play 'Boing' # Mac OSX TTS voice name(optional field), unnecessary for other OS
|
40
|
+
|
41
|
+
alert_on_fail
|
42
|
+
alert_on_fix
|
43
|
+
alert_on_unstable
|
44
44
|
alert_on_wip
|
45
45
|
end
|
46
46
|
```
|
data/agile_notifier.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.name = 'agile_notifier'
|
8
8
|
s.version = AgileNotifier::VERSION
|
9
9
|
s.license = 'MIT'
|
10
|
-
s.date = '2014-
|
10
|
+
s.date = '2014-10-02'
|
11
11
|
s.summary = %q{agile_notifier alerts you via making wonderful noises when your Continuous Integration status changes.}
|
12
12
|
s.description = %q{agile_notifier alerts you via making wonderful noises when your Continuous Integration status changes. It totally makes software development more agile and more fun.}
|
13
13
|
s.authors = ['Jing Li']
|
@@ -36,12 +36,22 @@ module AgileNotifier
|
|
36
36
|
@scm_repos.push(repo)
|
37
37
|
end
|
38
38
|
|
39
|
+
def scm_auth(auth)
|
40
|
+
username = auth.fetch(:username, nil)
|
41
|
+
password = auth.fetch(:password, nil)
|
42
|
+
token = auth.fetch(:token, nil)
|
43
|
+
@scm_authentication = username && password ? {:basic_auth => {:username => username, :password => password}} : nil
|
44
|
+
@scm_authentication = {:Authorization => "token #{token}"} if token
|
45
|
+
end
|
46
|
+
|
39
47
|
def scm_get(scm_type, args = {})
|
40
|
-
enterprise = args.fetch(:enterprise, false)
|
48
|
+
enterprise = args.fetch(:enterprise, false)
|
49
|
+
params = [@scm_url]
|
50
|
+
params.push(@scm_authentication) if @scm_authentication
|
41
51
|
if enterprise
|
42
|
-
@scm = @current_module.const_get(scm_type).new_enterprise_version(
|
52
|
+
@scm = @current_module.const_get(scm_type).new_enterprise_version(*params)
|
43
53
|
else
|
44
|
-
@scm = @current_module.const_get(scm_type).new(
|
54
|
+
@scm = @current_module.const_get(scm_type).new(*params)
|
45
55
|
end
|
46
56
|
@scm_repos.each do |repo|
|
47
57
|
@scm.add_repository(repo)
|
@@ -9,13 +9,25 @@ module AgileNotifier
|
|
9
9
|
|
10
10
|
ENTERPRISE_API = '/api/v3'
|
11
11
|
USERAGENT = 'AgileNotifier'
|
12
|
+
|
13
|
+
@@headers = {:headers => {'User-Agent' => USERAGENT}}
|
14
|
+
@@auth = nil
|
12
15
|
|
13
|
-
def initialize(url)
|
16
|
+
def initialize(url, args = {})
|
14
17
|
super
|
18
|
+
basic_auth = args.fetch(:basic_auth, nil)
|
19
|
+
access_token = args.fetch(:Authorization, nil)
|
20
|
+
if basic_auth
|
21
|
+
@@auth = {:basic_auth => basic_auth}
|
22
|
+
elsif access_token
|
23
|
+
@@headers[@@headers.keys.first] = @@headers.values.first.merge({'Authorization' => access_token})
|
24
|
+
end
|
15
25
|
if url.include?(ENTERPRISE_API)
|
16
26
|
status_url = url + '/zen'
|
17
27
|
begin
|
18
|
-
|
28
|
+
args = [status_url]
|
29
|
+
args.push(@@auth && @@auth.has_key?(:basic_auth) ? @@headers.merge(@@auth) : @@headers)
|
30
|
+
status = HTTParty.get(*args).code
|
19
31
|
availability = ( status == 200 )
|
20
32
|
rescue => e
|
21
33
|
puts e.message
|
@@ -30,12 +42,14 @@ module AgileNotifier
|
|
30
42
|
end
|
31
43
|
|
32
44
|
class << self
|
33
|
-
def new_enterprise_version(url)
|
34
|
-
new(url + ENTERPRISE_API)
|
45
|
+
def new_enterprise_version(url, args = {})
|
46
|
+
new(url + ENTERPRISE_API, args)
|
35
47
|
end
|
36
48
|
|
37
49
|
def get_value(key, url)
|
38
|
-
|
50
|
+
args = @@headers
|
51
|
+
args.merge!(@@auth) if @@auth && @@auth.has_key?(:basic_auth)
|
52
|
+
get_value_of_key(key, url, args)
|
39
53
|
end
|
40
54
|
end
|
41
55
|
|
data/lib/agile_notifier/scm.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
module AgileNotifier
|
2
2
|
class SCM
|
3
|
-
attr_accessor :url, :repositories
|
3
|
+
attr_accessor :url, :repositories, :args
|
4
4
|
|
5
|
-
def initialize(url)
|
5
|
+
def initialize(url, args = {})
|
6
6
|
@url = url
|
7
7
|
@repositories = []
|
8
|
+
@args = args
|
8
9
|
end
|
9
10
|
|
10
11
|
def add_repository(repository)
|
data/lib/agile_notifier.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: agile_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '2.
|
4
|
+
version: '2.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jing Li
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -81,7 +81,6 @@ extra_rdoc_files: []
|
|
81
81
|
files:
|
82
82
|
- .gitignore
|
83
83
|
- Gemfile
|
84
|
-
- Gemfile.lock
|
85
84
|
- README.md
|
86
85
|
- Rakefile
|
87
86
|
- agile_notifier.gemspec
|
data/Gemfile.lock
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
httparty (0.11.0)
|
5
|
-
multi_json (~> 1.0)
|
6
|
-
multi_xml (>= 0.5.2)
|
7
|
-
json (1.8.0)
|
8
|
-
metaclass (0.0.1)
|
9
|
-
mocha (0.14.0)
|
10
|
-
metaclass (~> 0.0.1)
|
11
|
-
multi_json (1.8.0)
|
12
|
-
multi_xml (0.5.5)
|
13
|
-
|
14
|
-
PLATFORMS
|
15
|
-
ruby
|
16
|
-
|
17
|
-
DEPENDENCIES
|
18
|
-
httparty
|
19
|
-
json
|
20
|
-
mocha
|