gwooks 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -83,8 +83,10 @@ notified, and _all_ the matching actions will be performed.
83
83
  ### DSL methods
84
84
 
85
85
  Each DSL method matches a corresponding property in the payload sent by the GitHub post-receive hooks
86
- (e.g. `repository_owner_email` matches `payload["repository"]["owner"]["email"]`). Note that all the methods
87
- starting with `commits` are also aliased with the singular `commit` to improve code readability.
86
+ (e.g. `repository_owner_email` matches `payload["repository"]["owner"]["email"]`).
87
+
88
+ Note that all the methods starting with `commits` are also aliased with the singular `commit`, and
89
+ those starting with `repository` are aliased with `repo` to improve code readability.
88
90
 
89
91
  The signature is identical for all methods:
90
92
 
@@ -113,18 +115,28 @@ commits_removed (alias: commit_removed)
113
115
  commits_timestamp (alias: commit_timestamp)
114
116
  commits_url (alias: commit_url)
115
117
  ref
116
- repository_description
117
- repository_forks
118
- repository_homepage
119
- repository_name
120
- repository_owner_email
121
- repository_owner_name
122
- repository_pledgie
123
- repository_private
124
- repository_url
125
- repository_watchers
118
+ repository_description (alias: repo_description)
119
+ repository_forks (alias: repo_forks)
120
+ repository_homepage (alias: repo_homepage)
121
+ repository_name (alias: repo_name)
122
+ repository_owner_email (alias: repo_owner_email)
123
+ repository_owner_name (alias: repo_owner_name)
124
+ repository_pledgie (alias: repo_pledgie)
125
+ repository_private (alias: repo_private)
126
+ repository_url (alias: repo_url)
127
+ repository_watchers (alias: repo_watchers)
126
128
  ```
127
129
 
130
+
128
131
  ## Beta
129
132
 
130
133
  Please take into consideration that this is a beta release, and as such the API may change
134
+
135
+
136
+ ## Changelog
137
+
138
+ v0.0.3 - Alias `repository_` methods to `repo_`
139
+
140
+ v0.0.2 - Alias `commits_` methods to `commit_`
141
+
142
+ v0.0.1 - First release
data/lib/gwooks/base.rb CHANGED
@@ -54,8 +54,19 @@ module Gwooks
54
54
  end
55
55
  end
56
56
 
57
- method_names.select { |n| n.start_with? "commits_" }.each do |method_name|
58
- alias_method method_name.gsub(/^commits_/, "commit_"), method_name
57
+ to_be_aliased = method_names.select do |n|
58
+ n.start_with? "commits_", "repository_"
59
+ end
60
+
61
+ to_be_aliased.each do |method_name|
62
+ alias_name = method_name.gsub /^(commits|repository)_/ do
63
+ if $1 == "commits"
64
+ "commit_"
65
+ else
66
+ "repo_"
67
+ end
68
+ end
69
+ alias_method alias_name, method_name
59
70
  end
60
71
 
61
72
  end
@@ -1,3 +1,3 @@
1
1
  module Gwooks
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -62,17 +62,27 @@ describe "subclass of Gwooks::Base" do
62
62
  end
63
63
  end
64
64
 
65
- method_names.select { |n| n.start_with? "commits_" }.each do |method_name|
66
- aliased_method_name = method_name.gsub(/^commits_/, "commit_")
65
+ to_be_aliased = method_names.select do |n|
66
+ n.start_with? "commits_", "repository_"
67
+ end
67
68
 
68
- describe aliased_method_name do
69
+ to_be_aliased.each do |method_name|
70
+ alias_name = method_name.gsub /^(commits|repository)_/ do
71
+ if $1 == "commits"
72
+ "commit_"
73
+ else
74
+ "repo_"
75
+ end
76
+ end
77
+
78
+ describe alias_name do
69
79
  it "is an alias for #{method_name}" do
70
- aliased_method = GwooksBaseSub.method(aliased_method_name.to_sym)
71
- aliased_method.should == GwooksBaseSub.method(method_name.to_sym)
80
+ alias_method = GwooksBaseSub.method(alias_name.to_sym)
81
+ alias_method.should == GwooksBaseSub.method(method_name.to_sym)
72
82
  end
73
83
  end
74
84
  end
75
-
85
+
76
86
  describe "instance" do
77
87
 
78
88
  describe :new do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gwooks
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease:
4
+ hash: 25
5
+ prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Luca Ongaro
@@ -15,9 +15,12 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-01-14 00:00:00 Z
18
+ date: 2013-01-15 00:00:00 +01:00
19
+ default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
22
+ name: json
23
+ prerelease: false
21
24
  requirement: &id001 !ruby/object:Gem::Requirement
22
25
  none: false
23
26
  requirements:
@@ -27,11 +30,11 @@ dependencies:
27
30
  segments:
28
31
  - 0
29
32
  version: "0"
30
- prerelease: false
31
33
  type: :runtime
32
- name: json
33
34
  version_requirements: *id001
34
35
  - !ruby/object:Gem::Dependency
36
+ name: sinatra
37
+ prerelease: false
35
38
  requirement: &id002 !ruby/object:Gem::Requirement
36
39
  none: false
37
40
  requirements:
@@ -41,11 +44,11 @@ dependencies:
41
44
  segments:
42
45
  - 0
43
46
  version: "0"
44
- prerelease: false
45
47
  type: :runtime
46
- name: sinatra
47
48
  version_requirements: *id002
48
49
  - !ruby/object:Gem::Dependency
50
+ name: rspec
51
+ prerelease: false
49
52
  requirement: &id003 !ruby/object:Gem::Requirement
50
53
  none: false
51
54
  requirements:
@@ -55,11 +58,11 @@ dependencies:
55
58
  segments:
56
59
  - 0
57
60
  version: "0"
58
- prerelease: false
59
61
  type: :development
60
- name: rspec
61
62
  version_requirements: *id003
62
63
  - !ruby/object:Gem::Dependency
64
+ name: rack-test
65
+ prerelease: false
63
66
  requirement: &id004 !ruby/object:Gem::Requirement
64
67
  none: false
65
68
  requirements:
@@ -69,9 +72,7 @@ dependencies:
69
72
  segments:
70
73
  - 0
71
74
  version: "0"
72
- prerelease: false
73
75
  type: :development
74
- name: rack-test
75
76
  version_requirements: *id004
76
77
  description: A DSL for quickly creating endpoints for GitHub post-receive webhooks.
77
78
  email:
@@ -97,6 +98,7 @@ files:
97
98
  - spec/gwooks/base_spec.rb
98
99
  - spec/integration/integration_spec.rb
99
100
  - spec/spec_helper.rb
101
+ has_rdoc: true
100
102
  homepage: https://github.com/lucaong/gwooks
101
103
  licenses: []
102
104
 
@@ -126,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
128
  requirements: []
127
129
 
128
130
  rubyforge_project:
129
- rubygems_version: 1.8.24
131
+ rubygems_version: 1.3.7
130
132
  signing_key:
131
133
  specification_version: 3
132
134
  summary: A DSL for quickly creating endpoints for GitHub post-receive webhooks. It provides methods for executing blocks of code when GitHub posts a payload matching some conditions in response to a code push.