damagecontrol 0.5.0 → 0.5.0.1391

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. data/README +67 -11
  2. data/Rakefile +15 -6
  3. data/app/controllers/admin_controller.rb +0 -3
  4. data/app/controllers/application.rb +42 -163
  5. data/app/controllers/build_controller.rb +33 -0
  6. data/app/controllers/files_controller.rb +1 -1
  7. data/app/controllers/project_controller.rb +23 -65
  8. data/app/controllers/rails_ext.rb +247 -0
  9. data/app/controllers/rscm_ext.rb +52 -0
  10. data/app/helpers/build_helper.rb +2 -0
  11. data/app/views/build/email.rhtml +18 -0
  12. data/app/views/build/status.rhtml +20 -0
  13. data/app/views/build/tests.rhtml +2 -0
  14. data/app/views/layouts/{rscm.rhtml → default.rhtml} +10 -4
  15. data/app/views/project/_changesets_list.rhtml +2 -2
  16. data/app/views/project/_cvs.rhtml +4 -5
  17. data/app/views/project/_project.rhtml +9 -9
  18. data/app/views/project/_select_pane.rhtml +26 -0
  19. data/app/views/project/_tab_pane.rhtml +23 -0
  20. data/app/views/project/changeset.rhtml +35 -0
  21. data/app/views/project/view.rhtml +18 -32
  22. data/app/views/setup/welcome.rhtml +118 -0
  23. data/config/database.yml +20 -20
  24. data/config/environment.rb +66 -60
  25. data/config/environments/development.rb +3 -2
  26. data/config/environments/production.rb +3 -2
  27. data/config/environments/test.rb +3 -2
  28. data/config/routes.rb +15 -0
  29. data/lib/damagecontrol/app.rb +11 -40
  30. data/lib/damagecontrol/build.rb +50 -8
  31. data/lib/damagecontrol/directories.rb +7 -6
  32. data/lib/damagecontrol/poller.rb +11 -20
  33. data/lib/damagecontrol/project.rb +83 -16
  34. data/lib/damagecontrol/publisher/ambient_orb.rb +16 -0
  35. data/lib/damagecontrol/publisher/archive.rb +16 -0
  36. data/lib/damagecontrol/publisher/base.rb +25 -0
  37. data/lib/damagecontrol/publisher/build_duration.rb +16 -0
  38. data/lib/damagecontrol/publisher/email.rb +59 -0
  39. data/lib/damagecontrol/publisher/execute.rb +49 -0
  40. data/lib/damagecontrol/publisher/ftp.rb +16 -0
  41. data/lib/damagecontrol/publisher/growl.rb +44 -0
  42. data/lib/damagecontrol/publisher/irc.rb +31 -0
  43. data/lib/damagecontrol/publisher/jabber.rb +68 -0
  44. data/lib/damagecontrol/publisher/scp.rb +16 -0
  45. data/lib/damagecontrol/publisher/x10cm11a.rb +17 -0
  46. data/lib/damagecontrol/publisher/x10cm17a.rb +17 -0
  47. data/lib/damagecontrol/publisher/yahoo.rb +16 -0
  48. data/lib/damagecontrol/standard_persister.rb +2 -2
  49. data/lib/damagecontrol/tracker.rb +48 -6
  50. data/lib/damagecontrol/visitor/rss_writer.rb +1 -1
  51. data/lib/damagecontrol/visitor/yaml_persister.rb +10 -1
  52. data/public/404.html +5 -5
  53. data/public/500.html +5 -5
  54. data/public/dispatch.cgi +2 -2
  55. data/public/dispatch.fcgi +1 -1
  56. data/public/dispatch.rb +2 -2
  57. data/public/images/growlicon.png +0 -0
  58. data/public/images/megaphone.png +0 -0
  59. data/public/images/monotone-logo.png +0 -0
  60. data/public/images/publisher/ambient_orb.png +0 -0
  61. data/public/images/publisher/build_duration.png +0 -0
  62. data/public/images/publisher/email.png +0 -0
  63. data/public/images/publisher/execute.png +0 -0
  64. data/public/images/publisher/growl.png +0 -0
  65. data/public/images/publisher/irc.png +0 -0
  66. data/public/images/publisher/jabber.png +0 -0
  67. data/public/images/publisher/x10cm11a.png +0 -0
  68. data/public/images/publisher/x10cm17a.png +0 -0
  69. data/public/images/publisher/yahoo.png +0 -0
  70. data/public/index.html +70 -1
  71. data/public/javascripts/dateFormat.js +283 -0
  72. data/public/javascripts/jscalendar/ChangeLog +500 -0
  73. data/public/javascripts/jscalendar/README +33 -0
  74. data/public/javascripts/jscalendar/bugtest-hidden-selects.html +108 -0
  75. data/public/javascripts/jscalendar/calendar-blue.css +231 -0
  76. data/public/javascripts/jscalendar/calendar-blue2.css +235 -0
  77. data/public/javascripts/jscalendar/calendar-brown.css +224 -0
  78. data/public/javascripts/jscalendar/calendar-green.css +228 -0
  79. data/public/javascripts/jscalendar/calendar-setup.js +181 -0
  80. data/public/javascripts/jscalendar/calendar-setup_stripped.js +21 -0
  81. data/public/javascripts/jscalendar/calendar-system.css +250 -0
  82. data/public/javascripts/jscalendar/calendar-tas.css +238 -0
  83. data/public/javascripts/jscalendar/calendar-win2k-1.css +270 -0
  84. data/public/javascripts/jscalendar/calendar-win2k-2.css +270 -0
  85. data/public/javascripts/jscalendar/calendar-win2k-cold-1.css +264 -0
  86. data/public/javascripts/jscalendar/calendar-win2k-cold-2.css +270 -0
  87. data/public/javascripts/jscalendar/calendar.js +1715 -0
  88. data/public/javascripts/jscalendar/calendar.php +119 -0
  89. data/public/javascripts/jscalendar/calendar_stripped.js +12 -0
  90. data/public/javascripts/jscalendar/doc/html/reference-Z-S.css +0 -0
  91. data/public/javascripts/jscalendar/doc/html/reference.css +34 -0
  92. data/public/javascripts/jscalendar/doc/html/reference.html +1316 -0
  93. data/public/javascripts/jscalendar/doc/reference.pdf +0 -0
  94. data/public/javascripts/jscalendar/img.gif +0 -0
  95. data/public/javascripts/jscalendar/index.html +333 -0
  96. data/public/javascripts/jscalendar/lang/calendar-af.js +39 -0
  97. data/public/javascripts/jscalendar/lang/calendar-br.js +45 -0
  98. data/public/javascripts/jscalendar/lang/calendar-ca.js +45 -0
  99. data/public/javascripts/jscalendar/lang/calendar-cs-win.js +34 -0
  100. data/public/javascripts/jscalendar/lang/calendar-da.js +63 -0
  101. data/public/javascripts/jscalendar/lang/calendar-de.js +100 -0
  102. data/public/javascripts/jscalendar/lang/calendar-du.js +45 -0
  103. data/public/javascripts/jscalendar/lang/calendar-el.js +89 -0
  104. data/public/javascripts/jscalendar/lang/calendar-en.js +123 -0
  105. data/public/javascripts/jscalendar/lang/calendar-es.js +114 -0
  106. data/public/javascripts/jscalendar/lang/calendar-fi.js +98 -0
  107. data/public/javascripts/jscalendar/lang/calendar-fr.js +86 -0
  108. data/public/javascripts/jscalendar/lang/calendar-hr-utf8.js +49 -0
  109. data/public/javascripts/jscalendar/lang/calendar-hr.js +0 -0
  110. data/public/javascripts/jscalendar/lang/calendar-hu.js +45 -0
  111. data/public/javascripts/jscalendar/lang/calendar-it.js +79 -0
  112. data/public/javascripts/jscalendar/lang/calendar-jp.js +45 -0
  113. data/public/javascripts/jscalendar/lang/calendar-ko-utf8.js +120 -0
  114. data/public/javascripts/jscalendar/lang/calendar-ko.js +120 -0
  115. data/public/javascripts/jscalendar/lang/calendar-lt-utf8.js +114 -0
  116. data/public/javascripts/jscalendar/lang/calendar-lt.js +114 -0
  117. data/public/javascripts/jscalendar/lang/calendar-nl.js +45 -0
  118. data/public/javascripts/jscalendar/lang/calendar-no.js +45 -0
  119. data/public/javascripts/jscalendar/lang/calendar-pl-utf8.js +93 -0
  120. data/public/javascripts/jscalendar/lang/calendar-pl.js +56 -0
  121. data/public/javascripts/jscalendar/lang/calendar-pt.js +45 -0
  122. data/public/javascripts/jscalendar/lang/calendar-ro.js +66 -0
  123. data/public/javascripts/jscalendar/lang/calendar-ru.js +45 -0
  124. data/public/javascripts/jscalendar/lang/calendar-si.js +94 -0
  125. data/public/javascripts/jscalendar/lang/calendar-sk.js +99 -0
  126. data/public/javascripts/jscalendar/lang/calendar-sp.js +63 -0
  127. data/public/javascripts/jscalendar/lang/calendar-sv.js +93 -0
  128. data/public/javascripts/jscalendar/lang/calendar-tr.js +58 -0
  129. data/public/javascripts/jscalendar/lang/calendar-zh.js +45 -0
  130. data/public/javascripts/jscalendar/menuarrow.gif +0 -0
  131. data/public/javascripts/jscalendar/menuarrow2.gif +0 -0
  132. data/public/javascripts/jscalendar/release-notes.html +334 -0
  133. data/public/javascripts/jscalendar/simple-1.html +244 -0
  134. data/public/javascripts/jscalendar/simple-2.html +108 -0
  135. data/public/javascripts/jscalendar/simple-3.html +130 -0
  136. data/public/javascripts/jscalendar/test-position.html +40 -0
  137. data/public/javascripts/jscalendar/test.php +116 -0
  138. data/public/javascripts/toggle_div.js +18 -0
  139. data/public/stylesheets/niceones.txt +1 -0
  140. data/public/stylesheets/style.css +8 -1
  141. data/script/breakpointer +4 -5
  142. data/script/console +19 -27
  143. data/script/console_sandbox.rb +7 -0
  144. data/script/destroy +5 -0
  145. data/script/generate +3 -68
  146. data/script/server +6 -16
  147. data/test/damagecontrol/build_test.rb +8 -8
  148. data/test/damagecontrol/poller_test.rb +10 -18
  149. data/test/damagecontrol/project_test.rb +49 -13
  150. data/test/damagecontrol/publisher/base_test.rb +26 -0
  151. data/test/damagecontrol/publisher/build/email.rhtml +0 -0
  152. data/test/damagecontrol/publisher/email_test.rb +26 -0
  153. data/test/damagecontrol/publisher/fixture.rb +34 -0
  154. data/test/damagecontrol/publisher/growl_test.rb +15 -0
  155. data/test/damagecontrol/publisher/jabber_test.rb +15 -0
  156. data/test/damagecontrol/scm_web_test.rb +1 -1
  157. data/test/damagecontrol/visitor/changesets.rss +1 -1
  158. data/test/damagecontrol/visitor/diff_persister_test.rb +4 -4
  159. data/test/functional/build_controller_test.rb +17 -0
  160. data/test/test_helper.rb +13 -13
  161. metadata +185 -24
  162. data/app/views/project/_bugzilla.rhtml +0 -13
  163. data/app/views/project/_jira.rhtml +0 -19
  164. data/app/views/project/_mooky.rhtml +0 -23
  165. data/app/views/project/_rubyforge.rhtml +0 -19
  166. data/app/views/project/_scarab.rhtml +0 -19
  167. data/app/views/project/_scms.rhtml +0 -15
  168. data/app/views/project/_sourceforge.rhtml +0 -19
  169. data/app/views/project/_starteam.rhtml +0 -43
  170. data/app/views/project/_svn.rhtml +0 -22
  171. data/app/views/project/_trac.rhtml +0 -13
  172. data/app/views/project/_trackers.rhtml +0 -18
  173. data/app/views/project/changesets.rhtml +0 -31
