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.
Files changed (50) hide show
  1. data/.gitignore +12 -0
  2. data/CHANGES +28 -0
  3. data/README.markdown +6 -0
  4. data/Rakefile +44 -83
  5. data/config/heroku/.gems +0 -3
  6. data/config/heroku/integrity-config.rb +4 -1
  7. data/integrity.gemspec +18 -6
  8. data/lib/integrity.rb +9 -5
  9. data/lib/integrity/app.rb +8 -8
  10. data/lib/integrity/build.rb +7 -7
  11. data/lib/integrity/helpers/authorization.rb +1 -1
  12. data/lib/integrity/helpers/breadcrumbs.rb +1 -1
  13. data/lib/integrity/helpers/rendering.rb +8 -2
  14. data/lib/integrity/helpers/urls.rb +33 -23
  15. data/lib/integrity/installer.rb +18 -17
  16. data/lib/integrity/notifier/base.rb +7 -2
  17. data/lib/integrity/project.rb +2 -2
  18. data/test/acceptance/api_test.rb +1 -1
  19. data/test/acceptance/browse_project_builds_test.rb +1 -1
  20. data/test/acceptance/browse_project_test.rb +1 -1
  21. data/test/acceptance/build_notifications_test.rb +1 -1
  22. data/test/acceptance/create_project_test.rb +1 -1
  23. data/test/acceptance/delete_project_test.rb +1 -1
  24. data/test/acceptance/edit_project_test.rb +1 -1
  25. data/test/acceptance/error_page_test.rb +1 -1
  26. data/test/acceptance/installer_test.rb +2 -6
  27. data/test/acceptance/manual_build_project_test.rb +1 -1
  28. data/test/acceptance/not_found_page_test.rb +29 -0
  29. data/test/acceptance/notifier_test.rb +1 -1
  30. data/test/acceptance/project_syndication_test.rb +1 -1
  31. data/test/acceptance/stylesheet_test.rb +10 -2
  32. data/test/acceptance/unauthorized_page_test.rb +20 -0
  33. data/test/helpers.rb +13 -7
  34. data/test/helpers/acceptance.rb +1 -0
  35. data/test/unit/build_test.rb +10 -0
  36. data/test/unit/helpers_test.rb +63 -20
  37. data/test/unit/integrity_test.rb +23 -6
  38. data/test/unit/notifier_test.rb +5 -0
  39. data/test/unit/project_test.rb +5 -0
  40. data/views/home.haml +2 -2
  41. data/views/layout.haml +6 -5
  42. data/views/new.haml +1 -1
  43. data/views/not_found.haml +2 -2
  44. data/views/unauthorized.haml +4 -4
  45. metadata +105 -6
  46. data/test/acceptance/helpers.rb +0 -2
  47. data/vendor/sinatra-ditties/README.rdoc +0 -3
  48. data/vendor/sinatra-ditties/lib/sinatra/ditties.rb +0 -12
  49. data/vendor/sinatra-ditties/lib/sinatra/ditties/authorization.rb +0 -61
  50. data/vendor/sinatra-ditties/lib/sinatra/ditties/mailer.rb +0 -146
