svn-campfire-notifier 0.3.0 → 0.3.2
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.
@@ -9,28 +9,20 @@ class SVNCampfireNotifier
|
|
9
9
|
@project = project
|
10
10
|
end
|
11
11
|
|
12
|
-
def extra_options
|
13
|
-
{
|
14
|
-
'isch' => '1',
|
15
|
-
'itp' => project.image_type,
|
16
|
-
'ic' => 'specific',
|
17
|
-
'ics' => project.color
|
18
|
-
}.inject([]) do |serialized, (key, value)|
|
19
|
-
serialized << "#{key}:#{value}"
|
20
|
-
end.join(',')
|
21
|
-
end
|
22
|
-
|
23
12
|
def query
|
24
13
|
"#{project.subject}+#{project.revision}"
|
25
14
|
end
|
26
15
|
|
27
16
|
def url
|
28
|
-
"#{URL}&q=#{query}&
|
17
|
+
"#{URL}&q=#{query}&imgcolor=#{project.color}&imgtype=#{project.image_type}"
|
29
18
|
end
|
30
19
|
|
31
20
|
def feeling_lucky
|
32
21
|
puts url
|
33
22
|
response = REST.get(url)
|
23
|
+
if response.found? and (location = response.headers['location'].first)
|
24
|
+
response = REST.get(location)
|
25
|
+
end
|
34
26
|
if response.ok? and match = RESULTS_REGEXP.match(response.body)
|
35
27
|
data = JSON.parse(match[1]).first
|
36
28
|
image_url = data[3]
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class SVNCampfireNotifier
|
2
2
|
class Project
|
3
|
-
SUBJECTS = %w(kitty turtle dog car computer retro)
|
3
|
+
SUBJECTS = %w(kitty turtle dog car computer retro fox rabbit tractor calculator bear shark happy cute)
|
4
4
|
COLORS = %w(red orange yellow green teal blue purple pink white grey black brown)
|
5
|
-
TYPES = %w(
|
5
|
+
TYPES = %w(photo clipart lineart) # EXCLUDE: face
|
6
6
|
|
7
7
|
attr_reader :repository_path, :revision
|
8
8
|
|
@@ -27,20 +27,16 @@ class SVNCampfireNotifier
|
|
27
27
|
@log ||= `svnlook log -r #{revision} #{repository_path}`.strip
|
28
28
|
end
|
29
29
|
|
30
|
-
def index
|
31
|
-
name[0]
|
32
|
-
end
|
33
|
-
|
34
30
|
def subject
|
35
|
-
SUBJECTS[
|
31
|
+
SUBJECTS[name[0] % SUBJECTS.length]
|
36
32
|
end
|
37
33
|
|
38
34
|
def color
|
39
|
-
COLORS[
|
35
|
+
COLORS[name[1] % COLORS.length]
|
40
36
|
end
|
41
37
|
|
42
38
|
def image_type
|
43
|
-
TYPES[
|
39
|
+
TYPES[name[2] % TYPES.length]
|
44
40
|
end
|
45
41
|
end
|
46
42
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svn-campfire-notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Manfred Stienstra
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-27 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|