dug 0.1.0.alpha1 → 0.1.0.alpha2

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: 4455906bdb42a42d8fbdce98f6b73debdd0b5f1b
4
- data.tar.gz: 63f162259f8dc882857627df00b17fb4ae23e28b
3
+ metadata.gz: 8c6c01300fe32cff493d71785c74fe0c37e02673
4
+ data.tar.gz: bf879e429299828cc2adf2bff39a1b30458da86c
5
5
  SHA512:
6
- metadata.gz: df82930ee5ea1e54545cf0a34f62f9ddf0c53f640771e36819636c8f88e2f7cc1a755846153e8bceedaa749a92f149b87be2613342218ecc56830593b8153359
7
- data.tar.gz: 0e5565de67ebf529278a01f4ec52d31cd2197a6528b22d58fed0fc7fecc5b2196a739d1783386fac853d7b552b204f55a196fae8de089302c2a1288dbdb405db
6
+ metadata.gz: 93dce7d68c25b9af837420525c8daad4bf489f93f1688445054f0794ea278a4b27344737b217bd26c6ce1183ca458497c72b6cd1c4effa25c854317774af7e27
7
+ data.tar.gz: 5aeac95bf1b2b1d41af25858c0c68e2f04874f960b6add28cb63cf67166010de76be0e578e0def24d4033e6dd546c842108cdd6d5e9fab4f09cf7f517b1e9ce0
@@ -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
@@ -2,3 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in dug.gemspec
4
4
  gemspec
5
+
6
+ group :test do
7
+ gem "codeclimate-test-reporter", require: nil
8
+ end
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
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/dug`. To experiment with that code, run `bin/console` for an interactive prompt.
7
+ Created out of frustration. _"[D]amn yo[u], [G]mail!"_
4
8
 
5
- TODO: Delete this and the text above, and describe your gem
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
- Add this line to your application's Gemfile:
17
+ ## Quick Installation
10
18
 
11
- ```ruby
12
- gem 'dug'
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
- And then execute:
24
+ Basic installation steps:
16
25
 
17
- $ bundle
26
+ 1. Install Dug
18
27
 
19
- Or install it yourself as:
28
+ ```
29
+ $ gem install dug
30
+ ```
20
31
 
21
- $ gem install dug
32
+ 2. Create a YAML Rule file. Example (`dug_rules.yml`):
22
33
 
23
- ## Usage
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
- TODO: Write usage instructions here
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
- ## Development
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
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
66
+ 3. Create all of the labels in the preceding step in Gmail, if you haven't already.
30
67
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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
- ## Contributing
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
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/dug. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
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
@@ -7,4 +7,4 @@ Rake::TestTask.new(:test) do |t|
7
7
  t.test_files = FileList['test/**/*_test.rb']
8
8
  end
9
9
 
10
- task :default => :spec
10
+ task :default => :test
@@ -24,5 +24,4 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "bundler", "~> 1.11"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  spec.add_development_dependency "minitest", "~> 5.0"
27
- spec.add_development_dependency "simplecov"
28
27
  end
@@ -1,3 +1,3 @@
1
1
  module Dug
2
- VERSION = "0.1.0.alpha1"
2
+ VERSION = "0.1.0.alpha2"
3
3
  end
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.alpha1
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-01 00:00:00.000000000 Z
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."