mingle_events 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -4
- data/lib/mingle_events.rb +19 -3
- data/lib/mingle_events/entry_cache.rb +129 -0
- data/lib/mingle_events/feed/author.rb +12 -23
- data/lib/mingle_events/feed/category.rb +2 -0
- data/lib/mingle_events/feed/changes.rb +19 -50
- data/lib/mingle_events/feed/entry.rb +16 -21
- data/lib/mingle_events/feed/links.rb +3 -3
- data/lib/mingle_events/feed/page.rb +5 -5
- data/lib/mingle_events/http.rb +50 -0
- data/lib/mingle_events/mingle_basic_auth_access.rb +17 -50
- data/lib/mingle_events/mingle_hmac_auth_access.rb +22 -0
- data/lib/mingle_events/mingle_oauth_access.rb +10 -30
- data/lib/mingle_events/poller.rb +4 -3
- data/lib/mingle_events/processors/author_filter.rb +7 -7
- data/lib/mingle_events/processors/card_data.rb +15 -15
- data/lib/mingle_events/project_custom_properties.rb +15 -15
- data/lib/mingle_events/project_event_fetcher.rb +21 -110
- data/lib/mingle_events/xml.rb +101 -0
- data/lib/mingle_events/zip_directory.rb +98 -0
- data/test/mingle_events/entry_cache_test.rb +75 -0
- data/test/mingle_events/feed/author_test.rb +2 -2
- data/test/mingle_events/feed/changes_test.rb +22 -22
- data/test/mingle_events/feed/entry_test.rb +12 -12
- data/test/mingle_events/feed/links_test.rb +5 -5
- data/test/mingle_events/mingle_basic_auth_access_test.rb +15 -0
- data/test/mingle_events/mingle_hmac_auth_access_test.rb +15 -0
- data/test/mingle_events/mingle_oauth_access_test.rb +15 -0
- data/test/mingle_events/poller_test.rb +1 -1
- data/test/mingle_events/processors/author_filter_test.rb +5 -5
- data/test/mingle_events/processors/card_data_test.rb +12 -17
- data/test/mingle_events/project_custom_properties_test.rb +2 -3
- data/test/mingle_events/project_event_fetcher_test.rb +64 -8
- data/test/mingle_events/xml_test.rb +80 -0
- data/test/mingle_events/zip_directory_test.rb +44 -0
- data/test/test_helper.rb +36 -27
- metadata +121 -62
data/test/test_helper.rb
CHANGED
@@ -3,15 +3,13 @@ require 'test/unit'
|
|
3
3
|
require 'ostruct'
|
4
4
|
require 'fileutils'
|
5
5
|
|
6
|
-
require 'rubygems'
|
7
|
-
require 'active_support'
|
8
6
|
|
9
7
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'mingle_events'))
|
10
8
|
|
11
9
|
MingleEvents.log.level = Logger::WARN
|
12
10
|
|
13
|
-
class Test::Unit::TestCase
|
14
|
-
|
11
|
+
class Test::Unit::TestCase
|
12
|
+
|
15
13
|
EMPTY_EVENTS_XML = %{
|
16
14
|
<?xml version="1.0" encoding="UTF-8"?>
|
17
15
|
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:mingle="http://www.thoughtworks-studios.com/ns/mingle">
|
@@ -22,15 +20,15 @@ class Test::Unit::TestCase
|
|
22
20
|
<updated>2011-08-04T19:42:04Z</updated>
|
23
21
|
</feed>
|
24
22
|
}
|
25
|
-
|
23
|
+
|
26
24
|
# page 3
|
27
25
|
LATEST_EVENTS_XML = %{
|
28
26
|
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:mingle="http://www.thoughtworks-studios.com/ns/mingle">
|
29
|
-
|
27
|
+
|
30
28
|
<link href="https://mingle.example.com/api/v2/projects/atlas/feeds/events.xml" rel="current"/>
|
31
29
|
<link href="https://mingle.example.com/api/v2/projects/atlas/feeds/events.xml" rel="self"/>
|
32
30
|
<link href="https://mingle.example.com/api/v2/projects/atlas/feeds/events.xml?page=2" rel="next"/>
|
33
|
-
|
31
|
+
|
34
32
|
<entry>
|
35
33
|
<id>https://mingle.example.com/projects/atlas/events/index/103</id>
|
36
34
|
<title>entry 103</title>
|
@@ -50,31 +48,31 @@ class Test::Unit::TestCase
|
|
50
48
|
<author><name>Mary</name></author>
|
51
49
|
</entry>
|
52
50
|
</feed>
|
53
|
-
}
|
54
|
-
|
51
|
+
}
|
52
|
+
|
55
53
|
# page 2
|
56
54
|
PAGE_2_EVENTS_XML = %{
|
57
55
|
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:mingle="http://www.thoughtworks-studios.com/ns/mingle">
|
58
|
-
|
56
|
+
|
59
57
|
<link href="https://mingle.example.com/api/v2/projects/atlas/feeds/events.xml" rel="current"/>
|
60
58
|
<link href="https://mingle.example.com/api/v2/projects/atlas/feeds/events.xml?page=2" rel="self"/>
|
61
59
|
<link href="https://mingle.example.com/api/v2/projects/atlas/feeds/events.xml?page=1" rel="next"/>
|
62
60
|
<link href="https://mingle.example.com/api/v2/projects/atlas/feeds/events.xml?page=3" rel="previous"/>
|
63
|
-
|
61
|
+
|
64
62
|
<entry>
|
65
63
|
<id>https://mingle.example.com/projects/atlas/events/index/99</id>
|
66
64
|
<title>entry 99</title>
|
67
65
|
<updated>2011-02-03T01:30:52Z</updated>
|
68
66
|
<author><name>Harry</name></author>
|
69
67
|
</entry>
|
70
|
-
|
68
|
+
|
71
69
|
<entry>
|
72
70
|
<id>https://mingle.example.com/projects/atlas/events/index/98</id>
|
73
71
|
<title>entry 98</title>
|
74
72
|
<updated>2011-02-03T01:20:52Z</updated>
|
75
73
|
<author><name>Harry</name></author>
|
76
74
|
</entry>
|
77
|
-
|
75
|
+
|
78
76
|
<entry>
|
79
77
|
<id>https://mingle.example.com/projects/atlas/events/index/97</id>
|
80
78
|
<title>entry 97</title>
|
@@ -82,16 +80,16 @@ class Test::Unit::TestCase
|
|
82
80
|
<author><name>Harry</name></author>
|
83
81
|
</entry>
|
84
82
|
</feed>
|
85
|
-
}
|
86
|
-
|
83
|
+
}
|
84
|
+
|
87
85
|
# page 1
|
88
86
|
PAGE_1_EVENTS_XML = %{
|
89
87
|
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:mingle="http://www.thoughtworks-studios.com/ns/mingle">
|
90
|
-
|
88
|
+
|
91
89
|
<link href="https://mingle.example.com/api/v2/projects/atlas/feeds/events.xml" rel="current"/>
|
92
90
|
<link href="https://mingle.example.com/api/v2/projects/atlas/feeds/events.xml?page=1" rel="self"/>
|
93
91
|
<link href="https://mingle.example.com/api/v2/projects/atlas/feeds/events.xml?page=2" rel="previous"/>
|
94
|
-
|
92
|
+
|
95
93
|
<entry>
|
96
94
|
<id>https://mingle.example.com/projects/atlas/events/index/23</id>
|
97
95
|
<title>entry 23</title>
|
@@ -99,8 +97,8 @@ class Test::Unit::TestCase
|
|
99
97
|
<author><name>Bob</name></author>
|
100
98
|
</entry>
|
101
99
|
</feed>
|
102
|
-
}
|
103
|
-
|
100
|
+
}
|
101
|
+
|
104
102
|
def stub_mingle_access
|
105
103
|
stub = StubMingleAccess.new
|
106
104
|
stub.register_page_content('https://mingle.example.com/api/v2/projects/atlas/feeds/events.xml', LATEST_EVENTS_XML)
|
@@ -113,16 +111,16 @@ class Test::Unit::TestCase
|
|
113
111
|
stub.register_page_content('/api/v2/projects/atlas/feeds/events.xml?page=3', LATEST_EVENTS_XML)
|
114
112
|
|
115
113
|
stub
|
116
|
-
end
|
117
|
-
|
114
|
+
end
|
115
|
+
|
118
116
|
def temp_dir
|
119
|
-
path = File.expand_path(File.join(File.dirname(__FILE__), 'tmp',
|
117
|
+
path = File.expand_path(File.join(File.dirname(__FILE__), 'tmp', ::SecureRandom.hex(16)))
|
120
118
|
FileUtils.mkdir_p(path)
|
121
119
|
path
|
122
120
|
end
|
123
121
|
|
124
122
|
def temp_file
|
125
|
-
File.join(temp_dir,
|
123
|
+
File.join(temp_dir, ::SecureRandom.hex(16))
|
126
124
|
end
|
127
125
|
|
128
126
|
class StubMingleAccess
|
@@ -132,7 +130,7 @@ class Test::Unit::TestCase
|
|
132
130
|
@not_found_pages = []
|
133
131
|
@exploding_pages = []
|
134
132
|
end
|
135
|
-
|
133
|
+
|
136
134
|
def base_url
|
137
135
|
'http://example.com/mingle'
|
138
136
|
end
|
@@ -144,7 +142,7 @@ class Test::Unit::TestCase
|
|
144
142
|
def register_page_not_found(path)
|
145
143
|
@not_found_pages << path
|
146
144
|
end
|
147
|
-
|
145
|
+
|
148
146
|
def register_explosion(path)
|
149
147
|
@exploding_pages << path
|
150
148
|
end
|
@@ -157,7 +155,7 @@ class Test::Unit::TestCase
|
|
157
155
|
end
|
158
156
|
raise MingleEvents::HttpError.new(rsp, path)
|
159
157
|
end
|
160
|
-
|
158
|
+
|
161
159
|
if @exploding_pages.include?(path)
|
162
160
|
rsp = Net::HTTPNotFound.new(nil, '500', 'Server exploded!')
|
163
161
|
def rsp.body
|
@@ -174,7 +172,7 @@ class Test::Unit::TestCase
|
|
174
172
|
|
175
173
|
class StubProjectCustomProperties
|
176
174
|
|
177
|
-
def initialize(property_names_by_column_names)
|
175
|
+
def initialize(property_names_by_column_names)
|
178
176
|
@property_names_by_column_names = property_names_by_column_names
|
179
177
|
end
|
180
178
|
|
@@ -184,4 +182,15 @@ class Test::Unit::TestCase
|
|
184
182
|
|
185
183
|
end
|
186
184
|
|
185
|
+
class HttpStub
|
186
|
+
def get(url, &block)
|
187
|
+
@req = Net::HTTP::Get.new(URI.parse(url).request_uri)
|
188
|
+
yield(@req) if block_given?
|
189
|
+
"OK"
|
190
|
+
end
|
191
|
+
|
192
|
+
def last_request
|
193
|
+
@req
|
194
|
+
end
|
195
|
+
end
|
187
196
|
end
|
metadata
CHANGED
@@ -1,62 +1,119 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mingle_events
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 3
|
10
|
-
version: 0.1.3
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- David Rice
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-08-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: nokogiri
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
33
22
|
type: :runtime
|
34
|
-
|
35
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
36
31
|
name: activesupport
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
37
39
|
prerelease: false
|
38
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: minitar
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
47
54
|
type: :runtime
|
48
|
-
|
49
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: api-auth
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rake
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
description: ! "\n Mingle 3.3 introduced a new Events API in the form of an \"Atom
|
95
|
+
feed\":http://www.thoughtworks-studios.com/mingle/3.3/help/mingle_api_events.html.
|
96
|
+
The Mingle team and ThoughtWorks Studios are big believers in the use of Atom for
|
97
|
+
exposing events. Atom is a widely used standard, and this event API style puts the
|
98
|
+
issue of robust event delivery in the hands of the consumer, where it belongs. In
|
99
|
+
fact, we'd argue this is the only feasible means of robust, scalable event delivery,
|
100
|
+
short of spending hundreds of thousands or millions of dollars on enterprise buses
|
101
|
+
and such. Atom-delivered events are cheap, scalable, standards-based, and robust.\n\n
|
102
|
+
\ However, we do accept that asking integrators wishing to consume events to implement
|
103
|
+
polling is not ideal. Writing polling consumers can be tedious. And this tedium
|
104
|
+
gets in the way of writing sweet Mingle integrations. We are addressing this by
|
105
|
+
publishing libraries such as this, which if effective, fully hide the mechanics
|
106
|
+
of event polling from the consumer. The consumer only need worry about the processing
|
107
|
+
of events. Said processing is modeled in the style of 'pipes and filters.'\n "
|
50
108
|
email: david.rice at gmail dot com
|
51
109
|
executables: []
|
52
|
-
|
53
110
|
extensions: []
|
54
|
-
|
55
|
-
extra_rdoc_files:
|
111
|
+
extra_rdoc_files:
|
56
112
|
- LICENSE.txt
|
57
113
|
- README.textile
|
58
|
-
files:
|
114
|
+
files:
|
59
115
|
- Gemfile
|
116
|
+
- lib/mingle_events/entry_cache.rb
|
60
117
|
- lib/mingle_events/feed/author.rb
|
61
118
|
- lib/mingle_events/feed/category.rb
|
62
119
|
- lib/mingle_events/feed/changes.rb
|
@@ -64,8 +121,10 @@ files:
|
|
64
121
|
- lib/mingle_events/feed/links.rb
|
65
122
|
- lib/mingle_events/feed/page.rb
|
66
123
|
- lib/mingle_events/feed.rb
|
124
|
+
- lib/mingle_events/http.rb
|
67
125
|
- lib/mingle_events/http_error.rb
|
68
126
|
- lib/mingle_events/mingle_basic_auth_access.rb
|
127
|
+
- lib/mingle_events/mingle_hmac_auth_access.rb
|
69
128
|
- lib/mingle_events/mingle_oauth_access.rb
|
70
129
|
- lib/mingle_events/poller.rb
|
71
130
|
- lib/mingle_events/processors/author_filter.rb
|
@@ -81,15 +140,21 @@ files:
|
|
81
140
|
- lib/mingle_events/processors.rb
|
82
141
|
- lib/mingle_events/project_custom_properties.rb
|
83
142
|
- lib/mingle_events/project_event_fetcher.rb
|
143
|
+
- lib/mingle_events/xml.rb
|
144
|
+
- lib/mingle_events/zip_directory.rb
|
84
145
|
- lib/mingle_events.rb
|
85
146
|
- LICENSE.txt
|
86
147
|
- README.textile
|
148
|
+
- test/mingle_events/entry_cache_test.rb
|
87
149
|
- test/mingle_events/feed/author_test.rb
|
88
150
|
- test/mingle_events/feed/category_test.rb
|
89
151
|
- test/mingle_events/feed/changes_test.rb
|
90
152
|
- test/mingle_events/feed/entry_test.rb
|
91
153
|
- test/mingle_events/feed/links_test.rb
|
92
154
|
- test/mingle_events/feed/page_test.rb
|
155
|
+
- test/mingle_events/mingle_basic_auth_access_test.rb
|
156
|
+
- test/mingle_events/mingle_hmac_auth_access_test.rb
|
157
|
+
- test/mingle_events/mingle_oauth_access_test.rb
|
93
158
|
- test/mingle_events/poller_test.rb
|
94
159
|
- test/mingle_events/processors/author_filter_test.rb
|
95
160
|
- test/mingle_events/processors/card_data_test.rb
|
@@ -101,47 +166,41 @@ files:
|
|
101
166
|
- test/mingle_events/processors/processor_test.rb
|
102
167
|
- test/mingle_events/project_custom_properties_test.rb
|
103
168
|
- test/mingle_events/project_event_fetcher_test.rb
|
169
|
+
- test/mingle_events/xml_test.rb
|
170
|
+
- test/mingle_events/zip_directory_test.rb
|
104
171
|
- test/test_helper.rb
|
105
172
|
- test/web_hook_server/web_hook_server.rb
|
106
|
-
has_rdoc: true
|
107
173
|
homepage: https://github.com/ThoughtWorksStudios/mingle_events
|
108
174
|
licenses: []
|
109
|
-
|
110
175
|
post_install_message:
|
111
|
-
rdoc_options:
|
176
|
+
rdoc_options:
|
112
177
|
- --line-numbers
|
113
178
|
- --inline-source
|
114
179
|
- --title
|
115
180
|
- mingle_events
|
116
181
|
- --main
|
117
182
|
- README.textile
|
118
|
-
require_paths:
|
183
|
+
require_paths:
|
119
184
|
- lib
|
120
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
185
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
186
|
none: false
|
122
|
-
requirements:
|
123
|
-
- -
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
|
126
|
-
segments:
|
187
|
+
requirements:
|
188
|
+
- - ! '>='
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
191
|
+
segments:
|
127
192
|
- 0
|
128
|
-
|
129
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
|
+
hash: 2863027732084932419
|
194
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
195
|
none: false
|
131
|
-
requirements:
|
132
|
-
- -
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
|
135
|
-
segments:
|
136
|
-
- 1
|
137
|
-
- 2
|
138
|
-
version: "1.2"
|
196
|
+
requirements:
|
197
|
+
- - ! '>='
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '1.2'
|
139
200
|
requirements: []
|
140
|
-
|
141
201
|
rubyforge_project: mingle_events
|
142
|
-
rubygems_version: 1.
|
202
|
+
rubygems_version: 1.8.23
|
143
203
|
signing_key:
|
144
204
|
specification_version: 3
|
145
205
|
summary: A gem that lets you process Mingle events in a pipes and filters style.
|
146
206
|
test_files: []
|
147
|
-
|