@@ -0,0 +1,40 @@
1
+ <html xmlns="http://www.w3.org/1999/xhtml">
2
+
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5
+ <title>JS Calendar (positioning test)</title>
6
+ <script type="text/javascript" src="calendar.js"></script>
7
+ <script type="text/javascript" src="calendar-setup.js"></script>
8
+ <script type="text/javascript" src="lang/calendar-en.js"></script>
9
+ <style type="text/css"> @import url("calendar-win2k-cold-1.css"); </style>
10
+ </head>
11
+
12
+ <body style="height: 100%; margin: 0px; padding: 0px;">
13
+ <table style="height: 100%; width: 100%;" cellspacing="0" cellpadding="0">
14
+ <tr style="height: 100%;">
15
+ <td style="vertical-align: top; text-align: left;">
16
+ <input type="text" id="cal-field-1" />
17
+ <button type="submit" id="cal-button-1">...</button>
18
+ <script type="text/javascript">
19
+ Calendar.setup({
20
+ inputField : "cal-field-1",
21
+ button : "cal-button-1",
22
+ align : "Tr"
23
+ });
24
+ </script>
25
+ </td>
26
+ <td style="vertical-align: bottom; text-align: right;">
27
+ <input type="text" id="cal-field-2" />
28
+ <button type="submit" id="cal-button-2">...</button>
29
+ <script type="text/javascript">
30
+ Calendar.setup({
31
+ inputField : "cal-field-2",
32
+ button : "cal-button-2"
33
+ });
34
+ </script>
35
+ </td>
36
+ </tr>
37
+ </table>
38
+ </body>
39
+
40
+ </html>
@@ -0,0 +1,116 @@
1
+ <?php
2
+
3
+ $lang = $_GET['lang'];
4
+ if (!$lang) {
5
+ $lang = $_REQUEST['lang'];
6
+ }
7
+ if (!$lang) {
8
+ $lang = 'en';
9
+ }
10
+ setcookie('lang', $lang);
11
+
12
+ ?>
13
+ <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
14
+ <html>
15
+ <head>
16
+ <title>
17
+ Test for calendar.php
18
+ </title>
19
+
20
+ <?php
21
+
22
+ // put here the correct path to "calendar.php"; don't move the file
23
+ // "calendar.php" -- I think it's best if you leave it inside the
24
+ // "/jscalendar/" directory. Just put here the correct path to it, such as
25
+ // "../jscalendar/calendar.php" or something.
26
+ require_once ('calendar.php');
27
+
28
+ // parameters to constructor:
29
+ // 1. the absolute URL path to the calendar files
30
+ // 2. the languate used for the calendar (see the lang/ dir)
31
+ // 3. the theme file used for the clanedar, without the ".css" extension
32
+ // 4. boolean that specifies if the "_stripped" files are to be loaded
33
+ // The stripped files are smaller as they have no whitespace and comments
34
+ $calendar = new DHTML_Calendar('/jscalendar/', $lang, 'calendar-win2k-2', false);
35
+
36
+ // call this in the <head> section; it will "echo" code that loads the calendar
37
+ // scripts and theme file.
38
+ $calendar->load_files();
39
+
40
+ ?>
41
+
42
+ </head>
43
+
44
+ <body>
45
+
46
+ <?php if ($_REQUEST['submitted']) { ?>
47
+
48
+ <h1>Form submitted</h1>
49
+
50
+ <?php foreach ($_REQUEST as $key => $val) {
51
+ echo htmlspecialchars($key) . ' = ' . htmlspecialchars($val) . '<br />';
52
+ } ?>
53
+
54
+ <?php } else { ?>
55
+
56
+ <h1>Calendar.php test</h1>
57
+
58
+ <form action="test.php" method="get">
59
+ Select language: <select name="lang" onchange="this.form.submit()">
60
+ <?php
61
+ $cwd = getcwd();
62
+ chdir('lang');
63
+ foreach (glob('*.js') as $filename) {
64
+ $l = preg_replace('/(^calendar-|.js$)/', '', $filename);
65
+ $selected = '';
66
+ if ($l == $lang)
67
+ $selected = 'selected="selected" ';
68
+ $display = $l;
69
+ if ($l == 'en')
70
+ $display = 'EN';
71
+ echo '<option ' . $selected . 'value="' . $l . '">' . $display . '</option>';
72
+ }
73
+ ?>
74
+ </select>
75
+ <blockquote style="font-size: 90%">
76
+ <b>NOTE</b>: as of this release, 0.9.6, only "EN" and "RO", which I
77
+ maintain, function correctly. Other language files do not work
78
+ because they need to be updated. If you update some language file,
79
+ please consider sending it back to me so that I can include it in the
80
+ calendar distribution.
81
+ </blockquote>
82
+ </form>
83
+
84
+ <form action="test.php" method="get">
85
+ <input type="hidden" name="submitted" value="1" />
86
+
87
+ <table>
88
+ <tr>
89
+ <td>
90
+ Date 1:
91
+ </td>
92
+ <td>
93
+ <?php $calendar->make_input_field(
94
+ // calendar options go here; see the documentation and/or calendar-setup.js
95
+ array('firstDay' => 1, // show Monday first
96
+ 'showsTime' => true,
97
+ 'showOthers' => true,
98
+ 'ifFormat' => '%Y-%m-%d %I:%M %P',
99
+ 'timeFormat' => '12'),
100
+ // field attributes go here
101
+ array('style' => 'width: 15em; color: #840; background-color: #ff8; border: 1px solid #000; text-align: center',
102
+ 'name' => 'date1',
103
+ 'value' => strftime('%Y-%m-%d %I:%M %P', strtotime('now')))); ?>
104
+ </td>
105
+ </tr>
106
+ </table>
107
+
108
+ <hr />
109
+ <button>Submit</button>
110
+
111
+ </form>
112
+
113
+ <?php } ?>
114
+
115
+ </body>
116
+ </html>
@@ -0,0 +1,18 @@
1
+ function setTab(tab) {
2
+ stickyTab = tab
3
+ showElement(stickyTab, tabs)
4
+ }
5
+
6
+ // hide all divs in the group unless selected
7
+ function showElement(selected, elements) {
8
+ // alert("showElement(" + selected + ",[" + elements.join() + "])")
9
+ for(element in elements) {
10
+ id = elements[element]
11
+ // alert("elements[" + element + "]=" + id)
12
+ style = "none"
13
+ if(id == selected) {
14
+ style = "block"
15
+ }
16
+ document.getElementById(id).style.display = style
17
+ }
18
+ }
@@ -0,0 +1 @@
1
+ http://googlemenus.blogspot.com/
@@ -304,4 +304,11 @@ th.pane {
304
304
  border: 1px solid #ccb;
305
305
  background: #eed;
306
306
  padding: 4px;
307
- }
307
+ }
308
+
309
+ .simplebox {
310
+ background:#eee;
311
+ border:1px solid #ccc;
312
+ padding:5px;
313
+ margin-bottom: 15px;
314
+ }
@@ -1,5 +1,4 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- require_gem 'rails'
5
- require 'breakpoint_client'
1
+ #!c:/ruby/bin/ruby
2
+ require 'rubygems'
3
+ require_gem 'rails'
4
+ require 'breakpoint_client'
@@ -1,30 +1,22 @@
1
- #!/usr/bin/env ruby
1
+ #!c:/ruby/bin/ruby
2
+ irb = RUBY_PLATFORM =~ /mswin32/ ? 'irb.bat' : 'irb'
2
3
 
