foca-integrity 0.1.9.2 → 0.1.9.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,17 @@
1
+ 0.1.9.3 / 2009-04-06
2
+ ====================
3
+
4
+ * Fix one more URL issue
5
+ * Fix that notifiers are always enabled
6
+ * Fix for when the commit identifier can't be retrieved
7
+ * Fix the schema to accept NULL commit author and message
8
+ * Upgrade to DataMapper 0.9.11
9
+ * Remove all of deprecation code, except on Notifier::Base
10
+ * Notifiers were refactored and now require to be registered:
11
+ Integrity.register(Integrity::Notifier::IRC)
12
+ * The installer do not migrate the database automagically after
13
+ a successful install anymore
14
+
1
15
  0.1.9.2 / 2009-03-28
2
16
  ====================
3
17
 
@@ -25,4 +39,4 @@
25
39
  * Fix the installer to work with the current Thor gem
26
40
 
27
41
 
28
- **There is no changelog for previous release :-)**
42
+ (There is no changelog for previous release)
@@ -18,8 +18,11 @@ Try it!
18
18
  Run the test suite
19
19
  ------------------
20
20
 
21
- Install the test dependencies with `rake test:setup` and
22
- run the test suite with `rake test`.
21
+ 1. Ensure you have `gems.github.com` in your gem sources:
22
+ `gem sources -a http://gems.github.com`
23
+ 2. Install the runtime and development dependencies:
24
+ `gem build integrity.gemspec && gem install *.gem --development`.
25
+ 3. Run the test suite: `rake test`
23
26
 
24
27
  Thanks
25
28
  ------
data/Rakefile CHANGED
@@ -1,5 +1,4 @@
1
1
  require "rake/testtask"
2
- require "rake/clean"
3
2
 
4
3
  def spec
5
4
  @spec ||= begin
@@ -11,15 +10,6 @@ end
11
10
  desc "Default: run all tests"
12
11
  task :default => :test
13
12
 
14
- desc "Install Integrity dependencies"
15
- task :setup do
16
- puts "NOTE: assuming you have gems.github.com in your gem sources"
17
-
18
- system "gem install " +
19
- spec.dependencies.select { |dep| dep.type == :runtime }.
20
- collect(&:name).join(" ")
21
- end
22
-
23
13
  desc "Launch Integrity real quick"
24
14
  task :launch do
25
15
  ruby "bin/integrity launch"
@@ -28,39 +18,27 @@ end
28
18
  desc "Run tests"
29
19
  task :test => %w(test:units test:acceptance)
30
20
  namespace :test do
21
+ desc "Run unit tests"
31
22
  Rake::TestTask.new(:units) do |t|
32
23
  t.test_files = FileList["test/unit/*_test.rb"]
33
24
  end
34
25
 
26
+ desc "Run acceptance tests"
35
27
  Rake::TestTask.new(:acceptance) do |t|
36
28
  t.test_files = FileList["test/acceptance/*_test.rb"]
37
29
  end
38
-
39
- desc "Install tests dependencies"
40
- task :setup do
41
- puts "NOTE: assuming you have gems.github.com in your gem sources"
42
-
43
- system "gem install " +
44
- spec.dependencies.select { |dep| dep.type == :development }.
45
- collect(&:name).join(" ")
46
- end
47
30
  end
48
31
 
49
32
  begin
50
33
  require "mg"
51
- MG.new("integrity.gemspec")
52
- rescue LoadError
53
- end
54
-
55
- begin
56
34
  require "metric_fu"
35
+
36
+ MG.new("integrity.gemspec")
57
37
  rescue LoadError
58
38
  end
59
39
 
60
40
  desc "Special task for running tests on <http://builder.integrityapp.com>"
61
41
  task :ci do
62
- sh "git submodule update --init"
63
-
64
42
  Rake::Task["test"].invoke
65
43
 
66
44
  metrics = %w(flay flog:all reek roodi saikuro)
@@ -70,10 +48,10 @@ task :ci do
70
48
  mv "tmp/metric_fu", "/var/www/integrity-metrics"
71
49
 
