rails 0.13.1 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rails might be problematic. Click here for more details.
- data/CHANGELOG +105 -0
- data/Rakefile +39 -17
- data/bin/breakpointer +2 -2
- data/bin/console +2 -22
- data/bin/destroy +2 -6
- data/bin/generate +2 -6
- data/bin/performance/benchmarker +3 -0
- data/bin/performance/profiler +3 -0
- data/bin/process/reaper +3 -0
- data/bin/process/spawner +3 -0
- data/bin/process/spinner +3 -0
- data/bin/rails +4 -0
- data/bin/runner +2 -27
- data/bin/server +2 -48
- data/configs/apache.conf +8 -0
- data/configs/database.yml +8 -8
- data/environments/boot.rb +17 -0
- data/environments/development.rb +10 -7
- data/environments/environment.rb +37 -73
- data/environments/production.rb +15 -6
- data/environments/test.rb +12 -6
- data/fresh_rakefile +6 -198
- data/helpers/application.rb +2 -2
- data/helpers/application_helper.rb +1 -1
- data/helpers/test_helper.rb +6 -19
- data/html/javascripts/controls.js +427 -165
- data/html/javascripts/dragdrop.js +256 -277
- data/html/javascripts/effects.js +766 -277
- data/html/javascripts/prototype.js +903 -217
- data/html/javascripts/scriptaculous.js +47 -0
- data/html/javascripts/slider.js +258 -0
- data/html/robots.txt +1 -0
- data/lib/binding_of_caller.rb +3 -1
- data/lib/breakpoint.rb +5 -5
- data/lib/breakpoint_client.rb +1 -1
- data/lib/code_statistics.rb +7 -4
- data/lib/commands.rb +17 -0
- data/lib/commands/breakpointer.rb +1 -0
- data/lib/commands/console.rb +22 -0
- data/lib/commands/destroy.rb +6 -0
- data/lib/commands/generate.rb +6 -0
- data/{bin → lib/commands/ncgi}/listener +0 -0
- data/{bin → lib/commands/ncgi}/tracker +0 -0
- data/lib/commands/performance/benchmarker.rb +26 -0
- data/{bin/profiler → lib/commands/performance/profiler.rb} +3 -2
- data/lib/commands/process/reaper.rb +130 -0
- data/lib/commands/process/spawner.rb +52 -0
- data/lib/commands/process/spinner.rb +57 -0
- data/lib/commands/runner.rb +27 -0
- data/lib/commands/server.rb +59 -0
- data/{bin/update → lib/commands/update.rb} +1 -2
- data/lib/dispatcher.rb +20 -3
- data/lib/fcgi_handler.rb +59 -41
- data/lib/initializer.rb +479 -0
- data/lib/rails_generator/base.rb +2 -2
- data/lib/rails_generator/commands.rb +59 -7
- data/lib/rails_generator/generators/applications/app/app_generator.rb +26 -15
- data/lib/rails_generator/generators/components/controller/controller_generator.rb +3 -2
- data/lib/rails_generator/generators/components/controller/templates/view.rhtml +1 -1
- data/lib/rails_generator/generators/components/mailer/USAGE +2 -3
- data/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +1 -1
- data/lib/rails_generator/generators/components/migration/migration_generator.rb +3 -1
- data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +32 -31
- data/lib/rails_generator/generators/components/scaffold/templates/view_edit.rhtml +1 -1
- data/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml +1 -1
- data/lib/rails_generator/generators/components/scaffold/templates/view_new.rhtml +1 -1
- data/lib/rails_generator/lookup.rb +3 -3
- data/lib/rails_generator/options.rb +1 -0
- data/lib/rails_generator/scripts.rb +1 -1
- data/lib/rails_version.rb +9 -0
- data/lib/railties_path.rb +1 -0
- data/lib/rubyprof_ext.rb +1 -1
- data/lib/tasks/databases.rake +152 -0
- data/lib/tasks/documentation.rake +44 -0
- data/lib/tasks/framework.rake +33 -0
- data/lib/tasks/javascripts.rake +6 -0
- data/lib/tasks/misc.rake +15 -0
- data/lib/tasks/rails.rb +7 -0
- data/lib/tasks/statistics.rake +16 -0
- data/lib/tasks/testing.rake +37 -0
- data/lib/test_help.rb +13 -0
- data/lib/webrick_server.rb +31 -9
- metadata +121 -85
- data/bin/benchmarker +0 -19
- data/bin/breakpointer_for_gem +0 -4
- data/bin/console_sandbox +0 -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/html/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
|
data/lib/binding_of_caller.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
begin
|
2
2
|
require 'simplecc'
|
3
3
|
rescue LoadError
|
4
|
-
|
4
|
+
# to satisfy rdoc
|
5
|
+
class Continuation #:nodoc:
|
6
|
+
end
|
5
7
|
def Continuation.create(*args, &block) # :nodoc:
|
6
8
|
cc = nil; result = callcc {|c| cc = c; block.call(cc) if block and args.empty?}
|
7
9
|
result ||= args
|
data/lib/breakpoint.rb
CHANGED
@@ -462,7 +462,7 @@ module IRB # :nodoc:
|
|
462
462
|
end
|
463
463
|
def IRB.parse_opts() end
|
464
464
|
|
465
|
-
class Context
|
465
|
+
class Context #:nodoc:
|
466
466
|
alias :old_evaluate :evaluate
|
467
467
|
def evaluate(line, line_no)
|
468
468
|
if line.chomp == "exit" then
|
@@ -473,7 +473,7 @@ module IRB # :nodoc:
|
|
473
473
|
end
|
474
474
|
end
|
475
475
|
|
476
|
-
class WorkSpace
|
476
|
+
class WorkSpace #:nodoc:
|
477
477
|
alias :old_evaluate :evaluate
|
478
478
|
|
479
479
|
def evaluate(*args)
|
@@ -491,7 +491,7 @@ module IRB # :nodoc:
|
|
491
491
|
end
|
492
492
|
end
|
493
493
|
|
494
|
-
module InputCompletor
|
494
|
+
module InputCompletor #:nodoc:
|
495
495
|
def self.eval(code, context, *more)
|
496
496
|
# Big hack, this assumes that InputCompletor
|
497
497
|
# will only call eval() when it wants code
|
@@ -501,8 +501,8 @@ module IRB # :nodoc:
|
|
501
501
|
end
|
502
502
|
end
|
503
503
|
|
504
|
-
module DRb
|
505
|
-
class DRbObject
|
504
|
+
module DRb #:nodoc:
|
505
|
+
class DRbObject #:nodoc:
|
506
506
|
undef :inspect if method_defined?(:inspect)
|
507
507
|
undef :clone if method_defined?(:clone)
|
508
508
|
end
|
data/lib/breakpoint_client.rb
CHANGED
data/lib/code_statistics.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
class CodeStatistics
|
1
|
+
class CodeStatistics #:nodoc:
|
2
|
+
|
3
|
+
TEST_TYPES = ['Units', 'Functionals', 'Unit tests', 'Functional tests']
|
4
|
+
|
2
5
|
def initialize(*pairs)
|
3
6
|
@pairs = pairs
|
4
7
|
@statistics = calculate_statistics
|
@@ -55,13 +58,13 @@ class CodeStatistics
|
|
55
58
|
|
56
59
|
def calculate_code
|
57
60
|
code_loc = 0
|
58
|
-
@statistics.each { |k, v| code_loc += v['codelines'] unless
|
61
|
+
@statistics.each { |k, v| code_loc += v['codelines'] unless TEST_TYPES.include? k }
|
59
62
|
code_loc
|
60
63
|
end
|
61
64
|
|
62
65
|
def calculate_tests
|
63
66
|
test_loc = 0
|
64
|
-
@statistics.each { |k, v| test_loc += v['codelines'] if
|
67
|
+
@statistics.each { |k, v| test_loc += v['codelines'] if TEST_TYPES.include? k }
|
65
68
|
test_loc
|
66
69
|
end
|
67
70
|
|
@@ -79,7 +82,7 @@ class CodeStatistics
|
|
79
82
|
m_over_c = (statistics["methods"] / statistics["classes"]) rescue m_over_c = 0
|
80
83
|
loc_over_m = (statistics["codelines"] / statistics["methods"]) - 2 rescue loc_over_m = 0
|
81
84
|
|
82
|
-
start = if
|
85
|
+
start = if TEST_TYPES.include? name
|
83
86
|
"| #{name.ljust(18)} "
|
84
87
|
else
|
85
88
|
"| #{name.ljust(20)} "
|
data/lib/commands.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
commands = Dir["#{File.dirname(__FILE__)}/commands/*.rb"].collect { |file_path| File.basename(file_path).split(".").first }
|
2
|
+
|
3
|
+
if commands.include?(ARGV.first)
|
4
|
+
require "#{File.dirname(__FILE__)}/commands/#{ARGV.shift}"
|
5
|
+
else
|
6
|
+
puts <<-USAGE
|
7
|
+
The 'run' provides a unified access point for all the default Rails' commands.
|
8
|
+
|
9
|
+
Usage: ./script/run <command> [OPTIONS]
|
10
|
+
|
11
|
+
Examples:
|
12
|
+
./script/run generate controller Admin
|
13
|
+
./script/run process reaper
|
14
|
+
|
15
|
+
USAGE
|
16
|
+
puts "Choose: #{commands.join(", ")}"
|
17
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'breakpoint_client'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
irb = RUBY_PLATFORM =~ /mswin32/ ? 'irb.bat' : 'irb'
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
options = { :sandbox => false, :irb => irb }
|
5
|
+
OptionParser.new do |opt|
|
6
|
+
opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |options[:sandbox]| }
|
7
|
+
opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |options[:irb]| }
|
8
|
+
opt.parse!(ARGV)
|
9
|
+
end
|
10
|
+
|
11
|
+
libs = " -r irb/completion"
|
12
|
+
libs << " -r #{RAILS_ROOT}/config/environment"
|
13
|
+
libs << " -r console_sandbox" if options[:sandbox]
|
14
|
+
|
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 "#{options[:irb]} #{libs} --prompt-mode simple"
|