3
- if ARGV[0]
4
- ENV['RAILS_ENV'] = ARGV[0]
5
- puts "Loading environment..."
6
- exec "irb -r config/environment.rb -r irb/completion --noinspect"
7
- else
8
- puts <<-HELP
9
-
10
- NAME
11
- console - interact with the domain model through a environment console (on IRB)
4
+ require 'optparse'
5
+ options = {}
6
+ OptionParser.new do |opt|
7
+ opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |options[:sandbox]| }
8
+ opt.parse!(ARGV)
9
+ end
12
10
 
13
- SYNOPSIS
14
- console [environment]
11
+ libs = " -r #{File.dirname(__FILE__)}/../config/environment"
12
+ libs << " -r #{File.dirname(__FILE__)}/console_sandbox" if options[:sandbox]
13
+ libs << " -r irb/completion"
15
14
 
16
- DESCRIPTION
17
- Starts an environment console using IRB that lets you manipulate and interrogate
18
- the domain model or even trigger controller actions. The database connection and
19
- configuration available to the web application is already setup.
20
-
21
- Tab completion is available to see classes and methods on individual objects.
22
-
23
- EXAMPLE
24
- console production
25
-
26
- This will initialize the production environment (as setup in config/database.yml
27
- and config/environments/production.rb). You would now be ready to start requiring
28
- models using require_dependency.
29
- HELP
30
- end
15
+ ENV['RAILS_ENV'] = ARGV.first || 'development'
16
+ if options[:sandbox]
17
+ puts "Loading #{ENV['RAILS_ENV']} environment in sandbox."
18
+ puts "Any modifications you make will be rolled back on exit."
19
+ else
20
+ puts "Loading #{ENV['RAILS_ENV']} environment."
21
+ end
22
+ exec "#{irb} #{libs}"
@@ -0,0 +1,7 @@
1
+ #!c:/ruby/bin/ruby
2
+ ActiveRecord::Base.lock_mutex
3
+ ActiveRecord::Base.connection.begin_db_transaction
4
+ at_exit do
5
+ ActiveRecord::Base.connection.rollback_db_transaction
6
+ ActiveRecord::Base.unlock_mutex
7
+ end
@@ -0,0 +1,5 @@
1
+ #!c:/ruby/bin/ruby
2
+ require File.dirname(__FILE__) + '/../config/environment'
3
+ require 'rails_generator'
4
+ require 'rails_generator/scripts/destroy'
5
+ Rails::Generator::Scripts::Destroy.new.run(ARGV)
@@ -1,70 +1,5 @@
1
- #!/usr/bin/env ruby
2
-
1
+ #!c:/ruby/bin/ruby
3
2
  require File.dirname(__FILE__) + '/../config/environment'
