Permalink
Browse files

added JIRA service hook

  • Loading branch information...
reset committed Mar 8, 2011
1 parent 89f45fc commit d081cb2733c8cfdaac4def693c3f1c68d09de78c
Showing with 35,252 additions and 4,035 deletions.
  1. +1 −0 CONTRIBUTORS
  2. +5 −2 docs/github_payload
  3. +40 −0 docs/jira
  4. +47 −0 services/jira.rb
  5. +0 −83 vendor/json-1.1.2/CHANGES
  6. +0 −78 vendor/json-1.1.2/README
  7. +0 −311 vendor/json-1.1.2/Rakefile
  8. +0 −1 vendor/json-1.1.2/VERSION
  9. +0 −133 vendor/json-1.1.2/benchmarks/benchmark.txt
  10. +0 −48 vendor/json-1.1.2/benchmarks/benchmark_generator.rb
  11. +0 −26 vendor/json-1.1.2/benchmarks/benchmark_parser.rb
  12. +0 −26 vendor/json-1.1.2/benchmarks/benchmark_rails.rb
  13. +0 −9 vendor/json-1.1.2/ext/json/ext/generator/extconf.rb
  14. +0 −876 vendor/json-1.1.2/ext/json/ext/generator/generator.c
  15. +0 −184 vendor/json-1.1.2/ext/json/ext/generator/unicode.c
  16. +0 −53 vendor/json-1.1.2/ext/json/ext/generator/unicode.h
  17. +0 −9 vendor/json-1.1.2/ext/json/ext/parser/extconf.rb
  18. +0 −639 vendor/json-1.1.2/ext/json/ext/parser/parser.rl
  19. +0 −156 vendor/json-1.1.2/ext/json/ext/parser/unicode.c
  20. +0 −58 vendor/json-1.1.2/ext/json/ext/parser/unicode.h
  21. +0 −235 vendor/json-1.1.2/lib/json.rb
  22. +0 −58 vendor/json-1.1.2/lib/json/add/rails.rb
  23. +0 −13 vendor/json-1.1.2/lib/json/ext.rb
  24. +0 −75 vendor/json-1.1.2/lib/json/pure.rb
  25. +0 −26 vendor/json-1.1.2/tests/runner.rb
  26. +0 −100 vendor/json-1.1.2/tests/test_json_generate.rb
  27. +0 −114 vendor/json-1.1.2/tests/test_json_rails.rb
  28. +188 −0 vendor/json-1.5.1/CHANGES
  29. +1 −1 vendor/{json-1.1.2/RUBY → json-1.5.1/COPYING}
  30. +57 −0 vendor/json-1.5.1/COPYING-json-jruby
  31. +7 −7 vendor/{json-1.1.2 → json-1.5.1}/GPL
  32. +356 −0 vendor/json-1.5.1/README
  33. +33 −0 vendor/json-1.5.1/README-json-jruby.markdown
  34. +401 −0 vendor/json-1.5.1/Rakefile
  35. 0 vendor/{json-1.1.2 → json-1.5.1}/TODO
  36. +1 −0 vendor/json-1.5.1/VERSION
  37. +52 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log
  38. +1,000 −0 ...son-1.5.1/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat
  39. +1,001 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat
  40. +900 −0 ...n-1.5.1/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat
  41. +901 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat
  42. +1,000 −0 ...son-1.5.1/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat
  43. +1,001 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat
  44. +261 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log
  45. +1,000 −0 ...on-1.5.1/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat
  46. +1,001 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat
  47. +1,000 −0 ...-1.5.1/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat
  48. +1,001 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat
  49. +1,000 −0 ...on-1.5.1/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat
  50. +1,001 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat
  51. +262 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log
  52. +1,000 −0 ...r/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat
  53. +1,001 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat
  54. +82 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log
  55. +34 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log
  56. +900 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat
  57. +901 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat
  58. +81 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log
  59. +1,000 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat
  60. +1,001 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat
  61. +82 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log
  62. +1,000 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat
  63. +1,001 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat
  64. +82 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log
  65. +1,000 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat
  66. +1,001 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat
  67. +82 −0 vendor/json-1.5.1/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log
  68. +222 −0 vendor/json-1.5.1/benchmarks/generator2_benchmark.rb
  69. +224 −0 vendor/json-1.5.1/benchmarks/generator_benchmark.rb
  70. +1,216 −0 vendor/json-1.5.1/benchmarks/ohai.json
  71. +1 −0 vendor/json-1.5.1/benchmarks/ohai.ruby
  72. +251 −0 vendor/json-1.5.1/benchmarks/parser2_benchmark.rb
  73. +259 −0 vendor/json-1.5.1/benchmarks/parser_benchmark.rb
  74. +0 −2 vendor/{json-1.1.2 → json-1.5.1}/bin/edit_json.rb
  75. +1 −1 vendor/{json-1.1.2 → json-1.5.1}/bin/prettify_json.rb
  76. 0 vendor/{json-1.1.2 → json-1.5.1}/data/example.json
  77. +5 −4 vendor/{json-1.1.2 → json-1.5.1}/data/index.html
  78. 0 vendor/{json-1.1.2 → json-1.5.1}/data/prototype.js
  79. +20 −0 vendor/json-1.5.1/ext/json/ext/generator/extconf.rb
  80. +1,417 −0 vendor/json-1.5.1/ext/json/ext/generator/generator.c
  81. +197 −0 vendor/json-1.5.1/ext/json/ext/generator/generator.h
  82. +16 −0 vendor/json-1.5.1/ext/json/ext/parser/extconf.rb
  83. +635 −418 vendor/{json-1.1.2 → json-1.5.1}/ext/json/ext/parser/parser.c
  84. +78 −0 vendor/json-1.5.1/ext/json/ext/parser/parser.h
  85. +826 −0 vendor/json-1.5.1/ext/json/ext/parser/parser.rl
  86. 0 vendor/{json-1.1.2 → json-1.5.1}/install.rb
  87. BIN vendor/json-1.5.1/java/lib/bytelist-1.0.6.jar
  88. BIN vendor/json-1.5.1/java/lib/jcodings.jar
  89. +167 −0 vendor/json-1.5.1/java/src/json/ext/ByteListTranscoder.java
  90. +441 −0 vendor/json-1.5.1/java/src/json/ext/Generator.java
  91. +231 −0 vendor/json-1.5.1/java/src/json/ext/GeneratorMethods.java
  92. +42 −0 vendor/json-1.5.1/java/src/json/ext/GeneratorService.java
  93. +473 −0 vendor/json-1.5.1/java/src/json/ext/GeneratorState.java
  94. +119 −0 vendor/json-1.5.1/java/src/json/ext/OptionsReader.java
  95. +2,295 −0 vendor/json-1.5.1/java/src/json/ext/Parser.java
  96. +825 −0 vendor/json-1.5.1/java/src/json/ext/Parser.rl
  97. +34 −0 vendor/json-1.5.1/java/src/json/ext/ParserService.java
  98. +119 −0 vendor/json-1.5.1/java/src/json/ext/RuntimeInfo.java
  99. +166 −0 vendor/json-1.5.1/java/src/json/ext/StringDecoder.java
  100. +106 −0 vendor/json-1.5.1/java/src/json/ext/StringEncoder.java
  101. +89 −0 vendor/json-1.5.1/java/src/json/ext/Utils.java
  102. +20 −0 vendor/json-1.5.1/json-java.gemspec
  103. +10 −0 vendor/json-1.5.1/lib/json.rb
  104. 0 vendor/{json-1.1.2 → json-1.5.1}/lib/json/Array.xpm
  105. 0 vendor/{json-1.1.2 → json-1.5.1}/lib/json/FalseClass.xpm
  106. 0 vendor/{json-1.1.2 → json-1.5.1}/lib/json/Hash.xpm
  107. 0 vendor/{json-1.1.2 → json-1.5.1}/lib/json/Key.xpm
  108. 0 vendor/{json-1.1.2 → json-1.5.1}/lib/json/NilClass.xpm
  109. 0 vendor/{json-1.1.2 → json-1.5.1}/lib/json/Numeric.xpm
  110. 0 vendor/{json-1.1.2 → json-1.5.1}/lib/json/String.xpm
  111. 0 vendor/{json-1.1.2 → json-1.5.1}/lib/json/TrueClass.xpm
  112. +42 −15 vendor/{json-1.1.2 → json-1.5.1}/lib/json/add/core.rb
  113. +8 −0 vendor/json-1.5.1/lib/json/add/rails.rb
  114. +121 −56 vendor/{json-1.1.2 → json-1.5.1}/lib/json/common.rb
  115. +12 −6 vendor/{json-1.1.2 → json-1.5.1}/lib/json/editor.rb
  116. +28 −0 vendor/json-1.5.1/lib/json/ext.rb
  117. 0 vendor/{json-1.1.2 → json-1.5.1}/lib/json/json.xpm
  118. +15 −0 vendor/json-1.5.1/lib/json/pure.rb
  119. +175 −128 vendor/{json-1.1.2 → json-1.5.1}/lib/json/pure/generator.rb
  120. +80 −19 vendor/{json-1.1.2 → json-1.5.1}/lib/json/pure/parser.rb
  121. +1 −2 vendor/{json-1.1.2 → json-1.5.1}/lib/json/version.rb
  122. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail1.json
  123. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail10.json
  124. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail11.json
  125. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail12.json
  126. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail13.json
  127. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail14.json
  128. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail18.json
  129. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail19.json
  130. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail2.json
  131. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail20.json
  132. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail21.json
  133. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail22.json
  134. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail23.json
  135. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail24.json
  136. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail25.json
  137. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail27.json
  138. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail28.json
  139. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail3.json
  140. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail4.json
  141. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail5.json
  142. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail6.json
  143. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail7.json
  144. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail8.json
  145. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/fail9.json
  146. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/pass1.json
  147. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/pass15.json
  148. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/pass16.json
  149. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/pass17.json
  150. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/pass2.json
  151. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/pass26.json
  152. 0 vendor/{json-1.1.2 → json-1.5.1}/tests/fixtures/pass3.json
  153. +11 −0 vendor/json-1.5.1/tests/setup_variant.rb
  154. +119 −23 vendor/{json-1.1.2 → json-1.5.1}/tests/test_json.rb
  155. +42 −19 vendor/{json-1.1.2 → json-1.5.1}/tests/test_json_addition.rb
  156. +65 −0 vendor/json-1.5.1/tests/test_json_encoding.rb
  157. +10 −5 vendor/{json-1.1.2 → json-1.5.1}/tests/test_json_fixtures.rb
  158. +179 −0 vendor/json-1.5.1/tests/test_json_generate.rb
  159. +40 −0 vendor/json-1.5.1/tests/test_json_string_matching.rb
  160. +23 −12 vendor/{json-1.1.2 → json-1.5.1}/tests/test_json_unicode.rb
  161. +10 −3 vendor/{json-1.1.2 → json-1.5.1}/tools/fuzz.rb
  162. +0 −1 vendor/{json-1.1.2 → json-1.5.1}/tools/server.rb
