integrity 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (249) hide show
  1. data/README.markdown +7 -0
  2. data/Rakefile +59 -132
  3. data/VERSION.yml +1 -1
  4. data/config/config.ru +29 -0
  5. data/config/config.sample.ru +6 -16
  6. data/config/config.sample.yml +15 -12
  7. data/config/config.yml +34 -0
  8. data/lib/integrity.rb +13 -13
  9. data/lib/integrity/app.rb +138 -0
  10. data/lib/integrity/author.rb +39 -0
  11. data/lib/integrity/build.rb +54 -31
  12. data/lib/integrity/commit.rb +71 -0
  13. data/lib/integrity/helpers.rb +3 -3
  14. data/lib/integrity/helpers/authorization.rb +2 -2
  15. data/lib/integrity/helpers/forms.rb +3 -3
  16. data/lib/integrity/helpers/pretty_output.rb +1 -1
  17. data/lib/integrity/helpers/rendering.rb +6 -1
  18. data/lib/integrity/helpers/resources.rb +9 -3
  19. data/lib/integrity/helpers/urls.rb +15 -13
  20. data/lib/integrity/installer.rb +45 -56
  21. data/lib/integrity/migrations.rb +31 -48
  22. data/lib/integrity/notifier.rb +14 -16
  23. data/lib/integrity/notifier/base.rb +29 -19
  24. data/lib/integrity/notifier/test_helpers.rb +100 -0
  25. data/lib/integrity/project.rb +69 -33
  26. data/lib/integrity/project_builder.rb +23 -14
  27. data/lib/integrity/scm/git.rb +15 -14
  28. data/lib/integrity/scm/git/uri.rb +9 -9
  29. data/test/acceptance/api_test.rb +97 -0
  30. data/test/acceptance/browse_project_builds_test.rb +65 -0
  31. data/test/acceptance/browse_project_test.rb +95 -0
  32. data/test/acceptance/build_notifications_test.rb +42 -0
  33. data/test/acceptance/create_project_test.rb +97 -0
  34. data/test/acceptance/delete_project_test.rb +53 -0
  35. data/test/acceptance/edit_project_test.rb +117 -0
  36. data/test/acceptance/error_page_test.rb +18 -0
  37. data/test/acceptance/helpers.rb +2 -0
  38. data/test/acceptance/installer_test.rb +62 -0
  39. data/test/acceptance/manual_build_project_test.rb +82 -0
  40. data/test/acceptance/notifier_test.rb +109 -0
  41. data/test/acceptance/project_syndication_test.rb +30 -0
  42. data/test/acceptance/stylesheet_test.rb +18 -0
  43. data/test/helpers.rb +59 -26
  44. data/test/helpers/acceptance.rb +19 -65
  45. data/test/helpers/acceptance/email_notifier.rb +55 -0
  46. data/test/helpers/acceptance/git_helper.rb +15 -15
  47. data/test/helpers/acceptance/textfile_notifier.rb +3 -3
  48. data/test/helpers/expectations.rb +0 -1
  49. data/test/helpers/expectations/be_a.rb +4 -4
  50. data/test/helpers/expectations/change.rb +5 -5
  51. data/test/helpers/expectations/have.rb +4 -4
  52. data/test/helpers/expectations/predicates.rb +4 -4
  53. data/test/helpers/fixtures.rb +44 -18
  54. data/test/helpers/initial_migration_fixture.sql +44 -0
  55. data/test/unit/build_test.rb +51 -0
  56. data/test/unit/commit_test.rb +83 -0
  57. data/test/unit/helpers_test.rb +56 -0
  58. data/test/unit/integrity_test.rb +18 -0
  59. data/test/unit/migrations_test.rb +56 -0
  60. data/test/unit/notifier_test.rb +123 -0
  61. data/test/unit/project_builder_test.rb +108 -0
  62. data/test/unit/project_test.rb +282 -0
  63. data/test/unit/scm_test.rb +54 -0
  64. data/vendor/webrat/History.txt +306 -0
  65. data/vendor/webrat/MIT-LICENSE.txt +19 -0
  66. data/vendor/webrat/README.rdoc +85 -0
  67. data/vendor/webrat/Rakefile +151 -0
  68. data/vendor/webrat/install.rb +1 -0
  69. data/vendor/webrat/lib/webrat.rb +34 -0
  70. data/vendor/webrat/lib/webrat/core.rb +14 -0
  71. data/vendor/webrat/lib/webrat/core/configuration.rb +98 -0
  72. data/vendor/webrat/lib/webrat/core/elements/area.rb +31 -0
  73. data/vendor/webrat/lib/webrat/core/elements/element.rb +33 -0
  74. data/vendor/webrat/lib/webrat/core/elements/field.rb +403 -0
  75. data/vendor/webrat/lib/webrat/core/elements/form.rb +103 -0
  76. data/vendor/webrat/lib/webrat/core/elements/label.rb +31 -0
  77. data/vendor/webrat/lib/webrat/core/elements/link.rb +90 -0
  78. data/vendor/webrat/lib/webrat/core/elements/select_option.rb +35 -0
  79. data/vendor/webrat/lib/webrat/core/locators.rb +20 -0
  80. data/vendor/webrat/lib/webrat/core/locators/area_locator.rb +38 -0
  81. data/vendor/webrat/lib/webrat/core/locators/button_locator.rb +54 -0
  82. data/vendor/webrat/lib/webrat/core/locators/field_by_id_locator.rb +37 -0
  83. data/vendor/webrat/lib/webrat/core/locators/field_labeled_locator.rb +56 -0
  84. data/vendor/webrat/lib/webrat/core/locators/field_locator.rb +25 -0
  85. data/vendor/webrat/lib/webrat/core/locators/field_named_locator.rb +41 -0
  86. data/vendor/webrat/lib/webrat/core/locators/form_locator.rb +19 -0
  87. data/vendor/webrat/lib/webrat/core/locators/label_locator.rb +34 -0
  88. data/vendor/webrat/lib/webrat/core/locators/link_locator.rb +66 -0
  89. data/vendor/webrat/lib/webrat/core/locators/locator.rb +20 -0
  90. data/vendor/webrat/lib/webrat/core/locators/select_option_locator.rb +59 -0
  91. data/vendor/webrat/lib/webrat/core/logging.rb +21 -0
  92. data/vendor/webrat/lib/webrat/core/matchers.rb +4 -0
  93. data/vendor/webrat/lib/webrat/core/matchers/have_content.rb +73 -0
  94. data/vendor/webrat/lib/webrat/core/matchers/have_selector.rb +74 -0
  95. data/vendor/webrat/lib/webrat/core/matchers/have_tag.rb +21 -0
  96. data/vendor/webrat/lib/webrat/core/matchers/have_xpath.rb +147 -0
  97. data/vendor/webrat/lib/webrat/core/methods.rb +61 -0
  98. data/vendor/webrat/lib/webrat/core/mime.rb +29 -0
  99. data/vendor/webrat/lib/webrat/core/save_and_open_page.rb +50 -0
  100. data/vendor/webrat/lib/webrat/core/scope.rb +350 -0
  101. data/vendor/webrat/lib/webrat/core/session.rb +281 -0
  102. data/vendor/webrat/lib/webrat/core/xml.rb +115 -0
  103. data/vendor/webrat/lib/webrat/core/xml/hpricot.rb +19 -0
  104. data/vendor/webrat/lib/webrat/core/xml/nokogiri.rb +76 -0
  105. data/vendor/webrat/lib/webrat/core/xml/rexml.rb +24 -0
  106. data/vendor/webrat/lib/webrat/core_extensions/blank.rb +58 -0
  107. data/vendor/webrat/lib/webrat/core_extensions/deprecate.rb +8 -0
  108. data/vendor/webrat/lib/webrat/core_extensions/detect_mapped.rb +12 -0
  109. data/vendor/webrat/lib/webrat/core_extensions/meta_class.rb +6 -0
  110. data/vendor/webrat/lib/webrat/core_extensions/nil_to_param.rb +5 -0
  111. data/vendor/webrat/lib/webrat/mechanize.rb +74 -0
  112. data/vendor/webrat/lib/webrat/merb.rb +9 -0
  113. data/vendor/webrat/lib/webrat/merb_session.rb +65 -0
  114. data/vendor/webrat/lib/webrat/rack.rb +24 -0
  115. data/vendor/webrat/lib/webrat/rails.rb +105 -0
  116. data/vendor/webrat/lib/webrat/rspec-rails.rb +13 -0
  117. data/vendor/webrat/lib/webrat/selenium.rb +154 -0
  118. data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/button.js +12 -0
  119. data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/label.js +16 -0
  120. data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webrat.js +5 -0
  121. data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webratlink.js +9 -0
  122. data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webratlinkwithin.js +15 -0
  123. data/vendor/webrat/lib/webrat/selenium/location_strategy_javascript/webratselectwithoption.js +5 -0
  124. data/vendor/webrat/lib/webrat/selenium/matchers.rb +4 -0
  125. data/vendor/webrat/lib/webrat/selenium/matchers/have_content.rb +66 -0
  126. data/vendor/webrat/lib/webrat/selenium/matchers/have_selector.rb +49 -0
  127. data/vendor/webrat/lib/webrat/selenium/matchers/have_tag.rb +72 -0
  128. data/vendor/webrat/lib/webrat/selenium/matchers/have_xpath.rb +45 -0
  129. data/vendor/webrat/lib/webrat/selenium/selenium_extensions.js +6 -0
  130. data/vendor/webrat/lib/webrat/selenium/selenium_session.rb +247 -0
  131. data/vendor/webrat/lib/webrat/sinatra.rb +44 -0
  132. data/vendor/webrat/spec/fakes/test_session.rb +34 -0
  133. data/vendor/webrat/spec/integration/merb/Rakefile +35 -0
  134. data/vendor/webrat/spec/integration/merb/app/controllers/application.rb +2 -0
  135. data/vendor/webrat/spec/integration/merb/app/controllers/exceptions.rb +13 -0
  136. data/vendor/webrat/spec/integration/merb/app/controllers/testing.rb +18 -0
  137. data/vendor/webrat/spec/integration/merb/app/views/exceptions/not_acceptable.html.erb +63 -0
  138. data/vendor/webrat/spec/integration/merb/app/views/exceptions/not_found.html.erb +47 -0
  139. data/vendor/webrat/spec/integration/merb/app/views/layout/application.html.erb +12 -0
  140. data/vendor/webrat/spec/integration/merb/app/views/testing/show_form.html.erb +27 -0
  141. data/vendor/webrat/spec/integration/merb/config/environments/development.rb +15 -0
  142. data/vendor/webrat/spec/integration/merb/config/environments/rake.rb +11 -0
  143. data/vendor/webrat/spec/integration/merb/config/environments/test.rb +14 -0
  144. data/vendor/webrat/spec/integration/merb/config/init.rb +25 -0
  145. data/vendor/webrat/spec/integration/merb/config/rack.rb +11 -0
  146. data/vendor/webrat/spec/integration/merb/config/router.rb +33 -0
  147. data/vendor/webrat/spec/integration/merb/spec/spec.opts +1 -0
  148. data/vendor/webrat/spec/integration/merb/spec/spec_helper.rb +24 -0
  149. data/vendor/webrat/spec/integration/merb/spec/webrat_spec.rb +32 -0
  150. data/vendor/webrat/spec/integration/merb/tasks/merb.thor/app_script.rb +31 -0
  151. data/vendor/webrat/spec/integration/merb/tasks/merb.thor/common.rb +64 -0
  152. data/vendor/webrat/spec/integration/merb/tasks/merb.thor/gem_ext.rb +124 -0
  153. data/vendor/webrat/spec/integration/merb/tasks/merb.thor/main.thor +150 -0
  154. data/vendor/webrat/spec/integration/merb/tasks/merb.thor/ops.rb +93 -0
  155. data/vendor/webrat/spec/integration/merb/tasks/merb.thor/utils.rb +40 -0
  156. data/vendor/webrat/spec/integration/rails/Rakefile +30 -0
  157. data/vendor/webrat/spec/integration/rails/app/controllers/application.rb +15 -0
  158. data/vendor/webrat/spec/integration/rails/app/controllers/webrat_controller.rb +39 -0
  159. data/vendor/webrat/spec/integration/rails/app/views/webrat/before_redirect_form.html.erb +4 -0
  160. data/vendor/webrat/spec/integration/rails/app/views/webrat/form.html.erb +28 -0
  161. data/vendor/webrat/spec/integration/rails/config/boot.rb +109 -0
  162. data/vendor/webrat/spec/integration/rails/config/environment.rb +12 -0
  163. data/vendor/webrat/spec/integration/rails/config/environments/development.rb +17 -0
  164. data/vendor/webrat/spec/integration/rails/config/environments/selenium.rb +22 -0
  165. data/vendor/webrat/spec/integration/rails/config/environments/test.rb +22 -0
  166. data/vendor/webrat/spec/integration/rails/config/initializers/inflections.rb +10 -0
  167. data/vendor/webrat/spec/integration/rails/config/initializers/mime_types.rb +5 -0
  168. data/vendor/webrat/spec/integration/rails/config/initializers/new_rails_defaults.rb +17 -0
  169. data/vendor/webrat/spec/integration/rails/config/locales/en.yml +5 -0
  170. data/vendor/webrat/spec/integration/rails/config/routes.rb +14 -0
  171. data/vendor/webrat/spec/integration/rails/public/404.html +30 -0
  172. data/vendor/webrat/spec/integration/rails/public/422.html +30 -0
  173. data/vendor/webrat/spec/integration/rails/public/500.html +33 -0
  174. data/vendor/webrat/spec/integration/rails/script/about +4 -0
  175. data/vendor/webrat/spec/integration/rails/script/console +3 -0
  176. data/vendor/webrat/spec/integration/rails/script/dbconsole +3 -0
  177. data/vendor/webrat/spec/integration/rails/script/destroy +3 -0
  178. data/vendor/webrat/spec/integration/rails/script/generate +3 -0
  179. data/vendor/webrat/spec/integration/rails/script/performance/benchmarker +3 -0
  180. data/vendor/webrat/spec/integration/rails/script/performance/profiler +3 -0
  181. data/vendor/webrat/spec/integration/rails/script/performance/request +3 -0
  182. data/vendor/webrat/spec/integration/rails/script/plugin +3 -0
  183. data/vendor/webrat/spec/integration/rails/script/process/inspector +3 -0
  184. data/vendor/webrat/spec/integration/rails/script/process/reaper +3 -0
  185. data/vendor/webrat/spec/integration/rails/script/process/spawner +3 -0
  186. data/vendor/webrat/spec/integration/rails/script/runner +3 -0
  187. data/vendor/webrat/spec/integration/rails/script/server +3 -0
  188. data/vendor/webrat/spec/integration/rails/test/integration/webrat_test.rb +80 -0
  189. data/vendor/webrat/spec/integration/rails/test/test_helper.rb +25 -0
  190. data/vendor/webrat/spec/integration/sinatra/Rakefile +5 -0
  191. data/vendor/webrat/spec/integration/sinatra/classic_app.rb +64 -0
  192. data/vendor/webrat/spec/integration/sinatra/modular_app.rb +16 -0
  193. data/vendor/webrat/spec/integration/sinatra/test/classic_app_test.rb +37 -0
  194. data/vendor/webrat/spec/integration/sinatra/test/modular_app_test.rb +18 -0
  195. data/vendor/webrat/spec/integration/sinatra/test/test_helper.rb +16 -0
  196. data/vendor/webrat/spec/private/core/configuration_spec.rb +104 -0
  197. data/vendor/webrat/spec/private/core/field_spec.rb +67 -0
  198. data/vendor/webrat/spec/private/core/link_spec.rb +24 -0
  199. data/vendor/webrat/spec/private/core/logging_spec.rb +10 -0
  200. data/vendor/webrat/spec/private/core/session_spec.rb +198 -0
  201. data/vendor/webrat/spec/private/mechanize/mechanize_session_spec.rb +81 -0
  202. data/vendor/webrat/spec/private/merb/merb_session_spec.rb +42 -0
  203. data/vendor/webrat/spec/private/nokogiri_spec.rb +77 -0
  204. data/vendor/webrat/spec/private/rails/attaches_file_spec.rb +81 -0
  205. data/vendor/webrat/spec/private/rails/rails_session_spec.rb +110 -0
  206. data/vendor/webrat/spec/private/selenium/selenium_session_spec.rb +44 -0
  207. data/vendor/webrat/spec/private/selenium/selenium_spec.rb +109 -0
  208. data/vendor/webrat/spec/public/basic_auth_spec.rb +24 -0
  209. data/vendor/webrat/spec/public/check_spec.rb +191 -0
  210. data/vendor/webrat/spec/public/choose_spec.rb +118 -0
  211. data/vendor/webrat/spec/public/click_area_spec.rb +106 -0
  212. data/vendor/webrat/spec/public/click_button_spec.rb +502 -0
  213. data/vendor/webrat/spec/public/click_link_spec.rb +469 -0
  214. data/vendor/webrat/spec/public/fill_in_spec.rb +209 -0
  215. data/vendor/webrat/spec/public/locators/field_by_xpath_spec.rb +19 -0
  216. data/vendor/webrat/spec/public/locators/field_labeled_spec.rb +157 -0
  217. data/vendor/webrat/spec/public/locators/field_with_id_spec.rb +16 -0
  218. data/vendor/webrat/spec/public/matchers/contain_spec.rb +114 -0
  219. data/vendor/webrat/spec/public/matchers/have_selector_spec.rb +135 -0
  220. data/vendor/webrat/spec/public/matchers/have_tag_spec.rb +39 -0
  221. data/vendor/webrat/spec/public/matchers/have_xpath_spec.rb +123 -0
  222. data/vendor/webrat/spec/public/reload_spec.rb +10 -0
  223. data/vendor/webrat/spec/public/save_and_open_spec.rb +51 -0
  224. data/vendor/webrat/spec/public/select_date_spec.rb +88 -0
  225. data/vendor/webrat/spec/public/select_datetime_spec.rb +106 -0
  226. data/vendor/webrat/spec/public/select_spec.rb +246 -0
  227. data/vendor/webrat/spec/public/select_time_spec.rb +79 -0
  228. data/vendor/webrat/spec/public/set_hidden_field_spec.rb +5 -0
  229. data/vendor/webrat/spec/public/submit_form_spec.rb +5 -0
  230. data/vendor/webrat/spec/public/visit_spec.rb +58 -0
  231. data/vendor/webrat/spec/public/within_spec.rb +177 -0
  232. data/vendor/webrat/spec/rcov.opts +1 -0
  233. data/vendor/webrat/spec/spec.opts +2 -0
  234. data/vendor/webrat/spec/spec_helper.rb +50 -0
  235. data/vendor/webrat/vendor/selenium-server.jar +0 -0
  236. data/views/_commit_info.haml +24 -0
  237. data/views/build.haml +2 -2
  238. data/views/error.haml +4 -3
  239. data/views/home.haml +3 -5
  240. data/views/integrity.sass +19 -6
  241. data/views/new.haml +6 -6
  242. data/views/project.builder +9 -9
  243. data/views/project.haml +14 -12
  244. metadata +319 -124
  245. data/app.rb +0 -138
  246. data/integrity.gemspec +0 -76
  247. data/lib/integrity/core_ext/string.rb +0 -5
  248. data/test/helpers/expectations/have_tag.rb +0 -128
  249. data/views/_build_info.haml +0 -18