4
3
  require 'rails_generator'
5
-
6
- ARGV.shift unless ARGV.empty? or not ['--help', '-h'].include?(ARGV[0])
7
-
8
- def find_synonyms(word)
9
- require 'open-uri'
10
- uri = "http://wordnet.princeton.edu/cgi-bin/webwn2.0?stage=2" +
11
- "&word=%s&posnumber=1&searchtypenumber=2&senses=&showglosses=1"
12
-
13
- open(uri % word) do |stream|
14
- data = stream.read.gsub("&nbsp;", " ").gsub("<BR>", "")
15
- data.scan(/^Sense \d+\n.+?\n\n/m)
16
- end
17
- rescue Exception
18
- return nil
19
- end
20
-
21
- unless ARGV.empty?
22
- begin
23
- name = ARGV.shift
24
- generator = Rails::Generator.instance(name, ARGV)
25
-
26
- if msg = generator.collision_with_builtin? then
27
- $stderr.puts msg
28
-
29
- if synonyms = find_synonyms(generator.class_name) then
30
- $stderr.puts(
31
- "", "Here are a few synonyms from WordNet. Maybe they will help you find an alternative name.",
32
- "", synonyms
33
- )
34
- end
35
- else
36
- generator.generate
37
- end
38
- rescue Rails::Generator::UsageError => e
39
- puts e.message
40
- end
41
- else
42
- builtin_generators = Rails::Generator.builtin_generators.join(', ')
43
- contrib_generators = Rails::Generator.contrib_generators.join(', ')
44
-
45
- $stderr.puts <<end_usage
46
- #{$0} generator [args]
47
-
48
- Rails comes with #{builtin_generators} generators.
49
- #{$0} controller Login login logout
50
- #{$0} model Account
51
- #{$0} mailer AccountMailer
52
- #{$0} scaffold Account action another_action
53
-
54
- end_usage
55
-
56
- unless contrib_generators.empty?
57
- $stderr.puts " Installed generators (in #{RAILS_ROOT}/script/generators):"
58
- $stderr.puts " #{contrib_generators}"
59
- $stderr.puts
60
- end
61
-
62
- $stderr.puts <<end_usage
63
- More generators are available at http://rubyonrails.org/show/Generators
64
- 1. Download, for example, login_generator.tar.gz
65
- 2. Unzip to directory #{RAILS_ROOT}/script/generators/login
66
- 3. Generate without args for usage information
67
- #{$0} login
68
- end_usage
69
- exit 0
70
- end
4
+ require 'rails_generator/scripts/generate'
5
+ Rails::Generator::Scripts::Generate.new.run(ARGV)
@@ -1,14 +1,14 @@
1
- #!/usr/bin/env ruby
1
+ #!c:/ruby/bin/ruby
2
2
 
