parlement 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. data/CHANGES +709 -0
  2. data/COPYING +223 -0
  3. data/README +20 -0
  4. data/Rakefile +136 -0
  5. data/app/controllers/account_controller.rb +181 -0
  6. data/app/controllers/application.rb +30 -0
  7. data/app/controllers/elt_controller.rb +83 -0
  8. data/app/helpers/account_helper.rb +2 -0
  9. data/app/helpers/application_helper.rb +4 -0
  10. data/app/helpers/elt_helper.rb +37 -0
  11. data/app/helpers/live_tree.rb +238 -0
  12. data/app/helpers/mailman.rb +96 -0
  13. data/app/models/attachment.rb +4 -0
  14. data/app/models/elt.rb +17 -0
  15. data/app/models/mail.rb +4 -0
  16. data/app/models/notifier.rb +13 -0
  17. data/app/models/person.rb +9 -0
  18. data/app/models/user.rb +7 -0
  19. data/app/models/user_notify.rb +75 -0
  20. data/app/views/account/_help.rhtml +23 -0
  21. data/app/views/account/_login.rhtml +57 -0
  22. data/app/views/account/_show.rhtml +31 -0
  23. data/app/views/account/logout.rhtml +10 -0
  24. data/app/views/account/signup.rhtml +17 -0
  25. data/app/views/account/welcome.rhtml +13 -0
  26. data/app/views/elt/_elt.rhtml +105 -0
  27. data/app/views/elt/_form.rhtml +31 -0
  28. data/app/views/elt/_list.rhtml +28 -0
  29. data/app/views/elt/new.rhtml +102 -0
  30. data/app/views/elt/rss.rxml +31 -0
  31. data/app/views/elt/show.rhtml +46 -0
  32. data/app/views/elt/show_tree.rhtml +8 -0
  33. data/app/views/layouts/scaffold.rhtml +13 -0
  34. data/app/views/layouts/top.rhtml +45 -0
  35. data/app/views/notifier/changeEmail.rhtml +10 -0
  36. data/config/boot.rb +17 -0
  37. data/config/database.yml +82 -0
  38. data/config/environment.rb +92 -0
  39. data/config/environments/development.rb +17 -0
  40. data/config/environments/production.rb +17 -0
  41. data/config/environments/test.rb +17 -0
  42. data/config/environments/user_environment.rb +1 -0
  43. data/config/routes.rb +28 -0
  44. data/db/ROOT/CV.txt +166 -0
  45. data/db/ROOT/IP.txt +3 -0
  46. data/db/ROOT/parleR.txt +3 -0
  47. data/db/ROOT/parlement/security.txt +34 -0
  48. data/db/ROOT/parlement/test.txt +4 -0
  49. data/db/ROOT/parlement.txt +51 -0
  50. data/db/ROOT/perso.txt +215 -0
  51. data/db/schema.sql +127 -0
  52. data/lib/data_import.rb +54 -0
  53. data/lib/file_column.rb +263 -0
  54. data/lib/file_column_helper.rb +45 -0
  55. data/lib/localization.rb +88 -0
  56. data/lib/localizer.rb +88 -0
  57. data/lib/login_system.rb +87 -0
  58. data/lib/rails_file_column.rb +19 -0
  59. data/lib/user_system.rb +101 -0
  60. data/public/404.html +8 -0
  61. data/public/500.html +8 -0
  62. data/public/dispatch.cgi +10 -0
  63. data/public/dispatch.fcgi +24 -0
  64. data/public/dispatch.rb +10 -0
  65. data/public/engine_files/README +5 -0
  66. data/public/engine_files/login_engine/stylesheets/login_engine.css +81 -0
  67. data/public/favicon.ico +0 -0
  68. data/public/favicon.png +0 -0
  69. data/public/images/live_tree_branch_collapsed_icon.gif +0 -0
  70. data/public/images/live_tree_branch_expanded_icon.gif +0 -0
  71. data/public/images/live_tree_leaf_icon.gif +0 -0
  72. data/public/images/live_tree_loading_spinner.gif +0 -0
  73. data/public/images/webfeed.gif +0 -0
  74. data/public/javascripts/controls.js +721 -0
  75. data/public/javascripts/dragdrop.js +519 -0
  76. data/public/javascripts/effects.js +992 -0
  77. data/public/javascripts/live_tree.js +749 -0
  78. data/public/javascripts/prototype.js +1726 -0
  79. data/public/javascripts/scriptaculous.js +47 -0
  80. data/public/javascripts/slider.js +258 -0
  81. data/public/oldREADME +190 -0
  82. data/public/oldindex.html +78 -0
  83. data/public/robots.txt +1 -0
  84. data/public/stylesheets/default.css +238 -0
  85. data/public/stylesheets/live_tree.css +62 -0
  86. data/public/stylesheets/scaffold.css +74 -0
  87. data/script/about +3 -0
  88. data/script/benchmarker +19 -0
  89. data/script/breakpointer +3 -0
  90. data/script/console +3 -0
  91. data/script/create_db +7 -0
  92. data/script/destroy +3 -0
  93. data/script/generate +3 -0
  94. data/script/performance/benchmarker +3 -0
  95. data/script/performance/profiler +3 -0
  96. data/script/plugin +3 -0
  97. data/script/process/reaper +3 -0
  98. data/script/process/spawner +3 -0
  99. data/script/process/spinner +3 -0
  100. data/script/profiler +34 -0
  101. data/script/runner +3 -0
  102. data/script/server +3 -0
  103. data/test/fixtures/attachments.yml +10 -0
  104. data/test/fixtures/elts.yml +15 -0
  105. data/test/fixtures/mails.yml +7 -0
  106. data/test/fixtures/people.yml +49 -0
  107. data/test/fixtures/users.yml +41 -0
  108. data/test/functional/account_controller_test.rb +239 -0
  109. data/test/functional/elt_controller_test.rb +18 -0
  110. data/test/mocks/test/time.rb +17 -0
  111. data/test/mocks/test/user_notify.rb +16 -0
  112. data/test/test_helper.rb +28 -0
  113. data/test/unit/attachment_test.rb +14 -0
  114. data/test/unit/elt_test.rb +14 -0
  115. data/test/unit/mail_test.rb +14 -0
  116. data/test/unit/notifier_test.rb +31 -0
  117. data/test/unit/person_test.rb +24 -0
  118. data/test/unit/user_test.rb +94 -0
  119. data/vendor/plugins/engines/CHANGELOG +7 -0
  120. data/vendor/plugins/engines/README +128 -0
  121. data/vendor/plugins/engines/init.rb +33 -0
  122. data/vendor/plugins/engines/lib/action_mailer_extensions.rb +160 -0
  123. data/vendor/plugins/engines/lib/action_view_extensions.rb +130 -0
  124. data/vendor/plugins/engines/lib/dependencies_extensions.rb +56 -0
  125. data/vendor/plugins/engines/lib/engines.rb +292 -0
  126. data/vendor/plugins/engines/lib/ruby_extensions.rb +127 -0
  127. data/vendor/plugins/engines/lib/testing_extensions.rb +33 -0
  128. data/vendor/plugins/engines/test/ruby_extensions_test.rb +94 -0
  129. data/vendor/plugins/login_engine/README +258 -0
  130. data/vendor/plugins/login_engine/app/controllers/user_controller.rb +248 -0
  131. data/vendor/plugins/login_engine/app/helpers/user_helper.rb +88 -0
  132. data/vendor/plugins/login_engine/app/models/user.rb +7 -0
  133. data/vendor/plugins/login_engine/app/models/user_notify.rb +75 -0
  134. data/vendor/plugins/login_engine/app/views/user/_edit.rhtml +11 -0
  135. data/vendor/plugins/login_engine/app/views/user/_password.rhtml +9 -0
  136. data/vendor/plugins/login_engine/app/views/user/change_password.rhtml +17 -0
  137. data/vendor/plugins/login_engine/app/views/user/edit.rhtml +23 -0
  138. data/vendor/plugins/login_engine/app/views/user/forgot_password.rhtml +18 -0
  139. data/vendor/plugins/login_engine/app/views/user/home.rhtml +7 -0
  140. data/vendor/plugins/login_engine/app/views/user/login.rhtml +17 -0
  141. data/vendor/plugins/login_engine/app/views/user/logout.rhtml +8 -0
  142. data/vendor/plugins/login_engine/app/views/user/signup.rhtml +17 -0
  143. data/vendor/plugins/login_engine/app/views/user_notify/change_password.rhtml +10 -0
  144. data/vendor/plugins/login_engine/app/views/user_notify/delete.rhtml +5 -0
  145. data/vendor/plugins/login_engine/app/views/user_notify/forgot_password.rhtml +11 -0
  146. data/vendor/plugins/login_engine/app/views/user_notify/pending_delete.rhtml +9 -0
  147. data/vendor/plugins/login_engine/app/views/user_notify/signup.rhtml +12 -0
  148. data/vendor/plugins/login_engine/db/schema.rb +25 -0
  149. data/vendor/plugins/login_engine/init_engine.rb +10 -0
  150. data/vendor/plugins/login_engine/lib/login_engine/authenticated_system.rb +107 -0
  151. data/vendor/plugins/login_engine/lib/login_engine/authenticated_user.rb +149 -0
  152. data/vendor/plugins/login_engine/lib/login_engine.rb +58 -0
  153. data/vendor/plugins/login_engine/public/stylesheets/login_engine.css +81 -0
  154. data/vendor/plugins/login_engine/tasks/tasks.rake +4 -0
  155. data/vendor/plugins/login_engine/test/fixtures/templates/users.yml +41 -0
  156. data/vendor/plugins/login_engine/test/fixtures/users.yml +41 -0
  157. data/vendor/plugins/login_engine/test/functional/user_controller_test.rb +533 -0
  158. data/vendor/plugins/login_engine/test/mocks/mail.rb +14 -0
  159. data/vendor/plugins/login_engine/test/mocks/time.rb +19 -0
  160. data/vendor/plugins/login_engine/test/test_helper.rb +15 -0
  161. data/vendor/plugins/login_engine/test/unit/user_test.rb +94 -0
  162. metadata +276 -0
