git_notified_on_trello 0.0.1
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 +7 -0
- data/.gitignore +15 -0
- data/.travis.yml +21 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +39 -0
- data/Rakefile +7 -0
- data/bin/gnot +44 -0
- data/git_notified_on_trello.gemspec +28 -0
- data/lib/git_notified_on_trello/version.rb +3 -0
- data/lib/git_notified_on_trello.rb +54 -0
- data/spec/lib/git_notified_on_trello_spec.rb +8 -0
- data/spec/spec_helper.rb +1 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5d40138fe5bfebe845e82969b6c1c0421079a011
|
4
|
+
data.tar.gz: bcc8b5e596474bcf89930790e4d748ad8c7ec2e8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3905bd923f14cb935db699887be954133d527b31bb314ae56316d033d99617317625bc4f3349c0c4f4a82aa89f02690f482f7405bfebf61017419e6a21a5b7a5
|
7
|
+
data.tar.gz: 1fa46db39ff0c08deb1c75d63b9816c4ddb7b93f2981c27ee371bd003381e9f2955b6d764d8c3331655493c2f5d3577efe446a41779a51408926933d97e5e35c
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- jruby
|
4
|
+
- 2.1.0
|
5
|
+
|
6
|
+
cache:
|
7
|
+
bundler: true
|
8
|
+
apt: true
|
9
|
+
directories:
|
10
|
+
- vendor/bundle
|
11
|
+
|
12
|
+
install: bundle install --jobs=3 --retry=3
|
13
|
+
|
14
|
+
deploy:
|
15
|
+
provider: rubygems
|
16
|
+
api_key: "38d57d2ad2520318f2155c1cc717925f"
|
17
|
+
gem:
|
18
|
+
master: git_notified_on_trello
|
19
|
+
on:
|
20
|
+
tags: true
|
21
|
+
branch: master
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Stephen Johnson
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
git_notified_on_trello
|
2
|
+
======================
|
3
|
+
|
4
|
+
Get notified of pushes to a Git Repo with updates to relevant Trello cards
|
5
|
+
|
6
|
+
|
7
|
+
Setup
|
8
|
+
-----
|
9
|
+
|
10
|
+
https://trello.com/1/authorize?key=YOUR_API_KEY&name=YOUR_APP_NAME&response_type=token&scope=read,write,account&expiration=never
|
11
|
+
-
|
12
|
+
|
13
|
+
|
14
|
+
### TODO ###
|
15
|
+
|
16
|
+
- provide example usage
|
17
|
+
- clean up and comment a bit
|
18
|
+
- package into a gem
|
19
|
+
- make idempotent
|
20
|
+
- make a plugin for jenkins
|
21
|
+
- send two separate messages
|
22
|
+
- on commit, as it does now
|
23
|
+
- on deploy
|
24
|
+
- style the comments with some fancy markdown
|
25
|
+
|
26
|
+
|
27
|
+
rake install \
|
28
|
+
DEVELOPER_KEY="16f7525a7039ee80c23365e648b8a542" \
|
29
|
+
MEMBER_TOKEN="" \
|
30
|
+
./bin/gnot -a "Stephen Johnson" -b "feature-git-notified-on-trello" -c "3463457" -m " Is it useful?\n\nhttps://trello.com/c/hR3cSUiu/1189-git-trello-plugin \nLine break on the shell like a normal commit messages would be.\n\nLet's try some *markdown*\n-------------------------\n"
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
# Get consumer key by calling
|
36
|
+
# https://trello.com/1/authorize?key=16f7525a7039ee80c23365e648b8a542&name=Git%20Notified%20on%20Trello&response_type=token&scope=read,write,account&expiration=never
|
37
|
+
|
38
|
+
# If you'd like to use your own application, replace the above with this:
|
39
|
+
# https://trello.com/1/authorize?key=YOUR_API_KEY&name=YOUR_APP_NAME&response_type=token&scope=read,write,account&expiration=never
|
data/Rakefile
ADDED
data/bin/gnot
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'trollop'
|
4
|
+
require 'git_notified_on_trello'
|
5
|
+
require 'git_notified_on_trello/version'
|
6
|
+
|
7
|
+
#
|
8
|
+
# DEVELOPER_KEY and MEMBER_TOKEN are expected to be provided as environment variables
|
9
|
+
# when using the command-line invocation
|
10
|
+
#
|
11
|
+
if (!ENV['DEVELOPER_KEY'])
|
12
|
+
puts "An environment variable named DEVELOPER_KEY must be set to your Trello developer key"
|
13
|
+
puts "Generate your credentials here: https://trello.com/1/authorize?key=YOUR_API_KEY&name=YOUR_APP_NAME&response_type=token&scope=read,write,account&expiration=never"
|
14
|
+
exit
|
15
|
+
end
|
16
|
+
|
17
|
+
if (!ENV['MEMBER_TOKEN'])
|
18
|
+
puts "An environment variable named MEMBER_TOKEN must be set to your Trello member token"
|
19
|
+
puts "Generate your credentials here: https://trello.com/1/authorize?key=YOUR_API_KEY&name=YOUR_APP_NAME&response_type=token&scope=read,write,account&expiration=never"
|
20
|
+
exit
|
21
|
+
end
|
22
|
+
|
23
|
+
# Parse the command-line arguments
|
24
|
+
opts = Trollop::options do
|
25
|
+
opt :author, "The commit author", :type => :string, :required => true
|
26
|
+
opt :branch, "The branch the commit is on", :type => :string, :required => true
|
27
|
+
opt :commit, "The commit hash", :type => :string, :required => true
|
28
|
+
opt :message, "The commit message", :type => :string, :required => true
|
29
|
+
opt :version, GitNotifiedOnTrello::VERSION
|
30
|
+
opt :help
|
31
|
+
end
|
32
|
+
|
33
|
+
# Make the post
|
34
|
+
notifier = GitNotifiedOnTrello::Notifier.new(
|
35
|
+
:developer_public_key => ENV['DEVELOPER_KEY'],
|
36
|
+
:member_token => ENV['MEMBER_TOKEN'],
|
37
|
+
:debug => true
|
38
|
+
)
|
39
|
+
notifier.notify(
|
40
|
+
opts.branch,
|
41
|
+
opts.commit,
|
42
|
+
opts.author,
|
43
|
+
opts.message
|
44
|
+
)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'git_notified_on_trello/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "git_notified_on_trello"
|
8
|
+
spec.version = GitNotifiedOnTrello::VERSION
|
9
|
+
spec.authors = ["Stephen Johnson"]
|
10
|
+
spec.email = ["steve@01j.me"]
|
11
|
+
spec.summary = %q{Get notified of pushes to a Git Repo with updates to relevant Trello cards}
|
12
|
+
spec.description = %q{Makes Trello more useful when managing software development teams}
|
13
|
+
spec.homepage = "https://github.com/smj10j/git_notified_on_trello"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", ">= 1.6.9"
|
22
|
+
spec.add_development_dependency "rake", ">= 10.0"
|
23
|
+
spec.add_development_dependency "rspec", ">= 3.1"
|
24
|
+
|
25
|
+
spec.add_runtime_dependency "ruby-trello", '~> 1.1.2'
|
26
|
+
spec.add_runtime_dependency "trollop", '~> 2.0'
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#
|
2
|
+
# Git Notified on Trello
|
3
|
+
#
|
4
|
+
# https://github.com/smj10j/git-notified-on-trello
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'trello'
|
8
|
+
|
9
|
+
module GitNotifiedOnTrello
|
10
|
+
|
11
|
+
class Notifier
|
12
|
+
|
13
|
+
def initialize(attrs = {})
|
14
|
+
@client = Trello::Client.new(
|
15
|
+
:developer_public_key => attrs[:developer_public_key],
|
16
|
+
:member_token => attrs[:member_token]
|
17
|
+
)
|
18
|
+
@debug = attrs[:debug] == nil ? false : attrs[:debug]
|
19
|
+
end
|
20
|
+
|
21
|
+
def notify(branch, commit, author, message)
|
22
|
+
|
23
|
+
matches = message.match(/^.*?trello\.com\/\w\/([\w]+?)\b.*?$/)
|
24
|
+
if ( matches && matches.size > 0 )
|
25
|
+
|
26
|
+
cardId = matches[1]
|
27
|
+
card = @client.find(:card, cardId)
|
28
|
+
cardMessage = (' '+message+' ').gsub(/https?[:\/\W]*?.trello.com[^ ]*/, "")
|
29
|
+
cardMessage = "> " + cardMessage.gsub(/[\r\n]|([\\]n)/, "
|
30
|
+
> ")
|
31
|
+
print "Trello card \"#{card.name}\" was found with card id #{cardId}\n"
|
32
|
+
|
33
|
+
comment = "\n"
|
34
|
+
comment+= "** ...whrr.. This is an automated post by the Trello Robot.. bzz.. **\n"
|
35
|
+
comment+= "\n"
|
36
|
+
comment+= "Branch *#{branch}*\n"
|
37
|
+
comment+= "\n"
|
38
|
+
comment+= "#{author} committed #[#{commit}](https://github.com/Extrabux/Extrabux-Complete/commits/#{commit})\n"
|
39
|
+
comment+= "\n"
|
40
|
+
comment+= "#{cardMessage}"
|
41
|
+
|
42
|
+
if(@debug)
|
43
|
+
print comment
|
44
|
+
end
|
45
|
+
card.add_comment(comment)
|
46
|
+
|
47
|
+
else
|
48
|
+
if(@debug)
|
49
|
+
print "No Trello card was found in message \"#{message}\"\n"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'git_notified_on_trello'
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: git_notified_on_trello
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stephen Johnson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.6.9
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.6.9
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: ruby-trello
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.1.2
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.1.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: trollop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.0'
|
83
|
+
description: Makes Trello more useful when managing software development teams
|
84
|
+
email:
|
85
|
+
- steve@01j.me
|
86
|
+
executables:
|
87
|
+
- gnot
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- ".travis.yml"
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE.txt
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- bin/gnot
|
98
|
+
- git_notified_on_trello.gemspec
|
99
|
+
- lib/git_notified_on_trello.rb
|
100
|
+
- lib/git_notified_on_trello/version.rb
|
101
|
+
- spec/lib/git_notified_on_trello_spec.rb
|
102
|
+
- spec/spec_helper.rb
|
103
|
+
homepage: https://github.com/smj10j/git_notified_on_trello
|
104
|
+
licenses:
|
105
|
+
- MIT
|
106
|
+
metadata: {}
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
requirements: []
|
122
|
+
rubyforge_project:
|
123
|
+
rubygems_version: 2.4.4
|
124
|
+
signing_key:
|
125
|
+
specification_version: 4
|
126
|
+
summary: Get notified of pushes to a Git Repo with updates to relevant Trello cards
|
127
|
+
test_files:
|
128
|
+
- spec/lib/git_notified_on_trello_spec.rb
|
129
|
+
- spec/spec_helper.rb
|