3
3
  require 'webrick'
4
4
  require 'optparse'
5
5
 
6
6
  OPTIONS = {
7
- :port => 4712,
8
- :ip => "127.0.0.1",
7
+ :port => 3000,
8
+ :ip => "0.0.0.0",
9
9
  :environment => "development",
10
10
  :server_root => File.expand_path(File.dirname(__FILE__) + "/../public/"),
11
- :server_type => WEBrick::SimpleServer,
11
+ :server_type => WEBrick::SimpleServer
12
12
  }
13
13
 
14
14
  ARGV.options do |opts|
@@ -45,17 +45,7 @@ ENV["RAILS_ENV"] = OPTIONS[:environment]
45
45
  require File.dirname(__FILE__) + "/../config/environment"
46
46
  require 'webrick_server'
47
47
 
48
- # Get rid of annoying trailing slash in original webrick_server's impl.
49
- class DispatchServlet
50
- def handle_index(req, res)
51
- if req.request_uri.path == "/"
52
- res.set_redirect WEBrick::HTTPStatus::MovedPermanently, "/project"
53
- return true
54
- else
55
- return false
56
- end
57
- end
58
- end
48
+ OPTIONS['working_directory'] = File.expand_path(RAILS_ROOT)
59
49
 
60
50
  puts "=> Rails application started on http://#{OPTIONS[:ip]}:#{OPTIONS[:port]}"
