Skip to content

Commit

Permalink
unload client class after running it
Browse files Browse the repository at this point in the history
to fully initialize includes in the next run
(gh#yast/ycp-killer#504)

- 1.1.5
  • Loading branch information
Ladislav Slezak committed Jul 17, 2013
1 parent 877c561 commit 7172962
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion VERSION.cmake
@@ -1,3 +1,3 @@
SET(VERSION_MAJOR "1")
SET(VERSION_MINOR "1")
SET(VERSION_PATCH "4")
SET(VERSION_PATCH "5")
9 changes: 9 additions & 0 deletions package/yast2-ruby-bindings.changes
@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Wed Jul 17 11:26:35 UTC 2013 - lslezak@suse.cz

- added Ops.get_* shortcut methods (dmajda)
- fix detecting of complex path in the last segment (jreidinger)
- unload client class after running it to fully initialize includes
in the next run (gh#yast/ycp-killer#504)
- 1.1.5

-------------------------------------------------------------------
Tue Jul 9 08:57:21 UTC 2013 - jreidinger@suse.com

Expand Down
15 changes: 15 additions & 0 deletions src/ruby/yast/wfm.rb
Expand Up @@ -86,6 +86,21 @@ def self.run_client client
e.backtrace
)
return nil
ensure
# unload the client class to ensure that the includes will be
# fully initialized when running it next time
# (Yast.include skips initialize_<include> calls when the include
# module is already present in the target class)
client_without_suffix = File.basename(client).sub(/\.rb$/, "")
client_name = (client_without_suffix.
gsub(/^./) { |s| s.upcase }.
gsub(/[-_.]./) { |s| s[1].upcase } +
"Client").to_sym

if Yast.constants.include?(client_name)
Yast.y2debug "Unloading client class #{client_name}"
Yast.send(:remove_const, client_name)
end
end
end
end
Expand Down

0 comments on commit 7172962

Please sign in to comment.