foca-integrity 0.1.8 → 0.1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/README.markdown +7 -0
  2. data/Rakefile +89 -81
  3. data/config/config.sample.ru +11 -21
  4. data/config/config.sample.yml +15 -12
  5. data/lib/integrity.rb +21 -23
  6. data/lib/integrity/app.rb +138 -0
  7. data/lib/integrity/author.rb +39 -0
  8. data/lib/integrity/build.rb +54 -31
  9. data/lib/integrity/commit.rb +71 -0
  10. data/lib/integrity/helpers.rb +3 -3
  11. data/lib/integrity/helpers/authorization.rb +2 -2
  12. data/lib/integrity/helpers/forms.rb +3 -3
  13. data/lib/integrity/helpers/pretty_output.rb +1 -1
  14. data/lib/integrity/helpers/rendering.rb +6 -1
  15. data/lib/integrity/helpers/resources.rb +9 -3
  16. data/lib/integrity/helpers/urls.rb +15 -13
  17. data/lib/integrity/installer.rb +43 -60
  18. data/lib/integrity/migrations.rb +31 -48
  19. data/lib/integrity/notifier.rb +14 -16
  20. data/lib/integrity/notifier/base.rb +29 -19
  21. data/lib/integrity/notifier/test_helpers.rb +100 -0
  22. data/lib/integrity/project.rb +69 -33
  23. data/lib/integrity/project_builder.rb +23 -14
  24. data/lib/integrity/scm/git.rb +15 -14
  25. data/lib/integrity/scm/git/uri.rb +9 -9
  26. data/test/acceptance/api_test.rb +97 -0
  27. data/test/acceptance/browse_project_builds_test.rb +65 -0
  28. data/test/acceptance/browse_project_test.rb +95 -0
  29. data/test/acceptance/build_notifications_test.rb +42 -0
  30. data/test/acceptance/create_project_test.rb +97 -0
  31. data/test/acceptance/delete_project_test.rb +53 -0
  32. data/test/acceptance/edit_project_test.rb +117 -0
  33. data/test/acceptance/error_page_test.rb +18 -0
  34. data/test/acceptance/helpers.rb +2 -0
  35. data/test/acceptance/installer_test.rb +62 -0
  36. data/test/acceptance/manual_build_project_test.rb +82 -0
  37. data/test/acceptance/notifier_test.rb +109 -0
  38. data/test/acceptance/project_syndication_test.rb +30 -0
  39. data/test/acceptance/stylesheet_test.rb +18 -0
  40. data/test/helpers.rb +59 -27
  41. data/test/helpers/acceptance.rb +19 -64
  42. data/test/helpers/acceptance/email_notifier.rb +55 -0
  43. data/test/helpers/acceptance/git_helper.rb +15 -15
  44. data/test/helpers/acceptance/textfile_notifier.rb +3 -3
  45. data/test/helpers/expectations.rb +0 -1
  46. data/test/helpers/expectations/be_a.rb +4 -4
  47. data/test/helpers/expectations/change.rb +5 -5
  48. data/test/helpers/expectations/have.rb +4 -4
  49. data/test/helpers/expectations/predicates.rb +4 -4
  50. data/test/helpers/fixtures.rb +44 -18
  51. data/test/helpers/initial_migration_fixture.sql +44 -0
  52. data/test/unit/build_test.rb +51 -0
  53. data/test/unit/commit_test.rb +83 -0
  54. data/test/unit/helpers_test.rb +56 -0
  55. data/test/unit/integrity_test.rb +18 -0
  56. data/test/unit/migrations_test.rb +56 -0
  57. data/test/unit/notifier_test.rb +123 -0
  58. data/test/unit/project_builder_test.rb +108 -0
  59. data/test/unit/project_test.rb +282 -0
  60. data/test/unit/scm_test.rb +54 -0
  61. data/views/_commit_info.haml +24 -0
  62. data/views/build.haml +2 -2
  63. data/views/error.haml +4 -3
  64. data/views/home.haml +3 -5
  65. data/views/integrity.sass +19 -6
  66. data/views/new.haml +6 -6
  67. data/views/project.builder +9 -9
  68. data/views/project.haml +14 -12
  69. metadata +98 -116
  70. data/VERSION.yml +0 -4
  71. data/app.rb +0 -137
  72. data/integrity.gemspec +0 -76
  73. data/lib/integrity/core_ext/string.rb +0 -5
  74. data/test/helpers/expectations/have_tag.rb +0 -128
  75. data/views/_build_info.haml +0 -18