61
- DispatchServlet.dispatch(OPTIONS)
51
+ DispatchServlet.dispatch(OPTIONS)
@@ -12,12 +12,12 @@ module DamageControl
12
12
 
13
13
  ENV["DAMAGECONTROL_HOME"] = home
14
14
  t = Time.utc(1971, 2, 28, 23, 45, 00)
15
- build = Build.new("mooky", "some_rev", t)
15
+ build = Build.new("mooky", "some_rev", t, "Test")
16
16
  a_program = File.expand_path(File.dirname(__FILE__) + "/a_program.rb")
17
17
  build.execute("ruby #{a_program} 0", {'foo' => 'zap'})
18
- stderr = "#{home}/mooky/changesets/some_rev/builds/19710228234500/stderr.log"
18
+ stderr = "#{home}/projects/mooky/changesets/some_rev/builds/19710228234500/stderr.log"
19
19
  assert_equal("this\nis\nstderr\nzap", File.read(stderr))
20
- stdout = "#{home}/mooky/changesets/some_rev/builds/19710228234500/stdout.log"
20
+ stdout = "#{home}/projects/mooky/changesets/some_rev/builds/19710228234500/stdout.log"
21
21
  assert_equal("this\nis\nstdout\n0", File.read(stdout))
22
22
  assert_equal(0, build.exit_code)
