overlay 0.0.9 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4706e5a02ba3659599d261fdef377ef3f6c93a0
4
- data.tar.gz: bcf7e96301b133743290b6dceeeebbc713269511
3
+ metadata.gz: b9ff825d01a64e7f1d6737b4a5e533de04d9f218
4
+ data.tar.gz: a37ef67f102494fb7dd846e063598a7e455f115a
5
5
  SHA512:
6
- metadata.gz: 6cc965f9dfabc6b135de7e6dde66d7dce7867c9d45a9cfd438d150fc6ee4f721fb7b44a30bd8e5c42513bf2f67f22f38081f2beca7fe095aa2a5510c83bc0da0
7
- data.tar.gz: 16180b98bd79d9553cf0fa9be6055a0446b4e2858786e4116ed5f4d47efa4a8a244e1fcd21b0bc9254ad08293470e95b1f0f2a0acb2d8b2b3227528f5937db46
6
+ metadata.gz: 618f713d45e200e2f2ecbf479a8a1c2dbe905319bb190a4d7723f062c6ca1df7c4a5a1ac0c727fe1dce10c55cf11f1750533f13dd4ad1357213983fae0ab3303
7
+ data.tar.gz: 93ddcd999a09a5cadc0ab3913004db51982baf99ccacd046c8804bdc3e9b7b73ff34b33335ec81e2b7c7301802a8ecfd7fd05b7dc556ef8d76d3a0f5f2b4240d
@@ -3,16 +3,17 @@ require_dependency "overlay/application_controller"
3
3
  module Overlay
4
4
  class GithubController < ApplicationController
5
5
  def update
6
+ render nothing: true
7
+
6
8
  Overlay.configuration.repositories.each do |repo_config|
7
9
  next unless repo_config.class == GithubRepo
8
10
  branch = repo_config[:branch] || 'master'
9
11
  if (params[:repository] && params[:ref])
10
12
  if (params[:repository][:name] == repo_config[:repo]) && (params[:ref] == "refs/heads/#{branch}")
11
- Overlay::Github.process_overlays
13
+ Overlay::GithubJob.new.async.perform repo_config
12
14
  end
13
15
  end
14
16
  end
15
- render :inline => github_update_url
16
17
  end
17
18
  end
18
19
  end
@@ -1,6 +1,7 @@
1
1
  require 'github_api'
2
2
  require 'fileutils'
3
3
  require 'socket'
4
+ require 'sucker_punch'
4
5
 
5
6
  module Overlay
6
7
  class Github
@@ -28,7 +29,7 @@ module Overlay
28
29
 
29
30
  register_web_hook(repo_config)
30
31
 
31
- overlay_repo(repo_config)
32
+ GithubJob.new.async.perform repo_config
32
33
  end
33
34
  end
34
35
 
@@ -47,7 +48,7 @@ module Overlay
47
48
  # Retrieve current web hooks
48
49
  current_hooks = github_repo.hooks.list(repo_config[:user], repo_config[:repo]).response.body
49
50
  if current_hooks.find {|hook| hook.config.url == uri}.nil?
50
- #register hook
51
+ # register hook
51
52
  github_repo.hooks.create(repo_config[:user], repo_config[:repo], name: 'web', active: true, config: {:url => uri, :content_type => 'json'})
52
53
  end
53
54
  end
@@ -123,4 +124,12 @@ module Overlay
123
124
  end
124
125
  end
125
126
  end
127
+
128
+ class GithubJob
129
+ include SuckerPunch::Job
130
+
131
+ def perform(repo_config)
132
+ Github.overlay_repo repo_config
133
+ end
134
+ end
126
135
  end
@@ -1,3 +1,3 @@
1
1
  module Overlay
2
- VERSION = "0.0.9"
2
+ VERSION = "1.0"
3
3
  end
@@ -4,12 +4,15 @@ module Overlay
4
4
  describe GithubController do
5
5
  before :each do
6
6
  Overlay.configure do |config|
7
+ config.repositories << Overlay::GithubRepo.new('test', 'test', 'master', 'test', 'test')
7
8
  end
8
9
  end
9
10
 
10
11
  describe "POST 'update'" do
11
12
  it "returns http success" do
12
- post 'update', {:use_route => :overlay}
13
+ Overlay::Github.stub(:overlay_repo) { true }
14
+ Overlay::Github.should_receive(:overlay_repo).once
15
+ post 'update', {:use_route => :overlay, :ref => "refs/heads/master", :repository => {:name => 'test'}}
13
16
  response.should be_success
14
17
  end
15
18
  end
@@ -167,3 +167,131 @@ Processing by Overlay::GithubController#update as HTML
167
167
  Completed 200 OK in 4ms (Views: 3.4ms)
168
168
  Processing by Overlay::GithubController#update as HTML
169
169
  Completed 200 OK in 1ms (Views: 0.3ms)
