foca-integrity 0.1.0 → 0.1.1

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.
data/README.markdown CHANGED
@@ -12,25 +12,28 @@ It has been designed with ruby projects in mind, but any project that can be
12
12
  tested in an unix-y fashion (with a command line tool that returns 0 on success
13
13
  and non-zero on failure) works with it.
14
14
 
15
- Integrity works out of the box with [git][] projects, but support for other
16
- SCMs like [Subversion][svn] is planned.
17
-
18
15
  Getting Started
19
16
  ===============
20
17
 
21
- Clone the source from our [git repository][repo]:
18
+ Install the `integrity` gem from GitHub:
19
+
20
+ gem sources add http://gems.github.com
21
+ sudo gem install foca-integrity
22
+
23
+ In order to setup Integrity, run the following command:
24
+
25
+ integrity install /path/to/my/app
26
+
27
+ Then browse to /path/to/my/app and edit the config files at your convenience.
28
+ The default configuration should be "good enough" in most cases, so you should
29
+ be pretty much ready to rock.
22
30
 
23
- gem install dm-core dm-more data_objects do_sqlite3 bcrypt-ruby sinatra json haml xmpp4r-simple rcov hoe sr-sinatra-diddies --source=http://gems.github.com
24
- git clone git://github.com/foca/integrity.git
25
- cd integrity
26
- git submodule update --init
27
- cp config/config.sample.yml config/config.yml
28
- $EDITOR config/config.yml
29
- rake db:migrate
30
- ruby app.rb
31
+ For deployment, we recommend [Thin][]. Provided with Integrity comes a thin.yml
32
+ file, so all you need to do after running `integrity install` should be
31
33
 
32
- Now you can go to http://localhost:4567, add your first project, and enjoy
33
- safer coding, with integrity.
34
+ thin -C /path/to/my/app/thin.yml -R /path/to/my/app/config.ru start
35
+
36
+ And you should be up and running.
34
37
 
35
38
  If you want automatic commit processing, you currently need to be using
36
39
  [GitHub][]. Click the edit link on your GitHub project, and add an integrity
@@ -38,16 +41,26 @@ link that looks like the following to the `Post-Receive URL` field:
38
41
 
39
42
  http://integrity.domain.tld/projectname/push
40
43
 
41
- Configuration
42
- =============
44
+ Receiving Notifications
45
+ =======================
46
+
47
+ If you want to be notified after each build, you need to install our notifiers.
48
+ For example, in order to receive an email after each build, install:
49
+
50
+ sudo gem install foca-integrity-email
51
+
52
+ And then edit `/path/to/my/app/config.ru` and add:
53
+
54
+ require "notifier/email"
55
+
56
+ After all the `require` lines.
43
57
 
44
- The `config.yml` only needs two settings:
58
+ Available notifiers
59
+ -------------------
45
60
 