@@ -0,0 +1,47 @@
1
+ // Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining
4
+ // a copy of this software and associated documentation files (the
5
+ // "Software"), to deal in the Software without restriction, including
6
+ // without limitation the rights to use, copy, modify, merge, publish,
7
+ // distribute, sublicense, and/or sell copies of the Software, and to
8
+ // permit persons to whom the Software is furnished to do so, subject to
9
+ // the following conditions:
10
+ //
11
+ // The above copyright notice and this permission notice shall be
12
+ // included in all copies or substantial portions of the Software.
13
+ //
14
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ var Scriptaculous = {
23
+ Version: '1.5_rc3',
24
+ require: function(libraryName) {
25
+ // inserting via DOM fails in Safari 2.0, so brute force approach
26
+ document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
27
+ },
28
+ load: function() {
29
+ if((typeof Prototype=='undefined') ||
30
+ parseFloat(Prototype.Version.split(".")[0] + "." +
31
+ Prototype.Version.split(".")[1]) < 1.4)
32
+ throw("script.aculo.us requires the Prototype JavaScript framework >= 1.4.0");
33
+ var scriptTags = document.getElementsByTagName("script");
34
+ for(var i=0;i<scriptTags.length;i++) {
35
+ if(scriptTags[i].src && scriptTags[i].src.match(/scriptaculous\.js(\?.*)?$/)) {
36
+ var path = scriptTags[i].src.replace(/scriptaculous\.js(\?.*)?$/,'');
37
+ this.require(path + 'effects.js');
38
+ this.require(path + 'dragdrop.js');
39
+ this.require(path + 'controls.js');
40
+ this.require(path + 'slider.js');
41
+ break;
42
+ }
43
+ }
44
+ }
45
+ }
46
+
47
+ Scriptaculous.load();
@@ -0,0 +1,258 @@
1
+ // Copyright (c) 2005 Marty Haught
2
+ //
3
+ // See scriptaculous.js for full license.
4
+
5
+ if(!Control) var Control = {};
6
+ Control.Slider = Class.create();
7
+
8
+ // options:
9
+ // axis: 'vertical', or 'horizontal' (default)
10
+ // increment: (default: 1)
11
+ // step: (default: 1)
12
+ //
13
+ // callbacks:
14
+ // onChange(value)
15
+ // onSlide(value)
16
+ Control.Slider.prototype = {
17
+ initialize: function(handle, track, options) {
18
+ this.handle = $(handle);
19
+ this.track = $(track);
20
+
21
+ this.options = options || {};
22
+
23
+ this.axis = this.options.axis || 'horizontal';
24
+ this.increment = this.options.increment || 1;
25
+ this.step = parseInt(this.options.step) || 1;
26
+ this.value = 0;
27
+
28
+ var defaultMaximum = Math.round(this.track.offsetWidth / this.increment);
29
+ if(this.isVertical()) defaultMaximum = Math.round(this.track.offsetHeight / this.increment);
30
+
31
+ this.maximum = this.options.maximum || defaultMaximum;
32
+ this.minimum = this.options.minimum || 0;
33
+
34
+ // Will be used to align the handle onto the track, if necessary
35
+ this.alignX = parseInt (this.options.alignX) || 0;
36
+ this.alignY = parseInt (this.options.alignY) || 0;
37
+
38
+ // Zero out the slider position
39
+ this.setCurrentLeft(Position.cumulativeOffset(this.track)[0] - Position.cumulativeOffset(this.handle)[0] + this.alignX);
40
+ this.setCurrentTop(this.trackTop() - Position.cumulativeOffset(this.handle)[1] + this.alignY);
41
+
42
+ this.offsetX = 0;
43
+ this.offsetY = 0;
44
+
45
+ this.originalLeft = this.currentLeft();
46
+ this.originalTop = this.currentTop();
47
+ this.originalZ = parseInt(this.handle.style.zIndex || "0");
48
+
49
+ // Prepopulate Slider value
50
+ this.setSliderValue(parseInt(this.options.sliderValue) || 0);
51
+
52
+ this.active = false;
53
+ this.dragging = false;
54
+ this.disabled = false;
55
+
56
+ // FIXME: use css
57
+ this.handleImage = $(this.options.handleImage) || false;
58
+ this.handleDisabled = this.options.handleDisabled || false;
59
+ this.handleEnabled = false;
60
+ if(this.handleImage)
61
+ this.handleEnabled = this.handleImage.src || false;
62
+
63
+ if(this.options.disabled)
64
+ this.setDisabled();
65
+
66
+ // Value Array
67
+ this.values = this.options.values || false; // Add method to validate and sort??
68
+
69
+ Element.makePositioned(this.handle); // fix IE
70
+
71
+ this.eventMouseDown = this.startDrag.bindAsEventListener(this);
72
+ this.eventMouseUp = this.endDrag.bindAsEventListener(this);
73
+ this.eventMouseMove = this.update.bindAsEventListener(this);
74
+ this.eventKeypress = this.keyPress.bindAsEventListener(this);
75
+
76
+ Event.observe(this.handle, "mousedown", this.eventMouseDown);
77
+ Event.observe(document, "mouseup", this.eventMouseUp);
78
+ Event.observe(document, "mousemove", this.eventMouseMove);
79
+ Event.observe(document, "keypress", this.eventKeypress);
80
+ },
81
+ dispose: function() {
82
+ Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
83
+ Event.stopObserving(document, "mouseup", this.eventMouseUp);
84
+ Event.stopObserving(document, "mousemove", this.eventMouseMove);
85
+ Event.stopObserving(document, "keypress", this.eventKeypress);
86
+ },
87
+ setDisabled: function(){
88
+ this.disabled = true;
89
+ if(this.handleDisabled)
90
+ this.handleImage.src = this.handleDisabled;
91
+ },
92
+ setEnabled: function(){
93
+ this.disabled = false;
94
+ if(this.handleEnabled)
95
+ this.handleImage.src = this.handleEnabled;
96
+ },
97
+ currentLeft: function() {
98
+ return parseInt(this.handle.style.left || '0');
99
+ },
100
+ currentTop: function() {
101
+ return parseInt(this.handle.style.top || '0');
102
+ },
103
+ setCurrentLeft: function(left) {
104
+ this.handle.style.left = left +"px";
105
+ },
106
+ setCurrentTop: function(top) {
107
+ this.handle.style.top = top +"px";
108
+ },
109
+ trackLeft: function(){
110
+ return Position.cumulativeOffset(this.track)[0];
111
+ },
112
+ trackTop: function(){
113
+ return Position.cumulativeOffset(this.track)[1];
114
+ },
115
+ getNearestValue: function(value){
116
+ if(this.values){
117
+ var i = 0;
118
+ var offset = Math.abs(this.values[0] - value);
119
+ var newValue = this.values[0];
120
+
121
+ for(i=0; i < this.values.length; i++){
122
+ var currentOffset = Math.abs(this.values[i] - value);
123
+ if(currentOffset < offset){
124
+ newValue = this.values[i];
125
+ offset = currentOffset;
126
+ }
127
+ }
128
+ return newValue;
129
+ }
130
+ return value;
131
+ },
132
+ setSliderValue: function(sliderValue){
133
+ // First check our max and minimum and nearest values
134
+ sliderValue = this.getNearestValue(sliderValue);
135
+ if(sliderValue > this.maximum) sliderValue = this.maximum;
136
+ if(sliderValue < this.minimum) sliderValue = this.minimum;
137
+ var offsetDiff = (sliderValue - (this.value||this.minimum)) * this.increment;
138
+
139
+ if(this.isVertical()){
140
+ this.setCurrentTop(offsetDiff + this.currentTop());
141
+ } else {
142
+ this.setCurrentLeft(offsetDiff + this.currentLeft());
143
+ }
144
+ this.value = sliderValue;
145
+ this.updateFinished();
146
+ },
147
+ minimumOffset: function(){
148
+ return(this.isVertical() ?
149
+ this.trackTop() + this.alignY :
150
+ this.trackLeft() + this.alignX);
151
+ },
152
+ maximumOffset: function(){
153
+ return(this.isVertical() ?
154
+ this.trackTop() + this.alignY + (this.maximum - this.minimum) * this.increment :
155
+ this.trackLeft() + this.alignX + (this.maximum - this.minimum) * this.increment);
156
+ },
157
+ isVertical: function(){
158
+ return (this.axis == 'vertical');
159
+ },
160
+ startDrag: function(event) {
161
+ if(Event.isLeftClick(event)) {
162
+ if(!this.disabled){
163
+ this.active = true;
164
+ var pointer = [Event.pointerX(event), Event.pointerY(event)];
165
+ var offsets = Position.cumulativeOffset(this.handle);
166
+ this.offsetX = (pointer[0] - offsets[0]);
167
+ this.offsetY = (pointer[1] - offsets[1]);
168
+ this.originalLeft = this.currentLeft();
169
+ this.originalTop = this.currentTop();
170
+ }
171
+ Event.stop(event);
172
+ }
173
+ },
174
+ update: function(event) {
175
+ if(this.active) {
176
+ if(!this.dragging) {
177
+ var style = this.handle.style;
178
+ this.dragging = true;
179
+ if(style.position=="") style.position = "relative";
180
+ style.zIndex = this.options.zindex;
181
+ }
182
+ this.draw(event);
183
+ // fix AppleWebKit rendering
184
+ if(navigator.appVersion.indexOf('AppleWebKit')>0) window.scrollBy(0,0);
185
+ Event.stop(event);
186
+ }
187
+ },
188
+ draw: function(event) {
189
+ var pointer = [Event.pointerX(event), Event.pointerY(event)];
190
+ var offsets = Position.cumulativeOffset(this.handle);
191
+
192
+ offsets[0] -= this.currentLeft();
193
+ offsets[1] -= this.currentTop();
194
+
195
+ // Adjust for the pointer's position on the handle
196
+ pointer[0] -= this.offsetX;
197
+ pointer[1] -= this.offsetY;
198
+ var style = this.handle.style;
199
+
200
+ if(this.isVertical()){
201
+ if(pointer[1] > this.maximumOffset())
202
+ pointer[1] = this.maximumOffset();
203
+ if(pointer[1] < this.minimumOffset())
204
+ pointer[1] = this.minimumOffset();
205
+
206
+ // Increment by values
207
+ if(this.values){
208
+ this.value = this.getNearestValue(Math.round((pointer[1] - this.minimumOffset()) / this.increment) + this.minimum);
209
+ pointer[1] = this.trackTop() + this.alignY + (this.value - this.minimum) * this.increment;
210
+ } else {
211
+ this.value = Math.round((pointer[1] - this.minimumOffset()) / this.increment) + this.minimum;
212
+ }
213
+ style.top = pointer[1] - offsets[1] + "px";
214
+ } else {
215
+ if(pointer[0] > this.maximumOffset()) pointer[0] = this.maximumOffset();
216
+ if(pointer[0] < this.minimumOffset()) pointer[0] = this.minimumOffset();
217
+ // Increment by values
218
+ if(this.values){
219
+ this.value = this.getNearestValue(Math.round((pointer[0] - this.minimumOffset()) / this.increment) + this.minimum);
220
+ pointer[0] = this.trackLeft() + this.alignX + (this.value - this.minimum) * this.increment;
221
+ } else {
222
+ this.value = Math.round((pointer[0] - this.minimumOffset()) / this.increment) + this.minimum;
223
+ }
224
+ style.left = (pointer[0] - offsets[0]) + "px";
225
+ }
226
+ if(this.options.onSlide) this.options.onSlide(this.value);
227
+ },
228
+ endDrag: function(event) {
229
+ if(this.active && this.dragging) {
230
+ this.finishDrag(event, true);
231
+ Event.stop(event);
232
+ }
233
+ this.active = false;
234
+ this.dragging = false;
235
+ },
236
+ finishDrag: function(event, success) {
237
+ this.active = false;
238
+ this.dragging = false;
239
+ this.handle.style.zIndex = this.originalZ;
240
+ this.originalLeft = this.currentLeft();
241
+ this.originalTop = this.currentTop();
242
+ this.updateFinished();
243
+ },
244
+ updateFinished: function() {
245
+ if(this.options.onChange) this.options.onChange(this.value);
246
+ },
247
+ keyPress: function(event) {
248
+ if(this.active && !this.disabled) {
249
+ switch(event.keyCode) {
250
+ case Event.KEY_ESC:
251
+ this.finishDrag(event, false);
252
+ Event.stop(event);
253
+ break;
254
+ }
255
+ if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event);
256
+ }
257
+ }
258
+ }
data/public/oldREADME ADDED
@@ -0,0 +1,190 @@
1
+ == Welcome to Rails
2
+
3
+ Rails is a web-application and persistance framework that includes everything
4
+ needed to create database-backed web-applications according to the
5
+ Model-View-Control pattern of separation. This pattern splits the view (also
6
+ called the presentation) into "dumb" templates that are primarily responsible
7
+ for inserting pre-build data in between HTML tags. The model contains the
8
+ "smart" domain objects (such as Account, Product, Person, Post) that holds all
9
+ the business logic and knows how to persist themselves to a database. The
10
+ controller handles the incoming requests (such as Save New Account, Update
11
+ Product, Show Post) by manipulating the model and directing data to the view.
12
+
13
+ In Rails, the model is handled by what's called a object-relational mapping
14
+ layer entitled Active Record. This layer allows you to present the data from
15
+ database rows as objects and embellish these data objects with business logic
16
+ methods. You can read more about Active Record in
17
+ link:files/vendor/rails/activerecord/README.html.
18
+
19
+ The controller and view is handled by the Action Pack, which handles both
20
+ layers by its two parts: Action View and Action Controller. These two layers
21
+ are bundled in a single package due to their heavy interdependence. This is
22
+ unlike the relationship between the Active Record and Action Pack that is much
23
+ more separate. Each of these packages can be used independently outside of
24
+ Rails. You can read more about Action Pack in
25
+ link:files/vendor/rails/actionpack/README.html.
26
+
27
+
28
+ == Requirements
29
+
30
+ * Database and driver (MySQL, PostgreSQL, or SQLite)
31
+ * Rake[http://rake.rubyforge.org] for running tests and the generating documentation
32
+
33
+ == Optionals
34
+
35
+ * Apache 1.3.x or 2.x or lighttpd 1.3.11+ (or any FastCGI-capable webserver with a
36
+ mod_rewrite-like module)
37
+ * FastCGI (or mod_ruby) for better performance on Apache
38
+
39
+ == Getting started
40
+
41
+ 1. Run the WEBrick servlet: <tt>ruby script/server</tt>
42
+ (run with --help for options)
43
+ 2. Go to http://localhost:3000/ and get "Congratulations, you've put Ruby on Rails!"
44
+ 3. Follow the guidelines on the "Congratulations, you've put Ruby on Rails!" screen
45
+
46
+
47
+ == Example for Apache conf
48
+
49
+ <VirtualHost *:80>
50
+ ServerName rails
51
+ DocumentRoot /path/application/public/
52
+ ErrorLog /path/application/log/server.log
53
+
54
+ <Directory /path/application/public/>
55
+ Options ExecCGI FollowSymLinks
56
+ AllowOverride all
57
+ Allow from all
58
+ Order allow,deny
59
+ </Directory>
60
+ </VirtualHost>
61
+
62
+ NOTE: Be sure that CGIs can be executed in that directory as well. So ExecCGI
63
+ should be on and ".cgi" should respond. All requests from 127.0.0.1 goes
64
+ through CGI, so no Apache restart is necessary for changes. All other requests
65
+ goes through FCGI (or mod_ruby) that requires restart to show changes.
66
+
67
+
68
+ == Example for lighttpd conf (with FastCGI)
69
+
70
+ server.port = 8080
71
+ server.bind = "127.0.0.1"
72
+ # server.event-handler = "freebsd-kqueue" # needed on OS X
73
+
74
+ server.modules = ( "mod_rewrite", "mod_fastcgi" )
75
+
76
+ url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )
77
+ server.error-handler-404 = "/dispatch.fcgi"
78
+
79
+ server.document-root = "/path/application/public"
80
+ server.errorlog = "/path/application/log/server.log"
81
+
82
+ fastcgi.server = ( ".fcgi" =>
83
+ ( "localhost" =>
84
+ (
85
+ "min-procs" => 1,
86
+ "max-procs" => 5,
87
+ "socket" => "/tmp/application.fcgi.socket",
88
+ "bin-path" => "/path/application/public/dispatch.fcgi",
89
+ "bin-environment" => ( "RAILS_ENV" => "development" )
90
+ )
91
+ )
92
+ )
93
+
94
+
95
+ == Debugging Rails
96
+
97
+ Have "tail -f" commands running on both the server.log, production.log, and
98
+ test.log files. Rails will automatically display debugging and runtime
99
+ information to these files. Debugging info will also be shown in the browser
100
+ on requests from 127.0.0.1.
101
+
102
+
103
+ == Breakpoints
104
+
105
+ Breakpoint support is available through the script/breakpointer client. This
106
+ means that you can break out of execution at any point in the code, investigate
107
+ and change the model, AND then resume execution! Example:
108
+
109
+ class WeblogController < ActionController::Base
110
+ def index
111
+ @posts = Post.find_all
112
+ breakpoint "Breaking out from the list"
113
+ end
114
+ end
115
+
116
+ So the controller will accept the action, run the first line, then present you
117
+ with a IRB prompt in the breakpointer window. Here you can do things like:
118
+
119
+ Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint'
120
+
121
+ >> @posts.inspect
122
+ => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
123
+ #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
124
+ >> @posts.first.title = "hello from a breakpoint"
125
+ => "hello from a breakpoint"
126
+
127
+ ...and even better is that you can examine how your runtime objects actually work:
128
+
129
+ >> f = @posts.first
130
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
131
+ >> f.
132
+ Display all 152 possibilities? (y or n)
133
+
134
+ Finally, when you're ready to resume execution, you press CTRL-D
135
+
136
+
137
+ == Console
138
+
139
+ You can interact with the domain model by starting the console through script/console.
140
+ Here you'll have all parts of the application configured, just like it is when the
141
+ application is running. You can inspect domain models, change values, and save to the
142
+ database. Start the script without arguments will launch it in the development environment.
143
+ Passing an argument will specify a different environment, like <tt>console production</tt>.
144
+
145
+
146
+ == Description of contents
147
+
148
+ app
149
+ Holds all the code that's specific to this particular application.
150
+
151
+ app/controllers
152
+ Holds controllers that should be named like weblog_controller.rb for
153
+ automated URL mapping. All controllers should descend from
154
+ ActionController::Base.
155
+
156
+ app/models
157
+ Holds models that should be named like post.rb.
158
+ Most models will descent from ActiveRecord::Base.
159
+
160
+ app/views
161
+ Holds the template files for the view that should be named like
162
+ weblog/index.rhtml for the WeblogController#index action. All views uses eRuby
163
+ syntax. This directory can also be used to keep stylesheets, images, and so on
164
+ that can be symlinked to public.
165
+
166
+ app/helpers
167
+ Holds view helpers that should be named like weblog_helper.rb.
168
+
169
+ config
170
+ Configuration files for the Rails environment, the routing map, the database, and other dependencies.
171
+
172
+ components
173
+ Self-contained mini-applications that can bundle controllers, models, and views together.
174
+
175
+ lib
176
+ Application specific libraries. Basically, any kind of custom code that doesn't
177
+ belong controllers, models, or helpers. This directory is in the load path.
178
+
179
+ public
180
+ The directory available for the web server. Contains sub-directories for images, stylesheets,
181
+ and javascripts. Also contains the dispatchers and the default HTML files.
182
+
183
+ script
184
+ Helper scripts for automation and generation.
185
+
186
+ test
187
+ Unit and functional tests along with fixtures.
188
+
189
+ vendor
190
+ External libraries that the application depend on. This directory is in the load path.
@@ -0,0 +1,78 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2
+ "http://www.w3.org/TR/html4/loose.dtd">
3
+ <html>
4
+ <head>
5
+ <title>Rails: Welcome on board</title>
6
+ <style>
7
+ body { background-color: #fff; color: #333; }
8
+
9
+ body, p, ol, ul, td {
10
+ font-family: verdana, arial, helvetica, sans-serif;
11
+ font-size: 12px;
12
+ line-height: 18px;
13
+ }
14
+
15
+ li {
16
+ margin-bottom: 7px;
17
+ }
18
+
19
+ pre {
20
+ background-color: #eee;
21
+ padding: 10px;
22
+ font-size: 11px;
23
+ }
24
+
25
+ a { color: #000; }
26
+ a:visited { color: #666; }
27
+ a:hover { color: #fff; background-color:#000; }
28
+ </style>
29
+ </head>
30
+ <body>
31
+
32
+ <h1>Congratulations, you've put Ruby on Rails!</h1>
33
+
34
+ <p><b>Before you move on</b>, verify that the following conditions have been met:</p>
35
+
36
+ <ol>
37
+ <li>The log and public directories must be writable to the web server (<code>chmod -R 775 log</code> and <code>chmod -R 775 public</code>).
38
+ <li>
39
+ The shebang line in the public/dispatch* files must reference your Ruby installation. <br/>
40
+ You might need to change it to <code>#!/usr/bin/env ruby</code> or point directly at the installation.
41
+ </li>
42
+ <li>
43
+ Rails on Apache needs to have the cgi handler and mod_rewrite enabled. <br/>
44
+ Somewhere in your httpd.conf, you should have:<br/>
45
+ <code>AddHandler cgi-script .cgi</code><br/>
46
+ <code>LoadModule rewrite_module libexec/httpd/mod_rewrite.so</code><br/>
47
+ <code>AddModule mod_rewrite.c</code>
48
+ </li>
49
+ </ol>
50
+
51
+ <p>Take the following steps to get started:</p>
52
+
53
+ <ol>
54
+ <li>Create empty development and test databases for your application.<br/>
55
+ <small>Recommendation: Use *_development and *_test names, such as basecamp_development and basecamp_test</small><br/>
56
+ <small>Warning: Don't point your test database at your development database, it'll destroy the latter on test runs!</small>
57
+ <li>Edit config/database.yml with your database settings.
58
+ <li>Create controllers and models using the generator in <code>script/generate</code> <br/>
59
+ <small>Help: Run the generator with no arguments for documentation</small>
60
+ <li>See all the tests run by running <code>rake</code>.
61
+ <li>Develop your Rails application!
62
+ <li>Setup Apache with <a href="http://www.fastcgi.com">FastCGI</a> (and <a href="http://raa.ruby-lang.org/list.rhtml?name=fcgi">Ruby bindings</a>), if you need better performance
63
+ <li>Remove the dispatches you don't use (so if you're on FastCGI, delete/move dispatch.rb, dispatch.cgi and gateway.cgi)</li>
64
+ </ol>
65
+
66
+ <p>
67
+ Trying to setup a default page for Rails using Routes? You'll have to delete this file (public/index.html) to get under way. Then define a new route in <tt>config/routes.rb</tt> of the form:
68
+ <pre> map.connect '', :controller => 'wiki/page', :action => 'show', :title => 'Welcome'</pre>
69
+ </p>
70
+
71
+ <p>
72
+ Having problems getting up and running? First try debugging it yourself by looking at the log files. <br/>
73
+ Then try the friendly Rails community <a href="http://www.rubyonrails.org">on the web</a> or <a href="http://www.rubyonrails.org/show/IRC">on IRC</a>
74
+ (<a href="irc://irc.freenode.net/#rubyonrails">FreeNode#rubyonrails</a>).
75
+ </p>
76
+
77
+ </body>
78
+ </html>
data/public/robots.txt ADDED
@@ -0,0 +1 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file