foca-integrity 0.1.9.1 → 0.1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +12 -0
- data/CHANGES +28 -0
- data/README.markdown +6 -0
- data/Rakefile +44 -83
- data/config/heroku/.gems +0 -3
- data/config/heroku/integrity-config.rb +4 -1
- data/integrity.gemspec +18 -6
- data/lib/integrity.rb +9 -5
- data/lib/integrity/app.rb +8 -8
- data/lib/integrity/build.rb +14 -7
- data/lib/integrity/commit.rb +0 -8
- data/lib/integrity/helpers/authorization.rb +1 -1
- data/lib/integrity/helpers/breadcrumbs.rb +1 -1
- data/lib/integrity/helpers/rendering.rb +8 -2
- data/lib/integrity/helpers/urls.rb +33 -23
- data/lib/integrity/installer.rb +18 -17
- data/lib/integrity/notifier/base.rb +12 -3
- data/lib/integrity/project.rb +6 -6
- data/lib/integrity/project_builder.rb +35 -35
- data/test/acceptance/api_test.rb +1 -1
- data/test/acceptance/browse_project_builds_test.rb +1 -1
- data/test/acceptance/browse_project_test.rb +1 -1
- data/test/acceptance/build_notifications_test.rb +1 -1
- data/test/acceptance/create_project_test.rb +1 -1
- data/test/acceptance/delete_project_test.rb +1 -1
- data/test/acceptance/edit_project_test.rb +1 -1
- data/test/acceptance/error_page_test.rb +1 -1
- data/test/acceptance/installer_test.rb +2 -6
- data/test/acceptance/manual_build_project_test.rb +1 -1
- data/test/acceptance/not_found_page_test.rb +29 -0
- data/test/acceptance/notifier_test.rb +1 -1
- data/test/acceptance/project_syndication_test.rb +1 -1
- data/test/acceptance/stylesheet_test.rb +10 -2
- data/test/acceptance/unauthorized_page_test.rb +20 -0
- data/test/helpers.rb +20 -7
- data/test/helpers/acceptance.rb +1 -0
- data/test/unit/build_test.rb +33 -0
- data/test/unit/commit_test.rb +0 -21
- data/test/unit/helpers_test.rb +67 -20
- data/test/unit/integrity_test.rb +23 -6
- data/test/unit/migrations_test.rb +2 -2
- data/test/unit/notifier_test.rb +5 -0
- data/test/unit/project_builder_test.rb +8 -1
- data/test/unit/project_test.rb +7 -0
- data/views/home.haml +2 -2
- data/views/layout.haml +6 -5
- data/views/new.haml +1 -1
- data/views/not_found.haml +2 -2
- data/views/unauthorized.haml +4 -4
- metadata +105 -6
- data/test/acceptance/helpers.rb +0 -2
- data/vendor/sinatra-ditties/README.rdoc +0 -3
- data/vendor/sinatra-ditties/lib/sinatra/ditties.rb +0 -12
- data/vendor/sinatra-ditties/lib/sinatra/ditties/authorization.rb +0 -61
- data/vendor/sinatra-ditties/lib/sinatra/ditties/mailer.rb +0 -146
data/views/new.haml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
%form{ :method => "post", :action => (@project.new_record? ? "/" : project_path(@project)) }
|
1
|
+
%form{ :method => "post", :action => (@project.new_record? ? root_path("/") : project_path(@project)) }
|
2
2
|
- unless @project.new_record?
|
3
3
|
.hidden
|
4
4
|
%input{ :name => "_method", :type => "hidden", :value => "put" }
|
data/views/not_found.haml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.error
|
2
2
|
%h1
|
3
3
|
Ehm, you seem a bit lost, sir. Maybe going to the
|
4
|
-
%a{ :href => "/", :rel => "home" } list of projects
|
4
|
+
%a{ :href => root_path("/"), :rel => "home" } list of projects
|
5
5
|
will help?
|
6
6
|
%dl
|
7
7
|
%dt Ouch. This is a 404 error-thingie, right?
|
@@ -14,7 +14,7 @@
|
|
14
14
|
%strong DON'T PANIC
|
15
15
|
/ if you didn't get the reference you aren't as nerd as you should be
|
16
16
|
You should probably just go back to
|
17
|
-
%a{ :href => "/", :rel => "home" } the projects list
|
17
|
+
%a{ :href => root_path("/"), :rel => "home" } the projects list
|
18
18
|
or, alternatively, go
|
19
19
|
= succeed "." do
|
20
20
|
%a{ :href => request.referer } back from whence you came
|
data/views/unauthorized.haml
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
.error
|
2
2
|
%h1
|
3
3
|
So... you don't know the password? Hmm... You can
|
4
|
-
%a{ :href => "/login" } try again
|
4
|
+
%a{ :href => root_path("/login") } try again
|
5
5
|
or
|
6
6
|
= succeed "." do
|
7
|
-
%a{ :href => "/", :rel => "home" } go back
|
7
|
+
%a{ :href => root_path("/"), :rel => "home" } go back
|
8
8
|
|
9
9
|
%dl
|
10
10
|
%dt Er... So... I'm trying to login without a password...
|
@@ -19,12 +19,12 @@
|
|
19
19
|
%dd
|
20
20
|
This just means that you can't access some part of this Integrity
|
21
21
|
server, but that shouldn't let you out of some of the
|
22
|
-
%a{ :href => "/" } awesome projects
|
22
|
+
%a{ :href => root_path("/") } awesome projects
|
23
23
|
hosted here. If this was just a misunderstanding and you
|
24
24
|
%strong do
|
25
25
|
have a password, then
|
26
26
|
= succeed "." do
|
27
|
-
%a{ :href => "/login" } click here to try again
|
27
|
+
%a{ :href => root_path("/login") } click here to try again
|
28
28
|
|
29
29
|
%dt
|
30
30
|
So what the hell is
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foca-integrity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.9.
|
4
|
+
version: 0.1.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Nicol\xC3\xA1s Sanguinetti"
|
@@ -23,6 +23,16 @@ dependencies:
|
|
23
23
|
- !ruby/object:Gem::Version
|
24
24
|
version: 0.9.1.1
|
25
25
|
version:
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: sinatra-authorization
|
28
|
+
type: :runtime
|
29
|
+
version_requirement:
|
30
|
+
version_requirements: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: "0"
|
35
|
+
version:
|
26
36
|
- !ruby/object:Gem::Dependency
|
27
37
|
name: haml
|
28
38
|
type: :runtime
|
@@ -83,6 +93,96 @@ dependencies:
|
|
83
93
|
- !ruby/object:Gem::Version
|
84
94
|
version: "0"
|
85
95
|
version:
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: rr
|
98
|
+
type: :development
|
99
|
+
version_requirement:
|
100
|
+
version_requirements: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: "0"
|
105
|
+
version:
|
106
|
+
- !ruby/object:Gem::Dependency
|
107
|
+
name: mocha
|
108
|
+
type: :development
|
109
|
+
version_requirement:
|
110
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: "0"
|
115
|
+
version:
|
116
|
+
- !ruby/object:Gem::Dependency
|
117
|
+
name: webrat
|
118
|
+
type: :development
|
119
|
+
version_requirement:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: "0"
|
125
|
+
version:
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: do_sqlite3
|
128
|
+
type: :development
|
129
|
+
version_requirement:
|
130
|
+
version_requirements: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: "0"
|
135
|
+
version:
|
136
|
+
- !ruby/object:Gem::Dependency
|
137
|
+
name: dm-sweatshop
|
138
|
+
type: :development
|
139
|
+
version_requirement:
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: "0"
|
145
|
+
version:
|
146
|
+
- !ruby/object:Gem::Dependency
|
147
|
+
name: ParseTree
|
148
|
+
type: :development
|
149
|
+
version_requirement:
|
150
|
+
version_requirements: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: "0"
|
155
|
+
version:
|
156
|
+
- !ruby/object:Gem::Dependency
|
157
|
+
name: jeremymcanally-context
|
158
|
+
type: :development
|
159
|
+
version_requirement:
|
160
|
+
version_requirements: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: "0"
|
165
|
+
version:
|
166
|
+
- !ruby/object:Gem::Dependency
|
167
|
+
name: jeremymcanally-pending
|
168
|
+
type: :development
|
169
|
+
version_requirement:
|
170
|
+
version_requirements: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: "0"
|
175
|
+
version:
|
176
|
+
- !ruby/object:Gem::Dependency
|
177
|
+
name: foca-storyteller
|
178
|
+
type: :development
|
179
|
+
version_requirement:
|
180
|
+
version_requirements: !ruby/object:Gem::Requirement
|
181
|
+
requirements:
|
182
|
+
- - ">="
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: "0"
|
185
|
+
version:
|
86
186
|
description: Your Friendly Continuous Integration server. Easy, fun and painless!
|
87
187
|
email: info@integrityapp.com
|
88
188
|
executables:
|
@@ -92,6 +192,8 @@ extensions: []
|
|
92
192
|
extra_rdoc_files: []
|
93
193
|
|
94
194
|
files:
|
195
|
+
- .gitignore
|
196
|
+
- CHANGES
|
95
197
|
- README.markdown
|
96
198
|
- Rakefile
|
97
199
|
- bin/integrity
|
@@ -140,12 +242,13 @@ files:
|
|
140
242
|
- test/acceptance/delete_project_test.rb
|
141
243
|
- test/acceptance/edit_project_test.rb
|
142
244
|
- test/acceptance/error_page_test.rb
|
143
|
-
- test/acceptance/helpers.rb
|
144
245
|
- test/acceptance/installer_test.rb
|
145
246
|
- test/acceptance/manual_build_project_test.rb
|
247
|
+
- test/acceptance/not_found_page_test.rb
|
146
248
|
- test/acceptance/notifier_test.rb
|
147
249
|
- test/acceptance/project_syndication_test.rb
|
148
250
|
- test/acceptance/stylesheet_test.rb
|
251
|
+
- test/acceptance/unauthorized_page_test.rb
|
149
252
|
- test/helpers.rb
|
150
253
|
- test/helpers/acceptance.rb
|
151
254
|
- test/helpers/acceptance/email_notifier.rb
|
@@ -168,10 +271,6 @@ files:
|
|
168
271
|
- test/unit/project_builder_test.rb
|
169
272
|
- test/unit/project_test.rb
|
170
273
|
- test/unit/scm_test.rb
|
171
|
-
- vendor/sinatra-ditties/README.rdoc
|
172
|
-
- vendor/sinatra-ditties/lib/sinatra/ditties.rb
|
173
|
-
- vendor/sinatra-ditties/lib/sinatra/ditties/authorization.rb
|
174
|
-
- vendor/sinatra-ditties/lib/sinatra/ditties/mailer.rb
|
175
274
|
- views/_commit_info.haml
|
176
275
|
- views/build.haml
|
177
276
|
- views/error.haml
|
data/test/acceptance/helpers.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require "sinatra/base"
|
2
|
-
|
3
|
-
module Sinatra
|
4
|
-
module Ditties
|
5
|
-
def self.version
|
6
|
-
"0.0.2".freeze
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
autoload :Authorization, File.dirname(__FILE__) + "/ditties/authorization"
|
11
|
-
autoload :Mailer, File.dirname(__FILE__) + "/ditties/mailer"
|
12
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
module Sinatra
|
2
|
-
# HTTP Authorization helpers for Sinatra.
|
3
|
-
#
|
4
|
-
# In your helpers module, include Sinatra::Authorization and then define
|
5
|
-
# a +authorize(user, password)+ method to handle user provided
|
6
|
-
# credentials.
|
7
|
-
#
|
8
|
-
# Inside your events, call +login_required+ to trigger the HTTP
|
9
|
-
# Authorization window to pop up in the browser.
|
10
|
-
#
|
11
|
-
# Code adapted from Ryan Tomayko <http://tomayko.com> and Christopher
|
12
|
-
# Schneid <http://gittr.com>, shared under an MIT License
|
13
|
-
module Authorization
|
14
|
-
# Redefine this method on your helpers block to actually contain
|
15
|
-
# your authorization logic.
|
16
|
-
def authorize(username, password)
|
17
|
-
false
|
18
|
-
end
|
19
|
-
|
20
|
-
# From you app, call set :authorization_realm, "my app" to set this
|
21
|
-
# or define a `authorization_realm` method in your helpers block.
|
22
|
-
def authorization_realm
|
23
|
-
Sinatra::Default.authorization_realm
|
24
|
-
end
|
25
|
-
|
26
|
-
# Call in any event that requires authentication
|
27
|
-
def login_required
|
28
|
-
return if authorized?
|
29
|
-
unauthorized! unless auth.provided?
|
30
|
-
bad_request! unless auth.basic?
|
31
|
-
unauthorized! unless authorize(*auth.credentials)
|
32
|
-
request.env['REMOTE_USER'] = auth.username
|
33
|
-
end
|
34
|
-
|
35
|
-
# Convenience method to determine if a user is logged in
|
36
|
-
def authorized?
|
37
|
-
!!request.env['REMOTE_USER']
|
38
|
-
end
|
39
|
-
alias :logged_in? :authorized?
|
40
|
-
|
41
|
-
# Name provided by the current user to log in
|
42
|
-
def current_user
|
43
|
-
request.env['REMOTE_USER']
|
44
|
-
end
|
45
|
-
|
46
|
-
private
|
47
|
-
|
48
|
-
def auth
|
49
|
-
@auth ||= Rack::Auth::Basic::Request.new(request.env)
|
50
|
-
end
|
51
|
-
|
52
|
-
def unauthorized!(realm=authorization_realm)
|
53
|
-
response["WWW-Authenticate"] = %(Basic realm="#{realm}")
|
54
|
-
throw :halt, [ 401, 'Authorization Required' ]
|
55
|
-
end
|
56
|
-
|
57
|
-
def bad_request!
|
58
|
-
throw :halt, [ 400, 'Bad Request' ]
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
@@ -1,146 +0,0 @@
|
|
1
|
-
# Shamelssly stolen from Merb::Mailer
|
2
|
-
# http://merbivore.com
|
3
|
-
|
4
|
-
require 'net/smtp'
|
5
|
-
require 'rubygems'
|
6
|
-
require 'mailfactory'
|
7
|
-
require 'tlsmail'
|
8
|
-
|
9
|
-
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
|
10
|
-
|
11
|
-
class MailFactory
|
12
|
-
attr_reader :html, :text
|
13
|
-
end
|
14
|
-
|
15
|
-
module Sinatra
|
16
|
-
# = Sinatra::Mailer
|
17
|
-
#
|
18
|
-
# Adds an #email method to your email handlers, that receives a hash of
|
19
|
-
# values to create your email.
|
20
|
-
#
|
21
|
-
# For example:
|
22
|
-
#
|
23
|
-
# post "/signup" do
|
24
|
-
# # sign up the user, and then:
|
25
|
-
# email :to => @user.email,
|
26
|
-
# :from => "awesomeness@example.com",
|
27
|
-
# :subject => "Welcome to Awesomeness!",
|
28
|
-
# :body => haml(:some_template)
|
29
|
-
# end
|
30
|
-
#
|
31
|
-
# == Configuration
|
32
|
-
#
|
33
|
-
# This plugin is very dirty yet :) Since it's just a port to Sinatra of
|
34
|
-
# Merb::Mailer[merbivore.com/documentation/1.0/doc/rdoc/merb-mailer-1.0].
|
35
|
-
# So the configuration is not Sinatra-y, yet. But we'll get to that.
|
36
|
-
#
|
37
|
-
# == Using SMTP
|
38
|
-
#
|
39
|
-
# Sinatra::Mailer.config = {
|
40
|
-
# :host => 'smtp.yourserver.com',
|
41
|
-
# :port => '25',
|
42
|
-
# :user => 'user',
|
43
|
-
# :pass => 'pass',
|
44
|
-
# :auth => :plain # :plain, :login, :cram_md5, the default is no auth
|
45
|
-
# :domain => "localhost.localdomain" # HELO domain provided by the client
|
46
|
-
# }
|
47
|
-
#
|
48
|
-
# == Using Gmail SMTP
|
49
|
-
#
|
50
|
-
# You need smtp-tls[http://github.com/ambethia/smtp-tls], a gem that improves
|
51
|
-
# Net::HTTP to add support for secure servers such as Gmail.
|
52
|
-
#
|
53
|
-
# require "smtp-tls"
|
54
|
-
#
|
55
|
-
# Sinatra::Mailer.config = {
|
56
|
-
# :host => 'smtp.gmail.com',
|
57
|
-
# :port => '587',
|
58
|
-
# :user => 'user@gmail.com',
|
59
|
-
# :pass => 'pass',
|
60
|
-
# :auth => :plain
|
61
|
-
# }
|
62
|
-
#
|
63
|
-
# Make sure that when you call your #email method you pass the
|
64
|
-
# +:text+ option and not +:body+.
|
65
|
-
#
|
66
|
-
# == Using sendmail
|
67
|
-
#
|
68
|
-
# Sinatra::Mailer.config = {:sendmail_path => '/somewhere/odd'}
|
69
|
-
# Sinatra::Mailer.delivery_method = :sendmail
|
70
|
-
#
|
71
|
-
# == Credits
|
72
|
-
#
|
73
|
-
# This has been blatantly adapted from
|
74
|
-
# Merb::Mailer[merbivore.com/documentation/1.0/doc/rdoc/merb-mailer-1.0]
|
75
|
-
# so all credit is theirs, I just ported it to Sinatra.
|
76
|
-
module Mailer
|
77
|
-
class << self
|
78
|
-
attr_accessor :config, :delivery_method
|
79
|
-
end
|
80
|
-
|
81
|
-
def email(mail_options={})
|
82
|
-
Email.new(mail_options).deliver!
|
83
|
-
end
|
84
|
-
|
85
|
-
class Email
|
86
|
-
attr_accessor :mail, :config
|
87
|
-
|
88
|
-
# Sends the mail using sendmail.
|
89
|
-
def sendmail
|
90
|
-
sendmail = IO.popen("#{config[:sendmail_path]} #{@mail.to}", 'w+')
|
91
|
-
sendmail.puts @mail.to_s
|
92
|
-
sendmail.close
|
93
|
-
end
|
94
|
-
|
95
|
-
# Sends the mail using SMTP.
|
96
|
-
def net_smtp
|
97
|
-
Net::SMTP.start(config[:host], config[:port].to_i, config[:domain],
|
98
|
-
config[:user], config[:pass], config[:auth]) { |smtp|
|
99
|
-
smtp.send_message(@mail.to_s, @mail.from.first, @mail.to.to_s.split(/[,;]/))
|
100
|
-
}
|
101
|
-
end
|
102
|
-
|
103
|
-
# Delivers the mail with the specified delivery method, defaulting to
|
104
|
-
# net_smtp.
|
105
|
-
def deliver!
|
106
|
-
send(Mailer.delivery_method || :net_smtp)
|
107
|
-
end
|
108
|
-
|
109
|
-
# ==== Parameters
|
110
|
-
# file_or_files<File, Array[File]>:: File(s) to attach.
|
111
|
-
# filename<String>::
|
112
|
-
# type<~to_s>::
|
113
|
-
# The attachment MIME type. If left out, it will be determined from
|
114
|
-
# file_or_files.
|
115
|
-
# headers<String, Array>:: Additional attachment headers.
|
116
|
-
#
|
117
|
-
# ==== Raises
|
118
|
-
# ArgumentError::
|
119
|
-
# file_or_files was not a File or an Array of File instances.
|
120
|
-
def attach(file_or_files, filename = file_or_files.is_a?(File) ? File.basename(file_or_files.path) : nil,
|
121
|
-
type = nil, headers = nil)
|
122
|
-
if file_or_files.is_a?(Array)
|
123
|
-
file_or_files.each {|k,v| @mail.add_attachment_as k, *v}
|
124
|
-
else
|
125
|
-
raise ArgumentError, "You did not pass in a file. Instead, you sent a #{file_or_files.class}" if !file_or_files.is_a?(File)
|
126
|
-
@mail.add_attachment_as(file_or_files, filename, type, headers)
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
# ==== Parameters
|
131
|
-
# o<Hash{~to_s => Object}>:: Configuration commands to send to MailFactory.
|
132
|
-
def initialize(o={})
|
133
|
-
self.config = Mailer.config || {:sendmail_path => '/usr/sbin/sendmail'}
|
134
|
-
o[:rawhtml] = o.delete(:html)
|
135
|
-
m = MailFactory.new()
|
136
|
-
o.each { |k,v| m.send "#{k}=", v }
|
137
|
-
@mail = m
|
138
|
-
end
|
139
|
-
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
class EventContext
|
144
|
-
include Mailer
|
145
|
-
end
|
146
|
-
end
|