overlay 2.1.4 → 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/overlay/github.rb +27 -21
- data/lib/overlay/version.rb +1 -1
- data/spec/dummy/log/test.log +175 -0
- data/spec/github_spec.rb +51 -17
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 031b8194d30735cc12a551ea18ffe9efdc7eb914
|
4
|
+
data.tar.gz: 3eb47ae8de9876ba5edb5538615d4dd249db71c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5fccfac90429e7a30cbeaf820db2b974b9c5dadfe7ee6fcef40c7e1bb45cd50318d925efb3984c8a9f6859dbdf0c7f28a88fbca627e4e6e0933c14e537ca8d5
|
7
|
+
data.tar.gz: 18a649cfb638101b073bb6d773d8c885fc83e7ebf926e9eabb7f0b554363db78f9826d5050f0827f01c5827f0721ddf45da1469710a0cef690d17d375fe9be84
|
data/lib/overlay/github.rb
CHANGED
@@ -53,33 +53,39 @@ module Overlay
|
|
53
53
|
|
54
54
|
commits.each do |commit|
|
55
55
|
# There will be three entries in each commit with file paths: added, removed, and modified.
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
56
|
+
unless commit['added'].nil?
|
57
|
+
added_files = commit['added']
|
58
|
+
added_files.each do |file|
|
59
|
+
# Do we care?
|
60
|
+
if my_file?(file, repo_config)
|
61
|
+
Rails.logger.info "Overlay found added file in hook: #{file}"
|
62
|
+
|
63
|
+
# Make sure that the directory is in place
|
64
|
+
FileUtils.mkdir_p(destination_path(File.dirname(file), repo_config))
|
65
|
+
clone_file(file, repo_config)
|
66
|
+
end
|
65
67
|
end
|
66
68
|
end
|
67
69
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
70
|
+
unless commit['modified'].nil?
|
71
|
+
modified_files = commit['modified']
|
72
|
+
modified_files.each do |file|
|
73
|
+
# Do we care?
|
74
|
+
if my_file?(file, repo_config)
|
75
|
+
Rails.logger.info "Overlay found modified file in hook: #{file}"
|
76
|
+
clone_file(file, repo_config)
|
77
|
+
end
|
74
78
|
end
|
75
79
|
end
|
76
80
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
81
|
+
unless commit['removed'].nil?
|
82
|
+
removed_files = commit['removed']
|
83
|
+
removed_files.each do |file|
|
84
|
+
# Do we care?
|
85
|
+
if my_file?(file, repo_config)
|
86
|
+
Rails.logger.info "Overlay found deleted file in hook: #{file}"
|
87
|
+
File.delete(destination_path(file, repo_config))
|
88
|
+
end
|
83
89
|
end
|
84
90
|
end
|
85
91
|
end
|
data/lib/overlay/version.rb
CHANGED
data/spec/dummy/log/test.log
CHANGED
@@ -1839,3 +1839,178 @@ Completed 200 OK in 6ms (Views: 5.3ms)
|
|
1839
1839
|
Processing by Overlay::GithubController#update as HTML
|
1840
1840
|
Parameters: {"ref"=>"refs/heads/master", "repository"=>{"name"=>"test_repo"}}
|
1841
1841
|
Completed 200 OK in 0ms (Views: 0.2ms)
|
1842
|
+
Processing by Overlay::GithubController#update as HTML
|
1843
|
+
Rendered text template (0.0ms)
|
1844
|
+
Completed 200 OK in 6ms (Views: 5.8ms)
|
1845
|
+
Processing by Overlay::GithubController#update as HTML
|
1846
|
+
Parameters: {"ref"=>"refs/heads/master", "repository"=>{"name"=>"test_repo"}}
|
1847
|
+
Completed 200 OK in 0ms (Views: 0.2ms)
|
1848
|
+
Overlay found added file in hook: lib/test/test.rb
|
1849
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1850
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1851
|
+
Overlay found added file in hook: lib/test/test.rb
|
1852
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1853
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1854
|
+
Overlay found added file in hook: lib/test/test.rb
|
1855
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1856
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1857
|
+
Overlay found added file in hook: lib/test/test.rb
|
1858
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1859
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1860
|
+
Overlay subscribing to redis channel: test_key
|
1861
|
+
Overlay register webhook for repo: org => test_org, repo => test_repo
|
1862
|
+
Overlay register webhook for repo: org => test_org, repo => test_repo
|
1863
|
+
Overlay found added file in hook: lib/test/test.rb
|
1864
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1865
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1866
|
+
Overlay found added file in hook: lib/test/test.rb
|
1867
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1868
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1869
|
+
Overlay found added file in hook: lib/test/test.rb
|
1870
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1871
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1872
|
+
Overlay found added file in hook: lib/test/test.rb
|
1873
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1874
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1875
|
+
Overlay subscribing to redis channel: test_key
|
1876
|
+
Overlay register webhook for repo: org => test_org, repo => test_repo
|
1877
|
+
Overlay register webhook for repo: org => test_org, repo => test_repo
|
1878
|
+
Processing by Overlay::GithubController#update as HTML
|
1879
|
+
Parameters: {"ref"=>"refs/heads/master", "repository"=>{"name"=>"test_repo"}}
|
1880
|
+
Rendered text template (0.0ms)
|
1881
|
+
Completed 200 OK in 4ms (Views: 3.2ms)
|
1882
|
+
Processing by Overlay::GithubController#update as HTML
|
1883
|
+
Completed 200 OK in 0ms (Views: 0.1ms)
|
1884
|
+
Overlay found added file in hook: lib/test/test.rb
|
1885
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1886
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1887
|
+
Overlay found added file in hook: lib/test/test.rb
|
1888
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1889
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1890
|
+
Overlay found added file in hook: lib/test/test.rb
|
1891
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1892
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1893
|
+
Overlay found added file in hook: lib/test/test.rb
|
1894
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1895
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1896
|
+
Overlay found added file in hook: lib/test/test.rb
|
1897
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1898
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1899
|
+
Overlay found added file in hook: lib/test/test.rb
|
1900
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1901
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1902
|
+
Overlay subscribing to redis channel: test_key
|
1903
|
+
Overlay register webhook for repo: org => test_org, repo => test_repo
|
1904
|
+
Overlay register webhook for repo: org => test_org, repo => test_repo
|
1905
|
+
Processing by Overlay::GithubController#update as HTML
|
1906
|
+
Parameters: {"ref"=>"refs/heads/master", "repository"=>{"name"=>"test_repo"}}
|
1907
|
+
Rendered text template (0.0ms)
|
1908
|
+
Completed 200 OK in 4ms (Views: 3.5ms)
|
1909
|
+
Processing by Overlay::GithubController#update as HTML
|
1910
|
+
Completed 200 OK in 0ms (Views: 0.1ms)
|
1911
|
+
Processing by Overlay::GithubController#update as HTML
|
1912
|
+
Parameters: {"ref"=>"refs/heads/master", "repository"=>{"name"=>"test_repo"}}
|
1913
|
+
Rendered text template (0.0ms)
|
1914
|
+
Completed 200 OK in 3ms (Views: 3.1ms)
|
1915
|
+
Processing by Overlay::GithubController#update as HTML
|
1916
|
+
Completed 200 OK in 0ms (Views: 0.1ms)
|
1917
|
+
Overlay register webhook for repo: org => test_org, repo => test_repo
|
1918
|
+
Overlay register webhook for repo: org => test_org, repo => test_repo
|
1919
|
+
Overlay subscribing to redis channel: test_key
|
1920
|
+
Overlay found added file in hook: lib/test/test.rb
|
1921
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1922
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1923
|
+
Overlay found added file in hook: lib/test/test.rb
|
1924
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1925
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1926
|
+
Overlay found added file in hook: lib/test/test.rb
|
1927
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1928
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1929
|
+
Overlay found added file in hook: lib/test/test.rb
|
1930
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1931
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1932
|
+
Overlay found added file in hook: lib/test/test.rb
|
1933
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1934
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1935
|
+
Overlay found added file in hook: lib/test/test.rb
|
1936
|
+
Overlay found modified file in hook: lib/test/test.rb
|
1937
|
+
Overlay found deleted file in hook: lib/test/test.rb
|
1938
|
+
Processing by Overlay::GithubController#update as HTML
|
1939
|
+
Rendered text template (0.0ms)
|
1940
|
+
Completed 200 OK in 4ms (Views: 3.5ms)
|
1941
|
+
Processing by Overlay::GithubController#update as HTML
|
1942
|
+
Parameters: {"ref"=>"refs/heads/master", "repository"=>{"name"=>"test_repo"}}
|
1943
|
+
Completed 200 OK in 0ms (Views: 0.2ms)
|
1944
|
+
Overlay found added file in hook: lib/test/test_added.rb
|
1945
|
+
Overlay found modified file in hook: lib/test/test_modified.rb
|
1946
|
+
Overlay found deleted file in hook: lib/test/test_removed.rb
|
1947
|
+
Overlay found added file in hook: lib/test/test_added.rb
|
1948
|
+
Overlay found modified file in hook: lib/test/test_modified.rb
|
1949
|
+
Overlay found deleted file in hook: lib/test/test_removed.rb
|
1950
|
+
Overlay found modified file in hook: lib/test/test_modified.rb
|
1951
|
+
Overlay found deleted file in hook: lib/test/test_removed.rb
|
1952
|
+
Overlay found added file in hook: lib/test/test_added.rb
|
1953
|
+
Overlay found modified file in hook: lib/test/test_modified.rb
|
1954
|
+
Overlay found deleted file in hook: lib/test/test_removed.rb
|
1955
|
+
Overlay found added file in hook: lib/test/test_added.rb
|
1956
|
+
Overlay found modified file in hook: lib/test/test_modified.rb
|
1957
|
+
Overlay found added file in hook: lib/test/test_added.rb
|
1958
|
+
Overlay found modified file in hook: lib/test/test_modified.rb
|
1959
|
+
Overlay found deleted file in hook: lib/test/test_removed.rb
|
1960
|
+
Overlay found added file in hook: lib/test/test_added.rb
|
1961
|
+
Overlay subscribing to redis channel: test_key
|
1962
|
+
Overlay register webhook for repo: org => test_org, repo => test_repo
|
1963
|
+
Overlay register webhook for repo: org => test_org, repo => test_repo
|
1964
|
+
Overlay register webhook for repo: org => test_org, repo => test_repo
|
1965
|
+
Overlay register webhook for repo: org => test_org, repo => test_repo
|
1966
|
+
Overlay found added file in hook: lib/test/test_added.rb
|
1967
|
+
Overlay found modified file in hook: lib/test/test_modified.rb
|
1968
|
+
Overlay found deleted file in hook: lib/test/test_removed.rb
|
1969
|
+
Overlay found added file in hook: lib/test/test_added.rb
|
1970
|
+
Overlay found modified file in hook: lib/test/test_modified.rb
|
1971
|
+
Overlay found deleted file in hook: lib/test/test_removed.rb
|
1972
|
+
Overlay found modified file in hook: lib/test/test_modified.rb
|
1973
|
+
Overlay found deleted file in hook: lib/test/test_removed.rb
|
1974
|
+
Overlay found added file in hook: lib/test/test_added.rb
|
1975
|
+
Overlay found modified file in hook: lib/test/test_modified.rb
|
1976
|
+
Overlay found added file in hook: lib/test/test_added.rb
|
1977
|
+
Overlay found modified file in hook: lib/test/test_modified.rb
|
1978
|
+
Overlay found deleted file in hook: lib/test/test_removed.rb
|
1979
|
+
Overlay found added file in hook: lib/test/test_added.rb
|
1980
|
+
Overlay found added file in hook: lib/test/test_added.rb
|
1981
|
+
Overlay found modified file in hook: lib/test/test_modified.rb
|
1982
|
+
Overlay found deleted file in hook: lib/test/test_removed.rb
|
1983
|
+
Overlay subscribing to redis channel: test_key
|
1984
|
+
Processing by Overlay::GithubController#update as HTML
|
1985
|
+
Parameters: {"ref"=>"refs/heads/master", "repository"=>{"name"=>"test_repo"}}
|
1986
|
+
Rendered text template (0.0ms)
|
1987
|
+
Completed 200 OK in 5ms (Views: 4.1ms)
|
1988
|
+
Processing by Overlay::GithubController#update as HTML
|
1989
|
+
Completed 200 OK in 0ms (Views: 0.1ms)
|
1990
|
+
Overlay found added file in hook: lib/test/test_added.rb
|
1991
|
+
Overlay found deleted file in hook: lib/test/test_removed.rb
|
1992
|
+
Overlay found added file in hook: lib/test/test_added.rb
|
1993
|
+
Overlay found modified file in hook: lib/test/test_modified.rb
|
1994
|
+
Overlay found modified file in hook: lib/test/test_modified.rb
|
1995
|
+
Overlay found deleted file in hook: lib/test/test_removed.rb
|
1996
|
+
Overlay found added file in hook: lib/test/test_added.rb
|
1997
|
+
Overlay found modified file in hook: lib/test/test_modified.rb
|
1998
|
+
Overlay found deleted file in hook: lib/test/test_removed.rb
|
1999
|
+
Overlay found added file in hook: lib/test/test_added.rb
|
2000
|
+
Overlay found modified file in hook: lib/test/test_modified.rb
|
2001
|
+
Overlay found deleted file in hook: lib/test/test_removed.rb
|
2002
|
+
Overlay found added file in hook: lib/test/test_added.rb
|
2003
|
+
Overlay found modified file in hook: lib/test/test_modified.rb
|
2004
|
+
Overlay found deleted file in hook: lib/test/test_removed.rb
|
2005
|
+
Overlay found added file in hook: lib/test/test_added.rb
|
2006
|
+
Overlay found modified file in hook: lib/test/test_modified.rb
|
2007
|
+
Overlay found deleted file in hook: lib/test/test_removed.rb
|
2008
|
+
Overlay subscribing to redis channel: test_key
|
2009
|
+
Overlay register webhook for repo: org => test_org, repo => test_repo
|
2010
|
+
Overlay register webhook for repo: org => test_org, repo => test_repo
|
2011
|
+
Processing by Overlay::GithubController#update as HTML
|
2012
|
+
Rendered text template (0.0ms)
|
2013
|
+
Completed 200 OK in 4ms (Views: 3.3ms)
|
2014
|
+
Processing by Overlay::GithubController#update as HTML
|
2015
|
+
Parameters: {"ref"=>"refs/heads/master", "repository"=>{"name"=>"test_repo"}}
|
2016
|
+
Completed 200 OK in 0ms (Views: 0.2ms)
|
data/spec/github_spec.rb
CHANGED
@@ -148,16 +148,13 @@ describe Overlay::Github do
|
|
148
148
|
\"username\":\"saarinen\"
|
149
149
|
},
|
150
150
|
\"added\":[
|
151
|
-
|
152
|
-
],
|
153
|
-
\"added\":[
|
154
|
-
\"lib/test/test.rb\"
|
151
|
+
\"lib/test/test_added.rb\"
|
155
152
|
],
|
156
153
|
\"removed\":[
|
157
|
-
\"lib/test/
|
154
|
+
\"lib/test/test_removed.rb\"
|
158
155
|
],
|
159
156
|
\"modified\":[
|
160
|
-
\"lib/test/
|
157
|
+
\"lib/test/test_modified.rb\"
|
161
158
|
]
|
162
159
|
}
|
163
160
|
],
|
@@ -178,13 +175,13 @@ describe Overlay::Github do
|
|
178
175
|
\"username\":\"saarinen\"
|
179
176
|
},
|
180
177
|
\"added\":[
|
181
|
-
\"lib/test/
|
178
|
+
\"lib/test/test_added.rb\"
|
182
179
|
],
|
183
180
|
\"removed\":[
|
184
|
-
\"lib/test/
|
181
|
+
\"lib/test/test_removed.rb\"
|
185
182
|
],
|
186
183
|
\"modified\":[
|
187
|
-
\"lib/test/
|
184
|
+
\"lib/test/test_modified.rb\"
|
188
185
|
]
|
189
186
|
},
|
190
187
|
\"repository\":{
|
@@ -229,24 +226,25 @@ describe Overlay::Github do
|
|
229
226
|
|
230
227
|
it 'should remove a deleted file' do
|
231
228
|
allow(Overlay::Github.instance).to receive(:clone_file).and_return
|
232
|
-
allow(FileUtils).to receive(:mkdir_p).
|
233
|
-
expect(File).to receive(:delete).with("#{Rails.application.root}/lib/test/
|
229
|
+
allow(FileUtils).to receive(:mkdir_p).and_return
|
230
|
+
expect(File).to receive(:delete).with("#{Rails.application.root}/lib/test/test_removed.rb").and_return
|
234
231
|
|
235
232
|
Overlay::Github.instance.process_hook(payload, repo_config)
|
236
233
|
end
|
237
234
|
|
238
235
|
it 'should clone added or modified files' do
|
239
|
-
allow(FileUtils).to receive(:mkdir_p).
|
240
|
-
allow(File).to receive(:delete).
|
241
|
-
expect(Overlay::Github.instance).to receive(:clone_file).with("lib/test/
|
236
|
+
allow(FileUtils).to receive(:mkdir_p).and_return
|
237
|
+
allow(File).to receive(:delete).and_return
|
238
|
+
expect(Overlay::Github.instance).to receive(:clone_file).with("lib/test/test_added.rb", repo_config).and_return
|
239
|
+
expect(Overlay::Github.instance).to receive(:clone_file).with("lib/test/test_modified.rb", repo_config).and_return
|
242
240
|
|
243
241
|
Overlay::Github.instance.process_hook(payload, repo_config)
|
244
242
|
end
|
245
243
|
|
246
244
|
it 'should call post_hook after hook is processed' do
|
247
|
-
allow(FileUtils).to receive(:mkdir_p).
|
248
|
-
allow(File).to receive(:delete).
|
249
|
-
allow(Overlay::Github.instance).to receive(:clone_file).
|
245
|
+
allow(FileUtils).to receive(:mkdir_p).and_return
|
246
|
+
allow(File).to receive(:delete).and_return
|
247
|
+
allow(Overlay::Github.instance).to receive(:clone_file).and_return
|
250
248
|
|
251
249
|
hook_ran = false
|
252
250
|
|
@@ -258,5 +256,41 @@ describe Overlay::Github do
|
|
258
256
|
|
259
257
|
expect(hook_ran).to eq(true)
|
260
258
|
end
|
259
|
+
|
260
|
+
it 'should process hook with null added descriptors' do
|
261
|
+
allow(FileUtils).to receive(:mkdir_p).and_return
|
262
|
+
allow(File).to receive(:delete).and_return
|
263
|
+
allow(Overlay::Github.instance).to receive(:clone_file).and_return
|
264
|
+
|
265
|
+
# Remove added file
|
266
|
+
payload_modified = payload
|
267
|
+
payload_modified['commits'].first['added'] = nil
|
268
|
+
|
269
|
+
expect { Overlay::Github.instance.process_hook(payload_modified, repo_config) }.to_not raise_error
|
270
|
+
end
|
271
|
+
|
272
|
+
it 'should process hook with null modified descriptors' do
|
273
|
+
allow(FileUtils).to receive(:mkdir_p).and_return
|
274
|
+
allow(File).to receive(:delete).and_return
|
275
|
+
allow(Overlay::Github.instance).to receive(:clone_file).and_return
|
276
|
+
|
277
|
+
# Remove modified file
|
278
|
+
payload_modified = payload
|
279
|
+
payload_modified['commits'].first['modified'] = nil
|
280
|
+
|
281
|
+
expect { Overlay::Github.instance.process_hook(payload_modified, repo_config) }.to_not raise_error
|
282
|
+
end
|
283
|
+
|
284
|
+
it 'should process hook with null removed descriptors' do
|
285
|
+
allow(FileUtils).to receive(:mkdir_p).and_return
|
286
|
+
allow(File).to receive(:delete).and_return
|
287
|
+
allow(Overlay::Github.instance).to receive(:clone_file).and_return
|
288
|
+
|
289
|
+
# Remove removed file
|
290
|
+
payload_modified = payload
|
291
|
+
payload_modified['commits'].first['removed'] = nil
|
292
|
+
|
293
|
+
expect { Overlay::Github.instance.process_hook(payload_modified, repo_config) }.to_not raise_error
|
294
|
+
end
|
261
295
|
end
|
262
296
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: overlay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Saarinen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|