perkins 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/Gemfile +1 -0
  4. data/README.md +11 -8
  5. data/Rakefile +1 -18
  6. data/config/database.yml +19 -0
  7. data/db/migrate/20150130143050_create_builds.rb +1 -1
  8. data/db/migrate/20150220143051_add_build_status_to_build_reports.rb +10 -0
  9. data/db/migrate/20150220143053_add_commit_to_build_reports.rb +10 -0
  10. data/db/migrate/20150220143054_add_hook_id_to_repo.rb +10 -0
  11. data/db/schema.rb +4 -2
  12. data/examples/Capfile +17 -0
  13. data/examples/Gemfile +14 -1
  14. data/examples/Gemfile.lock +45 -19
  15. data/examples/Procfile +8 -3
  16. data/examples/README.md +12 -0
  17. data/examples/boot.rb +5 -4
  18. data/examples/config.ru +2 -11
  19. data/examples/{database.yml → config/database.example.yml} +0 -0
  20. data/examples/config/database.yml +27 -0
  21. data/examples/config/deploy.rb +78 -0
  22. data/examples/config/deploy/staging.rb +61 -0
  23. data/examples/{rainbows.rb → config/rainbows/development.rb} +1 -1
  24. data/examples/config/rainbows/production.rb +56 -0
  25. data/examples/{sidekiq.yml → config/sidekiq.yml} +0 -0
  26. data/examples/db/schema.rb +43 -0
  27. data/examples/rakefile +8 -0
  28. data/lib/perkins/application.rb +1 -1
  29. data/lib/perkins/assets.rb +3 -3
  30. data/lib/perkins/assets/javascripts/app.js +1 -0
  31. data/lib/perkins/assets/javascripts/perkings.js.coffee +14 -9
  32. data/lib/perkins/assets/javascripts/perkins/helpers.js.coffee +2 -2
  33. data/lib/perkins/assets/javascripts/perkins/m/models.js.coffee +15 -9
  34. data/lib/perkins/assets/javascripts/perkins/router.js.coffee +1 -0
  35. data/lib/perkins/assets/javascripts/perkins/v/my_repos.js.coffee +1 -1
  36. data/lib/perkins/assets/javascripts/perkins/v/orgs.js.coffee +1 -1
  37. data/lib/perkins/assets/javascripts/perkins/v/repo.js.coffee +38 -5
  38. data/lib/perkins/assets/javascripts/templates/repo.hamlc +5 -14
  39. data/lib/perkins/assets/javascripts/templates/repos/build_row.hamlc +10 -5
  40. data/lib/perkins/assets/javascripts/templates/repos/config.hamlc +23 -13
  41. data/lib/perkins/assets/javascripts/templates/repos/report_detail.hamlc +6 -6
  42. data/lib/perkins/assets/javascripts/vendor/eventsource.polyfill.js +512 -0
  43. data/lib/perkins/build/script.rb +2 -1
  44. data/lib/perkins/build/script/go.rb +1 -1
  45. data/lib/perkins/build/script/ruby.rb +1 -1
  46. data/lib/perkins/build/script/stages.rb +0 -1
  47. data/lib/perkins/build_report.rb +27 -7
  48. data/lib/perkins/build_worker.rb +10 -15
  49. data/lib/perkins/git_loader_worker.rb +1 -14
  50. data/lib/perkins/repo.rb +106 -21
  51. data/lib/perkins/runner.rb +57 -12
  52. data/lib/perkins/server.rb +42 -46
  53. data/lib/perkins/socket_server.rb +38 -0
  54. data/lib/perkins/version.rb +1 -1
  55. data/lib/tasks/db_tasks.rake +35 -0
  56. data/perkins.gemspec +16 -19
  57. data/spec/README.md +3 -0
  58. data/spec/lib/build/build_spec.rb +7 -3
  59. data/spec/lib/repo_spec.rb +23 -32
  60. data/spec/lib/runner_spec.rb +52 -2
  61. data/spec/lib/server_spec.rb +15 -6
  62. data/spec/spec_helper.rb +6 -5
  63. metadata +21 -57
  64. data/.DS_Store +0 -0
  65. data/lib/perkins/views/builds.haml +0 -43
  66. data/lib/perkins/views/menu.haml +0 -18
  67. data/lib/perkins/views/orgs.haml +0 -101
  68. data/lib/perkins/views/profile.haml +0 -31
  69. data/lib/perkins/views/repos/config.haml +0 -72
  70. data/lib/perkins/views/repos/github.haml +0 -45
  71. data/lib/perkins/views/repos/menu.haml +0 -17
  72. data/lib/perkins/views/repos/repo.haml +0 -64
  73. data/lib/perkins/views/repos/spinner.haml +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45570213f70cf7ea0b87581baced671d022d2bb4
