kjeldahl-metric_fu 1.1.5.2 → 1.1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/base/configuration.rb +5 -0
- data/spec/base/base_template_spec.rb +2 -2
- data/spec/base/configuration_spec.rb +20 -0
- data/tasks/metric_fu.rake +1 -1
- metadata +1 -1
data/lib/base/configuration.rb
CHANGED
@@ -100,6 +100,7 @@ module MetricFu
|
|
100
100
|
@scratch_directory = File.join(@base_directory, 'scratch')
|
101
101
|
@output_directory = File.join(@base_directory, 'output')
|
102
102
|
@data_directory = File.join('tmp/metric_fu', '_data')
|
103
|
+
@daily_data_resolution = true
|
103
104
|
@metric_fu_root_directory = File.join(File.dirname(__FILE__),
|
104
105
|
'..', '..')
|
105
106
|
@template_directory = File.join(@metric_fu_root_directory,
|
@@ -175,6 +176,10 @@ module MetricFu
|
|
175
176
|
@code_dirs = ['lib']
|
176
177
|
end
|
177
178
|
end
|
179
|
+
|
180
|
+
def data_filename
|
181
|
+
@daily_data_resolution ? "#{Time.now.strftime("%Y%m%d")}.yml" : "#{Time.now.strftime("%Y%m%d%H%M")}.yml"
|
182
|
+
end
|
178
183
|
|
179
184
|
def platform #:nodoc:
|
180
185
|
return RUBY_PLATFORM
|
@@ -109,7 +109,7 @@ describe MetricFu::Template do
|
|
109
109
|
File.stub!(:expand_path).with('filename').and_return('/expanded/filename')
|
110
110
|
result = @template.send(:link_to_filename, 'filename', 6)
|
111
111
|
result.should eql("<a href='txmt://open/?url=file://" \
|
112
|
-
+ "/expanded/filename&line=6'>filename:6</a>")
|
112
|
+
+ "/expanded/filename&line=6'>filename:6</a>")
|
113
113
|
end
|
114
114
|
|
115
115
|
describe "and given link text" do
|
@@ -117,7 +117,7 @@ describe MetricFu::Template do
|
|
117
117
|
File.stub!(:expand_path).with('filename').and_return('/expanded/filename')
|
118
118
|
result = @template.send(:link_to_filename, 'filename', 6, 'link content')
|
119
119
|
result.should eql("<a href='txmt://open/?url=file://" \
|
120
|
-
+ "/expanded/filename&line=6'>link content</a>")
|
120
|
+
+ "/expanded/filename&line=6'>link content</a>")
|
121
121
|
end
|
122
122
|
end
|
123
123
|
end
|
@@ -297,4 +297,24 @@ describe MetricFu::Configuration do
|
|
297
297
|
end
|
298
298
|
end
|
299
299
|
end
|
300
|
+
|
301
|
+
describe "#data_filename" do
|
302
|
+
before(:each) { get_new_config }
|
303
|
+
describe "when daily_data_resolution is set" do
|
304
|
+
before(:each) do
|
305
|
+
@config.instance_variable_set(:@daily_data_resolution, true)
|
306
|
+
end
|
307
|
+
it "should return a filename with 8 digits" do
|
308
|
+
@config.data_filename.should == "#{Time.now.strftime("%Y%m%d")}.yml"
|
309
|
+
end
|
310
|
+
end
|
311
|
+
describe "when daily_data_resolution is NOT set" do
|
312
|
+
before(:each) do
|
313
|
+
@config.daily_data_resolution = false
|
314
|
+
end
|
315
|
+
it "should return a filename with 12 digits" do
|
316
|
+
@config.data_filename.should == "#{Time.now.strftime("%Y%m%d%H%M")}.yml"
|
317
|
+
end
|
318
|
+
end
|
319
|
+
end
|
300
320
|
end
|
data/tasks/metric_fu.rake
CHANGED
@@ -9,7 +9,7 @@ namespace :metrics do
|
|
9
9
|
"report.yml")
|
10
10
|
MetricFu.report.save_output(MetricFu.report.to_yaml,
|
11
11
|
MetricFu.data_directory,
|
12
|
-
|
12
|
+
MetricFu.data_filename)
|
13
13
|
MetricFu.report.save_templatized_report
|
14
14
|
|
15
15
|
MetricFu.graphs.each {|graph| MetricFu.graph.add(graph) }
|