@@ -8,6 +8,13 @@ Integrity
8
8
  * Join us on [#integrity][irc-channel] for ideas, help, patches or something
9
9
  * Get the code on [GitHub][repo]
10
10
 
11
+ Try it!
12
+ -------
13
+
14
+ $ git clone git://github.com/foca/integrity.git
15
+ $ rake launch
16
+ # Navigate to <http://0.0.0.0:4567>
17
+
11
18
  Thanks
12
19
  ------
13
20
 
data/Rakefile CHANGED
@@ -2,14 +2,43 @@ require "rake/testtask"
2
2
  require "rake/clean"
3
3
  require "rcov/rcovtask"
4
4
 
5
- require File.dirname(__FILE__) + "/lib/integrity"
5
+ begin
6
+ require "metric_fu"
7
+ rescue LoadError
8
+ end
9
+
10
+ module Integrity
11
+ def self.version
12
+ YAML.load_file("VERSION.yml").values.join(".")
13
+ end
14
+ end
6
15
 
7
- desc "Run all tests and check test coverage"
8
- task :default => "test:coverage:verify"
16
+ desc "Default: run all tests"
17
+ task :default => :test
18
+
19
+ desc "Special task for running tests on <http://builder.integrityapp.com>"
20
+ task :ci do
21
+ sh "git submodule update --init"
22
+
23
+ Rake::Task["test"].invoke
24
+
25
+ metrics = %w(flay flog:all reek roodi saikuro)
26
+ metrics.each { |m| Rake::Task["metrics:#{m}"].invoke }
27
+
28
+ rm_rf "/var/www/integrity-metrics"
29
+ mv "tmp/metric_fu", "/var/www/integrity-metrics"
30
+
31
+ File.open("/var/www/integrity-metrics/index.html", "w") { |f|
32
+ f << "<ul>"
33
+ metrics.map { |m| m.split(":").first }.each { |m|
34
+ f << %Q(<li><a href="/#{m}">#{m}</a></li>)
35
+ }
36
+ f << "</ul>"
37
+ }
38
+ end
9
39
 
10
40
  desc "Run tests"
11
41
  task :test => %w(test:units test:acceptance)
12
-
13
42
  namespace :test do
14
43
  Rake::TestTask.new(:units) do |t|
15
44
  t.test_files = FileList["test/unit/*_test.rb"]
@@ -19,110 +48,18 @@ namespace :test do
19
48
  t.test_files = FileList["test/acceptance/*_test.rb"]
20
49
  end
21
50
 
22
- desc "Measure test coverage"
23
- task :coverage => %w(test:coverage:units test:coverage:acceptance)
24
-
25
- namespace :coverage do
26
- desc "Measure test coverage of unit tests"
27
- Rcov::RcovTask.new(:units) do |rcov|
28
- rcov.pattern = "test/unit/*_test.rb"
29
- rcov.rcov_opts = %w(--html --aggregate .aggregated_coverage_report)
30
- rcov.rcov_opts << ENV["RCOV_OPTS"] if ENV["RCOV_OPTS"]
31
- end
32
-
33
- desc "Measure test coverage of acceptance tests"
34
- Rcov::RcovTask.new(:acceptance) do |rcov|
35
- rcov.pattern = "test/acceptance/*_test.rb"
36
- rcov.rcov_opts = %w(--html --aggregate .aggregated_coverage_report)
37
- rcov.rcov_opts << ENV["RCOV_OPTS"] if ENV["RCOV_OPTS"]
38
- end
39
-
40
- desc "Verify test coverage"
41
- task :verify => "test:coverage" do
42
- File.read("coverage/index.html") =~ /<tt class='coverage_total'>\s*(\d+\.\d+)%\s*<\/tt>/
43
- coverage = $1.to_f
44
-
45
- puts
46
- if coverage == 100
47
- puts "\e[32m100% coverage! Awesome!\e[0m"
48
- else
49
- puts "\e[31mOnly #{coverage}% code coverage. You can do better ;)\e[0m"
50
- end
51
- end
52
- end
53
-
54
51
  desc "Install all gems on which the tests depend on"
55
52
  task :install_dependencies do
56
- system 'gem install redgreen rr mocha ruby-debug dm-sweatshop webrat'
57
- system 'gem install -s http://gems.github.com jeremymcanally-context jeremymcanally-matchy jeremymcanally-pending foca-storyteller'
58
- end
59
- end
60
-
61
- namespace :db do
62
- desc "Setup connection."
63
- task :connect do
64
- config = File.expand_path(ENV['CONFIG']) if ENV['CONFIG']
65
- config = Integrity.root / 'config.yml' if File.exists?(Integrity.root / 'config.yml')
66
- Integrity.new(config)
67
- end
68
-
69
- desc "Automigrate the database"
70
- task :migrate => :connect do
71
- require "project"
72
- require "build"
73
- require "notifier"
74
- DataMapper.auto_migrate!
53
+ system "gem install rr mocha dm-sweatshop ZenTest"
54
+ system "gem install -s http://gems.github.com jeremymcanally-context \
55
+ jeremymcanally-matchy jeremymcanally-pending foca-storyteller"
56
+ system "git submodule update --init"
75
57
  end
76
58
  end
77
59
 
78
- # tx RMT :)
79
- namespace :rubyforge do
80
- def package(ext="")
81
- "dist/integrity-#{Integrity.version}" + ext
82
- end
83
-
84
- directory "dist/"
85
- CLOBBER.include("dist")
86
-
87
- desc "Build packages"
88
- task :package => %w[.gem .tar.gz].map { |ext| package(ext) } << :changelog
89
-
90
- desc "Build and install as local gem"
91
- task :install => package(".gem") do
92
- sh "gem install #{package(".gem")}"
93
- end
94
-
95
- file package(".gem") => %w[dist/ integrity.gemspec] do |f|
96
- sh "gem build integrity.gemspec"
97
- mv File.basename(f.name), f.name
98
- end
99
-
100
- file package('.tar.gz') => %w[dist/] do |f|
101
- sh <<-SH
102
- git archive \
103
- --prefix=integrity-#{Integrity.version}/ \
104
- --format=tar \
105
- HEAD | gzip > #{f.name}
106
- SH
107
- end
108
-
109
- desc "Publish gem and tarball to rubyforge"
110
- task "publish:gem" => [package(".gem"), package(".tar.gz")] do |t|
111
- sh <<-end
112
- rubyforge add_release integrity integrity #{Integrity.version} #{package('.gem')} &&
113
- rubyforge add_file integrity integrity #{Integrity.version} #{package('.tar.gz')}
114
- end
115
- end
116
-
117
- file "dist/git-changelog.py" => %w[dist/] do
118
- sh "cd dist && wget http://gist.github.com/raw/62837/bc6d2c6102933c3eac5fa33afd3effd7ab97edb7/git-changelog.py"
119
- end
120
-
121
- task :changelog => ["dist/git-changelog.py"] do
122
- sh "python git-changelog.py"
123
- sh "git add ChangeLog"
124
- sh 'git commit -m "Regenerated ChangeLog"'
125
- end
60
+ desc "Launch Integrity real quick"
61
+ task :launch do
62
+ ruby "bin/integrity launch"
126
63
  end
127
64
 
128
65
  begin
@@ -130,36 +67,26 @@ begin
130
67
 
131
68
  namespace :jeweler do
132
69
  Jeweler::Tasks.new do |s|
133
- files = `git ls-files`.split("\n").reject {|f| f =~ %r(^test/acceptance) || f =~ %r(^test/unit) || f =~ /^\.git/ }
134
-
135
- s.name = 'integrity'
136
- s.summary = 'The easy and fun Continuous Integration server'
137
- s.description = 'Your Friendly Continuous Integration server. Easy, fun and painless!'
138
- s.homepage = 'http://integrityapp.com'
139
- s.rubyforge_project = 'integrity'
140
- s.email = 'contacto@nicolassanguinetti.info'
141
- s.authors = ['Nicolás Sanguinetti', 'Simon Rozet']
142
- s.files = files
143
- s.executables = ['integrity']
144
- s.post_install_message = 'Run `integrity help` for information on how to setup Integrity.'
145
-
146
- s.add_dependency 'sinatra', ['>= 0.9.0.3']
147
- s.add_dependency 'haml', ['>= 2.0.0']
148
- s.add_dependency 'dm-core', ['>= 0.9.5']
149
- s.add_dependency 'dm-validations', ['>= 0.9.5']
150
- s.add_dependency 'dm-types', ['>= 0.9.5']
151
- s.add_dependency 'dm-timestamps', ['>= 0.9.5']
152
- s.add_dependency 'dm-aggregates', ['>= 0.9.5']
153
- s.add_dependency 'dm-migrations', ['>= 0.9.5']
154
- s.add_dependency 'data_objects', ['>= 0.9.5']
155
- s.add_dependency 'do_sqlite3', ['>= 0.9.5']
156
- s.add_dependency 'json'
157
- s.add_dependency 'foca-sinatra-diddies', ['>= 0.0.2']
158
- s.add_dependency 'thor'
159
- s.add_dependency 'uuidtools' # required by dm-types
160
- s.add_dependency 'bcrypt-ruby' # required by dm-types
70
+ s.name = "integrity"
71
+ s.summary = "The easy and fun Continuous Integration server"
72
+ s.description = "Your Friendly Continuous Integration server. Easy, fun and painless!"
73
+ s.homepage = "http://integrityapp.com"
74
+ s.rubyforge_project = "integrity"
75
+ s.email = "contacto@nicolassanguinetti.info"
76
+ s.authors = ["Nicolás Sanguinetti", "Simon Rozet"]
77
+ s.files = FileList["[A-Z]*", "{bin,lib,views,public,config,test,vendor}/**/*"]
78
+ s.executables = ["integrity"]
79
+ s.post_install_message = "Run `integrity help` for information on how to setup Integrity."
80
+
81
+ s.add_dependency "sinatra", [">= 0.9.1.1"]
82
+ s.add_dependency "haml", [">= 2.0.0"]
83
+ s.add_dependency "data_mapper", [">= 0.9.10"]
84
+ s.add_dependency "uuidtools" # required by dm-types
85
+ s.add_dependency "bcrypt-ruby" # required by dm-types
86
+ s.add_dependency "json"
87
+ s.add_dependency "foca-sinatra-ditties", [">= 0.0.3"]
88
+ s.add_dependency "thor"
161
89
  end
162
90
  end
163
91
  rescue LoadError
164
92
  end
165
-
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  major: 0
3
- patch: 8
3
+ patch: 9
4
4
  minor: 1
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + "/../lib/integrity"
3
+ require "rack/lobster"
4
+ # If you want to add any notifiers, install the gems and then require them here
5
+ # For example, to enable the Email notifier: install the gem (from github:
6
+ #
7
+ # sudo gem install -s http://gems.github.com foca-integrity-email
8
+ #
9
+ # And then uncomment the following line:
10
+ #
11
+ # require "notifier/email"
12
+
13
+ # Load configuration and initialize Integrity
14
+ Integrity.new#(File.dirname(__FILE__) + "/config.yml")
15
+ DataMapper.auto_migrate!
16
+
17
+ # You probably don't want to edit anything below
18
+ Integrity::App.set :environment, ENV["RACK_ENV"] || :production
19
+ Integrity::App.set :port, 8910
20
+ rack = proc do |env|
21
+ [200, { 'Content-Type' => 'text/html' }, "#{env['rack.session'].inspect}"]
22
+ end
23
+
24
+ map "/foo" do
25
+ run Integrity::App
26
+ end
27
+ map "/" do
28
+ run rack
29
+ end
@@ -11,21 +11,11 @@ require "integrity"
11
11
  #
12
12
  # require "notifier/email"
13
13
 
14
- # Load integrity's configuration.
15
- Integrity.config = File.expand_path("./config.yml")
14
+ # Load configuration and initialize Integrity
15
+ Integrity.new(File.dirname(__FILE__) + "/config.yml")
16
16
 
17
- #######################################################################
18
- ## ##
19
- ## == DON'T EDIT ANYTHING BELOW UNLESS YOU KNOW WHAT YOU'RE DOING == ##
20
- ## ##
21
- #######################################################################
22
- require Integrity.root / "app"
17
+ # You probably don't want to edit anything below
18
+ Integrity::App.set :environment, ENV["RACK_ENV"] || :production
19
+ Integrity::App.set :port, 8910
23
20
 
24
- set :environment, ENV["RACK_ENV"] || :production
25
- set :public, Integrity.root / "public"
26
- set :views, Integrity.root / "views"
27
- set :port, 8910
28
- disable :run, :reload
29
-
30
- use Rack::CommonLogger, Integrity.logger if Integrity.config[:log_debug_info]
31
- run Sinatra::Application
21
+ run Integrity::App
@@ -4,24 +4,27 @@
4
4
  # http://builder.integrityapp.com
5
5
  :base_uri: http://integrity.domain.tld
6
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).
7
+ # This should be a complete connection string to your database.
8
+ #
9
+ # Examples:
10
+ # * `mysql://user:password@localhost/integrity`
11
+ # * `postgres://user:password@localhost/integrity`
12
+ # * `sqlite3:///home/integrity/db/integrity.sqlite`
13
+ #
14
+ # Note:
15
+ # * The appropriate data_objects adapter must be installed (`do_mysql`, etc)
16
+ # * You must create the `integrity` database on localhost, of course.
10
17
  :database_uri: sqlite3:///var/integrity.db
11
18
 
12
- # This is where your project's code will be checked out to. Make sure it's
19
+ # This is where your project's code will be checked out to. Make sure it's
13
20
  # writable by the user that runs Integrity.
14
21
  :export_directory: /path/to/scm/exports
15
22
 
16
23
  # Path to the integrity log file
17
24
  :log: /var/log/integrity.log
18
25
 
19
- # Enable/Disable debug logging. Turning this on will log queries made to the
20
- # database and web requests (if using the provided rackup file)
21
- :log_debug_info: false
22
-
23
- # Enable or disable HTTP authentication for the app. BE AWARE that if you
24
- # disable this anyone can delete and alter projects, so do it only if your
26
+ # Enable or disable HTTP authentication for the app. BE AWARE that if you
27
+ # disable this anyone can delete and alter projects, so do it only if your
25
28
  # app is running in a controlled environment (ie, behind your company's
26
29
  # firewall.)
27
30
  :use_basic_auth: false
@@ -29,10 +32,10 @@
29
32
  # When `use_basic_auth` is true, the admin's username for HTTP authentication.
30
33
  :admin_username: username
31
34
 
32
- # When `use_basic_auth` is true, the admin's password. Usually saved as a
35
+ # When `use_basic_auth` is true, the admin's password. Usually saved as a
33
36
  # SHA1 hash. See the next option.
34
37
  :admin_password: a94a8fe5ccb19ba61c4c0873d391e987982fbbd3
35
38
 
36
- # If this is true, then whenever we authenticate the admin user, will hash
39
+ # If this is true, then whenever we authenticate the admin user, will hash
37
40
  # it using SHA1. If not, we'll assume the provided password is in plain text.
38
41
  :hash_admin_password: true
@@ -0,0 +1,34 @@
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
5
+ :base_uri: http://0.0.0.0:1234
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).
10
+ :database_uri: sqlite3:///home/simon/tmp/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.
14
+ :export_directory: /home/simon/tmp/integrity_exports
15
+
16
+ # Path to the integrity log file
17
+ :log: /tmp/integrity.log
18
+
19
+ # Enable or disable HTTP authentication for the app. BE AWARE that if you
20
+ # disable this anyone can delete and alter projects, so do it only if your
21
+ # app is running in a controlled environment (ie, behind your company's
22
+ # firewall.)
23
+ :use_basic_auth: false
24
+
25
+ # When `use_basic_auth` is true, the admin's username for HTTP authentication.
26
+ :admin_username: username
27
+
28
+ # When `use_basic_auth` is true, the admin's password. Usually saved as a
29
+ # SHA1 hash. See the next option.
30
+ :admin_password: a94a8fe5ccb19ba61c4c0873d391e987982fbbd3
31
+
32
+ # If this is true, then whenever we authenticate the admin user, will hash
33
+ # it using SHA1. If not, we'll assume the provided password is in plain text.
34
+ :hash_admin_password: true
@@ -6,33 +6,36 @@ require "dm-validations"
6
6
  require "dm-types"