4
- data.tar.gz: 974641b152db25e612ef63370f9f3e450c4e0b4e
3
+ metadata.gz: 3defe620fc8bbdd1b502a414e375ab91cf375117
4
+ data.tar.gz: 099aa7dd415787d693322cbd62a37a965b07529a
5
5
  SHA512:
6
- metadata.gz: f72e7ec3b748f44f04ff3419775f8695e456a54fc0ccb3b9552a5ef96af4c14d085e0821e2ef88ce5ecd5dce9f003560b2953031310ff07e76f2a0b9fec331a7
7
- data.tar.gz: d94c351caebcb5796a210ea2ac4af9ba808bc771e0c351a2f588aaa81a67eea95916ef719aaf464688ab0e208a3176d5cc2729135f0d1677656199eec5bb221e
6
+ metadata.gz: d090dd6071032b320f57a99b464edf7f9d75e4cc05d6b72aa7bca7614c5555cb856c0e8c1eec36f363e7e49d3d39d72ad8cf65cdd2432c0681c4ea1a7b729291
7
+ data.tar.gz: a2729c698076e98fbb0a019cdea72b14383bd9e5d5f8a4b381153550d344d4fcbfae40ee99b82b8cf2b9a0a6a07cfa504d8c12432357a3905c0b01c9ebc65239
data/.gitignore CHANGED
@@ -16,6 +16,7 @@ mkmf.log
16
16
  /examples/.env
17
17
  /examples/tmp
18
18
  /examples/log
19
+ /examples/db/*.sqlite3
19
20
 
20
21
  /db/*.sqlite3
21
22
  /db/*.sqlite3-journal
@@ -23,3 +24,5 @@ mkmf.log
23
24
 
24
25
  Vagrantfile
25
26
  chef
27
+
28
+ examples/config/deploy/production.rb
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem "pry"
7
+ gem "mysql2"
7
8
 
8
9
  group :test do
9
10
  gem "rspec"
data/README.md CHANGED
@@ -1,16 +1,16 @@
1
1
  # Perkins
2
2
 
3
- ### A travis compatible standalone CI solution for ruby
3
+ ### A travis compatible minimal CI solution built in ruby
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
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
8
 
9
- Said that, big kudos to Travis team for developing such an art piece and save us months of work to develop those components
9
+ Said that, big kudos to Travis team for open sourcing those components and save us months of work.
10
10
 
11
11
  ## Why not use Travis open source app ?
12
12
 
13
- Travis code is undoubtedly a piece of art, but at the same time is a complex application, made of several components, at least 8, with a service-oriented architecture. That's great! but for a small team like mine we can't afford manage as many applications for a single task, so we prefer to use a monolithic, lightweight solution to run our specs, in a Travis compatible way, yay!
13
+ Travis code is undoubtedly a piece of art, but at the same time is a complex application, made of several components, at least 8, with a service-oriented architecture. That's great! but for personal use or for a small teams it's difficult to manage many applications for a single task, so we prefer to use a monolithic, lightweight solution to run our specs, in a Travis compatible way, yay!
14
14
 
15
15
  ### Status:
16
16
 
@@ -19,8 +19,10 @@ Perkins is at experimental fase, use at your own risk.
19
19
  ## Features:
20
20
 
21
21
  + Github webhook receiver.
22
+ + Github status sender from builds.
22
23
  + Github repo selector from user & organizations.
23
24
  + .travis.yml detection.
25
+ + Concurrent builds.
24
26
  + Build support for ruby (supports bundler and rvm or chruby).
25
27
  + Build support for Go.
26
28
  + Addition of more languages should be trivial thanks to travis-build.
@@ -43,14 +45,15 @@ or
43
45
  configuration file for perkins to run.
44
46
 
45
47
  ```ruby
46
- Perkins.application() do |app|
47
-
48
+ Perkins.application do |app|
48
49
  config do |c|
49
- c.redis = {host: "localhost"}
50
- c.github_client_id = ENV['GITHUB_CLIENT_ID']
50
+ c.sse_endpoint = ENV['ENDPOINT']
51
+ c.port = ENV['PORT']
52
+ c.redis = {host: "localhost"}
53
+ c.database = File.expand_path("../path/to/database.yml", __FILE__)
54
+ c.github_client_id = ENV['GITHUB_CLIENT_ID']
51
55
  c.github_client_secret = ENV['GITHUB_SECRET']
52
56
  end
53
-
54
57
  end
55
58
  ```
56
59
 
data/Rakefile CHANGED
@@ -1,29 +1,12 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
+ import "./lib/tasks/db_tasks.rake"
3
4
  require 'rspec/core/rake_task'
4
5
 
5
- require "sinatra/activerecord/rake"
6
-
7
- require "pry"
8
-
9
- require "perkins"
10
-
11
- desc 'Default: run unit specs.'
12
- task :default => :spec
13
-
14
6
  desc 'Test perkins.'
15
7
  RSpec::Core::RakeTask.new('spec') do |t|
16
8
  t.pattern = FileList['spec/**/*_spec.rb']