View
@@ -57,3 +57,4 @@ Thanks to the following people for making this possible
- Serge Smetana
- Matthias Viehweger
- Justin Mazzi
- Jamie Winsor
View
@@ -2,7 +2,10 @@
{
"data" => {
"token" => "token from travis-ci.org/profile"
"api_version" => "2.0.alpha1",
"username" => "jamie.winsor",
"password" => "passw0rd",
"server_url" => "http://jira"
},
"payload" => {
@@ -21,7 +24,7 @@
"commits" => [
{
"removed" => [],
"message" => "stub git call for Grit#heads test",
"message" => "[#WEB-249 status:31 resolution:1] stub git call for Grit#heads test",
"added" => [],
"timestamp" => "2007-10-10T00:11:02-07:00",
"modified" => ["lib/grit/grit.rb", "test/helper.rb", "test/test_grit.rb"],
View
@@ -0,0 +1,40 @@
Jira
========
This service hook allows you to transition Jira tickets using the REST API available in
version 4.2+ of Jira. To interact with tickets in Jira you will need to place markup
similar to Lighthouse's in your commit message.
Fixed an annoying bug [#WEB-210 transition:31 resolution:1]
This will perform transition 31 with a resolution code of 1 on the issue WEB-210. You can specify
any key value pair with the `key:value` notation, but at the very least transition must be present.
NOTE: As of 2.0.alpha1, the REST API will not automatically interpret strings into integers and vice
versa.
Install Notes
-------------
A user in Jira will need to be created for GitHub. It should be given full
access to all projects.
Using the following url as an example:
http://jira.enmasse.com/rest/2.0.alpha1/issue/WEB-249
1. http://jira.enmasse.com is the server_hostname
2. 2.0.alpha1 is the api_version
3. username of the GitHub user in Jira
4. password of the GitHub user in Jira
Developer Notes
---------------
data
- server_hostname
- api_version
- username
- password
payload
- refer to docs/github_payload
View
@@ -0,0 +1,47 @@
require 'json'
service :jira do |data, payload|
payload['commits'].each do |commit|
next if commit['message'] =~ /^x /
comment_body = "#{commit['message']}\n#{commit['url']}"
commit['message'].match(/\[#(.+)\]/)
# Don't need to continue if we don't have a commit message containing JIRA markup
next unless $1
jira_markup = $1.split
issue_id = jira_markup.shift
changeset = { :comment => { :body => comment_body } }
jira_markup.each do |entry|
key, value = entry.split(':')
if key =~ /(?i)status|(?i)transition/
changeset.merge!(:transition => value.to_i)
elsif key =~ /(?i)resolution/
changeset.merge!(:fields => { :resolution => value.to_i })
else
changeset.merge!(:fields => { key.to_sym => "Resolved" })
end
end
# Don't need to continue if we don't have a transition to perform
next unless changeset.has_key?(:transition)
begin
url = URI.parse('%s/rest/api/%s/issue/%s/transitions' % [data['server_url'], data['api_version'], issue_id])
Net::HTTP.start(url.host, url.port) do |http|
req = Net::HTTP::Post.new(url.path)
req.basic_auth data['username'], data['password']
req.body = changeset.to_json
req.set_content_type('application/json')
response = http.request(req)
puts response.body
end
rescue URI::InvalidURIError
raise GitHub::ServiceConfigurationError, "Invalid server_hostname: #{data['server_hostname']}"
end
end
end
View

This file was deleted.

Oops, something went wrong.
View

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit d081cb2

Please sign in to comment.