data/VERSION.yml DELETED
@@ -1,4 +0,0 @@
1
- ---
2
- major: 0
3
- patch: 8
4
- minor: 1
data/app.rb DELETED
@@ -1,137 +0,0 @@
1
- require File.dirname(__FILE__) + "/lib/integrity"
2
- require "sinatra"
3
- require "helpers"
4
-
5
- set :root, Integrity.root
6
- set :public, Integrity.root / "public"
7
- set :views, Integrity.root / "views"
8
-
9
- enable :sessions
10
-
11
- include Integrity
12
-
13
- configure :development do
14
- config = Integrity.root / "config" / "config.yml"
15
- Integrity.config = config if File.exists? config
16
- end
17
-
18
- configure do
19
- Integrity.new
20
- end
21
-
22
- not_found do
23
- status 404
24
- show :not_found, :title => "lost, are we?"
25
- end
26
-
27
- error do
28
- @error = request.env['sinatra.error']
29
- status 500
30
- show :error, :title => "something has gone terribly wrong"
31
- end
32
-
33
- before do
34
- # The browser only sends http auth data for requests that are explicitly
35
- # required to do so. This way we get the real values of +#logged_in?+ and
36
- # +#current_user+
37
- login_required if session[:user]
38
- end
39
-
40
- get "/" do
41
- @projects = Project.only_public_unless(authorized?)
42
- show :home, :title => "projects"
43
- end
44
-
45
- get "/login" do
46
- login_required
47
- session[:user] = current_user
48
- redirect root_url
49
- end
50
-
51
- get "/new" do
52
- login_required
53
-
54
- @project = Project.new
55
- show :new, :title => ["projects", "new project"]
56
- end
57
-
58
- post "/" do
59
- login_required
60
-
61
- @project = Project.new(params[:project_data])
62
- if @project.save
63
- @project.enable_notifiers(params["enabled_notifiers[]"], params["notifiers"])
64
- redirect project_url(@project)
65
- else
66
- show :new, :title => ["projects", "new project"]
67
- end
68
- end
69
-
70
- get "/:project" do
71
- login_required unless current_project.public?
72
- show :project, :title => ["projects", current_project.name]
73
- end
74
-
75
- get "/:project.atom" do
76
- login_required unless current_project.public?
77
- response["Content-Type"] = "application/rss+xml; charset=utf-8"
78
- builder :project
79
- end
80
-
81
- put "/:project" do
82
- login_required
83
-
84
- if current_project.update_attributes(params[:project_data])
85
- current_project.enable_notifiers(params["enabled_notifiers"], params["notifiers"])
86
- redirect project_url(current_project)
87
- else
88
- show :new, :title => ["projects", current_project.permalink, "edit"]
89
- end
90
- end
91
-
92
- delete "/:project" do
93
- login_required
94
-
95
- current_project.destroy
96
- redirect root_url
97
- end
98
-
99
- get "/:project/edit" do
100
- login_required
101
-
102
- show :new, :title => ["projects", current_project.permalink, "edit"]
103
- end
104
-
105
- post "/:project/push" do
106
- login_required
107
-
108
- content_type "text/plain"
109
-
110
- begin
111
- current_project.push(params[:payload])
112
- "Thanks, build started."
113
- rescue JSON::ParserError => exception
114
- throw :halt, [422, exception.to_s]
115
- end
116
- end
117
-
118
- post "/:project/builds" do
119
- login_required
120
-
121
- current_project.build
122
- redirect project_url(@project)
123
- end
124
-
125
- get "/:project/builds/:build" do
126
- login_required unless current_project.public?
127
- show :build, :title => ["projects", current_project.permalink, current_build.short_commit_identifier]
128
- end
129
-
130
- get "/integrity.css" do
131
- response["Content-Type"] = "text/css; charset=utf-8"
132
- sass :integrity
133
- end
134
-
135
- helpers do
136
- include Helpers
137
- end
data/integrity.gemspec DELETED
@@ -1,76 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- Gem::Specification.new do |s|
4
- s.name = %q{integrity}
5
- s.version = "0.1.8"
6
-
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Nicol\303\241s Sanguinetti", "Simon Rozet"]
9
- s.date = %q{2009-02-12}
10
- s.default_executable = %q{integrity}
11
- s.description = %q{Your Friendly Continuous Integration server. Easy, fun and painless!}
12
- s.email = %q{contacto@nicolassanguinetti.info}
13
- s.executables = ["integrity"]
14
- s.files = ["README.markdown", "Rakefile", "VERSION.yml", "app.rb", "bin/integrity", "config/config.sample.ru", "config/config.sample.yml", "config/thin.sample.yml", "integrity.gemspec", "lib/integrity.rb", "lib/integrity/build.rb", "lib/integrity/core_ext/object.rb", "lib/integrity/core_ext/string.rb", "lib/integrity/helpers.rb", "lib/integrity/helpers/authorization.rb", "lib/integrity/helpers/breadcrumbs.rb", "lib/integrity/helpers/forms.rb", "lib/integrity/helpers/pretty_output.rb", "lib/integrity/helpers/rendering.rb", "lib/integrity/helpers/resources.rb", "lib/integrity/helpers/urls.rb", "lib/integrity/installer.rb", "lib/integrity/migrations.rb", "lib/integrity/notifier.rb", "lib/integrity/notifier/base.rb", "lib/integrity/project.rb", "lib/integrity/project_builder.rb", "lib/integrity/scm.rb", "lib/integrity/scm/git.rb", "lib/integrity/scm/git/uri.rb", "public/buttons.css", "public/reset.css", "public/spinner.gif", "test/helpers.rb", "test/helpers/acceptance.rb", "test/helpers/acceptance/git_helper.rb", "test/helpers/acceptance/textfile_notifier.rb", "test/helpers/expectations.rb", "test/helpers/expectations/be_a.rb", "test/helpers/expectations/change.rb", "test/helpers/expectations/have.rb", "test/helpers/expectations/have_tag.rb", "test/helpers/expectations/predicates.rb", "test/helpers/fixtures.rb", "views/_build_info.haml", "views/build.haml", "views/error.haml", "views/home.haml", "views/integrity.sass", "views/layout.haml", "views/new.haml", "views/not_found.haml", "views/notifier.haml", "views/project.builder", "views/project.haml", "views/unauthorized.haml"]
15
- s.homepage = %q{http://integrityapp.com}
16
- s.post_install_message = %q{Run `integrity help` for information on how to setup Integrity.}
17
- s.require_paths = ["lib"]
18
- s.rubyforge_project = %q{integrity}
19
- s.rubygems_version = %q{1.3.1}
20
- s.summary = %q{The easy and fun Continuous Integration server}
21
-
22
- if s.respond_to? :specification_version then
23
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
- s.specification_version = 2
25
-
26
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
- s.add_runtime_dependency(%q<sinatra>, [">= 0.9.0.3"])
28
- s.add_runtime_dependency(%q<haml>, [">= 0"])
29
- s.add_runtime_dependency(%q<dm-core>, [">= 0.9.5"])
30
- s.add_runtime_dependency(%q<dm-validations>, [">= 0.9.5"])
31
- s.add_runtime_dependency(%q<dm-types>, [">= 0.9.5"])
32
- s.add_runtime_dependency(%q<dm-timestamps>, [">= 0.9.5"])
33
- s.add_runtime_dependency(%q<dm-aggregates>, [">= 0.9.5"])
34
- s.add_runtime_dependency(%q<dm-migrations>, [">= 0.9.5"])
35
- s.add_runtime_dependency(%q<data_objects>, [">= 0.9.5"])
36
- s.add_runtime_dependency(%q<do_sqlite3>, [">= 0.9.5"])
37
- s.add_runtime_dependency(%q<json>, [">= 0"])
38
- s.add_runtime_dependency(%q<foca-sinatra-diddies>, [">= 0.0.2"])
39
- s.add_runtime_dependency(%q<thor>, [">= 0"])
40
- s.add_runtime_dependency(%q<uuidtools>, [">= 0"])
41
- s.add_runtime_dependency(%q<bcrypt-ruby>, [">= 0"])
42
- else
43
- s.add_dependency(%q<sinatra>, [">= 0.9.0.3"])
44
- s.add_dependency(%q<haml>, [">= 0"])
45
- s.add_dependency(%q<dm-core>, [">= 0.9.5"])
46
- s.add_dependency(%q<dm-validations>, [">= 0.9.5"])
47
- s.add_dependency(%q<dm-types>, [">= 0.9.5"])
48
- s.add_dependency(%q<dm-timestamps>, [">= 0.9.5"])
49
- s.add_dependency(%q<dm-aggregates>, [">= 0.9.5"])
50
- s.add_dependency(%q<dm-migrations>, [">= 0.9.5"])
51
- s.add_dependency(%q<data_objects>, [">= 0.9.5"])
52
- s.add_dependency(%q<do_sqlite3>, [">= 0.9.5"])
53
- s.add_dependency(%q<json>, [">= 0"])
54
- s.add_dependency(%q<foca-sinatra-diddies>, [">= 0.0.2"])
55
- s.add_dependency(%q<thor>, [">= 0"])
56
- s.add_dependency(%q<uuidtools>, [">= 0"])
57
- s.add_dependency(%q<bcrypt-ruby>, [">= 0"])
58
- end
59
- else
60
- s.add_dependency(%q<sinatra>, [">= 0.9.0.3"])
61
- s.add_dependency(%q<haml>, [">= 0"])
62
- s.add_dependency(%q<dm-core>, [">= 0.9.5"])
63
- s.add_dependency(%q<dm-validations>, [">= 0.9.5"])
64
- s.add_dependency(%q<dm-types>, [">= 0.9.5"])
65
- s.add_dependency(%q<dm-timestamps>, [">= 0.9.5"])
66
- s.add_dependency(%q<dm-aggregates>, [">= 0.9.5"])
67
- s.add_dependency(%q<dm-migrations>, [">= 0.9.5"])
68
- s.add_dependency(%q<data_objects>, [">= 0.9.5"])
69
- s.add_dependency(%q<do_sqlite3>, [">= 0.9.5"])
70
- s.add_dependency(%q<json>, [">= 0"])
71
- s.add_dependency(%q<foca-sinatra-diddies>, [">= 0.0.2"])
72
- s.add_dependency(%q<thor>, [">= 0"])
73
- s.add_dependency(%q<uuidtools>, [">= 0"])
74
- s.add_dependency(%q<bcrypt-ruby>, [">= 0"])
75
- end
76
- end
@@ -1,5 +0,0 @@
1
- class String
2
- def /(other)
3
- File.join(self, other)
4
- end
5
- end
@@ -1,128 +0,0 @@
1
- require 'hpricot'
2
-
3
- # evil hack to duck-type CgiResponse so that nested shoulds can use
4
- # +rspec_on_rails+ matchers without remembering to call to_s on it
5
- #
6
- # e.g.
7
- #
8
- # response.should have_tag("li") do |ul|
9
- # ul.should have_text("List Item") # with hack
10
- # ul.to_s.should have_text("List Item") # without hack
11
- # end
12
- class Hpricot::Elem
13
- alias body to_s
14
- end
15
-
16
- module Matchy::Expectations
17
- class HaveTag < Base
18
- def initialize(test_case, selector, inner_text_or_options, options, &block)
19
- #@expected = expected
20
- @test_case = test_case
21
- @selector = selector
22
-
23
- if Hash === inner_text_or_options
24
- @inner_text = nil
25
- @options = inner_text_or_options
26
- else
27
- @inner_text = inner_text_or_options
28
- @options = options
29
- end
30
- end
31
-
32
- def matches?(actual, &block)
33
- @actual = actual
34
- @doc = hpricot_document(@actual)
35
-
36
- matched_elements = @doc.search(@selector)
37
-
38
- return @options[:count] == 0 if matched_elements.empty?
39
-
40
- matched_elements = filter_on_inner_text(matched_elements) if @inner_text
41
- matched_elements = filter_on_nested_expectations(matched_elements, block) if block
42
-
43
- @actual_count = matched_elements.length
44
-
45
- return false unless acceptable_count?(@actual_count)
46
-
47
- !matched_elements.empty?
48
- end
49
-
50
- def failure_message
51
- explanation = @actual_count ? "but found #{@actual_count}" : "but did not"
52
- "expected\n#{@doc.to_s}\nto have #{failure_count_phrase} #{failure_selector_phrase}, #{explanation}"
53
- end
54
-
55
- def negative_failure_message
56
- explanation = @actual_count ? "but found #{@actual_count}" : "but did"
57
- "expected\n#{@doc.to_s}\nnot to have #{failure_count_phrase} #{failure_selector_phrase}, #{explanation}"
58
- end
59
-
60
- private
61
- def hpricot_document(input)
62
- if Hpricot === input
63
- input
64
- elsif input.respond_to?(:body)
65
- Hpricot(input.body)
66
- else
67
- Hpricot(input.to_s)
68
- end
69
- end
70
-
71
- def filter_on_inner_text(elements)
72
- elements.select do |element|
73
- next(element.inner_text =~ @inner_text) if @inner_text.is_a?(Regexp)
74
- element.inner_text == @inner_text
75
- end
76
- end
77
-
78
- def filter_on_nested_expectations(elements, block)
79
- elements.select do |el|
80
- begin
81
- block.call(el)
82
- rescue NoMethodError
83
- false
84
- else
85
- true
86
- end
87
- end
88
- end
89
-
90
- def acceptable_count?(actual_count)
91
- if @options[:count]
92
- return false unless @options[:count] === actual_count
93
- end
94
- if @options[:minimum]
95
- return false unless actual_count >= @options[:minimum]
96
- end
97
- if @options[:maximum]
98
- return false unless actual_count <= @options[:maximum]
99
- end
100
-
101
- true
102
- end
103
-
104
- def failure_count_phrase
105
- if @options[:count]
106
- "#{@options[:count]} elements matching"
107
- elsif @options[:minimum] || @options[:maximum]
108
- count_explanations = []
109
- count_explanations << "at least #{@options[:minimum]}" if @options[:minimum]
110
- count_explanations << "at most #{@options[:maximum]}" if @options[:maximum]
111
- "#{count_explanations.join(' and ')} elements matching"
112
- else
113
- "an element matching"
114
- end
115
- end
116
-
117
- def failure_selector_phrase
118
- phrase = @selector.inspect
119
- phrase << (@inner_text ? " with inner text #{@inner_text.inspect}" : "")
120
- end
121
- end
122
-
123
- module TestCaseExtensions
124
- def have_tag(selector, inner_text_or_options = nil, options = {}, &block)
125
- Matchy::Expectations::HaveTag.new(self, selector, inner_text_or_options, options, &block)
126
- end
127
- end
128
- end
@@ -1,18 +0,0 @@
1
- %h1<
2
- &== Built #{build.short_commit_identifier} #{build.successful? ? "successfully" : "and failed"}
3
- %blockquote
4
- %p&= build.commit_message
5
- %p.meta<
6
- %span.who<
7
- &== by: #{build.commit_author.name}
8
- |
9
- %span.when{ :title => build.commited_at.iso8601 }<
10
- &= pretty_date build.commited_at
11
- |
12
- %span.what<
13
- &== commit: #{build.commit_identifier}
14
-
15
- %h2 Build Output:
16
- %pre.output
17
- :preserve
18
- #{bash_color_codes h(build.output)}