17
9
  end
18
10
 
19
- #USAGE: bundle exec rake db:migrate PERKINS_CONFIG=./examples/boot RACK_ENV=test --trace
20
- namespace :db do
21
- task :load_config do
22
- ENV['RACK_ENV'] = ENV['RACK_ENV'].present? ? ENV['RACK_ENV'] : "development"
23
- config_file = ENV["PERKINS_CONFIG"]
24
- require config_file
25
- #app = eval(File.open(config_file).read)
26
- end
27
- end
28
11
 
29
12
 
@@ -0,0 +1,19 @@
1
+ development:
2
+
3
+ adapter: mysql2
4
+ database: perkins_development
5
+ username: root
6
+ password:
7
+ host: localhost
8
+ pool: 22
9
+
10
+ #adapter: sqlite3
11
+ #database: ./db/development2.sqlite3 #point to perkins gem database
12
+ #pool: 25
13
+ #timeout: 5000
14
+
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
@@ -5,7 +5,7 @@ class CreateBuilds < ActiveRecord::Migration
5
5
  t.column :branch, :string
6
6
  t.column :build_time, :string
7
7
  t.column :duration, :string
8
- t.column :response, :string
8
+ t.column :response, :text
9
9
  t.column :status, :boolean
10
10
  t.column :repo_id, :integer
11
11
  end
@@ -0,0 +1,10 @@
1
+ class AddBuildStatusToBuildReports < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :build_reports , :build_status, :string
4
+ end
5
+
6
+ def self.down
7
+ remove_column :build_reports, :build_status
8
+ end
9
+
10
+ end
@@ -0,0 +1,10 @@
1
+ class AddCommitToBuildReports < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :build_reports , :commit, :text
4
+ end
5
+
6
+ def self.down
7
+ remove_column :build_reports, :commit
8
+ end
9
+
10
+ end
@@ -0,0 +1,10 @@
1
+ class AddHookIdToRepo < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :repos , :hook_id, :integer
4
+ end
5
+
6
+ def self.down
7
+ remove_column :repos, :hook_id
8
+ end
9
+
10
+ end
@@ -11,16 +11,18 @@
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: 20150220143050) do
14
+ ActiveRecord::Schema.define(version: 20150220143053) do
15
15
 
16
16
  create_table "build_reports", force: true do |t|
17
17
  t.string "sha"
18
18
  t.string "branch"
19
19
  t.string "build_time"
20
20
  t.string "duration"
21
- t.string "response"
21
+ t.text "response"
22
22
  t.boolean "status"
23
23
  t.integer "repo_id"
24
+ t.string "build_status"
25
+ t.text "commit"
24
26
  end
25
27
 
26
28
  create_table "repos", force: true do |t|
@@ -0,0 +1,17 @@
1
+ # Load DSL and set up stages
2
+ require 'capistrano/setup'
3
+
4
+ # Include default deployment tasks
5
+ require 'capistrano/deploy'
6
+
7
+ # https://github.com/capistrano/rvm
8
+ require 'capistrano/rvm'
9
+ require 'capistrano/bundler'
10
+ require 'capistrano3/rainbows'
11
+ require 'capistrano/sidekiq'
12
+ # require 'capistrano/rails/assets'
13
+ # require 'capistrano/rails/migrations'
14
+ # require 'capistrano/passenger'
15
+
16
+ # Load custom tasks from `lib/capistrano/tasks` if you have any defined
17
+ Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
@@ -1,4 +1,17 @@
1
1
  source 'https://rubygems.org'
2
2
  gem "pry"
3
3
  gem "rainbows"