170
+ Processing by Overlay::GithubController#update as HTML
171
+ Rendered inline template (0.8ms)
172
+ Completed 200 OK in 5ms (Views: 4.6ms)
173
+ Processing by Overlay::GithubController#update as HTML
174
+ Completed 200 OK in 1ms (Views: 0.4ms)
175
+ Shutdown completed cleanly
176
+ Processing by Overlay::GithubController#update as HTML
177
+ Rendered inline template (0.8ms)
178
+ Completed 200 OK in 4ms (Views: 3.8ms)
179
+ Processing by Overlay::GithubController#update as HTML
180
+ Completed 200 OK in 1ms (Views: 0.3ms)
181
+ Terminating 3 actors...
182
+ Shutdown completed cleanly
183
+ Processing by Overlay::GithubController#update as HTML
184
+ Rendered text template (0.0ms)
185
+ Completed 200 OK in 4ms (Views: 3.9ms)
186
+ Processing by Overlay::GithubController#update as HTML
187
+ Completed 200 OK in 0ms (Views: 0.2ms)
188
+ Terminating 3 actors...
189
+ Shutdown completed cleanly
190
+ Processing by Overlay::GithubController#update as HTML
191
+ Parameters: {"ref"=>"refs/heads/master", "repository"=>{"name"=>"test"}}
192
+ Rendered text template (0.0ms)
193
+ Overlay::GithubJob crashed!
194
+ Github::Error::NotFound: GET https://api.github.com/repos/test/test/contents/test?ref=master: 404 Not Found
195
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/github_api-0.10.2/lib/github_api/response/raise_error.rb:14:in `on_complete'
196
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/faraday-0.8.7/lib/faraday/response.rb:9:in `block in call'
197
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/faraday-0.8.7/lib/faraday/response.rb:63:in `on_complete'
198
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/faraday-0.8.7/lib/faraday/response.rb:8:in `call'
199
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/faraday-0.8.7/lib/faraday/response.rb:8:in `call'
200
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/faraday-0.8.7/lib/faraday/response.rb:8:in `call'
201
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/faraday-0.8.7/lib/faraday/request/url_encoded.rb:14:in `call'
202
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/faraday-0.8.7/lib/faraday/request/multipart.rb:13:in `call'
203
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/github_api-0.10.2/lib/github_api/request/jsonize.rb:18:in `call'
204
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/faraday-0.8.7/lib/faraday/connection.rb:247:in `run_request'
205
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/faraday-0.8.7/lib/faraday/connection.rb:100:in `get'
206
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/github_api-0.10.2/lib/github_api/request.rb:44:in `request'
207
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/github_api-0.10.2/lib/github_api/request.rb:12:in `get_request'
208
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/github_api-0.10.2/lib/github_api/repos/contents.rb:47:in `get'
209
+ /Users/ssaarinen/dev/overlay/lib/overlay/github.rb:84:in `overlay_directory'
210
+ /Users/ssaarinen/dev/overlay/lib/overlay/github.rb:64:in `overlay_repo'
211
+ /Users/ssaarinen/dev/overlay/lib/overlay/github.rb:132:in `perform'
212
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/calls.rb:25:in `public_send'
213
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/calls.rb:25:in `dispatch'
214
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/calls.rb:67:in `dispatch'
215
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/actor.rb:326:in `block in handle_message'
216
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/tasks.rb:42:in `block in initialize'
217
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/tasks/task_fiber.rb:11:in `block in create'
218
+ (celluloid):0:in `remote procedure call'
219
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/calls.rb:95:in `value'
220
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/proxies/sync_proxy.rb:28:in `method_missing'
221
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/legacy.rb:14:in `method_missing'
222
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/proxies/actor_proxy.rb:25:in `_send_'
223
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/pool_manager.rb:41:in `_send_'
224
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/pool_manager.rb:122:in `method_missing'
225
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/calls.rb:25:in `public_send'
226
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/calls.rb:25:in `dispatch'
227
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/calls.rb:67:in `dispatch'
228
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/actor.rb:326:in `block in handle_message'
229
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/tasks.rb:42:in `block in initialize'
230
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/tasks/task_fiber.rb:11:in `block in create'
231
+ Completed 500 Internal Server Error in 546ms
232
+ Processing by Overlay::GithubController#update as HTML
233
+ Completed 200 OK in 0ms (Views: 0.2ms)
234
+ Terminating 3 actors...
235
+ Shutdown completed cleanly
236
+ Processing by Overlay::GithubController#update as HTML
237
+ Parameters: {"ref"=>"refs/heads/master", "repository"=>{"name"=>"test"}}
238
+ Rendered text template (0.0ms)
239
+ Overlay::GithubJob crashed!
240
+ Github::Error::NotFound: GET https://api.github.com/repos/test/test/contents/test?ref=master: 404 Not Found
241
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/github_api-0.10.2/lib/github_api/response/raise_error.rb:14:in `on_complete'
242
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/faraday-0.8.7/lib/faraday/response.rb:9:in `block in call'
243
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/faraday-0.8.7/lib/faraday/response.rb:63:in `on_complete'
244
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/faraday-0.8.7/lib/faraday/response.rb:8:in `call'
245
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/faraday-0.8.7/lib/faraday/response.rb:8:in `call'
246
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/faraday-0.8.7/lib/faraday/response.rb:8:in `call'
247
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/faraday-0.8.7/lib/faraday/request/url_encoded.rb:14:in `call'
248
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/faraday-0.8.7/lib/faraday/request/multipart.rb:13:in `call'
249
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/github_api-0.10.2/lib/github_api/request/jsonize.rb:18:in `call'
250
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/faraday-0.8.7/lib/faraday/connection.rb:247:in `run_request'
251
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/faraday-0.8.7/lib/faraday/connection.rb:100:in `get'
252
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/github_api-0.10.2/lib/github_api/request.rb:44:in `request'
253
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/github_api-0.10.2/lib/github_api/request.rb:12:in `get_request'
254
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/github_api-0.10.2/lib/github_api/repos/contents.rb:47:in `get'
255
+ /Users/ssaarinen/dev/overlay/lib/overlay/github.rb:84:in `overlay_directory'
256
+ /Users/ssaarinen/dev/overlay/lib/overlay/github.rb:64:in `overlay_repo'
257
+ /Users/ssaarinen/dev/overlay/lib/overlay/github.rb:132:in `perform'
258
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/calls.rb:25:in `public_send'
259
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/calls.rb:25:in `dispatch'
260
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/calls.rb:67:in `dispatch'
261
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/actor.rb:326:in `block in handle_message'
262
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/tasks.rb:42:in `block in initialize'
263
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/tasks/task_fiber.rb:11:in `block in create'
264
+ (celluloid):0:in `remote procedure call'
265
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/calls.rb:95:in `value'
266
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/proxies/sync_proxy.rb:28:in `method_missing'
267
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/legacy.rb:14:in `method_missing'
268
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/proxies/actor_proxy.rb:25:in `_send_'
269
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/pool_manager.rb:41:in `_send_'
270
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/pool_manager.rb:122:in `method_missing'
271
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/calls.rb:25:in `public_send'
272
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/calls.rb:25:in `dispatch'
273
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/calls.rb:67:in `dispatch'
274
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/actor.rb:326:in `block in handle_message'
275
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/tasks.rb:42:in `block in initialize'
276
+ /Users/ssaarinen/.rvm/gems/ruby-2.0.0-p195/gems/celluloid-0.14.1/lib/celluloid/tasks/task_fiber.rb:11:in `block in create'
277
+ Completed 500 Internal Server Error in 490ms
278
+ Processing by Overlay::GithubController#update as HTML
279
+ Completed 200 OK in 0ms (Views: 0.2ms)
280
+ Terminating 3 actors...
281
+ Shutdown completed cleanly
282
+ Processing by Overlay::GithubController#update as HTML
283
+ Parameters: {"ref"=>"refs/heads/master", "repository"=>{"name"=>"test"}}
284
+ Rendered text template (0.0ms)
285
+ Completed 200 OK in 26ms (Views: 3.2ms)
286
+ Processing by Overlay::GithubController#update as HTML
287
+ Completed 200 OK in 0ms (Views: 0.2ms)
288
+ Terminating 3 actors...
289
+ Shutdown completed cleanly
290
+ Processing by Overlay::GithubController#update as HTML
291
+ Rendered text template (0.0ms)
292
+ Completed 200 OK in 4ms (Views: 3.2ms)
293
+ Processing by Overlay::GithubController#update as HTML
294
+ Parameters: {"ref"=>"refs/heads/master", "repository"=>{"name"=>"test"}}
295
+ Completed 200 OK in 1ms (Views: 0.2ms)
296
+ Terminating 3 actors...
297
+ Shutdown completed cleanly
data/spec/spec_helper.rb CHANGED
@@ -3,6 +3,7 @@ ENV["RAILS_ENV"] ||= 'test'
3
3
  require File.expand_path("../dummy/config/environment.rb", __FILE__)
4
4
  require 'rspec/rails'
5
5
  require 'rspec/autorun'
6
+ require 'sucker_punch/testing/inline'
6
7
 
7
8
  # Requires supporting ruby files with custom matchers and macros, etc,
8
9
  # in spec/support/ and its subdirectories.
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: 0.0.9
4
+ version: '1.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Saarinen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-14 00:00:00.000000000 Z
11
+ date: 2013-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sucker_punch
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.0.beta2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.0.beta2
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rspec-rails
43
57
  requirement: !ruby/object:Gem::Requirement