7
7
  require "dm-timestamps"
8
8
  require "dm-aggregates"
9
+ require "sinatra/base"
9
10
 
10
11
  require "yaml"
11
12
  require "logger"
12
13
  require "digest/sha1"
13
14
  require "timeout"
14
15
  require "ostruct"
15
- require "fileutils"
16
+ require "pathname"
16
17
 
17
18
  require "integrity/core_ext/object"
18
- require "integrity/core_ext/string"
19
19
 
20
20
  require "integrity/project"
21
+ require "integrity/author"
22
+ require "integrity/commit"
21
23
  require "integrity/build"
22
24
  require "integrity/project_builder"
23
25
  require "integrity/scm"
24
26
  require "integrity/scm/git"
25
27
  require "integrity/notifier"
28
+ require "integrity/helpers"
29
+ require "integrity/app"
26
30
 
27
31
  module Integrity
28
32
  def self.new(config_file = nil)
29
- self.config = config_file unless config_file.nil?
30
- DataMapper.logger = self.logger if config[:log_debug_info]
33
+ self.config = YAML.load_file(config_file) unless config_file.nil?
31
34
  DataMapper.setup(:default, config[:database_uri])
32
35
  end
33
36
 
34
37
  def self.root
35
- File.expand_path(File.join(File.dirname(__FILE__), ".."))
38
+ Pathname.new(File.dirname(__FILE__)).join("..").expand_path
36
39
  end
