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
data/README CHANGED
@@ -2,13 +2,39 @@
2
2
 
3
3
  = Feature overview
4
4
 
5
- * Supports all SCMs supported by RSCM.
5
+ * Builds projects of any kind:
6
+ * Java
7
+ * .NET
8
+ * Ruby
9
+ * C/C++
10
+ * (This is getting boring, you can build projects in any language)
11
+ * Supports any kind of build tools:
12
+ * Ant
13
+ * Nant
14
+ * Make
15
+ * Rake
16
+ * Maven
17
+ * Bash/Sh/Bat scripts
18
+ * (You get the picture)
19
+ * Several notification channels
20
+ * Email
21
+ * IRC
22
+ * RSS
23
+ * Growl
24
+ * Supports all SCMs supported by RSCM:
25
+ * CVS
26
+ * Subversion
27
+ * Perforce
28
+ * Monotone
29
+ * ClearCase
30
+ * (See http://rscm.codehaus.org for details)
31
+ * Trend graphs and statistics (soming soon)
6
32
  * Web interface based on RoR (http://www.rubyonrails.org/)
33
+ * No funny config files, all web based configuration (you can use config files if you wish)
7
34
  * Colourised HTML diffs.
8
- * RSS feeds for changesets and builds.
9
- * Generation of URL links to diffs for several popular SCM web front-ends.
10
- * Generation of URL links to bugs/issues for several popular bug/issue trackers.
11
- * Uses UTC times according to the SCM server's clock, not the machine running RSCM. No NTP needed!
35
+ * Integration with several SCM web front-ends.
36
+ * Integration with several issue trackers.
37
+ * Uses UTC times according to the SCM server's clock, not the machine running RSCM. No NTP needed!
12
38
 
13
39
  == DamageControl Server
14
40
 
@@ -59,17 +85,47 @@ Planned:
59
85
 
60
86
  * RT - http://fsck.com/projects/rt/
61
87
 
62
- == SCM web front-ends - diffs
88
+ == SCM web front-ends
63
89
 
64
- DamageControl's web interface features colourised diffs for all changes in a changeset.
65
- It can also generate links to individual diff pages in other SCM web frontends:
90
+ DamageControl's web interface features colourised diffs for all changes in a changeset (for any supported SCM).
91
+ It can also generate links to individual diff pages in other SCM web frontends, provided it's compatible with
92
+ the given project's SCM:
66
93
 
67
- * RSCM Built-in HTML diffs.
68
94
  * Fisheye - http://www.cenqua.com/fisheye/
69
95
  * ViewCVS - http://viewcvs.sourceforge.net/
96
+ * Trac - http://www.edgewall.com/trac/
70
97
 
71
98
  Planned:
72
99
 
73
- * Trac - http://www.edgewall.com/trac/
74
- * Chora - http://horde.org/chora/
100
+ * Chora - http://horde.org/chora/
101
+
102
+ = Extending DamageControl
103
+
104
+ == SourceControl
105
+
106
+ See http://rscm.rubyforge.org for instructions about how to add support for new SCMs
107
+
108
+ == Build Publishers
109
+
110
+ If you have an idea for a new publisher it's very easy to hook in. Just drop your class into the lib/publisher directory. Your publisher class
111
+ must implement the following methods:
112
+
113
+ # This method will be called when a build is complete.
114
+ def publish(build)
115
+ ...
116
+ end
117
+
118
+ # This is the display name of the publisher
119
+ def name
120
+ ...
121
+ end
75
122
 
123
+ You must also make sure your publisher class registers with the Project class. Put this in the class body:
124
+
125
+ Project.available_publisher_classes << self
126
+
127
+ If your publisher requires some sort of configuration, just make an attr_accessor for each configuration option. DamageControl will automatically
128
+ pick up your publisher, render it under the Publishers tab on the project configuration page.
129
+
130
+ If you want to share your publisher with the rest of the world, just upload it to DamageControl's JIRA. If you include a unit test for it,
131
+ we'll be extra happy.
data/Rakefile CHANGED
@@ -16,11 +16,16 @@ task :default => [ :all ]
16
16
 
17
17
  # Run the unit tests
18
18
  # To run a specific test: rake test TEST=path/to/test
19
- fl = FileList.new('test/**/*_test.rb')
19
+ fl = FileList.new('test/**/*_test.rb')
20
+ # Work around annoying LoadError - run this test alone
21
+ fl.exclude('test/**/email_test.rb')
22
+ fl.exclude('test/functional/*')
20
23
  # TODO: figure out how to add all the stuff in app.
21
24
  Rake::TestTask.new { |t|
22
- # We need some of the test utils from rscm
23
- t.libs << "test" << File.expand_path(File.dirname(__FILE__) + "/../rscm/test") << File.expand_path(File.dirname(__FILE__) + "/../rscm/lib")
25
+ t.libs << "test"
26
+ # We need some of the test utils from rscm. add them in 2 ways so they can be found when built by dc too.
27
+ t.libs << File.expand_path(File.dirname(__FILE__) + "/../rscm/test") << File.expand_path(File.dirname(__FILE__) + "/../rscm/lib")
28
+ t.libs << File.expand_path(File.dirname(__FILE__) + "/../../RSCM/checkout/test") << File.expand_path(File.dirname(__FILE__) + "/../../RSCM/checkout/lib")
24
29
  t.test_files = fl
25
30
  t.verbose = true
26
31
  }
@@ -65,9 +70,13 @@ else
65
70
 
66
71
  #### Dependencies and requirements.
67
72
 
68
- s.add_dependency('log4r', '> 1.0.4')
69
- s.add_dependency('rscm')
70
- s.add_dependency('needle')
73
+ s.add_dependency('rscm', '0.2.0')
74
+ s.add_dependency('rails', '0.10.0')
75
+ s.add_dependency('log4r', '1.0.5')
76
+ s.add_dependency('needle', '1.2.0')
77
+ s.add_dependency('jabber4r', '0.7.0')
78
+ s.add_dependency('rake', '0.4.5')
79
+ s.add_dependency('ruby-growl', '1.0.0')
71
80
  # s.add_dependency('rgl')
72
81
  #s.requirements << ""
73
82
 
@@ -1,6 +1,3 @@
1
- #require 'rscm'
2
- #require 'rscm/tracker'
3
-
4
1
  class AdminController < ApplicationController
5
2
 
6
3
  def new_project
@@ -1,163 +1,42 @@
1
- # The filters added to this controller will be run for all controllers in the application.
2
- # Likewise will all the methods added be available for all controllers.
3
-
4
- require 'rubygems'
5
- require_gem 'rscm'
6
- require 'damagecontrol/project'
7
- require 'damagecontrol/build'
8
- require 'damagecontrol/tracker'
9
- require 'damagecontrol/scm_web'
10
-
11
- # Start Drb - this is how we communicate with the daemon.
12
- DRb.start_service()
13
- Rscm = DRbObject.new(nil, 'druby://localhost:9000')
14
-
15
- class ApplicationController < ActionController::Base
16
-
17
- layout 'rscm'
18
-
19
- def initialize
20
- @sidebar_links = [
21
- {
22
- :controller => "project",
23
- :action => "new",
24
- :image => "/images/24x24/box_new.png",
25
- :name => "New project"
26
- }
27
- ]
28
- @controller = self
29
- end
30
-
31
- # Loads the project specified by the +id+ parameter and places it into the @project variable
32
- def load_project
33
- project_name = @params["id"]
34
- @project = DamageControl::Project.load(project_name)
35
- end
36
-
37
- def breadcrumbs
38
- subpaths = @request.path.split(/\//)
39
- # subpaths.collect { |p| link_to_unless_current(p) }.links.join(" ")
40
- end
41
-
42
- protected
43
-
44
- # Sets the links to display in the sidebar. Override this method in other controllers
45
- # To change what to display.
46
- def set_sidebar_links
47
-
48
- end
49
-
50
- end
51
-
52
- module ActionView
53
- module Helpers
54
- module UrlHelper
55
- # Modify the original behaviour of +link_to+ so that the link
56
- # includes the client's timezone as URL param +timezone+ in the request.
57
- # Can be used by server to adjust formatting of UTC dates so they match the client's time zone.
58
- def convert_confirm_option_to_javascript!(html_options)
59
- # We're adding this JS call to add the timezone info as a URL param.
60
- html_options["onclick"] = "intercept(this);"
61
- if html_options.include?(:confirm)
62
- html_options["onclick"] += "return confirm('#{html_options[:confirm]}');"
63
- html_options.delete(:confirm)
64
- end
65
- end
66
- end
67
- end
68
-
69
- class Base
70
- def text_or_input(input, options)
71
- if(input)
72
- options[:class] = "setting-input" unless options[:class]
73
- tag("input", options)
74
- elsif(options[:value] =~ /^http?:\/\//)
75
- content_tag("a", options[:value], "href" => options[:value])
76
- else
77
- options[:value]
78
- end
79
- end
80
-
81
- def text_or_select(input, options)
82
- values = options.delete(:values)
83
- if(input)
84
- options[:class] = "setting-input" unless options[:class]
85
-
86
- option_tags = ""
87
- values.each do |value|
88
- option_attrs = {:value => value.class.name}
89
- option_attrs[:selected] = "true" if value.selected?
90
- option_tag = content_tag("option", value.name, option_attrs)
91
- option_tags << option_tag
92
- end
93
- content_tag("select", option_tags, options)
94
- else
95
- values.find {|v| v.selected?}.name
96
- end
97
- end
98
-
99
- # Creates an image with a tooltip that will show on mouseover.
100
- #
101
- # Options:
102
- # * <tt>:txt</tt> - The text to put in the tooltip. Can be HTML.
103
- # * <tt>:img</tt> - The image to display on the page. Defaults to '/images/16x16/about.png'
104
- def tip(options)
105
- tip = options.delete(:txt)
106
- options[:src] = options.delete(:img) || "/images/16x16/about.png"
107
- options[:onmouseover] = "Tooltip.show(event,#{tip})"
108
- options[:onmouseout] = "Tooltip.hide()"
109
-
110
- tag("img", options)
111
- end
112
- end
113
- end
114
-
115
- module DamageControl
116
-
117
- # Add some generic web capabilities to the RSCM classes
118
- module Web
119
- module Configuration
120
-
121
- def selected?
122
- false
123
- end
124
-
125
- # Returns the short lowercase name. Used for javascript and render_partial.
126
- def short
127
- $1.downcase if self.class.name =~ /.*::(.*)/
128
- end
129
-
130
- end
131
- end
132
- end
133
-
134
- class RSCM::AbstractSCM
135
- include DamageControl::Web::Configuration
136
- end
137
-
138
- class DamageControl::Tracker::Base
139
- include DamageControl::Web::Configuration
140
- end
141
-
142
- class DamageControl::Project
143
- include DamageControl::Web::Configuration
144
- end
145
-
146
- class DamageControl::Build
147
- def small_image
148
- exit_code == 0 ? "/images/green-16.gif" : "/images/red-16.gif"
149
- end
150
- end
151
-
152
- class RSCM::Change
153
- ICONS = {
154
- MODIFIED => "/images/16x16/document_edit.png",
155
- DELETED => "/images/16x16/document_delete.png",
156
- ADDED => "/images/16x16/document_add.png",
157
- MOVED => "/images/16x16/document_exchange.png",
158
- }
159
-
160
- def icon
161
- ICONS[@status] || "/images/16x16/document_warning.png"
162
- end
163
- end
1
+ # The filters added to this controller will be run for all controllers in the application.
2
+ # Likewise will all the methods added be available for all controllers.
3
+
4
+ require 'damagecontrol/project'
5
+ require 'damagecontrol/build'
6
+ require 'damagecontrol/tracker'
7
+ require 'damagecontrol/scm_web'
8
+ require 'damagecontrol/publisher/base'
9
+ require 'rscm_ext'
10
+ require 'rails_ext'
11
+
12
+ class ApplicationController < ActionController::Base
13
+
14
+ layout 'default'
15
+
16
+ def initialize
17
+ @sidebar_links = [
18
+ {
19
+ :controller => "project",
20
+ :action => "new",
21
+ :image => "/images/24x24/box_new.png",
22
+ :name => "New project"
23
+ }
24
+ ]
25
+ @controller = self
26
+ end
27
+
28
+ # Loads the project specified by the +id+ parameter and places it into the @project variable
29
+ def load_project
30
+ project_name = @params["id"]
31
+ @project = DamageControl::Project.load(project_name)
32
+ end
33
+
34
+ protected
35
+
36
+ # Sets the links to display in the sidebar. Override this method in other controllers
37
+ # To change what to display.
38
+ def set_sidebar_links
39
+
40
+ end
41
+
42
+ end
@@ -0,0 +1,33 @@
1
+ class BuildController < ApplicationController
2
+
3
+ def status
4
+ end
5
+
6
+ def stdout
7
+ load_build
8
+ send_log(@build.stdout)
9
+ end
10
+
11
+ def stderr
12
+ load_build
13
+ send_log(@build.stderr)
14
+ end
15
+
16
+ def tests
17
+ end
18
+
19
+ private
20
+
21
+ def send_log(file)
22
+ # see application.rb for :no_disposition
23
+ send_file(file, :stream => true, :type => "text/plain", :no_disposition => true)
24
+ end
25
+
26
+ def load_build
27
+ load_project
28
+ changeset_identifier = @params["changeset"].to_identifier
29
+ build_time = @params["build"].to_identifier
30
+ @build = @project.build(changeset_identifier, build_time)
31
+ end
32
+
33
+ end
@@ -1,4 +1,4 @@
1
- require 'rscm/directories'
1
+ require 'damagecontrol/directories'
2
2
 
3
3
  class FilesController < ApplicationController
4
4
 
@@ -3,58 +3,38 @@ require 'damagecontrol/project'
3
3
  require 'damagecontrol/directories'
4
4
  require 'damagecontrol/diff_parser'
5
5
  require 'damagecontrol/diff_htmlizer'
6
+ require 'damagecontrol/publisher/base'
6
7
 
7
8
  class ProjectController < ApplicationController
8
9
 
9
10
  # TODO: check if the various SCMs are installed and disable them with a warning if not.
10
11
  # Each SCM class should have an available? method
11
12
 
12
- SCMS = [
13
- # Uncomment this to see Mooky in action in the web interface!
14
- # RSCM::Mooky,
15
- RSCM::CVS,
16
- RSCM::SVN,
17
- RSCM::StarTeam
18
- ]
19
-
20
- TRACKERS = [
21
- DamageControl::Tracker::Null,
22
- DamageControl::Tracker::Bugzilla,
23
- DamageControl::Tracker::JIRA,
24
- DamageControl::Tracker::RubyForge,
25
- DamageControl::Tracker::SourceForge,
26
- DamageControl::Tracker::Scarab,
27
- DamageControl::Tracker::Trac
28
- ]
29
-
30
- SCM_WEBS = [
31
- # SCMWeb::Null.new,
32
- # SCMWeb::ViewCVS.new,
33
- # SCMWeb::Fisheye.new
34
- ]
35
-
36
13
  def initialize
37
14
  super
38
15
  @navigation_name = "changesets_list"
39
16
  end
40
17
 
41
18
  def index
42
- @projects = DamageControl::Project.find_all
19
+ @projects = ::DamageControl::Project.find_all
43
20
  @navigation_name = "null"
44
21
  end
45
22
 
46
23
  def new
47
24
  @project = DamageControl::Project.new
48
- @scms = SCMS.collect {|o| o.new}
25
+
26
+ @scms = RSCM::AbstractSCM.classes.collect {|cls| cls.new}
49
27
  first_scm = @scms[0]
50
28
  def first_scm.selected?
51
29
  true
52
30
  end
53
- @trackers = TRACKERS.collect {|o| o.new}
31
+
32
+ @trackers = DamageControl::Tracker::Base.classes.collect {|cls| cls.new}
54
33
  first_tracker = @trackers[0]
55
34
  def first_tracker.selected?
56
35
  true
57
36
  end
37
+
58
38
  @edit = true
59
39
  @new_project = true
60
40
  render_action("view")
@@ -88,25 +68,21 @@ class ProjectController < ApplicationController
88
68
  end
89
69
 
90
70
  def save
91
- project = instantiate_from_params("project")
92
- project.scm = instantiate_from_params("scm")
93
- project.tracker = instantiate_from_params("tracker")
94
-
95
- begin
96
- Rscm.save_project(project)
97
- rescue => e
98
- $stderr.puts(e.backtrace.join("\n"))
99
- return render_text("Couldn't connect to RSCM server. Please make sure it's running.<br>" + e.message)
100
- end
71
+ project = instantiate_from_hash(DamageControl::Project, @params[DamageControl::Project.name])
72
+ project.scm = find_selected("scms")
73
+ project.tracker = find_selected("trackers")
74
+ project.publishers = instantiate_array_from_hashes(@params["publishers"])
75
+
76
+ project.save
101
77
 
102
78
  redirect_to(:action => "view", :id => project.name)
103
79
  end
104
80
 
105
- def changesets
81
+ def changeset
106
82
  load
107
- last_changeset_identifier = @params["changeset"]
108
- @changesets = @project.changesets(last_changeset_identifier.to_identifier, 1)
109
- @changesets.accept(HtmlDiffVisitor.new(@project))
83
+ changeset_identifier = @params["changeset"]
84
+ @changeset = @project.changeset(changeset_identifier.to_identifier)
85
+ @changeset.accept(HtmlDiffVisitor.new(@project))
110
86
  end
111
87
 
112
88
  protected
@@ -117,9 +93,6 @@ protected
117
93
  @project = project
118
94
  end
119
95
 
120
- def visit_changesets(changesets)
121
- end
122
-
123
96
  def visit_changeset(changeset)
124
97
  @changeset = changeset
125
98
  end
@@ -173,7 +146,7 @@ protected
173
146
  # }
174
147
  # end
175
148
 
176
- if(@project.exists? && @project.scm && !@project.scm.exists? && @project.scm.can_create?)
149
+ if(@project.exists? && @project.scm && @project.scm.can_create? && !@project.scm.exists?)
177
150
  @sidebar_links << {
178
151
  :controller => "scm",
179
152
  :action => "create",
@@ -213,7 +186,7 @@ protected
213
186
  }
214
187
  end
215
188
 
216
- if(@project.exists?)
189
+ if(@project.exists? && @project.tracker)
217
190
  @sidebar_links << {
218
191
  :href => @project.tracker.url,
219
192
  :image => "/images/24x24/scroll_information.png",
@@ -250,17 +223,15 @@ private
250
223
  def scm.selected?
251
224
  true
252
225
  end
226
+ # Make a dupe of the scm/tracker lists and substitute with project's value
227
+ @scms = RSCM::AbstractSCM.classes.collect {|cls| $stderr.puts "CLASS: #{cls.name}" ;cls.new}
228
+ @scms.each_index {|i| @scms[i] = @project.scm if @scms[i].class == @project.scm.class}
253
229
 
254
230
  tracker = @project.tracker
255
231
  def tracker.selected?
256
232
  true
257
233
  end
258
-
259
- # Make a dupe of the scm/tracker lists and substitute with project's value
260
- @scms = SCMS.collect {|o| o.new}
261
- @scms.each_index {|i| @scms[i] = @project.scm if @scms[i].class == @project.scm.class}
262
-
263
- @trackers = TRACKERS.collect {|o| o.new}
234
+ @trackers = DamageControl::Tracker::Base.classes.collect {|cls| cls.new}
264
235
  @trackers.each_index {|i| @trackers[i] = @project.tracker if @trackers[i].class == @project.tracker.class}
265
236
 
266
237
  @linkable_changesets = @project.changesets(@project.latest_changeset_identifier, 10)
@@ -268,17 +239,4 @@ private
268
239
 
269
240
  set_sidebar_links
270
241
  end
271
-
272
- # Instantiates an object from parameters
273
- def instantiate_from_params(param)
274
- class_name = @params[param]
275
- clazz = eval(class_name)
276
- ob = clazz.new
277
- attribs = @params[class_name] || {}
278
- attribs.each do |k,v|
279
- ob.send("#{k}=", v)
280
- end
281
- ob
282
- end
283
-
284
242
  end