Top Level Namespace
- Includes:
- Aquarium::Aspects, Toaster
Defined Under Namespace
Modules: Kernel, Toaster Classes: Chef, MyThreadOut, RubyLexer, ToasterAppService, User
Constant Summary collapse
- TOASTER_ROOT_DIR =
File.join(File.dirname(__FILE__), "..","..","..")
Instance Method Summary collapse
- #create_diff_for_package(p1, p2, pkg) ⇒ Object
- #diff__files(f1, f2) ⇒ Object
-
#diff__packages(p1, p2) ⇒ Object
takes two state property hashes (pre-state and post-state) and returns an array of state property changes.
- #eliminate_json_map_entries(p) ⇒ Object
- #execute(cmd, silent = false) ⇒ Object
-
#ignore_properties__files ⇒ Object
return a list of properties which should not be considered for test case generation or computation of the state transition graphs.
-
#ignore_properties__packages ⇒ Object
return a list of properties which should not be considered for test case generation or computation of the state transition graphs.
- #reduce__files(f1, f2) ⇒ Object
-
#reduce__packages(p1, p2) ⇒ Object
takes two state property hashes (pre-state and post-state) and returns a pair of states which are either equal to or a subset of the given states.
Instance Method Details
#create_diff_for_package(p1, p2, pkg) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/toaster/ohai/packages/_meta.rb', line 51 def create_diff_for_package(p1, p2, pkg) pkg1 = p1[pkg] pkg2 = p2[pkg] return nil if pkg1 && pkg2 && pkg1 == pkg2 name = "packages['#{pkg}']" if pkg1 && !pkg2 return StateChange.new(name, StateChange::ACTION_DELETE, pkg1) elsif !pkg1 && pkg2 return StateChange.new(name, StateChange::ACTION_INSERT, pkg2) elsif pkg1 && pkg2 && pkg1 != pkg2 return StateChange.new(name, StateChange::ACTION_MODIFY, pkg2, pkg1) end end |
#diff__files(f1, f2) ⇒ Object
22 23 24 25 |
# File 'lib/toaster/ohai/files/_meta.rb', line 22 def diff__files(f1, f2) # not implemented return nil end |
#diff__packages(p1, p2) ⇒ Object
takes two state property hashes (pre-state and post-state) and returns an array of state property changes
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/toaster/ohai/packages/_meta.rb', line 9 def diff__packages(p1, p2) result = [] pkg_names = Set.new p1 = eliminate_json_map_entries(p1) p2 = eliminate_json_map_entries(p2) p1.each do |k,v| pkg_names.add(k) end p2.each do |k,v| pkg_names.add(k) end pkg_names.each do |pn| d = create_diff_for_package(p1, p2, pn) result << d if d end return result end |
#eliminate_json_map_entries(p) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/toaster/ohai/packages/_meta.rb', line 65 def eliminate_json_map_entries(p) return if !p p = p.dup sub = p[MarkupUtil::JSON_MAP_ENTRY_NAME] p.delete(MarkupUtil::JSON_MAP_ENTRY_NAME) if sub sub.each do |pair| key = pair[MarkupUtil::JSON_MAP_ENTRY_KEY] val = pair[MarkupUtil::JSON_MAP_ENTRY_VALUE] p[key] = val if key && val end end return p end |
#execute(cmd, silent = false) ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/toaster/toaster_app_service.rb', line 67 def execute(cmd, silent=false) puts "Executing command: #{cmd}" if !silent output = `#{cmd}` retval = $? puts "return code: #{retval}, output: \n#{output}" if !silent return retval end |
#ignore_properties__files ⇒ Object
return a list of properties which should not be considered for test case generation or computation of the state transition graphs
15 16 17 18 19 20 |
# File 'lib/toaster/ohai/files/_meta.rb', line 15 def ignore_properties__files() return [ /(')*files.*\.(')*ctime(')*/, # file creating time /(')*files.*\.(')*mtime(')*/ # file modification time ] end |
#ignore_properties__packages ⇒ Object
return a list of properties which should not be considered for test case generation or computation of the state transition graphs
84 85 86 |
# File 'lib/toaster/ohai/packages/_meta.rb', line 84 def ignore_properties__packages() return [] end |
#reduce__files(f1, f2) ⇒ Object
27 28 29 30 |
# File 'lib/toaster/ohai/files/_meta.rb', line 27 def reduce__files(f1, f2) # not implemented return nil end |
#reduce__packages(p1, p2) ⇒ Object
takes two state property hashes (pre-state and post-state) and returns a pair of states which are either equal to or a subset of the given states.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/toaster/ohai/packages/_meta.rb', line 30 def reduce__packages(p1, p2) any_changes = false max_items = 100 if p1.size > max_items p1.keys.dup.each do |k| if p1.size <= max_items break end if p1[k] == p2[k] p1.delete(k) p2.delete(k) any_changes = true end end end if any_changes p1["__INFO__"] = "Some items left out." p2["__INFO__"] = "Some items left out." end end |