perkins 0.0.2 → 0.0.3

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: e221f76f15d35aed4024e928ad9a110cd1cc35c7
4
- data.tar.gz: 8949ff14e44a8830713eb5beaa8f1139cdaf7e05
3
+ metadata.gz: 45570213f70cf7ea0b87581baced671d022d2bb4
4
+ data.tar.gz: 974641b152db25e612ef63370f9f3e450c4e0b4e
5
5
  SHA512:
6
- metadata.gz: c5972841aac46d31ecde60b81b5a2144d8d3bf95e689db05d32f9e9f871b665219fa3a211f1efdd85941ba76864c0f0f5d8ee5c24e3f137bfa9e1b34ded08940
7
- data.tar.gz: e44f197ad2e3f504eb355221af2c6a1b934cef2a31e1b1f5ef4071bca4d63756840e6cb2221afaf14487c3b3429da0aa6c7c08c338b5c63c9cbc359f61732143
6
+ metadata.gz: f72e7ec3b748f44f04ff3419775f8695e456a54fc0ccb3b9552a5ef96af4c14d085e0821e2ef88ce5ecd5dce9f003560b2953031310ff07e76f2a0b9fec331a7
7
+ data.tar.gz: d94c351caebcb5796a210ea2ac4af9ba808bc771e0c351a2f588aaa81a67eea95916ef719aaf464688ab0e208a3176d5cc2729135f0d1677656199eec5bb221e
data/.gitignore CHANGED
@@ -22,3 +22,4 @@ mkmf.log
22
22
  /log/*.log
23
23
 
24
24
  Vagrantfile
25
+ chef
data/TODO.md CHANGED
@@ -1,4 +1,4 @@
1
1
  #TODO
2
2
 
3
- + filter saved repos from listed github repos.
4
- + add hook interaction.
3
+ + check for concurrent builds for the same repo
4
+ in concurrent scenarios the cloned repo may not be "thread safe"
data/examples/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
  gem "pry"
3
- gem "unicorn"
3
+ gem "rainbows"
4
4
  gem "perkins", path: "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- perkins (0.0.1)
4
+ perkins (0.0.2)
5
5
  activerecord (>= 3, < 4.1)
6
6
  activesupport (>= 3, < 4.1)
7
7
  celluloid
@@ -45,7 +45,7 @@ GEM
45
45
  multi_json (~> 1.3)
46
46
  thread_safe (~> 0.1)
47
47
  tzinfo (~> 0.3.37)
48
- addressable (2.3.7)
48
+ addressable (2.3.8)
49
49
  arel (4.0.2)
50
50
  backports (3.6.4)
51
51
  builder (3.1.4)
@@ -55,17 +55,17 @@ GEM
55
55
  celluloid (>= 0.16.0)
56
56
  nio4r (>= 1.1.0)
57
57
  coderay (1.1.0)
58
- coffee-script (2.3.0)
58
+ coffee-script (2.4.1)
59
59
  coffee-script-source
60
60
  execjs
61
- coffee-script-source (1.9.1)
62
- connection_pool (2.1.1)
61
+ coffee-script-source (1.9.1.1)
62
+ connection_pool (2.2.0)
63
63
  daemons (1.1.9)
64
- dotenv (1.0.2)
65
- dotenv-rails (1.0.2)
66
- dotenv (= 1.0.2)
64
+ dotenv (2.0.1)
65
+ dotenv-rails (2.0.1)
66
+ dotenv (= 2.0.1)
67
67
  eventmachine (1.0.7)
68
- execjs (2.3.0)
68
+ execjs (2.5.2)
69
69
  faraday (0.9.1)
70
70
  multipart-post (>= 1.2, < 3)
71
71
  git (1.2.9.1)
@@ -78,11 +78,11 @@ GEM
78
78
  hike (1.2.3)
79
79
  hitimes (1.2.2)
80
80
  i18n (0.7.0)
81
- json (1.8.2)
81
+ json (1.8.3)
82
82
  kgio (2.9.3)
83
83
  method_source (0.8.2)
84
84
  minitest (4.7.5)
85
- multi_json (1.10.1)
85
+ multi_json (1.11.2)
86
86
  multipart-post (2.0.0)
87
87
  nio4r (1.1.0)
88
88
  octokit (3.8.0)
@@ -96,25 +96,29 @@ GEM
96
96
  rack
97
97
  rack-test (0.6.3)
98
98
  rack (>= 1.0)
99
+ rainbows (4.6.2)
100
+ kgio (~> 2.5)
101
+ rack (~> 1.1)
102
+ unicorn (~> 4.8)
99
103
  raindrops (0.13.0)
100
104
  rdiscount (2.1.8)
101
105
  redis (3.2.1)
102
- redis-namespace (1.5.1)
106
+ redis-namespace (1.5.2)
103
107
  redis (~> 3.0, >= 3.0.4)
104
- sass (3.4.12)
108
+ sass (3.4.16)
105
109
  sawyer (0.6.0)
106
110
  addressable (~> 2.3.5)
107
111
  faraday (~> 0.8, < 0.10)
108
- sidekiq (3.3.2)
109
- celluloid (>= 0.16.0)
110
- connection_pool (>= 2.1.1)
111
- json
112
- redis (>= 3.0.6)
113
- redis-namespace (>= 1.3.1)
114
- sinatra (1.4.5)
112
+ sidekiq (3.4.2)
113
+ celluloid (~> 0.16.0)
114
+ connection_pool (~> 2.2, >= 2.2.0)
115
+ json (~> 1.0)
116
+ redis (~> 3.2, >= 3.2.1)
117
+ redis-namespace (~> 1.5, >= 1.5.2)
118
+ sinatra (1.4.6)
115
119
  rack (~> 1.4)
116
120
  rack-protection (~> 1.4)
117
- tilt (~> 1.3, >= 1.3.4)
121
+ tilt (>= 1.3, < 3)
118
122
  sinatra-activerecord (2.0.5)
119
123
  activerecord (>= 3.2)
120
124
  sinatra (~> 1.0)
@@ -137,7 +141,7 @@ GEM
137
141
  eventmachine (~> 1.0)
138
142
  rack (~> 1.0)
139
143
  thor (0.19.1)
140
- thread_safe (0.3.4)
144
+ thread_safe (0.3.5)
141
145
  tilt (1.4.1)
142
146
  timers (4.0.1)
143
147
  hitimes
@@ -161,4 +165,7 @@ PLATFORMS
161
165
  DEPENDENCIES
162
166
  perkins!
163
167
  pry
164
- unicorn
168
+ rainbows
169
+
170
+ BUNDLED WITH
171
+ 1.10.5
data/examples/Procfile CHANGED
@@ -1,4 +1,5 @@
1
1
  #unicorn: unicorn -c unicorn.rb
2
- web: rackup config.ru
2
+ rainbows: rainbows -c rainbows.rb
3
+ #web: rackup config.ru
3
4
  #web: thin --servers 3 -R config.ru start
4
5
  workers: bundle exec sidekiq -r ./boot.rb -C ./sidekiq.yml
data/examples/config.ru CHANGED
@@ -3,6 +3,8 @@ require "./boot"
3
3
 
4
4
  require 'sidekiq/web'
5
5
 
6
+ require 'rack/protection'
7
+
6
8
  #\ -o 0.0.0.0 -w -p 3000
7
9
 
8
10
  #worker_processes 3
@@ -14,6 +16,10 @@ map '/' do
14
16
  end
15
17
 
16
18
  map '/sidekiq' do
19
+ use Rack::Session::Pool, :key => 'session_id'
20
+ use Rack::Protection
21
+ use Rack::Protection::AuthenticityToken
22
+
17
23
  use Rack::Auth::Basic, "Protected Area" do |username, password|
18
24
  username == 'sidekiq' && password == 'sidekiq'
19
25
  end
@@ -0,0 +1,5 @@
1
+ worker_processes 4 # assuming four CPU cores
2
+ Rainbows! do
3
+ use :FiberSpawn
4
+ worker_connections 100
5
+ end
data/examples/rakefile ADDED
@@ -0,0 +1,4 @@
1
+ desc "Open an irb session preloaded with this library"
2
+ task :console do
3
+ sh "irb -rubygems -I lib -r ./boot.rb"
4
+ end
@@ -9,12 +9,13 @@ module Perkins
9
9
  end
10
10
 
11
11
  def initialize(opts={})
12
- host = opts[:host] unless opts[:host].blank?
13
- post = opts[:port] unless opts[:port].blank?
14
- github_client_id = opts[:github_client_id] unless opts[:github_client_id].blank?
15
- github_client_server = opts[:github_client_secret] unless opts[:github_client_secret].blank?
12
+ @host = opts[:host] unless opts[:host].blank?
13
+ @post = opts[:port] unless opts[:port].blank?
14
+ @github_client_id = opts[:github_client_id] unless opts[:github_client_id].blank?
15
+ @github_client_server = opts[:github_client_secret] unless opts[:github_client_secret].blank?
16
16
  working_dir = opts[:working_dir] unless opts[:working_dir].blank?
17
17
  self.class.instance = self
18
+ self.init_github_client
18
19
  self
19
20
  end
20
21
 
@@ -28,6 +29,19 @@ module Perkins
28
29
  @db
29
30
  end
30
31
 
32
+ def init_github_client
33
+ #$github_client = Octokit::Client.new \
34
+ # :client_id => @github_client_id,
35
+ # :client_secret => @github_client_server
36
+
37
+ #GLOBAL SERVER 2 SERVER GITHUB CLIENT
38
+ $github_client ||= Octokit::Client.new(
39
+ login: ENV['LOGIN'],
40
+ access_token: ENV['ACCESS_TOKEN']
41
+ )
42
+
43
+ end
44
+
31
45
  def redis=(opts={})
32
46
  namespace = opts.delete(:namespace) || :perkins
33
47
  redis_connection = Redis.new(opts)
@@ -5,7 +5,7 @@ Perkins.Helpers.gravatar_url = (email, size) ->
5
5
  "http://gravatar.com/avatar/#{gravatar_id}.png?s=#{size}"
6
6
 
7
7
  Perkins.Helpers.commit_url = (repo, sha) ->
8
- "#{repo.http_url}/commit/#{sha}"
8
+ "#{repo.repo.http_url}/commit/#{sha}"
9
9
 
10
10
  Perkins.Helpers.status_label = (status)->
11
11
  label = if status == true then "success" else "default"
@@ -7,6 +7,11 @@ module Perkins
7
7
  @commit ||= Perkins::Commit.new(self.sha, self.repo)
8
8
  end
9
9
 
10
+ def send_github_status(sha)
11
+ self.repo.git
12
+ self.build_status_report(sha)
13
+ end
14
+
10
15
  def as_json(options = {})
11
16
  data = {}
12
17
 
@@ -20,5 +25,33 @@ module Perkins
20
25
  data
21
26
  end
22
27
 
28
+
29
+
30
+ # Status report to GITHUB repo
31
+
32
+ def build_status_report(sha)
33
+ $github_client.create_status(
34
+ self.repo.name, sha,
35
+ github_state,
36
+ { context: "Perkins CI",
37
+ description: github_state_description ,
38
+ target_url: github_state_url
39
+ }
40
+ )
41
+ end
42
+
43
+ def github_state
44
+ self.status ? "success" : "failure"
45
+ end
46
+
47
+ def github_state_description
48
+ d = "- The Perkins CI build"
49
+ d = self.status ? "passed" : "fail"
50
+ end
51
+
52
+ def github_state_url
53
+ "#{Perkins::Application.instance.sse_endpoint}/repos/#{repo.name}/builds/#{self.id}"
54
+ end
55
+
23
56
  end
24
57
  end
@@ -21,6 +21,8 @@ module Perkins
21
21
  repo.runner.run(sha)
22
22
 
23
23
  report = repo.build_reports.find_by(sha: sha)
24
+ report.send_github_status(sha)
25
+
24
26
  send_sse({repo: {id: repo.id, name: repo.name , status: "stop", report: report } })
25
27
  end
26
28
 
data/lib/perkins/repo.rb CHANGED
@@ -154,6 +154,8 @@ module Perkins
154
154
  build_reports.last.id if build_reports.any?
155
155
  end
156
156
 
157
+
158
+
157
159
  end
158
160
 
159
161
  end
@@ -1,3 +1,3 @@
1
1
  module Perkins
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perkins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - miguel michelson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-13 00:00:00.000000000 Z
11
+ date: 2015-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -434,6 +434,8 @@ files:
434
434
  - examples/boot.rb
435
435
  - examples/config.ru
436
436
  - examples/database.yml
437
+ - examples/rainbows.rb
438
+ - examples/rakefile
437
439
  - examples/sidekiq.yml
438
440
  - lib/core_ext/hash/compact.rb
439
441
  - lib/core_ext/hash/deep_merge.rb
@@ -575,7 +577,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
575
577
  version: '0'
576
578
  requirements: []
577
579
  rubyforge_project:
578
- rubygems_version: 2.4.6
580
+ rubygems_version: 2.4.8
579
581
  signing_key:
580
582
  specification_version: 4
581
583
  summary: A travis compatible standalone CI solution for ruby