perkins 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +5 -0
- data/.ruby-version +1 -0
- data/.vagrant/machines/default/virtualbox/action_provision +1 -0
- data/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/.vagrant/machines/default/virtualbox/id +1 -0
- data/Gemfile +0 -1
- data/README.md +11 -4
- data/Rakefile +3 -2
- data/TODO.md +2 -2
- data/Vagrantfile +53 -0
- data/db/migrate/20150220143050_add_status_fields_to_repos.rb +11 -0
- data/db/schema.rb +3 -1
- data/examples/Gemfile +4 -0
- data/examples/Gemfile.lock +164 -0
- data/examples/Procfile +4 -0
- data/examples/boot.rb +15 -0
- data/examples/config.ru +22 -0
- data/examples/database.yml +2 -2
- data/examples/sidekiq.yml +9 -0
- data/lib/core_ext/string/color.rb +22 -0
- data/lib/perkins/application.rb +27 -3
- data/lib/perkins/assets/images/error.gif +0 -0
- data/lib/perkins/assets/images/working.gif +0 -0
- data/lib/perkins/assets/javascripts/app.js +17 -1
- data/lib/perkins/assets/javascripts/config.js.coffee +14 -0
- data/lib/perkins/assets/javascripts/log_view.js.coffee +1 -2
- data/lib/perkins/assets/javascripts/perkings.js.coffee +129 -20
- data/lib/perkins/assets/javascripts/perkins/helpers.js.coffee +21 -0
- data/lib/perkins/assets/javascripts/perkins/m/models.js.coffee +50 -0
- data/lib/perkins/assets/javascripts/perkins/router.js.coffee +10 -0
- data/lib/perkins/assets/javascripts/perkins/v/dashboard.js.coffee +17 -0
- data/lib/perkins/assets/javascripts/perkins/v/err.js.coffee +12 -0
- data/lib/perkins/assets/javascripts/perkins/v/menu.js.coffee +10 -0
- data/lib/perkins/assets/javascripts/perkins/v/my_repos.js.coffee +41 -0
- data/lib/perkins/assets/javascripts/perkins/v/orgs.js.coffee +39 -0
- data/lib/perkins/assets/javascripts/perkins/v/profile.js.coffee +20 -0
- data/lib/perkins/assets/javascripts/perkins/v/repo.js.coffee +192 -0
- data/lib/perkins/assets/javascripts/perkins/v/sidebar.js.coffee +33 -0
- data/lib/perkins/assets/javascripts/templates/dashboard.hamlc +11 -0
- data/lib/perkins/assets/javascripts/templates/error.hamlc +22 -0
- data/lib/perkins/assets/javascripts/templates/menu.hamlc +18 -0
- data/lib/perkins/assets/javascripts/templates/org.hamlc +77 -0
- data/lib/perkins/assets/javascripts/templates/profile.hamlc +28 -0
- data/lib/perkins/assets/javascripts/templates/repo.hamlc +37 -0
- data/lib/perkins/assets/javascripts/templates/repos/build_row.hamlc +19 -0
- data/lib/perkins/assets/javascripts/templates/repos/builds.hamlc +25 -0
- data/lib/perkins/assets/javascripts/templates/repos/config.hamlc +77 -0
- data/lib/perkins/assets/javascripts/templates/repos/gb_repo.hamlc +31 -0
- data/lib/perkins/assets/javascripts/templates/repos/github.hamlc +7 -0
- data/lib/perkins/assets/javascripts/templates/repos/menu.hamlc +17 -0
- data/lib/perkins/assets/javascripts/templates/repos/report_detail.hamlc +53 -0
- data/lib/perkins/assets/javascripts/templates/sidebar.hamlc +14 -0
- data/lib/perkins/assets/javascripts/templates/sidebar_repo.hamlc +4 -0
- data/lib/perkins/assets/javascripts/vendor/backbone-min.js +2 -0
- data/lib/perkins/assets/javascripts/vendor/backbone.marionette.js +2891 -0
- data/lib/perkins/assets/javascripts/vendor/hamlcoffee.js.coffee.erb +138 -0
- data/lib/perkins/assets/javascripts/vendor/livequery.jquery.js +8 -0
- data/lib/perkins/assets/javascripts/vendor/log.js +1 -1
- data/lib/perkins/assets/javascripts/vendor/md5.js +207 -0
- data/lib/perkins/assets/javascripts/vendor/nprogress.js +476 -0
- data/lib/perkins/assets/javascripts/vendor/underscore.js +6 -0
- data/lib/perkins/assets/stylesheets/app.css +3 -0
- data/lib/perkins/assets/stylesheets/bootstrap-overrides.css.scss +13 -0
- data/lib/perkins/assets/stylesheets/styles.css.scss +30 -3
- data/lib/perkins/assets/stylesheets/vendor/nprogress.css +74 -0
- data/lib/perkins/assets.rb +42 -0
- data/lib/perkins/build/script/ruby.rb +1 -1
- data/lib/perkins/build_report.rb +13 -0
- data/lib/perkins/{worker.rb → build_worker.rb} +9 -5
- data/lib/perkins/cli.rb +4 -2
- data/lib/perkins/commit.rb +8 -1
- data/lib/perkins/git_loader_worker.rb +29 -0
- data/lib/perkins/repo.rb +23 -9
- data/lib/perkins/runner.rb +16 -25
- data/lib/perkins/server.rb +121 -116
- data/lib/perkins/version.rb +1 -1
- data/lib/perkins/views/builds.haml +0 -3
- data/lib/perkins/views/layout.haml +25 -36
- data/lib/perkins/views/menu.haml +1 -1
- data/lib/perkins/views/repos/github.haml +0 -31
- data/lib/perkins/views/repos/repo.haml +1 -1
- data/lib/perkins.rb +4 -2
- data/perkins.gemspec +5 -2
- data/spec/lib/repo_spec.rb +27 -6
- data/spec/lib/runner_spec.rb +1 -0
- data/spec/lib/server_spec.rb +6 -23
- data/spec/spec_helper.rb +14 -3
- metadata +160 -70
- data/examples/config.rb +0 -12
- data/examples/mongo.yml +0 -13
- data/lib/perkins/listener.rb +0 -38
- data/spec/lib/listener_spec.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e221f76f15d35aed4024e928ad9a110cd1cc35c7
|
4
|
+
data.tar.gz: 8949ff14e44a8830713eb5beaa8f1139cdaf7e05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5972841aac46d31ecde60b81b5a2144d8d3bf95e689db05d32f9e9f871b665219fa3a211f1efdd85941ba76864c0f0f5d8ee5c24e3f137bfa9e1b34ded08940
|
7
|
+
data.tar.gz: e44f197ad2e3f504eb355221af2c6a1b934cef2a31e1b1f5ef4071bca4d63756840e6cb2221afaf14487c3b3429da0aa6c7c08c338b5c63c9cbc359f61732143
|
data/.gitignore
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.0
|
@@ -0,0 +1 @@
|
|
1
|
+
1.5:0278f96b-581b-4d5c-8d27-3c5753af89a6
|
@@ -0,0 +1 @@
|
|
1
|
+
1424370216
|
@@ -0,0 +1 @@
|
|
1
|
+
0278f96b-581b-4d5c-8d27-3c5753af89a6
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
|
5
5
|
Behind the scenes perkins uses a slightly modified version of *travis-build* library and uses *Travis-yaml* gem to parse the .travis.yml files on existing repos. Also it integrates the Log.js library to display the build log the same way Travis does.
|
6
6
|
|
7
|
+
![screen shot 2015-04-14 at 7 02 02 pm](https://cloud.githubusercontent.com/assets/11976/8642513/971455da-28fb-11e5-8b9b-3741aa499655.png)
|
8
|
+
|
7
9
|
Said that, big kudos to Travis team for developing such an art piece and save us months of work to develop those components
|
8
10
|
|
9
11
|
## Why not use Travis open source app ?
|
@@ -17,11 +19,12 @@ Perkins is at experimental fase, use at your own risk.
|
|
17
19
|
## Features:
|
18
20
|
|
19
21
|
+ Github webhook receiver.
|
20
|
-
+ Github user &
|
21
|
-
+ .travis.yml detection
|
22
|
-
+ Build for ruby (supports bundler and rvm or chruby)
|
23
|
-
+ Build for Go.
|
22
|
+
+ Github repo selector from user & organizations.
|
23
|
+
+ .travis.yml detection.
|
24
|
+
+ Build support for ruby (supports bundler and rvm or chruby).
|
25
|
+
+ Build support for Go.
|
24
26
|
+ Addition of more languages should be trivial thanks to travis-build.
|
27
|
+
+ Badge generation through https://img.shields.io/ service.
|
25
28
|
|
26
29
|
## Installation
|
27
30
|
|
@@ -51,6 +54,10 @@ Perkins.application() do |app|
|
|
51
54
|
end
|
52
55
|
```
|
53
56
|
|
57
|
+
## Config oauth app in github
|
58
|
+
|
59
|
+
https://github.com/settings/applications
|
60
|
+
|
54
61
|
## Webhooks
|
55
62
|
|
56
63
|
To set the webhook for a repo you can go to github repo admin or visit a perkins repo on `youapp.com/repos/my/repo/config`
|
data/Rakefile
CHANGED
@@ -16,12 +16,13 @@ RSpec::Core::RakeTask.new('spec') do |t|
|
|
16
16
|
t.pattern = FileList['spec/**/*_spec.rb']
|
17
17
|
end
|
18
18
|
|
19
|
-
#
|
19
|
+
#USAGE: bundle exec rake db:migrate PERKINS_CONFIG=./examples/boot RACK_ENV=test --trace
|
20
20
|
namespace :db do
|
21
21
|
task :load_config do
|
22
22
|
ENV['RACK_ENV'] = ENV['RACK_ENV'].present? ? ENV['RACK_ENV'] : "development"
|
23
23
|
config_file = ENV["PERKINS_CONFIG"]
|
24
|
-
|
24
|
+
require config_file
|
25
|
+
#app = eval(File.open(config_file).read)
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
data/TODO.md
CHANGED
data/Vagrantfile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
VAGRANTFILE_API_VERSION = "2"
|
4
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
5
|
+
config.vm.box = "ubuntu/precise64"
|
6
|
+
config.omnibus.chef_version = :latest
|
7
|
+
|
8
|
+
config.vm.network :private_network, ip: "10.11.12.14"
|
9
|
+
|
10
|
+
#config.vm.network "forwarded_port", guest: 80, host: 9292
|
11
|
+
|
12
|
+
abbr_name = "#{ENV['VNAME'].gsub('dev-', '')}"
|
13
|
+
name = "#{abbr_name}-perkins"
|
14
|
+
|
15
|
+
config.vm.hostname = name
|
16
|
+
|
17
|
+
config.vm.provider "virtualbox" do |v|
|
18
|
+
|
19
|
+
host = RbConfig::CONFIG['host_os']
|
20
|
+
|
21
|
+
# Give VM 1/4 system memory & access to all cpu cores on the host
|
22
|
+
if host =~ /darwin/
|
23
|
+
cpus = `sysctl -n hw.ncpu`.to_i
|
24
|
+
# sysctl returns Bytes and we need to convert to MB
|
25
|
+
mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 4
|
26
|
+
elsif host =~ /linux/
|
27
|
+
cpus = `nproc`.to_i
|
28
|
+
# meminfo shows KB and we need to convert to MB
|
29
|
+
mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 4
|
30
|
+
else # sorry Windows folks, I can't help you
|
31
|
+
cpus = 2
|
32
|
+
mem = 1024
|
33
|
+
end
|
34
|
+
v.customize ["modifyvm", :id, "--ioapic", "on"]
|
35
|
+
v.customize ["modifyvm", :id, "--memory", mem]
|
36
|
+
v.customize ["modifyvm", :id, "--cpus", cpus]
|
37
|
+
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
38
|
+
v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
|
39
|
+
end
|
40
|
+
|
41
|
+
config.vm.synced_folder "./", "/vagrant", :nfs => true
|
42
|
+
|
43
|
+
config.vm.provision "chef_client" do |chef|
|
44
|
+
chef.chef_server_url = "https://chef.preyapp.com"
|
45
|
+
chef.node_name = name
|
46
|
+
chef.validation_key_path = ENV['VPATH']
|
47
|
+
chef.validation_client_name = abbr_name
|
48
|
+
chef.environment = "development"
|
49
|
+
|
50
|
+
# Run list
|
51
|
+
chef.add_role "development"
|
52
|
+
end
|
53
|
+
end
|
data/db/schema.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20150220143050) do
|
15
15
|
|
16
16
|
create_table "build_reports", force: true do |t|
|
17
17
|
t.string "sha"
|
@@ -31,6 +31,8 @@ ActiveRecord::Schema.define(version: 20150130143050) do
|
|
31
31
|
t.integer "gb_id"
|
32
32
|
t.text "github_data"
|
33
33
|
t.boolean "cached"
|
34
|
+
t.string "build_status"
|
35
|
+
t.string "download_status"
|
34
36
|
end
|
35
37
|
|
36
38
|
add_index "repos", ["gb_id"], name: "index_repos_on_gb_id", unique: true
|
data/examples/Gemfile
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../
|
3
|
+
specs:
|
4
|
+
perkins (0.0.1)
|
5
|
+
activerecord (>= 3, < 4.1)
|
6
|
+
activesupport (>= 3, < 4.1)
|
7
|
+
celluloid
|
8
|
+
celluloid-io
|
9
|
+
coffee-script
|
10
|
+
dotenv-rails
|
11
|
+
git
|
12
|
+
haml
|
13
|
+
haml_coffee_assets
|
14
|
+
rdiscount
|
15
|
+
redis
|
16
|
+
redis-namespace
|
17
|
+
sass
|
18
|
+
sidekiq
|
19
|
+
sinatra
|
20
|
+
sinatra-activerecord
|
21
|
+
sinatra-contrib
|
22
|
+
sprockets
|
23
|
+
sqlite3
|
24
|
+
thin
|
25
|
+
thor
|
26
|
+
travis-yaml
|
27
|
+
warden-github (~> 1.0)
|
28
|
+
yui-compressor
|
29
|
+
|
30
|
+
GEM
|
31
|
+
remote: https://rubygems.org/
|
32
|
+
specs:
|
33
|
+
activemodel (4.0.13)
|
34
|
+
activesupport (= 4.0.13)
|
35
|
+
builder (~> 3.1.0)
|
36
|
+
activerecord (4.0.13)
|
37
|
+
activemodel (= 4.0.13)
|
38
|
+
activerecord-deprecated_finders (~> 1.0.2)
|
39
|
+
activesupport (= 4.0.13)
|
40
|
+
arel (~> 4.0.0)
|
41
|
+
activerecord-deprecated_finders (1.0.3)
|
42
|
+
activesupport (4.0.13)
|
43
|
+
i18n (~> 0.6, >= 0.6.9)
|
44
|
+
minitest (~> 4.2)
|
45
|
+
multi_json (~> 1.3)
|
46
|
+
thread_safe (~> 0.1)
|
47
|
+
tzinfo (~> 0.3.37)
|
48
|
+
addressable (2.3.7)
|
49
|
+
arel (4.0.2)
|
50
|
+
backports (3.6.4)
|
51
|
+
builder (3.1.4)
|
52
|
+
celluloid (0.16.0)
|
53
|
+
timers (~> 4.0.0)
|
54
|
+
celluloid-io (0.16.2)
|
55
|
+
celluloid (>= 0.16.0)
|
56
|
+
nio4r (>= 1.1.0)
|
57
|
+
coderay (1.1.0)
|
58
|
+
coffee-script (2.3.0)
|
59
|
+
coffee-script-source
|
60
|
+
execjs
|
61
|
+
coffee-script-source (1.9.1)
|
62
|
+
connection_pool (2.1.1)
|
63
|
+
daemons (1.1.9)
|
64
|
+
dotenv (1.0.2)
|
65
|
+
dotenv-rails (1.0.2)
|
66
|
+
dotenv (= 1.0.2)
|
67
|
+
eventmachine (1.0.7)
|
68
|
+
execjs (2.3.0)
|
69
|
+
faraday (0.9.1)
|
70
|
+
multipart-post (>= 1.2, < 3)
|
71
|
+
git (1.2.9.1)
|
72
|
+
haml (4.0.6)
|
73
|
+
tilt
|
74
|
+
haml_coffee_assets (1.16.0)
|
75
|
+
coffee-script (~> 2.0)
|
76
|
+
sprockets (~> 2.0)
|
77
|
+
tilt (~> 1.1)
|
78
|
+
hike (1.2.3)
|
79
|
+
hitimes (1.2.2)
|
80
|
+
i18n (0.7.0)
|
81
|
+
json (1.8.2)
|
82
|
+
kgio (2.9.3)
|
83
|
+
method_source (0.8.2)
|
84
|
+
minitest (4.7.5)
|
85
|
+
multi_json (1.10.1)
|
86
|
+
multipart-post (2.0.0)
|
87
|
+
nio4r (1.1.0)
|
88
|
+
octokit (3.8.0)
|
89
|
+
sawyer (~> 0.6.0, >= 0.5.3)
|
90
|
+
pry (0.10.1)
|
91
|
+
coderay (~> 1.1.0)
|
92
|
+
method_source (~> 0.8.1)
|
93
|
+
slop (~> 3.4)
|
94
|
+
rack (1.6.0)
|
95
|
+
rack-protection (1.5.3)
|
96
|
+
rack
|
97
|
+
rack-test (0.6.3)
|
98
|
+
rack (>= 1.0)
|
99
|
+
raindrops (0.13.0)
|
100
|
+
rdiscount (2.1.8)
|
101
|
+
redis (3.2.1)
|
102
|
+
redis-namespace (1.5.1)
|
103
|
+
redis (~> 3.0, >= 3.0.4)
|
104
|
+
sass (3.4.12)
|
105
|
+
sawyer (0.6.0)
|
106
|
+
addressable (~> 2.3.5)
|
107
|
+
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)
|
115
|
+
rack (~> 1.4)
|
116
|
+
rack-protection (~> 1.4)
|
117
|
+
tilt (~> 1.3, >= 1.3.4)
|
118
|
+
sinatra-activerecord (2.0.5)
|
119
|
+
activerecord (>= 3.2)
|
120
|
+
sinatra (~> 1.0)
|
121
|
+
sinatra-contrib (1.4.2)
|
122
|
+
backports (>= 2.0)
|
123
|
+
multi_json
|
124
|
+
rack-protection
|
125
|
+
rack-test
|
126
|
+
sinatra (~> 1.4.0)
|
127
|
+
tilt (~> 1.3)
|
128
|
+
slop (3.6.0)
|
129
|
+
sprockets (2.12.3)
|
130
|
+
hike (~> 1.2)
|
131
|
+
multi_json (~> 1.0)
|
132
|
+
rack (~> 1.0)
|
133
|
+
tilt (~> 1.1, != 1.3.0)
|
134
|
+
sqlite3 (1.3.10)
|
135
|
+
thin (1.6.3)
|
136
|
+
daemons (~> 1.0, >= 1.0.9)
|
137
|
+
eventmachine (~> 1.0)
|
138
|
+
rack (~> 1.0)
|
139
|
+
thor (0.19.1)
|
140
|
+
thread_safe (0.3.4)
|
141
|
+
tilt (1.4.1)
|
142
|
+
timers (4.0.1)
|
143
|
+
hitimes
|
144
|
+
travis-yaml (0.2.0)
|
145
|
+
tzinfo (0.3.43)
|
146
|
+
unicorn (4.8.3)
|
147
|
+
kgio (~> 2.6)
|
148
|
+
rack
|
149
|
+
raindrops (~> 0.7)
|
150
|
+
warden (1.2.3)
|
151
|
+
rack (>= 1.0)
|
152
|
+
warden-github (1.2.0)
|
153
|
+
activesupport (> 3.0)
|
154
|
+
octokit (> 2.1.0)
|
155
|
+
warden (> 1.0)
|
156
|
+
yui-compressor (0.12.0)
|
157
|
+
|
158
|
+
PLATFORMS
|
159
|
+
ruby
|
160
|
+
|
161
|
+
DEPENDENCIES
|
162
|
+
perkins!
|
163
|
+
pry
|
164
|
+
unicorn
|
data/examples/Procfile
ADDED
data/examples/boot.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
Bundler.require
|
4
|
+
|
5
|
+
require "perkins"
|
6
|
+
|
7
|
+
Perkins.application do |app|
|
8
|
+
config do |c|
|
9
|
+
c.sse_endpoint = "http://dev.perkins.ci:3000"
|
10
|
+
c.redis = {host: "localhost"}
|
11
|
+
c.database = File.expand_path("../database.yml", __FILE__)
|
12
|
+
c.github_client_id = ENV['GITHUB_CLIENT_ID']
|
13
|
+
c.github_client_secret = ENV['GITHUB_SECRET']
|
14
|
+
end
|
15
|
+
end
|
data/examples/config.ru
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
require "./boot"
|
3
|
+
|
4
|
+
require 'sidekiq/web'
|
5
|
+
|
6
|
+
#\ -o 0.0.0.0 -w -p 3000
|
7
|
+
|
8
|
+
#worker_processes 3
|
9
|
+
|
10
|
+
options = {port: 3000, host: "0.0.0.0", e: :development}
|
11
|
+
|
12
|
+
map '/' do
|
13
|
+
run ::Perkins::Server.new(options)
|
14
|
+
end
|
15
|
+
|
16
|
+
map '/sidekiq' do
|
17
|
+
use Rack::Auth::Basic, "Protected Area" do |username, password|
|
18
|
+
username == 'sidekiq' && password == 'sidekiq'
|
19
|
+
end
|
20
|
+
|
21
|
+
run Sidekiq::Web
|
22
|
+
end
|
data/examples/database.yml
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
class String
|
2
|
+
# colorization
|
3
|
+
def colorize(color_code)
|
4
|
+
"\e[#{color_code}m#{self}\e[0m"
|
5
|
+
end
|
6
|
+
|
7
|
+
def red
|
8
|
+
colorize(31)
|
9
|
+
end
|
10
|
+
|
11
|
+
def green
|
12
|
+
colorize(32)
|
13
|
+
end
|
14
|
+
|
15
|
+
def yellow
|
16
|
+
colorize(33)
|
17
|
+
end
|
18
|
+
|
19
|
+
def pink
|
20
|
+
colorize(35)
|
21
|
+
end
|
22
|
+
end
|
data/lib/perkins/application.rb
CHANGED
@@ -1,20 +1,27 @@
|
|
1
1
|
module Perkins
|
2
2
|
class Application
|
3
|
-
attr_accessor :host , :port, :working_dir, :redis, :database
|
3
|
+
attr_accessor :host , :port, :working_dir, :redis, :database, :sse_endpoint
|
4
4
|
attr_reader :server
|
5
5
|
attr_accessor :github_client_id, :github_client_secret
|
6
6
|
|
7
|
+
class << self
|
8
|
+
attr_accessor :instance
|
9
|
+
end
|
10
|
+
|
7
11
|
def initialize(opts={})
|
8
12
|
host = opts[:host] unless opts[:host].blank?
|
9
13
|
post = opts[:port] unless opts[:port].blank?
|
10
14
|
github_client_id = opts[:github_client_id] unless opts[:github_client_id].blank?
|
11
15
|
github_client_server = opts[:github_client_secret] unless opts[:github_client_secret].blank?
|
12
16
|
working_dir = opts[:working_dir] unless opts[:working_dir].blank?
|
17
|
+
self.class.instance = self
|
18
|
+
self
|
13
19
|
end
|
14
20
|
|
15
21
|
def database=(file)
|
16
|
-
dbconfig = YAML::load(File.open(file))
|
17
|
-
@db = ActiveRecord::Base.establish_connection(dbconfig[ENV['RACK_ENV']])
|
22
|
+
@dbconfig = YAML::load(File.open(file))
|
23
|
+
@db = ActiveRecord::Base.establish_connection(@dbconfig[ENV['RACK_ENV']])
|
24
|
+
setup_sidekiq
|
18
25
|
end
|
19
26
|
|
20
27
|
def database
|
@@ -36,5 +43,22 @@ module Perkins
|
|
36
43
|
data
|
37
44
|
end
|
38
45
|
|
46
|
+
def setup_sidekiq
|
47
|
+
# Sidekiq server is multi-threaded so our Redis connection pool size defaults to concurrency (-c)
|
48
|
+
Sidekiq.configure_server do |config|
|
49
|
+
config.redis = { :namespace => 'perkins-worker' }
|
50
|
+
if defined?(ActiveRecord::Base)
|
51
|
+
#ActiveRecord::Base.establish_connection
|
52
|
+
#Perkins::Application.instance.database
|
53
|
+
ActiveRecord::Base.establish_connection(@dbconfig[ENV['RACK_ENV']])
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
Sidekiq.configure_client do |config|
|
58
|
+
config.redis = { :namespace => 'perkins-worker' }
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
39
63
|
end
|
40
64
|
end
|
Binary file
|
Binary file
|
@@ -1,9 +1,25 @@
|
|
1
1
|
// require_tree
|
2
2
|
|
3
|
+
//= require vendor/md5
|
4
|
+
//= require vendor/livequery.jquery
|
5
|
+
//= require vendor/hamlcoffee
|
3
6
|
//= require vendor/ansiparse
|
4
7
|
//= require vendor/minispade
|
5
8
|
//= require vendor/log
|
6
9
|
//= require log_view
|
7
10
|
//= require vendor/jquery.timeago
|
11
|
+
//= require vendor/underscore
|
12
|
+
//= require vendor/backbone-min
|
13
|
+
//= require vendor/backbone.marionette
|
14
|
+
//= require vendor/nprogress
|
15
|
+
|
16
|
+
//= require config
|
17
|
+
|
18
|
+
//= require "perkins/router"
|
19
|
+
//= require "perkins/helpers"
|
20
|
+
//= require_tree "./templates"
|
21
|
+
//= require_tree "./perkins/m"
|
22
|
+
//= require_tree "./perkins/v"
|
23
|
+
|
24
|
+
//= require perkings
|
8
25
|
|
9
|
-
//= require perkings
|
@@ -9,7 +9,6 @@ class window.LogView
|
|
9
9
|
|
10
10
|
render: ()->
|
11
11
|
parts = @split(@text)
|
12
|
-
|
13
12
|
#@log.set(ix, line)
|
14
13
|
@receive(part[0], part[1]) for part in parts
|
15
14
|
#console.log(@el)
|
@@ -22,7 +21,7 @@ class window.LogView
|
|
22
21
|
string = string.replace(/\r\n/gm, "\n") # it seems split(/^/) would remove the newline, but not the \r here?
|
23
22
|
lines = string.split(/^/m)
|
24
23
|
parts = ([i, line] for line, i in lines)
|
25
|
-
console.log(JSON.stringify(parts))
|
24
|
+
#console.log(JSON.stringify(parts))
|
26
25
|
parts = @slice(parts) if @options.slice
|
27
26
|
parts = @randomize(parts) if @options.randomize
|
28
27
|
# parts = @partition(parts) if @options.partition
|