72
50
  File.open("/var/www/integrity-metrics/index.html", "w") { |f|
73
- f << "<ul>"
51
+ f.puts "<ul>"
74
52
  metrics.map { |m| m.split(":").first }.each { |m|
75
- f << %Q(<li><a href="/#{m}">#{m}</a></li>)
53
+ f.puts %Q(<li><a href="/#{m}">#{m}</a></li>)
76
54
  }
77
- f << "</ul>"
55
+ f.puts "</ul>"
78
56
  }
79
57
  end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "integrity"
3
- s.version = "0.1.9.2"
4
- s.date = "2009-03-16"
3
+ s.version = "0.1.9.3"
4
+ s.date = "2009-04-06"
5
5
 
6
6
  s.description = "Your Friendly Continuous Integration server. Easy, fun and painless!"
7
7
  s.summary = "The easy and fun Continuous Integration server"
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency "sinatra", [">= 0.9.1.1"]
22
22
  s.add_dependency "sinatra-authorization"
23
23
  s.add_dependency "haml", [">= 2.0.0"]
24
- s.add_dependency "data_mapper", [">= 0.9.10"]
24
+ s.add_dependency "data_mapper", ["= 0.9.11"]
25
25
  s.add_dependency "uuidtools" # required by dm-types
26
26
  s.add_dependency "bcrypt-ruby" # required by dm-types
27
27
  s.add_dependency "json"
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
35
35
  s.add_development_dependency "dm-sweatshop"
36
36
  s.add_development_dependency "ParseTree" # required by dm-sweatshop
37
37
  s.add_development_dependency "jeremymcanally-context"
38
+ s.add_development_dependency "jeremymcanally-matchy"
38
39
  s.add_development_dependency "jeremymcanally-pending"
39
40
  s.add_development_dependency "foca-storyteller"
40
41
  end
@@ -42,7 +43,7 @@ Gem::Specification.new do |s|
42
43
  s.files = %w[
43
44
  .gitignore
44
45
  CHANGES
45
- README.markdown
46
+ README.md
46
47
  Rakefile
47
48
  bin/integrity
48
49
  config/config.sample.ru
@@ -75,6 +76,8 @@ lib/integrity/notifier/test.rb
75
76
  lib/integrity/notifier/test/fixtures.rb
76
77
  lib/integrity/notifier/test/hpricot_matcher.rb
77
78
  lib/integrity/project.rb
79
+ lib/integrity/project/notifiers.rb
80
+ lib/integrity/project/push.rb
78
81
  lib/integrity/project_builder.rb
79
82
  lib/integrity/scm.rb
80
83
  lib/integrity/scm/git.rb
@@ -93,7 +96,6 @@ test/acceptance/error_page_test.rb
93
96
  test/acceptance/installer_test.rb
94
97
  test/acceptance/manual_build_project_test.rb
95
98
  test/acceptance/not_found_page_test.rb
96
- test/acceptance/notifier_test.rb
97
99
  test/acceptance/project_syndication_test.rb
98
100
  test/acceptance/stylesheet_test.rb
99
101
  test/acceptance/unauthorized_page_test.rb
@@ -101,19 +103,20 @@ test/helpers.rb
101
103
  test/helpers/acceptance.rb
102
104
  test/helpers/acceptance/email_notifier.rb
103
105
  test/helpers/acceptance/git_helper.rb
106
+ test/helpers/acceptance/notifier_helper.rb
104
107
  test/helpers/acceptance/textfile_notifier.rb
105
108
  test/helpers/expectations.rb
106
109
  test/helpers/expectations/be_a.rb
107
110
  test/helpers/expectations/change.rb
108
111
  test/helpers/expectations/have.rb
109
112
  test/helpers/expectations/predicates.rb
110
- test/helpers/fixtures.rb
111
113
  test/helpers/initial_migration_fixture.sql
112
114
  test/unit/build_test.rb
113
115
  test/unit/commit_test.rb
114
116
  test/unit/helpers_test.rb
115
117
  test/unit/integrity_test.rb
116
118
  test/unit/migrations_test.rb
119
+ test/unit/notifier/base_test.rb
117
120
  test/unit/notifier/test_test.rb
118
121
  test/unit/notifier_test.rb
119
122
  test/unit/project_builder_test.rb
@@ -69,9 +69,9 @@ module Integrity
69
69
  end
70
70
  private_class_method :logger
71
71
 
72
- class LogFormatter < Logger::Formatter
73
- def call(severity, time, progname, msg)
74
- time.strftime("[%H:%M:%S] ") + msg2str(msg) + "\n"
75
- end
72
+ class LogFormatter < Logger::Formatter
73
+ def call(severity, time, progname, msg)
74
+ time.strftime("[%H:%M:%S] ") + msg2str(msg) + "\n"
76
75
  end
76
+ end
77
77
  end
@@ -121,7 +121,7 @@ module Integrity
121
121
  get "/:project/commits/:commit" do
122
122
  login_required unless current_project.public?
123
123
 
124
- show :build, :title => ["projects", current_project.permalink, current_commit.short_commit_identifier]
124
+ show :build, :title => ["projects", current_project.permalink, current_commit.short_identifier]
125
125
  end
126
126
 
127
127
  get "/:project/builds/:commit" do
@@ -11,7 +11,8 @@ module Integrity
11
11
  property :started_at, DateTime
12
12
  property :completed_at, DateTime
13
13
 
14
- belongs_to :commit, :class_name => "Integrity::Commit"
14
+ belongs_to :commit, :class_name => "Integrity::Commit",
15
+ :child_key => [:commit_id]
15
16
 
16
17
  def self.pending
17
18
  all(:started_at => nil)
@@ -47,45 +48,5 @@ module Integrity
47
48
  def complete!(time=Time.now)
48
49
  self.completed_at = time
49
50
  end
50
-
51
- #
52
- # Deprecated methods
53
- #
54
- def short_commit_identifier
55
- warn "Build#short_commit_identifier is deprecated, use Commit#short_identifier (#{caller[0]})"
56
- commit.short_identifier
57
- end
58
-
59
- def commit_identifier
60
- warn "Build#commit_identifier is deprecated, use Commit#identifier (#{caller[0]})"
61
- commit.identifier
62
- end
63
-
64
- def commit_author
65
- warn "Build#commit_author is deprecated, use Commit#author (#{caller[0]})"
66
- commit.author
67
- end
68
-
69
- def commit_message
70
- warn "Build#commit_message is deprecated, use Commit#message (#{caller[0]})"
71
- commit.message
72
- end
73
-
74
- def commited_at
75
- warn "Build#commited_at is deprecated, use Commit#committed_at (#{caller[0]})"
76
- commit.committed_at
77
- end
78
-
79
- def project_id
80
- warn "Build#project_id is deprecated, use Commit#project_id (#{caller[0]})"
81
- commit.project_id
82
- end
83
-
84
- def commit_metadata
85
- warn "Build#commit_metadata is deprecated, use the different methods in Commit instead (#{caller[0]})"
86
- { :message => commit.message,
87
- :author => commit.author,
88
- :date => commit.committed_at }
89
- end
90
51
  end
91
52
  end
@@ -10,15 +10,19 @@ module Integrity
10
10
  property :created_at, DateTime
11
11
  property :updated_at, DateTime
12
12
 
13
- has 1, :build, :class_name => "Integrity::Build", :order => [:created_at.desc]
14
- belongs_to :project, :class_name => "Integrity::Project"
13
+ has 1, :build, :class_name => "Integrity::Build",
14
+ :order => [:created_at.desc]
15
+
16
+ belongs_to :project, :class_name => "Integrity::Project",
17
+ :child_key => [:project_id]
15
18
 
16
19
  def message
17
20
  attribute_get(:message) || "<Commit message not loaded>"
18
21
  end
19
22
 
20
23
  def author
21
- attribute_get(:author) || Author.load('<Commit author not loaded> <<Commit author not loaded>>', :author)
24
+ attribute_get(:author) ||
25
+ Author.load('<Commit author not loaded> <<Commit author not loaded>>', :author)
22
26
  end
23
27
 
24
28
  def short_identifier
@@ -52,12 +56,5 @@ module Integrity
52
56
  def output
53
57
  build && build.output
54
58
  end
55
-
56
- # Deprecation layer
57
- alias :short_commit_identifier :short_identifier
58
- alias :commit_identifier :identifier
59
- alias :commit_author :author
60
- alias :commit_message :message
61
- alias :commited_at :committed_at
62
59
  end
63
60
  end
@@ -2,7 +2,7 @@ module Integrity
2
2
  module Helpers
3
3
  module Breadcrumbs
4
4
  def pages
5
- @pages ||= [["projects", root_path], ["new project", root_path("/new")]]
5
+ @pages ||= [["projects", root_path("/")], ["new project", root_path("/new")]]
6
6
  end
7
7
 
8
8
  def breadcrumbs(*crumbs)
@@ -16,12 +16,13 @@ module Integrity
16
16
  attrs.update(extras)
17
17
  end
18
18
 
19
- def notifier_form(notifier)
20
- haml(notifier.to_haml, :layout => :notifier, :locals => {
21
- :config => current_project.config_for(notifier),
22
- :notifier => "#{notifier.to_s.split(/::/).last}",
23
- :enabled => current_project.notifies?(notifier)
24
- })
19
+ def notifier_form
20
+ Notifier.available.each_pair { |name, klass|
21
+ haml_concat haml(klass.to_haml, :layout => :notifier, :locals => {
22
+ :notifier => name,
23
+ :enabled => current_project.notifies?(name),
24
+ :config => current_project.config_for(name) })
25
+ }
25
26
  end
26
27
  end
27
28
  end
@@ -11,7 +11,7 @@ module Integrity
11
11
 
12
12
  def update_notifiers_of(project)
13
13
  if params["notifiers"]
14
- project.enable_notifiers(params["notifiers"].keys, params["notifiers"])
14
+ project.update_notifiers(params["enabled_notifiers"] || [], params["notifiers"])
15
15
  end
16
16
  end
17
17
  end
@@ -21,7 +21,6 @@ module Integrity
21
21
  create_dir_structure
22
22
  copy_template_files
23
23
  edit_template_files
24
- migrate_db(root.join("config.yml"))
25
24
  puts post_install_message
26
25
  end
27
26
  end
@@ -45,6 +44,7 @@ module Integrity
45
44
 
46
45
  File.file?(options[:config].to_s) ?
47
46
  Integrity.new(options[:config]) : Integrity.new
47
+ Integrity.config[:base_uri] = "http://0.0.0.0:#{options[:port]}"
48
48
 
49
49
  DataMapper.auto_migrate!
50
50
 
@@ -109,6 +109,11 @@ EOF
109
109
  <<EOF
110
110
  Awesome! Integrity was installed successfully!
111
111
 
112
+ To complete the installation, please configure the `database_uri` in
113
+ #{root.join("config.yml")} and install the matching DataMapper adapter if
114
+ necessary. Then, run `integrity migrate_db #{root.join("config.yml")}
115
+
116
+ == Notifiers
112
117
  If you want to enable notifiers, install the gems and then require them
113
118
  in #{root}/config.ru
114
119
 
@@ -84,8 +84,8 @@ module Integrity
84
84
  create_table :integrity_commits do
85
85
  column :id, Integer, :serial => true
86
86
  column :identifier, String, :nullable => false
87
- column :message, String, :nullable => false, :length => 255
88
- column :author, String, :nullable => false, :length => 255
87
+ column :message, String, :nullable => true, :length => 255
88
+ column :author, String, :nullable => true, :length => 255
89
89
  column :committed_at, DateTime, :nullable => false
90
90
  column :created_at, DateTime
91
91
  column :updated_at, DateTime
@@ -136,5 +136,16 @@ module Integrity
136
136
  end
137
137
  end
138
138
  end
139
+
140
+ migration 3, :add_enabled_column do
141
+ up do
142
+ modify_table(:integrity_notifiers) { add_column :enabled, Boolean }
143
+ end
144
+
145
+ down do
146
+ # TODO: sqlite doesn't support DROP COLUMN ...
147
+ # modify_table(:integrity_notifiers) { drop_column :enabled }
148
+ end
149
+ end
139
150
  end
140
151
  end
@@ -6,43 +6,39 @@ module Integrity
6
6
 
7
7
  property :id, Integer, :serial => true
8
8
  property :name, String, :nullable => false
9
- property :config, Yaml, :nullable => false, :lazy => false
9
+ property :enabled, Boolean, :nullable => false, :default => false
10
+ property :config, Yaml, :nullable => false, :lazy => false
10
11
 
11
- belongs_to :project, :class_name => "Integrity::Project"
12
+ belongs_to :project, :class_name => "Integrity::Project",
13
+ :child_key => [:project_id]
12
14
 
13
15
  validates_is_unique :name, :scope => :project_id
14
16
  validates_present :project_id
15
17
 
16
18
  def self.available
17
- constants.map { |name| const_get(name) }.select { |notifier| valid_notifier?(notifier) }
19
+ @@_notifiers ||= {}
20
+ @@_notifiers
18
21
  end
19
22
 
20
- def self.enable_notifiers(project, enabled, config={})
21
- all(:project_id => project).destroy!
22
- list_of_enabled_notifiers(enabled).each do |name|
23
- create! :project_id => project, :name => name, :config => config[name]
24
- end
23
+ def self.register(klass)
24
+ raise ArgumentError unless valid?(klass)
25
+
26
+ available[klass.to_s.split(":").last] = klass
27
+ end
25
28
 
29
+ def self.valid?(notifier)
30
+ notifier.respond_to?(:to_haml) && notifier.respond_to?(:notify_of_build) &&
31
+ notifier != Notifier::Base
26
32
  end
33
+ private_class_method :valid?
27
34
 
28
35
  def notify_of_build(build)
29
36
  to_const.notify_of_build(build, config)
30
37
  end
31
38
 
32
39
  private
33
-
34
40
  def to_const
35
- self.class.module_eval(name)
36
- end
37
-
38
- def self.list_of_enabled_notifiers(names)
39
- [*names].reject { |n| n.nil? }
40
- end
41
- private_class_method :list_of_enabled_notifiers
42
-
43
- def self.valid_notifier?(notifier)
44
- notifier.respond_to?(:to_haml) && notifier.respond_to?(:notify_of_build) && notifier != Notifier::Base
41
+ self.class.available[name]
45
42
  end
46
- private_class_method :valid_notifier?
47
43
  end
48
44
  end