4
- gem "perkins", path: "../"
4
+ gem "rake"
5
+ gem "mysql2"
6
+ gem "perkins" #, path: "../" #development
7
+
8
+ #gem "perkins", path: "../" #development
9
+ #gem "perkins", github: "michelson/perkins"
10
+
11
+ group :development do
12
+ #gem 'capistrano3-rainbows'
13
+ gem "capistrano3-rainbows", github: "tiagoamaro/capistrano3-rainbows"
14
+ gem "capistrano-sidekiq"
15
+ gem 'capistrano-rvm'
16
+ gem 'capistrano-bundler'
17
+ end
@@ -1,11 +1,16 @@
1
+ GIT
2
+ remote: git://github.com/tiagoamaro/capistrano3-rainbows.git
3
+ revision: c7d6e89eed6081b7a9bfb1a863280005e1e175b1
4
+ specs:
5
+ capistrano3-rainbows (0.2.1)
6
+ capistrano (~> 3.1, >= 3.1.0)
7
+
1
8
  PATH
2
9
  remote: ../
3
10
  specs:
4
- perkins (0.0.2)
11
+ perkins (0.0.4)
5
12
  activerecord (>= 3, < 4.1)
6
13
  activesupport (>= 3, < 4.1)
7
- celluloid
8
- celluloid-io
9
14
  coffee-script
10
15
  dotenv-rails
11
16
  git
@@ -17,7 +22,6 @@ PATH
17
22
  sass
18
23
  sidekiq
19
24
  sinatra
20
- sinatra-activerecord
21
25
  sinatra-contrib
22
26
  sprockets
23
27
  sqlite3
@@ -38,7 +42,7 @@ GEM
38
42
  activerecord-deprecated_finders (~> 1.0.2)
39
43
  activesupport (= 4.0.13)
40
44
  arel (~> 4.0.0)
41
- activerecord-deprecated_finders (1.0.3)
45
+ activerecord-deprecated_finders (1.0.4)
42
46
  activesupport (4.0.13)
43
47
  i18n (~> 0.6, >= 0.6.9)
44
48
  minitest (~> 4.2)
@@ -47,20 +51,31 @@ GEM
47
51
  tzinfo (~> 0.3.37)
48
52
  addressable (2.3.8)
49
53
  arel (4.0.2)
50
- backports (3.6.4)
54
+ backports (3.6.5)
51
55
  builder (3.1.4)
56
+ capistrano (3.4.0)
57
+ i18n
58
+ rake (>= 10.0.0)
59
+ sshkit (~> 1.3)
60
+ capistrano-bundler (1.1.4)
61
+ capistrano (~> 3.1)
62
+ sshkit (~> 1.2)
63
+ capistrano-rvm (0.1.2)
64
+ capistrano (~> 3.0)
65
+ sshkit (~> 1.2)
66
+ capistrano-sidekiq (0.5.3)
67
+ capistrano
68
+ sidekiq
52
69
  celluloid (0.16.0)
53
70
  timers (~> 4.0.0)
54
- celluloid-io (0.16.2)
55
- celluloid (>= 0.16.0)
56
- nio4r (>= 1.1.0)
57
71
  coderay (1.1.0)
58
72
  coffee-script (2.4.1)
59
73
  coffee-script-source
60
74
  execjs
61
75
  coffee-script-source (1.9.1.1)
76
+ colorize (0.7.7)
62
77
  connection_pool (2.2.0)
63
- daemons (1.1.9)
78
+ daemons (1.2.3)
64
79
  dotenv (2.0.1)
65
80
  dotenv-rails (2.0.1)
66
81
  dotenv (= 2.0.1)
@@ -84,8 +99,11 @@ GEM
84
99
  minitest (4.7.5)
85
100
  multi_json (1.11.2)
86
101
  multipart-post (2.0.0)
87
- nio4r (1.1.0)
88
- octokit (3.8.0)
102
+ mysql2 (0.3.18)
103
+ net-scp (1.2.1)
104
+ net-ssh (>= 2.6.5)
105
+ net-ssh (2.9.2)
106
+ octokit (4.0.1)
89
107
  sawyer (~> 0.6.0, >= 0.5.3)
90
108
  pry (0.10.1)
91
109
  coderay (~> 1.1.0)
@@ -101,6 +119,7 @@ GEM
101
119
  rack (~> 1.1)
102
120
  unicorn (~> 4.8)
103
121
  raindrops (0.13.0)
122
+ rake (10.4.2)
104
123
  rdiscount (2.1.8)