@@ -0,0 +1,12 @@
1
+ log/*.log
2
+ config/thin.yml
3
+ config/deploy.rb
4
+ config/config.yml
5
+ dist
6
+ coverage
7
+ integrity.db
8
+ exports
9
+ *.gem
10
+ *.swp
11
+ .aggregated_coverage_report
12
+ tmp/
data/CHANGES ADDED
@@ -0,0 +1,28 @@
1
+ 0.1.9.2 / unreleased
2
+ ====================
3
+
4
+ * Add development dependencies to gemspec
5
+ * Fix and improve deprecation (Josh Nichols)
6
+ * Fix a typo in post install message (Josh Nichols)
7
+ * Fix URLs issues (hopefully)
8
+ * Calculate URLs using base_uri option instead of the request.url
9
+ * Fix and use the URLs generation helpers in views. (Will Leinweber)
10
+ * Depend on sinatra-authorization (which has no dependency) instead
11
+ of sinatra-ditties.
12
+ * Use [mg](http://github.com/sr/mg) to manage release
13
+ * Various tweaks to the bootstraping Rake tasks. I am not happy
14
+ with them, though.
15
+ <http://integrity.lighthouseapp.com/projects/14308/tickets/126>
16
+
17
+ 0.1.9.1 / 2009-03-16
18
+ ====================
19
+
20
+ * Add the Integrity::Notifier::Test mixin, aimed at helping
21
+ writing test for notifiers.
22
+ NOTE: The API is not fixed yet. See the following ticket
23
+ <http://integrity.lighthouseapp.com/projects/14308-integrity/tickets/130>
24
+ * Add support for Heroku as a deployment option
25
+ * Fix the installer to work with the current Thor gem
26
+
27
+
28
+ **There is no changelog for previous release :-)**
@@ -15,6 +15,12 @@ Try it!
15
15
  $ rake launch
16
16
  # Navigate to <http://0.0.0.0:4567>
17
17
 
18
+ Run the test suite
19
+ ------------------
20
+
21
+ Install the test dependencies with `rake test:setup` and
22
+ run the test suite with `rake test`.
23
+
18
24
  Thanks
19
25
  ------
20
26
 
data/Rakefile CHANGED
@@ -1,34 +1,28 @@
1
1
  require "rake/testtask"
2
2
  require "rake/clean"
3
- require "rcov/rcovtask"
4
3
 
5
- begin
6
- require "metric_fu"
7
- rescue LoadError
4
+ def spec
5
+ @spec ||= begin
6
+ require "rubygems/specification"
7
+ eval(File.read("integrity.gemspec"))
8
+ end
8
9
  end
9
10
 
10
11
  desc "Default: run all tests"
11
12
  task :default => :test
12
13
 
13
- desc "Special task for running tests on <http://builder.integrityapp.com>"
14
- task :ci do
15
- sh "git submodule update --init"
16
-
17
- Rake::Task["test"].invoke
18
-
19
- metrics = %w(flay flog:all reek roodi saikuro)
20
- metrics.each { |m| Rake::Task["metrics:#{m}"].invoke }
14
+ desc "Install Integrity dependencies"
15
+ task :setup do
16
+ puts "NOTE: assuming you have gems.github.com in your gem sources"
21
17
 
22
- rm_rf "/var/www/integrity-metrics"
23
- mv "tmp/metric_fu", "/var/www/integrity-metrics"
18
+ system "gem install " +
19
+ spec.dependencies.select { |dep| dep.type == :runtime }.
20
+ collect(&:name).join(" ")
21
+ end
24
22
 
25
- File.open("/var/www/integrity-metrics/index.html", "w") { |f|
26
- f << "<ul>"
27
- metrics.map { |m| m.split(":").first }.each { |m|
28
- f << %Q(<li><a href="/#{m}">#{m}</a></li>)
29
- }
30
- f << "</ul>"
31
- }
23
+ desc "Launch Integrity real quick"
24
+ task :launch do
25
+ ruby "bin/integrity launch"
32
26
  end
33
27
 
34
28
  desc "Run tests"
@@ -42,77 +36,44 @@ namespace :test do
42
36
  t.test_files = FileList["test/acceptance/*_test.rb"]
43
37
  end
44
38
 
45
- desc "Install all gems on which the tests depend on"
46
- task :install_dependencies do
47
- system "gem install rr mocha dm-sweatshop ZenTest"
48
- system "gem install -s http://gems.github.com jeremymcanally-context \
49
- jeremymcanally-matchy jeremymcanally-pending foca-storyteller"
50
- system "git submodule update --init"
51
- end
52
- end
39
+ desc "Install tests dependencies"
40
+ task :setup do
41
+ puts "NOTE: assuming you have gems.github.com in your gem sources"
53
42
 
54
- desc "Launch Integrity real quick"
55
- task :launch do
56
- ruby "bin/integrity launch"
57
- end
58
-
59
- directory "dist/"
60
- CLOBBER.include("dist")
61
-
62
- # Load the gemspec using the same limitations as github
63
- def spec
64
- @spec ||=
65
- begin
66
- require "rubygems/specification"
67
- data = File.read("integrity.gemspec")
68
- spec = nil
69
- Thread.new { spec = eval("$SAFE = 3\n#{data}") }.join
70
- spec
71
- end
43
+ system "gem install " +
44
+ spec.dependencies.select { |dep| dep.type == :development }.
45
+ collect(&:name).join(" ")
46
+ end
72
47
  end
73
48
 
74
- def package(ext="")
75
- "dist/integrity-#{spec.version}" + ext
49
+ begin
50
+ require "mg"
51
+ MG.new("integrity.gemspec")
52
+ rescue LoadError
76
53
  end
77
54
 
78
- desc "Build and install as local gem"
79
- task :install => package('.gem') do
80
- sh "gem install #{package('.gem')}"
55
+ begin
56
+ require "metric_fu"
57
+ rescue LoadError
81
58
  end
82
59
 
83
- desc "Publish the current release on Rubyforge"
84
- task :rubyforge => ["rubyforge:gem", "rubyforge:tarball", "rubyforge:git"]
85
-
86
- namespace :rubyforge do
87
- desc "Publish gem and tarball to rubyforge"
88
- task :gem => package(".gem") do
89
- sh "rubyforge add_release integrity integrity #{spec.version} #{package('.gem')}"
90
- end
60
+ desc "Special task for running tests on <http://builder.integrityapp.com>"
61
+ task :ci do
62
+ sh "git submodule update --init"
91
63
 
92
- task :tarball => package(".tar.gz") do
93
- sh "rubyforge add_file integrity integrity #{spec.version} #{package('.tar.gz')}"
94
- end
64
+ Rake::Task["test"].invoke
95
65
 
96
- desc "Push to gitosis@rubyforge.org:integrity.git"
97
- task :git do
98
- sh "git push gitosis@rubyforge.org:integrity.git master"
99
- end
100
- end
66
+ metrics = %w(flay flog:all reek roodi saikuro)
67
+ metrics.each { |m| Rake::Task["metrics:#{m}"].invoke }
101
68
 
102
- desc "Build gem tarball into dist/"
103
- task :package => %w(.gem .tar.gz).map { |ext| package(ext) }
104
- namespace :package do
105
- file package(".tar.gz") => "dist/" do |f|
106
- sh <<-SH
107
- git archive \
108
- --prefix=integrity-#{spec.version}/ \
109
- --format=tar \
110
- HEAD | gzip > #{f.name}
111
- SH
112
- end
69
+ rm_rf "/var/www/integrity-metrics"
70
+ mv "tmp/metric_fu", "/var/www/integrity-metrics"
113
71
 
114
- file package(".gem") => "dist/" do |f|
115
- sh "gem build integrity.gemspec"
116
- mv File.basename(f.name), f.name
117
- end
72
+ File.open("/var/www/integrity-metrics/index.html", "w") { |f|
73
+ f << "<ul>"
74
+ metrics.map { |m| m.split(":").first }.each { |m|
75
+ f << %Q(<li><a href="/#{m}">#{m}</a></li>)
76
+ }
77
+ f << "</ul>"
78
+ }
118
79
  end
@@ -1,4 +1 @@
1
- mailfactory --version '>= 1.4.0'
2
- tlsmail
3
- foca-sinatra-ditties --version 0.0.3 --source http://gems.github.com
4
1
  integrity --version 0.1.9.0
@@ -5,7 +5,10 @@ require "integrity"
5
5
  Integrity.config = {
6
6
  :database_uri => ENV["DATABASE_URL"],
7
7
  :export_directory => File.dirname(__FILE__) + "/tmp",
8
- :log => File.dirname(__FILE__) + "/log/integrity.log"
8
+ :log => File.dirname(__FILE__) + "/log/integrity.log",
9
+ # Uncomment to setup a password
10
+ # :admin_usenrame => "admin",
11
+ # :admin_password => "foobar"
9
12
  }
10
13
 
11
14
  Integrity.new
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "integrity"
3
- s.version = "0.1.9.1"
3
+ s.version = "0.1.9.2"
4
4
  s.date = "2009-03-16"
5
5
 
6
6
  s.description = "Your Friendly Continuous Integration server. Easy, fun and painless!"
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.rubygems_version = "1.3.1"
20
20
 
21
21
  s.add_dependency "sinatra", [">= 0.9.1.1"]
22
+ s.add_dependency "sinatra-authorization"
22
23
  s.add_dependency "haml", [">= 2.0.0"]
23
24
  s.add_dependency "data_mapper", [">= 0.9.10"]
24
25
  s.add_dependency "uuidtools" # required by dm-types
@@ -26,7 +27,21 @@ Gem::Specification.new do |s|
26
27
  s.add_dependency "json"
27
28
  s.add_dependency "thor"
28
29
 
30
+ if s.respond_to?(:add_development_dependency)
31
+ s.add_development_dependency "rr"
32
+ s.add_development_dependency "mocha"
33
+ s.add_development_dependency "webrat"
34
+ s.add_development_dependency "do_sqlite3"
35
+ s.add_development_dependency "dm-sweatshop"
36
+ s.add_development_dependency "ParseTree" # required by dm-sweatshop
37
+ s.add_development_dependency "jeremymcanally-context"
38
+ s.add_development_dependency "jeremymcanally-pending"
39
+ s.add_development_dependency "foca-storyteller"
40
+ end
41
+
29
42
  s.files = %w[
43
+ .gitignore
44
+ CHANGES
30
45
  README.markdown
31
46
  Rakefile
32
47
  bin/integrity
@@ -75,12 +90,13 @@ test/acceptance/create_project_test.rb
75
90
  test/acceptance/delete_project_test.rb
76
91
  test/acceptance/edit_project_test.rb
77
92
  test/acceptance/error_page_test.rb
78
- test/acceptance/helpers.rb
79
93
  test/acceptance/installer_test.rb
80
94
  test/acceptance/manual_build_project_test.rb
95
+ test/acceptance/not_found_page_test.rb
81
96
  test/acceptance/notifier_test.rb
82
97
  test/acceptance/project_syndication_test.rb
83
98
  test/acceptance/stylesheet_test.rb
99
+ test/acceptance/unauthorized_page_test.rb
84
100
  test/helpers.rb
85
101
  test/helpers/acceptance.rb
86
102
  test/helpers/acceptance/email_notifier.rb
@@ -103,10 +119,6 @@ test/unit/notifier_test.rb
103
119
  test/unit/project_builder_test.rb
104
120
  test/unit/project_test.rb
105
121
  test/unit/scm_test.rb
106
- vendor/sinatra-ditties/README.rdoc
107
- vendor/sinatra-ditties/lib/sinatra/ditties.rb
108
- vendor/sinatra-ditties/lib/sinatra/ditties/authorization.rb
109
- vendor/sinatra-ditties/lib/sinatra/ditties/mailer.rb
110
122
  views/_commit_info.haml
111
123
  views/build.haml
112
124
  views/error.haml
@@ -1,5 +1,4 @@
1
- $:.unshift File.expand_path(File.dirname(__FILE__)),
2
- File.expand_path(File.dirname(__FILE__) + "/../vendor/sinatra-ditties/lib")
1
+ $:.unshift File.expand_path(File.dirname(__FILE__))
3
2
 
4
3
  require "json"
5
4
  require "haml"
@@ -31,9 +30,14 @@ require "integrity/helpers"
31
30
  require "integrity/app"
32
31
 
33
32
  module Integrity
34
- def self.new(config_file = nil)
35
- self.config = YAML.load_file(config_file) unless config_file.nil?
36
- DataMapper.setup(:default, config[:database_uri])
33
+ def self.new(config=nil)
34
+ if config.is_a?(String) && File.file?(config)
35
+ self.config = YAML.load_file(config)
36
+ elsif config.is_a?(Hash)
37
+ self.config = config
38
+ end
39
+
40
+ DataMapper.setup(:default, self.config[:database_uri])
37
41
  end
38
42
 
39
43
  def self.default_configuration
@@ -31,7 +31,7 @@ module Integrity
31
31
  sass :integrity
32
32
  end
33
33
 
34
- get "/" do
34
+ get "/?" do
35
35
  @projects = Project.only_public_unless(authorized?)
36
36
  show :home, :title => "projects"
37
37
  end
@@ -40,7 +40,7 @@ module Integrity
40
40
  login_required
41
41
 
42
42
  session[:user] = current_user
43
- redirect root_url
43
+ redirect root_url.to_s
44
44
  end
45
45
 
46
46
  get "/new" do
@@ -50,14 +50,14 @@ module Integrity
50
50
  show :new, :title => ["projects", "new project"]
51
51
  end
52
52
 
53
- post "/" do
53
+ post "/?" do
54
54
  login_required
55
55
 
56
56
  @project = Project.new(params[:project_data])
57
57
 
58
58
  if @project.save
59
59
  update_notifiers_of(@project)
60
- redirect project_url(@project)
60
+ redirect project_url(@project).to_s
61
61
  else
62
62
  show :new, :title => ["projects", "new project"]
63
63
  end
@@ -79,7 +79,7 @@ module Integrity
79
79
 
80
80
  if current_project.update_attributes(params[:project_data])
81
81
  update_notifiers_of(current_project)
82
- redirect project_url(current_project)
82
+ redirect project_url(current_project).to_s
83
83
  else
84
84
  show :new, :title => ["projects", current_project.permalink, "edit"]
85
85
  end
@@ -89,7 +89,7 @@ module Integrity
89
89
  login_required
90
90
 
91
91
  current_project.destroy
92
- redirect root_url
92
+ redirect root_url.to_s
93
93
  end
94
94
 
95
95
  get "/:project/edit" do
@@ -115,7 +115,7 @@ module Integrity
115
115
  login_required
116
116
 
117
117
  current_project.build
118
- redirect project_url(current_project)
118
+ redirect project_url(current_project).to_s
119
119
  end
120
120
 
121
121
  get "/:project/commits/:commit" do
@@ -132,7 +132,7 @@ module Integrity
132
132
  login_required
133
133
 
134
134
  current_project.build(params[:commit])
135
- redirect commit_url(current_commit)
135
+ redirect commit_url(current_commit).to_s
136
136
  end
137
137
  end
138
138
  end
@@ -45,37 +45,37 @@ module Integrity
45
45
  # Deprecated methods
46
46
  #
47
47
  def short_commit_identifier
48
- warn "Build#short_commit_identifier is deprecated, use Commit#short_identifier"
48
+ warn "Build#short_commit_identifier is deprecated, use Commit#short_identifier (#{caller[0]})"
49
49
  commit.short_identifier
50
50
  end
51
51
 
52
52
  def commit_identifier
53
- warn "Build#commit_identifier is deprecated, use Commit#identifier"
53
+ warn "Build#commit_identifier is deprecated, use Commit#identifier (#{caller[0]})"
54
54
  commit.identifier
55
55
  end
56
56
 
57
57
  def commit_author
58
- warn "Build#commit_author is deprecated, use Commit#author"
58
+ warn "Build#commit_author is deprecated, use Commit#author (#{caller[0]})"
59
59
  commit.author
60
60
  end
61
61
 
62
62
  def commit_message
63
- warn "Build#commit_message is deprecated, use Commit#message"
63
+ warn "Build#commit_message is deprecated, use Commit#message (#{caller[0]})"
64
64
  commit.message
65
65
  end
66
66
 
67
67
  def commited_at
68
- warn "Build#commited_at is deprecated, use Commit#committed_at"
68
+ warn "Build#commited_at is deprecated, use Commit#committed_at (#{caller[0]})"
69
69
  commit.committed_at
70
70
  end
71
71
 
72
72
  def project_id
73
- warn "Build#project_id is deprecated, use Commit#project_id"
73
+ warn "Build#project_id is deprecated, use Commit#project_id (#{caller[0]})"
74
74
  commit.project_id
75
75
  end
76
76
 
77
77
  def commit_metadata
78
- warn "Build#commit_metadata is deprecated, use the different methods in Commit instead"
78
+ warn "Build#commit_metadata is deprecated, use the different methods in Commit instead (#{caller[0]})"
79
79
  { :message => commit.message,
80
80
  :author => commit.author,
81
81
  :date => commit.committed_at }
@@ -1,4 +1,4 @@
1
- require "sinatra/ditties"
1
+ require "sinatra/authorization"
2
2
 
3
3
  module Integrity
4
4
  module Helpers
@@ -2,7 +2,7 @@ module Integrity
2
2
  module Helpers
3
3
  module Breadcrumbs
4
4
  def pages
5
- @pages ||= [["projects", "/"], ["new project", "/new"]]
5
+ @pages ||= [["projects", root_path], ["new project", root_path("/new")]]
6
6
  end
7
7
 
8
8
  def breadcrumbs(*crumbs)