23
23
  end
@@ -27,12 +27,12 @@ module DamageControl
27
27
 
28
28
  ENV["DAMAGECONTROL_HOME"] = home
29
29
  t = Time.utc(1971, 2, 28, 23, 45, 00)
30
- build = Build.new("mooky", "some_rev", t)
30
+ build = Build.new("mooky", "some_rev", t, "Test")
31
31
  a_program = File.expand_path(File.dirname(__FILE__) + "/a_program.rb")
32
32
  build.execute("ruby #{a_program} 44", {'foo' => 'bar'})
33
- stderr = "#{home}/mooky/changesets/some_rev/builds/19710228234500/stderr.log"
33
+ stderr = "#{home}/projects/mooky/changesets/some_rev/builds/19710228234500/stderr.log"
34
34
  assert_equal("this\nis\nstderr\nbar", File.read(stderr))
35
- stdout = "#{home}/mooky/changesets/some_rev/builds/19710228234500/stdout.log"
35
+ stdout = "#{home}/projects/mooky/changesets/some_rev/builds/19710228234500/stdout.log"
36
36
  assert_equal("this\nis\nstdout\n44", File.read(stdout))
37
37
  assert_equal(44, build.exit_code)
38
38
  end
@@ -42,7 +42,7 @@ module DamageControl
42
42
 