105
124
  redis (3.2.1)
106
125
  redis-namespace (1.5.2)
@@ -119,23 +138,24 @@ GEM
119
138
  rack (~> 1.4)
120
139
  rack-protection (~> 1.4)
121
140
  tilt (>= 1.3, < 3)
122
- sinatra-activerecord (2.0.5)
123
- activerecord (>= 3.2)
124
- sinatra (~> 1.0)
125
- sinatra-contrib (1.4.2)
141
+ sinatra-contrib (1.4.6)
126
142
  backports (>= 2.0)
127
143
  multi_json
128
144
  rack-protection
129
145
  rack-test
130
146
  sinatra (~> 1.4.0)
131
- tilt (~> 1.3)
147
+ tilt (>= 1.3, < 3)
132
148
  slop (3.6.0)
133
- sprockets (2.12.3)
149
+ sprockets (2.12.4)
134
150
  hike (~> 1.2)
135
151
  multi_json (~> 1.0)
136
152
  rack (~> 1.0)
137
153
  tilt (~> 1.1, != 1.3.0)
138
154
  sqlite3 (1.3.10)
155
+ sshkit (1.7.1)
156
+ colorize (>= 0.7.0)
157
+ net-scp (>= 1.1.2)
158
+ net-ssh (>= 2.8.0)
139
159
  thin (1.6.3)
140
160
  daemons (~> 1.0, >= 1.0.9)
141
161
  eventmachine (~> 1.0)
@@ -146,7 +166,7 @@ GEM
146
166
  timers (4.0.1)
147
167
  hitimes
148
168
  travis-yaml (0.2.0)
149
- tzinfo (0.3.43)
169
+ tzinfo (0.3.44)
150
170
  unicorn (4.8.3)
151
171
  kgio (~> 2.6)
152
172
  rack
@@ -163,9 +183,15 @@ PLATFORMS
163
183
  ruby
164
184
 
165
185
  DEPENDENCIES
186
+ capistrano-bundler
187
+ capistrano-rvm
188
+ capistrano-sidekiq
189
+ capistrano3-rainbows!
190
+ mysql2
166
191
  perkins!
167
192
  pry
168
193
  rainbows
194
+ rake
169
195
 
170
196
  BUNDLED WITH
171
197
  1.10.5
@@ -1,5 +1,10 @@
1
+
2
+
3
+ rainbows: bundle exec rainbows -c config/rainbows/development.rb -p $PORT -E $RACK_ENV
4
+
5
+ workers: bundle exec sidekiq -r ./boot.rb -C ./config/sidekiq.yml -e $RACK_ENV
6
+
7
+
1
8
  #unicorn: unicorn -c unicorn.rb
2
- rainbows: rainbows -c rainbows.rb
3
9
  #web: rackup config.ru
4
- #web: thin --servers 3 -R config.ru start
5
- workers: bundle exec sidekiq -r ./boot.rb -C ./sidekiq.yml
10
+ #web: thin --servers 3 -R config.ru start
@@ -0,0 +1,12 @@
1
+ ## install
2
+
3
+ - bundle install
4
+
5
+ - bundle exec rake db:migrate PERKINS_CONFIG=./boot RACK_ENV=development
6
+
7
+
8
+ ## deploy
9
+
10
+ cap production deploy
11
+
12
+ see config/deploy & Capfile
@@ -6,10 +6,11 @@ require "perkins"
6
6
 
7
7
  Perkins.application do |app|
8
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']
9
+ c.sse_endpoint = ENV['ENDPOINT']
10
+ c.port = ENV['PORT']
11
+ c.redis = {host: "localhost"}
12
+ c.database = File.expand_path("../config/database.yml", __FILE__)
13
+ c.github_client_id = ENV['GITHUB_CLIENT_ID']
13
14
  c.github_client_secret = ENV['GITHUB_SECRET']
14
15
  end
15
16
  end
@@ -1,18 +1,9 @@
1
-
2
- require "./boot"
3
-
4
1
  require 'sidekiq/web'
5
-
6
2
  require 'rack/protection'
7
-
8
- #\ -o 0.0.0.0 -w -p 3000
9
-
10
- #worker_processes 3
11
-
12
- options = {port: 3000, host: "0.0.0.0", e: :development}
3
+ require "./boot"
13
4
 
14
5
  map '/' do
15
- run ::Perkins::Server.new(options)
6
+ run ::Perkins::Server.new
16
7
  end
17
8
 
18
9
  map '/sidekiq' do