46
- * `database_uri`: this should be a complete connection string to your database.
47
- For example `mysql://user@localhost/integrity` (you need an `integrity` db
48
- created in localhost, of course).
49
- * `export_directory`: This is where your project's code will be checked out to.
50
- Make sure it's writable by the user that runs Integrity.
61
+ * [Mail](http://github.com/foca/integrity-email)
62
+ * [Jabber](http://github.com/ph/integrity-jabber)
63
+ * [Campfire](http://github.com/defunkt/integrity-campfire)
51
64
 
52
65
  Resources
53
66
  ========
@@ -60,7 +73,8 @@ Future plans
60
73
  ============
61
74
 
62
75
  * [Twitter][]/[IRC][]/etc bots
63
- * Other SCMs like Subversion
76
+ * A sample generic post-receive-hook so you can run this from any git repo
77
+ * Better integration with GitHub
64
78
 
65
79
  Development
66
80
  ===========
@@ -126,6 +140,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
126
140
  [IRC]: http://wikipedia.org/wiki/IRC
127
141
  [entp]: http://entp.com
128
142
  [GitHub]: http://github.com
143
+ [Thin]: http://code.macournoyer.com/thin/
129
144
 
130
145
  [rspec]: http://rspec.info
131
146
  [rcov]: http://eigenclass.org/hiki.rb?rcov
@@ -135,5 +150,4 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
135
150
  [lighthouse]: http://integrity.lighthouseapp.com/projects/14308-integrity
136
151
  [irc-channel]: irc://irc.freenode.net/integrity
137
152
 
138
- [sr]: http://atonie.org/
139
153
  [foca]: http://nicolassanguinetti.info/
data/Rakefile CHANGED
@@ -28,11 +28,12 @@ namespace :spec do
28
28
  end
29
29
  end
30
30
 
31
-
32
31
  namespace :db do
33
32
  desc "Setup connection."
34
33
  task :connect do
35
- ENV['CONFIG'] ? Integrity.new(ENV['CONFIG']) : Integrity.new
34
+ config = File.expand_path(ENV['CONFIG']) if ENV['CONFIG']
35
+ config = Integrity.root / 'config.yml' if File.exists?(Integrity.root / 'config.yml')
36
+ Integrity.new(config)
36
37
  end
37
38
 
38
39
  desc "Automigrate the database"
@@ -44,44 +45,34 @@ namespace :db do
44
45
  end
45
46
  end
46
47
 
47
- namespace :gem do
48
- desc "Generate the gemspec at the root dir"
49
- task :gemspec do
48
+ begin
49
+ require 'jeweler'
50
+ Jeweler::Tasks.new do |s|
50
51
  files = `git ls-files`.split("\n").reject {|f| f =~ %r(^spec) || f =~ %r(^vendor/rspec) || f =~ /^\.git/ }
51
52
  files += %w(spec/spec_helper.rb spec/form_field_matchers.rb)
52
-
53
- gemspec = <<-GEM
54
- Gem::Specification.new do |s|
55
- s.name = 'integrity'
56
- s.version = '#{Integrity::VERSION}'
57
- s.date = '#{Date.today.to_s}'
58
- s.summary = 'The easy and fun Continuous Integration server'
59
- s.description = 'Your Friendly Continuous Integration server. Easy, fun and painless!'
60
- s.homepage = 'http://integrityapp.com'
61
- s.rubyforge_project = 'integrity'
62
- s.email = 'contacto@nicolassanguinetti.info'
63
- s.authors = ['Nicolás Sanguinetti', 'Simon Rozet']
64
- s.has_rdoc = false
65
- s.executables = ['integrity']
66
- s.files = %w(
67
- #{files.join("\n" + " " * 26)}
68
- )
69
53
 
70
- s.add_dependency 'sinatra', ['>= 0.3.2']
71
- s.add_dependency 'dm-core', ['>= 0.9.5']
72
- s.add_dependency 'dm-validations', ['>= 0.9.5']
73
- s.add_dependency 'dm-types', ['>= 0.9.5']
74
- s.add_dependency 'dm-timestamps', ['>= 0.9.5']
75
- s.add_dependency 'dm-aggregates', ['>= 0.9.5']
76
- s.add_dependency 'data_objects', ['>= 0.9.5']
77
- s.add_dependency 'do_sqlite3', ['>= 0.9.5']
78
- s.add_dependency 'json'
79
- s.add_dependency 'foca-sinatra-diddies', ['>= 0.0.2']
80
- s.add_dependency 'rspec_hpricot_matchers'
81
- s.add_dependency 'thor'
82
- end
83
- GEM
84
-
85
- File.open(Integrity.root / "integrity.gemspec", "w") {|f| f.puts gemspec }
54
+ s.name = 'integrity'
55
+ s.summary = 'The easy and fun Continuous Integration server'
56
+ s.description = 'Your Friendly Continuous Integration server. Easy, fun and painless!'
57
+ s.homepage = 'http://integrityapp.com'
58
+ s.rubyforge_project = 'integrity'
59
+ s.email = 'contacto@nicolassanguinetti.info'
60
+ s.authors = ['Nicolás Sanguinetti', 'Simon Rozet']
61
+ s.files = files
62
+
63
+ s.add_dependency 'sinatra', ['>= 0.3.2']
64
+ s.add_dependency 'dm-core', ['>= 0.9.5']
65
+ s.add_dependency 'dm-validations', ['>= 0.9.5']
66
+ s.add_dependency 'dm-types', ['>= 0.9.5']
67
+ s.add_dependency 'dm-timestamps', ['>= 0.9.5']
68
+ s.add_dependency 'dm-aggregates', ['>= 0.9.5']
69
+ s.add_dependency 'data_objects', ['>= 0.9.5']
70
+ s.add_dependency 'do_sqlite3', ['>= 0.9.5']
71
+ s.add_dependency 'json'
72
+ s.add_dependency 'foca-sinatra-diddies', ['>= 0.0.2']
73
+ s.add_dependency 'rspec_hpricot_matchers'
74
+ s.add_dependency 'thor'
86
75
  end
76
+ rescue LoadError
87
77
  end
78
+
data/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ major: 0
3
+ minor: 1
4
+ patch: 1
data/app.rb CHANGED
@@ -11,6 +11,11 @@ enable :sessions
11
11
 
12
12
  include Integrity
13
13
 
14
+ configure :development do
15
+ config = Integrity.root / "config" / "config.yml"
16
+ Integrity.config = config if File.exists? config
17
+ end
18
+
14
19
  configure do
15
20
  Integrity.new
16
21
  end
@@ -87,11 +92,13 @@ get "/:project/edit" do
87
92
  end
88
93
 
89
94
  post "/:project/push" do
95
+ login_required
96
+
90
97
  content_type 'text/plain'
91
98
 
92
99
  begin
93
100
  payload = JSON.parse(params[:payload] || "")
94
- payload['commits'].each do |commit|
101
+ payload['commits'].reverse.each do |commit|
95
102
  current_project.build(commit['id']) if payload['ref'] =~ /#{current_project.branch}/
96
103
  end
97
104
  'Thanks, build started.'
data/bin/integrity CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
-
3
2
  require "rubygems"
4
- require "integrity"
5
3
  require "thor"
6
4
 
5
+ require File.dirname(__FILE__) + "/../lib/integrity"
6
+
7
7
  class WithIntegrity < Thor
8
8
  include FileUtils
9
9
 
@@ -15,8 +15,16 @@ class WithIntegrity < Thor
15
15
  create_dir_structure
16
16
  copy_template_files
17
17
  edit_template_files
18
+ create_db(root / 'config.yml')
18
19
  after_setup_message
19
20
  end
21
+
22
+ desc "Create database based on the config file at CONFIG",
23
+ "Checks the `database_uri` in CONFIG and creates and bootstraps a database for integrity"
24
+ def create_db(config)
25
+ Integrity.new(config)
26
+ DataMapper.auto_migrate!
27
+ end
20
28
 
21
29
  private
22
30
  attr_reader :root
@@ -34,11 +42,22 @@ class WithIntegrity < Thor
34
42
  end
35
43
 
36
44
  def edit_template_files
45
+ edit_integrity_configuration
46
+ edit_thin_configuration
47
+ end
48
+
49
+ def edit_integrity_configuration
37
50
  config = File.read(root / "config.yml")
38
51
  config.gsub!(%r(sqlite3:///var/integrity.db), "sqlite3://#{root}/integrity.db")
39
52
  config.gsub!(%r(/path/to/scm/exports), "#{root}/builds")
40
53
  File.open(root / "config.yml", "w") {|f| f.puts config }
41
54
  end
55
+
56
+ def edit_thin_configuration
57
+ config = File.read(root / 'thin.yml')
58
+ config.gsub!(%r(/apps/integrity), root)
59
+ File.open(root / 'thin.yml', 'w') { |f| f.puts config }
60
+ end
42
61
 
43
62
  def after_setup_message
44
63
  puts
@@ -54,7 +73,9 @@ class WithIntegrity < Thor
54
73
  puts %Q(And then in #{root}/config.ru add:)
55
74
  puts
56
75
  puts %Q( require "notifier/email")
76
+ puts
77
+ puts %Q(Don't forget to tweak #{root / "config.yml"} to your needs.)
57
78
  end
58
79
  end
59
80
 
60
- WithIntegrity.start
81
+ WithIntegrity.start
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- require "lib/integrity"
3
- require "sinatra"
2
+ require 'rubygems'
3
+ require 'integrity'
4
4
 
5
5
  # If you want to add any notifiers, install the gems and then require them here
6
6
  # For example, to enable the Email notifier: install the gem (from github:
@@ -12,19 +12,19 @@ require "sinatra"
12
12
  # require "notifier/email"
13
13
 
14
14
  # Load integrity's configuration.
15
- Integrity.config = File.expand_path("./config.yml")
15
+ Integrity.config = File.expand_path('./config.yml')
16
16
 
17
17
  #######################################################################
18
18
  ## ##
19
19
  ## == DON'T EDIT ANYTHING BELOW UNLESS YOU KNOW WHAT YOU'RE DOING == ##
20
20
  ## ##
21
21
  #######################################################################
22
+ require Integrity.root / 'app'
23
+
24
+ set :public, Integrity.root / 'public'
25
+ set :views, Integrity.root / 'views'
26
+ set :port, 8910
27
+ set :env, :production
28
+ disable :run, :reload
22
29
 
23
- Sinatra::Application.default_options.merge!(
24
- :run => false,
25
- :port => Integrity.config[:port],
26
- :env => :production
27
- )
28
-
29
- require "app"
30
30
  run Sinatra.application
@@ -1,8 +1,31 @@
1
+ # Domain where integrity will be running from. This is used to have
2
+ # nice URLs in your notifications.
3
+ # For example:
4
+ # http://builder.integrityapp.com
1
5
  :base_uri: http://integrity.domain.tld
6
+
7
+ # This should be a complete connection string to your database. For example
8
+ # `mysql://user@localhost/integrity` (you need an `integrity` db created in
9
+ # localhost, of course).
2
10
  :database_uri: sqlite3:///var/integrity.db
11
+
12
+ # This is where your project's code will be checked out to. Make sure it's
13
+ # writable by the user that runs Integrity.
3
14
  :export_directory: /path/to/scm/exports
4
- :hash_admin_password: true
5
- :use_basic_auth: true
15
+
16
+ # Enable or disable HTTP authentication for the app. BE AWARE that if you
17
+ # disable this anyone can delete and alter projects, so do it only if your
18
+ # app is running in a controlled environment (ie, behind your company's
19
+ # firewall.)
20
+ :use_basic_auth: false
21
+
22
+ # When `use_basic_auth` is true, the admin's username for HTTP authentication.
6
23
  :admin_username: username
24
+
25
+ # When `use_basic_auth` is true, the admin's password. Usually saved as a
26
+ # SHA1 hash. See the next option.
7
27
  :admin_password: a94a8fe5ccb19ba61c4c0873d391e987982fbbd3
8
- :port: 4567
28
+
29
+ # If this is true, then whenever we authenticate the admin user, will hash
30
+ # it using SHA1. If not, we'll assume the provided password is in plain text.
31
+ :hash_admin_password: true
@@ -2,8 +2,6 @@
2
2
  environment: production
3
3
  chdir: /apps/integrity
4
4
  address: 127.0.0.1
5
- user: deploy
6
- group: deploy
7
5
  port: 8910
8
6
  pid: /apps/integrity/thin.pid
9
7
  rackup: /apps/integrity/config.ru
@@ -12,3 +10,4 @@ max_conns: 1024
12
10
  timeout: 30
13
11
  max_persistent_conns: 512
14
12
  daemonize: true
13
+ servers: 2
data/integrity.gemspec CHANGED
@@ -1,65 +1,64 @@
1
1
  Gem::Specification.new do |s|
2
- s.name = 'integrity'
3
- s.version = '0.1.0'
4
- s.date = '2008-11-14'
5
- s.summary = 'The easy and fun Continuous Integration server'
6
- s.description = 'Your Friendly Continuous Integration server. Easy, fun and painless!'
7
- s.homepage = 'http://integrityapp.com'
8
- s.rubyforge_project = 'integrity'
9
- s.email = 'contacto@nicolassanguinetti.info'
10
- s.authors = ['Nicolás Sanguinetti', 'Simon Rozet']
11
- s.has_rdoc = false
12
- s.executables = ['integrity']
13
- s.files = %w(
14
- README.markdown
15
- Rakefile
16
- app.rb
17
- bin/integrity
18
- config/config.sample.ru
19
- config/config.sample.yml
20
- config/thin.sample.yml
21
- integrity.gemspec
22
- lib/integrity.rb
23
- lib/integrity/build.rb
24
- lib/integrity/builder.rb
25
- lib/integrity/core_ext/object.rb
26
- lib/integrity/core_ext/string.rb
27
- lib/integrity/core_ext/time.rb
28
- lib/integrity/notifier.rb
29
- lib/integrity/notifier/base.rb
30
- lib/integrity/project.rb
31
- lib/integrity/scm.rb
32
- lib/integrity/scm/git.rb
33
- lib/integrity/scm/git/uri.rb
34
- lib/integrity/version.rb
35
- public/buttons.css
36
- public/reset.css
37
- public/spinner.gif
38
- vendor/sinatra-hacks/lib/hacks.rb
39
- views/build.haml
40
- views/build_info.haml
41
- views/home.haml
42
- views/integrity.sass
43
- views/layout.haml
44
- views/new.haml
45
- views/not_found.haml
46
- views/notifier.haml
47
- views/project.haml
48
- views/unauthorized.haml
49
- spec/spec_helper.rb
50
- spec/form_field_matchers.rb
51
- )
2
+ s.name = %q{integrity}
3
+ s.version = "0.1.1"
52
4
 
53
- s.add_dependency 'sinatra', ['>= 0.3.2']
54
- s.add_dependency 'dm-core', ['>= 0.9.5']
55
- s.add_dependency 'dm-validations', ['>= 0.9.5']
56
- s.add_dependency 'dm-types', ['>= 0.9.5']
57
- s.add_dependency 'dm-timestamps', ['>= 0.9.5']
58
- s.add_dependency 'dm-aggregates', ['>= 0.9.5']
59
- s.add_dependency 'data_objects', ['>= 0.9.5']
60
- s.add_dependency 'do_sqlite3', ['>= 0.9.5']
61
- s.add_dependency 'json'
62
- s.add_dependency 'foca-sinatra-diddies', ['>= 0.0.2']
63
- s.add_dependency 'rspec_hpricot_matchers'
64
- s.add_dependency 'thor'
5
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
+ s.authors = ["Nicol\303\241s Sanguinetti", "Simon Rozet"]
7
+ s.date = %q{2008-11-17}
8
+ s.description = %q{Your Friendly Continuous Integration server. Easy, fun and painless!}
9
+ s.email = %q{contacto@nicolassanguinetti.info}
10
+ 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/builder.rb", "lib/integrity/core_ext/object.rb", "lib/integrity/core_ext/string.rb", "lib/integrity/core_ext/time.rb", "lib/integrity/notifier.rb", "lib/integrity/notifier/base.rb", "lib/integrity/project.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", "vendor/sinatra-hacks/lib/hacks.rb", "views/build.haml", "views/build_info.haml", "views/home.haml", "views/integrity.sass", "views/layout.haml", "views/new.haml", "views/not_found.haml", "views/notifier.haml", "views/project.haml", "views/unauthorized.haml", "spec/spec_helper.rb", "spec/form_field_matchers.rb"]
11
+ s.homepage = %q{http://integrityapp.com}
12
+ s.require_paths = ["lib"]
13
+ s.rubyforge_project = %q{integrity}
14
+ s.rubygems_version = %q{1.2.0}
15
+ s.summary = %q{The easy and fun Continuous Integration server}
16
+ s.executables = ['integrity']
17
+ s.post_install_message = %q{Run `integrity help` for information on how to setup Integrity.}
18
+
19
+ if s.respond_to? :specification_version then
20
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
21
+ s.specification_version = 2
22
+
23
+ if current_version >= 3 then
24
+ s.add_runtime_dependency(%q<sinatra>, [">= 0.3.2"])
25
+ s.add_runtime_dependency(%q<dm-core>, [">= 0.9.5"])
26
+ s.add_runtime_dependency(%q<dm-validations>, [">= 0.9.5"])
27
+ s.add_runtime_dependency(%q<dm-types>, [">= 0.9.5"])
28
+ s.add_runtime_dependency(%q<dm-timestamps>, [">= 0.9.5"])
29
+ s.add_runtime_dependency(%q<dm-aggregates>, [">= 0.9.5"])
30
+ s.add_runtime_dependency(%q<data_objects>, [">= 0.9.5"])
31
+ s.add_runtime_dependency(%q<do_sqlite3>, [">= 0.9.5"])
32
+ s.add_runtime_dependency(%q<json>, [">= 0"])
33
+ s.add_runtime_dependency(%q<foca-sinatra-diddies>, [">= 0.0.2"])
34
+ s.add_runtime_dependency(%q<rspec_hpricot_matchers>, [">= 0"])
35
+ s.add_runtime_dependency(%q<thor>, [">= 0"])
36
+ else
37
+ s.add_dependency(%q<sinatra>, [">= 0.3.2"])
38
+ s.add_dependency(%q<dm-core>, [">= 0.9.5"])
39
+ s.add_dependency(%q<dm-validations>, [">= 0.9.5"])
40
+ s.add_dependency(%q<dm-types>, [">= 0.9.5"])
41
+ s.add_dependency(%q<dm-timestamps>, [">= 0.9.5"])
42
+ s.add_dependency(%q<dm-aggregates>, [">= 0.9.5"])
43
+ s.add_dependency(%q<data_objects>, [">= 0.9.5"])
44
+ s.add_dependency(%q<do_sqlite3>, [">= 0.9.5"])
45
+ s.add_dependency(%q<json>, [">= 0"])
46
+ s.add_dependency(%q<foca-sinatra-diddies>, [">= 0.0.2"])
47
+ s.add_dependency(%q<rspec_hpricot_matchers>, [">= 0"])
48
+ s.add_dependency(%q<thor>, [">= 0"])
49
+ end
50
+ else
51
+ s.add_dependency(%q<sinatra>, [">= 0.3.2"])
52
+ s.add_dependency(%q<dm-core>, [">= 0.9.5"])
53
+ s.add_dependency(%q<dm-validations>, [">= 0.9.5"])
54
+ s.add_dependency(%q<dm-types>, [">= 0.9.5"])
55
+ s.add_dependency(%q<dm-timestamps>, [">= 0.9.5"])
56
+ s.add_dependency(%q<dm-aggregates>, [">= 0.9.5"])
57
+ s.add_dependency(%q<data_objects>, [">= 0.9.5"])
58
+ s.add_dependency(%q<do_sqlite3>, [">= 0.9.5"])
59
+ s.add_dependency(%q<json>, [">= 0"])
60
+ s.add_dependency(%q<foca-sinatra-diddies>, [">= 0.0.2"])
61
+ s.add_dependency(%q<rspec_hpricot_matchers>, [">= 0"])
62
+ s.add_dependency(%q<thor>, [">= 0"])
63
+ end
65
64
  end
@@ -13,6 +13,7 @@ module Integrity
13
13
  end
14
14
 
15
15
  def build(commit)
16
+ Integrity.logger.info "Building #{commit} (#{@branch}) of #{@build.project.name} in #{export_directory} using #{scm_name}"
16
17
  @scm.with_revision(commit) { run_build_script }
17
18
  @build
18
19
  ensure
@@ -32,7 +33,13 @@ module Integrity
32
33
  Integrity.config[:export_directory] / "#{SCM.working_tree_path(@uri)}-#{@branch}"
33
34
  end
34
35
 
36
+ def scm_name
37
+ @scm.name
38
+ end
39
+
35
40
  def run_build_script
41
+ Integrity.logger.info "Running `#{build_script}` in #{@scm.working_directory}"
42
+
36
43
  IO.popen "(cd #{@scm.working_directory} && #{build_script}) 2>&1", "r" do |pipe|
37
44
  @build.output = pipe.read
38
45
  end
@@ -6,8 +6,7 @@ module Integrity
6
6
  end
7
7
 
8
8
  def self.to_haml
9
- filename = name.split("::").last.downcase
10
- File.read File.join(Integrity.root / "lib" / "integrity" / "notifier" / "#{filename}.haml")
9
+ raise NoMethodError, "you need to implement this method in your notifier"
11
10
  end
12
11
 
13
12
  attr_reader :build
@@ -14,7 +14,7 @@ module Integrity
14
14
  @branch = branch.to_s
15
15
  @working_directory = working_directory
16
16
  end
17
-
17
+
18
18
  def with_revision(revision)
19
19
  fetch_code
20
20
  checkout(revision)
@@ -30,6 +30,10 @@ module Integrity
30
30
  YAML.load(`cd #{working_directory} && git show -s --pretty=format:"#{format}" #{sha1}`)
31
31
  end
32
32
 
33
+ def name
34
+ self.class.name.split("::").last
35
+ end
36
+
33
37
  private
34
38
 
35
39
  def fetch_code
data/lib/integrity.rb CHANGED
@@ -10,16 +10,18 @@ require 'dm-timestamps'
10
10
  require 'dm-aggregates'
11
11
 
12
12
  require 'yaml'
13
+ require 'logger'
13
14
  require 'digest/sha1'
14
15
 
15
16
  require "core_ext/object"
16
17
  require "core_ext/string"
17
18
  require "core_ext/time"
18
19
 
19
- %w(project build builder scm scm/git notifier version).each &method(:require)
20
+ %w(project build builder scm scm/git notifier).each &method(:require)
20
21
 
21
22
  module Integrity
22
- def self.new
23
+ def self.new(config_file = nil)
24
+ self.config = config_file unless config_file.nil?
23
25
  DataMapper.setup(:default, config[:database_uri])
24
26
  end
25
27
 
@@ -28,11 +30,11 @@ module Integrity
28
30
  end
29
31
 
30
32
  def self.default_configuration
31
- @defaults ||= { :database_uri => 'sqlite3::memory:',
33
+ @defaults ||= { :database_uri => 'sqlite3::memory:',
32
34
  :export_directory => root / 'exports',
33
- :base_uri => 'http://localhost:4567',
34
- :use_basic_auth => false,
35
- :port => 9876 }
35
+ :log => STDOUT,
36
+ :base_uri => 'http://localhost:8910',
37
+ :use_basic_auth => false }
36
38
  end
37
39
 
38
40
  def self.config
@@ -41,7 +43,13 @@ module Integrity
41
43
 
42
44
  def self.config=(file)
43
45
  @config = default_configuration.merge(YAML.load_file(file))
44
- rescue Errno::ENOENT
45
- {}
46
+ end
47
+
48
+ def self.logger
49
+ @logger ||= Logger.new(config[:log])
50
+ end
51
+
52
+ def self.logger=(file)
53
+ @logger = Logger.new(file)
46
54
  end
47
55
  end
data/spec/spec_helper.rb CHANGED
@@ -63,9 +63,7 @@ module DatabaseSpecHelper
63
63
 
64
64
  def setup_database!
65
65
  DataMapper.setup(:default, 'sqlite3::memory:')
66
- Integrity::Project.auto_migrate!
67
- Integrity::Build.auto_migrate!
68
- Integrity::Notifier.auto_migrate!
66
+ DataMapper.auto_migrate!
69
67
  end
70
68
  end
71
69
 
data/views/home.haml CHANGED
@@ -8,7 +8,15 @@
8
8
  - else
9
9
  %ul#projects
10
10
  - @projects.each do |project|
11
- %li{ :class => cycle("even", "odd") + (project.building? ? ' building' : '') }
11
+ %li{ :class => cycle("even", "odd") + (project.building? ? ' building' : '') + (project.last_build ? (project.last_build.successful? ? ' success' : ' failed') : '') }
12
12
  %a{ :href => project_url(project) }&= project.name
13
+ .meta
14
+ - if project.building?
15
+ Building!
16
+ - elsif project.last_build.nil?
17
+ Never built yet
18
+ - else
19
+ = "Built #{project.last_build.short_commit_identifier}"
20
+ = project.last_build.successful? ? "successfully" : "and failed"
13
21
  %p#new
14
22
  %a{ :href => "/new" } Add a new project
data/views/integrity.sass CHANGED
@@ -218,21 +218,36 @@ a
218
218
  :margin 1em 0 2em
219
219
  :border-top = 1px solid !rule_color
220
220
  li
221
+ :position relative
221
222
  :border-bottom = 1px solid !rule_color
222
223
  &.odd
223
224
  :background = !content_bg - #080808
224
225
  &.building
225
226
  :background transparent url(/spinner.gif) no-repeat scroll right
226
- a
227
- :font-size 2em
228
- :padding .25em
229
- :line-height 1.2
230
- :font-weight bold
231
- :display block
232
- &.success
227
+ a
228
+ :font-size 2em
229
+ :padding .25em
230
+ :line-height 1.2
231
+ :font-weight bold
232
+ :display block
233
+ &.success
234
+ :color = !success_color
235
+ &.failed
236
+ :color = !failed_color
237
+ .meta
238
+ :position absolute
239
+ :right .6em
240
+ :top 1.5em
241
+ :font-size 0.8em
242
+ :color = !light_color
243
+ :text-align right
244
+ &.building .meta
245
+ :right 1.6em
246
+ &.success .meta
233
247
  :color = !success_color
234
- &.failed
248
+ &.failed .meta
235
249
  :color = !failed_color
250
+
236
251
 
237
252
  #previous_builds
238
253
  li
@@ -247,6 +262,9 @@ a
247
262
  :font-size 1.3em
248
263
  .attribution
249
264
  :font-size .9em
265
+
266
+ #projects, #previous_builds
267
+ li
250
268
  &.success a
251
269
  :background-color = !success_bg
252
270
  :border-color = !success_bg - #222
@@ -263,6 +281,7 @@ a
263
281
  :color = !failed_bg - #444
264
282
  &:hover
265
283
  :background-color = !failed_bg + #222
284
+
266
285
 
267
286
  #build, #last_build
268
287
  h1, blockquote
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.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Nicol\xC3\xA1s Sanguinetti"
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2008-11-14 00:00:00 -08:00
13
+ date: 2008-11-17 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -132,6 +132,7 @@ extra_rdoc_files: []
132
132
  files:
133
133
  - README.markdown
134
134
  - Rakefile
135
+ - VERSION.yml
135
136
  - app.rb
136
137
  - bin/integrity
137
138
  - config/config.sample.ru
@@ -150,7 +151,6 @@ files:
150
151
  - lib/integrity/scm.rb
151
152
  - lib/integrity/scm/git.rb
152
153
  - lib/integrity/scm/git/uri.rb
153
- - lib/integrity/version.rb
154
154
  - public/buttons.css
155
155
  - public/reset.css
156
156
  - public/spinner.gif
@@ -169,7 +169,7 @@ files:
169
169
  - spec/form_field_matchers.rb
170
170
  has_rdoc: false
171
171
  homepage: http://integrityapp.com
172
- post_install_message:
172
+ post_install_message: Run `integrity help` for information on how to setup Integrity.
173
173
  rdoc_options: []
174
174
 
175
175
  require_paths:
@@ -1,3 +0,0 @@
1
- module Integrity
2
- VERSION = "0.1.0"
3
- end