Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
lib/model/base.rb | 66 | 38 | 92.42%
|
86.84%
|
Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.
1 # |
2 # Copyright [2011] [Red Hat, Inc.] |
3 # |
4 # Licensed under the Apache License, Version 2.0 (the "License"); |
5 # you may not use this file except in compliance with the License. |
6 # You may obtain a copy of the License at |
7 # |
8 # http://www.apache.org/licenses/LICENSE-2.0 |
9 # |
10 # Unless required by applicable law or agreed to in writing, software |
11 # distributed under the License is distributed on an "AS IS" BASIS, |
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 # See the License for the specific language governing permissions and |
14 # limitations under the License. |
15 # |
16 require 'fileutils' |
17 |
18 module ConfigServer |
19 module Model |
20 @@storage_dir = "" |
21 @@instance_config_schema_location = "" |
22 |
23 @@configurable_mapping = {} |
24 |
25 def self.add_configurable_mapping(name, klass) |
26 @@configurable_mapping[name] = klass |
27 end |
28 |
29 def self.storage_dir=(dir) |
30 @@storage_dir = dir |
31 end |
32 |
33 def self.storage_dir |
34 @@storage_dir |
35 end |
36 |
37 def self.update_required_parameters_in_deployable(params={}) |
38 end |
39 |
40 class Base |
41 def initialize |
42 Base.ensure_storage_path |
43 end |
44 |
45 def logger |
46 $LOGGER |
47 end |
48 |
49 def self.ensure_storage_path |
50 path = storage_path |
51 if not (path.nil? or path.empty? or File.directory?(path)) |
52 FileUtils.mkdir_p(path, :mode => 0700) |
53 end |
54 end |
55 |
56 def self.storage_path(path=nil) |
57 # implement this method to return the storage directory for the model |
58 # object |
59 # |
60 return (path.nil?) ? |
61 ConfigServer::Model.storage_dir : |
62 File.join(ConfigServer::Model.storage_dir, path) |
63 end |
64 end |
65 end |
66 end |
Generated on Wed Dec 14 16:00:31 -0500 2011 with rcov 0.9.11