43
43
  ENV["DAMAGECONTROL_HOME"] = home
44
44
  t = Time.utc(1971, 2, 28, 23, 45, 00)
45
- build = Build.new("mooky", "some_rev", t)
45
+ build = Build.new("mooky", "some_rev", t, "Test")
46
46
  a_program = File.expand_path(File.dirname(__FILE__) + "/a_slow_program.rb")
47
47
  t = Thread.new do
48
48
  build.execute("ruby #{a_program} 55", {'foo' => 'mooky'})
@@ -50,7 +50,7 @@ module DamageControl
50
50
  # make sure it's running
51
51
  sleep(2)
52
52
  build.kill
53
- stdout = "#{home}/mooky/changesets/some_rev/builds/19710228234500/stdout.log"
53
+ stdout = "#{home}/projects/mooky/changesets/some_rev/builds/19710228234500/stdout.log"
54
54
  assert_equal("this\nis\nstdout\n44", File.read(stdout))
55
55
  assert_equal(nil, build.exit_code)
56
56
  end
@@ -7,21 +7,6 @@ module DamageControl
7
7
  class PollerTest < Test::Unit::TestCase
8
8
  include MockIt
9
9
 
10
- def test_should_not_add_projects_twice
11
- s = Poller.new
12
- a1 = Project.new; a1.name = "jalla"
13
- s.add_project(a1)
14
- assert_equal([a1], s.projects)
15
-
16
- a2 = Project.new; a2.name = "jalla"
17
- s.add_project(a2)
18
- assert_equal([a2], s.projects)
19
-
20
- b = Project.new; b.name = "mooky"
21
- s.add_project(b)
22
- assert_equal([a2, b], s.projects)
23
- end
24
-
25
10
  def test_yields_project_and_changesets_for_each_project_with_changesets
26
11
  p1 = Project.new; p1.name = "p2"
27
12
  p1.scm = new_mock
@@ -41,8 +26,16 @@ module DamageControl
41
26
  projects << project
42
27
  changesets_ << changesets
43
28
  end
44
- s.add_project(p1)
45
- s.add_project(p2)
29
+
30
+ def Project.projects=(p)
31
+ @projects = p
32
+ end
33
+
34
+ def Project.find_all
35
+ @projects
36
+ end
37
+
38
+ Project.projects = [p1, p2]
46
39
 
47
40
  s.poll
48
41
 
@@ -51,6 +44,5 @@ module DamageControl
51
44
  assert_equal("some fake changesets", changesets_[0])
52
45
  assert_equal("some other fake changesets", changesets_[1])
53
46
  end
54
-
55
47
  end
56
48
  end