dug 0.1.0.alpha1 → 0.1.0.alpha2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +12 -0
- data/Gemfile +4 -0
- data/README.md +158 -18
- data/Rakefile +1 -1
- data/dug.gemspec +0 -1
- data/lib/dug/version.rb +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c6c01300fe32cff493d71785c74fe0c37e02673
|
4
|
+
data.tar.gz: bf879e429299828cc2adf2bff39a1b30458da86c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93dce7d68c25b9af837420525c8daad4bf489f93f1688445054f0794ea278a4b27344737b217bd26c6ce1183ca458497c72b6cd1c4effa25c854317774af7e27
|
7
|
+
data.tar.gz: 5aeac95bf1b2b1d41af25858c0c68e2f04874f960b6add28cb63cf67166010de76be0e578e0def24d4033e6dd546c842108cdd6d5e9fab4f09cf7f517b1e9ce0
|
data/.travis.yml
CHANGED
@@ -1,4 +1,16 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
+
- 2.1
|
4
|
+
- 2.2
|
3
5
|
- 2.3.0
|
6
|
+
- jruby-head
|
7
|
+
- rbx
|
8
|
+
matrix:
|
9
|
+
allow_failures:
|
10
|
+
- rvm: jruby-head
|
11
|
+
- rvm: rbx
|
12
|
+
addons:
|
13
|
+
code_climate:
|
14
|
+
repo_token: 7da851c483298b23777baeb35bc0e33154313620b02d72792a9f49d4d377f44e
|
4
15
|
before_install: gem install bundler -v 1.11.2
|
16
|
+
script: bundle exec rake test
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,39 +1,179 @@
|
|
1
1
|
# Dug
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/dug.svg)](https://badge.fury.io/rb/dug)
|
3
|
+
[![Build Status](https://travis-ci.org/chrisarcand/dug.svg?branch=master)](https://travis-ci.org/chrisarcand/dug)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/chrisarcand/dug/badges/gpa.svg)](https://codeclimate.com/github/chrisarcand/dug)
|
5
|
+
[![Test Coverage](https://codeclimate.com/github/chrisarcand/dug/badges/coverage.svg)](https://codeclimate.com/github/chrisarcand/dug/coverage)
|
2
6
|
|
3
|
-
|
7
|
+
Created out of frustration. _"[D]amn yo[u], [G]mail!"_
|
4
8
|
|
5
|
-
|
9
|
+
**Dug is a simple, configurable gem to organize your GitHub notification emails in
|
10
|
+
ways Gmail can't and in an easier-to-configure way.** It interacts with Google's
|
11
|
+
Gmail API to do all the things that people usually do with Gmail filters (label by
|
12
|
+
organization name, repository name) as well as parse GitHub's custom X headers to
|
13
|
+
label your messages with things like "Mentioned by name", "Assigned to me",
|
14
|
+
"Commented", etc.
|
6
15
|
|
7
|
-
## Installation
|
8
16
|
|
9
|
-
|
17
|
+
## Quick Installation
|
10
18
|
|
11
|
-
|
12
|
-
|
13
|
-
|
19
|
+
Dug is meant to be stupid simple. It's practically a gemified script with a
|
20
|
+
configurable API. As such, you can programmatically configure and execute Dug's
|
21
|
+
runner class in any way you see fit (within a web app hook, a Rake task, a script,
|
22
|
+
whatever).
|
14
23
|
|
15
|
-
|
24
|
+
Basic installation steps:
|
16
25
|
|
17
|
-
|
26
|
+
1. Install Dug
|
18
27
|
|
19
|
-
|
28
|
+
```
|
29
|
+
$ gem install dug
|
30
|
+
```
|
20
31
|
|
21
|
-
|
32
|
+
2. Create a YAML Rule file. Example (`dug_rules.yml`):
|
22
33
|
|
23
|
-
|
34
|
+
```
|
35
|
+
---
|
36
|
+
organizations:
|
37
|
+
- rails
|
38
|
+
- name: rspec
|
39
|
+
label: RSpec
|
40
|
+
repositories:
|
41
|
+
- name: rspec-expectations
|
42
|
+
label: RSpec/rspec-expectations
|
43
|
+
- ManageIQ
|
24
44
|
|
25
|
-
|
45
|
+
reasons:
|
46
|
+
author:
|
47
|
+
label: Participating
|
48
|
+
comment:
|
49
|
+
label: Participating
|
50
|
+
mention:
|
51
|
+
label: Mentioned by name
|
52
|
+
team_mention:
|
53
|
+
label: Team mention
|
54
|
+
assign:
|
55
|
+
label: Assigned to me
|
56
|
+
```
|
26
57
|
|
27
|
-
|
58
|
+
The above rule file will:
|
59
|
+
* Label all notifications from the organization `rails` with the label `rails`, `rspec` with `RSpec`, `ManageIQ` with `ManageIQ`.
|
60
|
+
* Label all notifications from the repository `rspec-expectations` with the label `RSpec/rspec-expectations`
|
61
|
+
* Label notifications with `Participating` if I am the author of the Issue/PR or if I commented on it.
|
62
|
+
* Label notifications with `Mentioned by name` if I'm directly mentioned in it.
|
63
|
+
* Label notifications with `Team mention` if a team I am a part of is mentioned in it.
|
64
|
+
* Label notifications with `Assigned to me` if the Issue/PR is assigned to me.
|
28
65
|
|
29
|
-
|
66
|
+
3. Create all of the labels in the preceding step in Gmail, if you haven't already.
|
30
67
|
|
31
|
-
|
68
|
+
4. Create a project in the [Google Developers Console](https://console.developers.google.com) to authenticate to the
|
69
|
+
Gmail API via OAuth 2.0. If you need help, detailed instructions are included further in this document.
|
32
70
|
|
33
|
-
|
71
|
+
5. Create a script. Example (`script.rb`; fill in your OAuth credentials):
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
require 'dug'
|
75
|
+
|
76
|
+
Dug.configure do |config|
|
77
|
+
# You can alternatively pass environment variables
|
78
|
+
# or a path to a downloadable authentication .json file from Google
|
79
|
+
config.client_id = "lja8w34jfo8ajer9vjsoasdufo98auow34f.apps.googleusercontent.com"
|
80
|
+
config.client_secret = "34t998asDF9879hjfd"
|
81
|
+
|
82
|
+
config.rule_file = File.join(Dir.pwd, "dug_rules.yml")
|
83
|
+
end
|
84
|
+
|
85
|
+
Dug::Runner.run
|
86
|
+
```
|
87
|
+
|
88
|
+
6. Run the script and watch your notifications get organized! The first time your run this you will be given a link to
|
89
|
+
visit in your browser to sign in to Gmail verify via a one time token.
|
90
|
+
|
91
|
+
```
|
92
|
+
$ ruby script.rb
|
93
|
+
```
|
94
|
+
|
95
|
+
7. Set a cron and forget about it (this is what I do, 60 second polling). Or deploy Dug in a web application. Or even
|
96
|
+
just write a loop in your script `loop do; Dug::Runner.run; sleep 60; end`. How you run it is completely up to you,
|
97
|
+
and really doesn't matter.
|
98
|
+
|
99
|
+
For more help, see verbose instructions below.
|
100
|
+
|
101
|
+
## Verbose Installation/Usage
|
102
|
+
|
103
|
+
Dug requires MRI 2.1+. Tests pass on the latest versions of JRuby and Rubinius as well.
|
104
|
+
|
105
|
+
### Creating OAuth 2.0 credentials to the Gmail API
|
106
|
+
|
107
|
+
[Create a project named "Dug" in the Google Developers Console and enable the Gmail
|
108
|
+
API.](https://console.developers.google.com//start/api?id=gmail&credential=client_key)
|
109
|
+
Using this link guides you through the process and activates the Gmail API automatically.
|
110
|
+
|
111
|
+
For more information, see [Using OAuth 2.0 to Access Google APIs](https://developers.google.com/identity/protocols/OAuth2)
|
112
|
+
|
113
|
+
#### Using the created OAuth credentials
|
114
|
+
|
115
|
+
There are multiple ways to use created OAuth credentials with Dug.
|
34
116
|
|
35
|
-
|
117
|
+
* You can set the environment variables `GOOGLE_CLIENT_ID` and `GOOGLE_CLIENT_SECRET` for the OAuth client ID and secret, respectively.
|
118
|
+
* In the Google Developer Console, in Credentials, there is an option to download a JSON file containing client credentials. You may set
|
119
|
+
the environment variable `GOOGLE_APPLICATION_CREDENTIALS` as a path to this file and it will be used.
|
120
|
+
* You can set the client ID and secret OR credentials file path as mentioned above directly in a Dug configuration block:
|
121
|
+
|
122
|
+
```ruby
|
123
|
+
Dug.configure do |config|
|
124
|
+
config.client_id = "lja8w34jfo8ajer9vjsoasdufo98auow34f.apps.googleusercontent.com"
|
125
|
+
config.client_secret = "34t998asDF9879hjfd"
|
126
|
+
|
127
|
+
# OR
|
128
|
+
|
129
|
+
config.application_credentials_file = "/path/to/file"
|
130
|
+
end
|
131
|
+
```
|
132
|
+
|
133
|
+
#### Token store
|
134
|
+
|
135
|
+
Dug uses Google's file-based token store for refresh tokens from the [Google Auth
|
136
|
+
Library for Ruby](https://github.com/google/google-auth-library-ruby). The token
|
137
|
+
store's location can be configured using the `TOKEN_STORE_PATH` environment
|
138
|
+
variable or within the configuration block as follows:
|
139
|
+
|
140
|
+
```ruby
|
141
|
+
Dug.configure do |config|
|
142
|
+
config.token_store = "/path/to/token/store"
|
143
|
+
end
|
144
|
+
```
|
145
|
+
|
146
|
+
### More configuration options
|
147
|
+
|
148
|
+
You can use public methods in Dug's configuration class to programmatically
|
149
|
+
configure Dug without a Rules YAML file. As a documenting example, here is the
|
150
|
+
same scenario in the YAML file used previously in this README but within a config
|
151
|
+
block:
|
152
|
+
|
153
|
+
```ruby
|
154
|
+
Dug.configure do |config|
|
155
|
+
config.set_organization_rule('rails')
|
156
|
+
config.set_organization_rule('rspec', label: 'RSpec')
|
157
|
+
config.set_organization_rule('ManageIQ')
|
158
|
+
|
159
|
+
config.set_repository_rule('rspec-expectations', label: 'RSpec/rspec-expectations')
|
160
|
+
|
161
|
+
config.set_reason_rule('author', label: 'Participating')
|
162
|
+
config.set_reason_rule('comment', label: 'Participating')
|
163
|
+
config.set_reason_rule('mention', label: 'Mention by name')
|
164
|
+
config.set_reason_rule('team_mention', label: 'Team mention')
|
165
|
+
end
|
166
|
+
```
|
167
|
+
|
168
|
+
## Development
|
169
|
+
|
170
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
171
|
+
`rake test` to run the tests. You can also run `bin/console` for an interactive
|
172
|
+
prompt that will allow you to experiment.
|
173
|
+
|
174
|
+
## Contributing
|
36
175
|
|
176
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/chrisarcand/dug.
|
37
177
|
|
38
178
|
## License
|
39
179
|
|
data/Rakefile
CHANGED
data/dug.gemspec
CHANGED
data/lib/dug/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.alpha2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Arcand
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-api-client
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '5.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: simplecov
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
69
|
description: "[D]amn yo[u], [G]mail. A gemified script to organize your GitHub notification
|
84
70
|
emails using a simple configuration file in ways Gmail filters can't, such as X-GitHub-Reason
|
85
71
|
headers."
|