37
40
 
38
41
  def self.default_configuration
@@ -42,15 +45,15 @@ module Integrity
42
45
  :base_uri => "http://localhost:8910",
43
46
  :use_basic_auth => false,
44
47
  :build_all_commits => true,
45
- :log_debug_info => false }
48
+ :log_debug_info => false }.dup
46
49
  end
47
50
 
48
51
  def self.config
49
52
  @config ||= default_configuration
50
53
  end
51
54
 
52
- def self.config=(file)
53
- @config = default_configuration.merge(YAML.load_file(file))
55
+ def self.config=(options)
56
+ @config = default_configuration.merge(options)
54
57
  end
55
58
 
56
59
  def self.log(message, &block)
@@ -64,14 +67,11 @@ module Integrity
64
67
  end
65
68
 
66
69
  def self.version
67
- @version ||= begin
68
- file = YAML.load_file(Integrity.root / "VERSION.yml")
69
- "#{file['major']}.#{file['minor']}.#{file['patch']}"
70
- end
70
+ YAML.load_file(File.dirname(__FILE__) + "/../VERSION.yml").
71
+ values.join(".")
71
72
  end
72
73
 
73
74
  private
74
-
75
75
  class LogFormatter < Logger::Formatter
76
76
  def call(severity, time, progname, msg)
77
77
  time.strftime("[%H:%M:%S] ") + msg2str(msg) + "\n"