From e9185434341b4ab5f1d49d521064d2f4ffd27347 Mon Sep 17 00:00:00 2001 From: Paolo Capriotti Date: Thu, 2 Jul 2009 11:49:49 +0200 Subject: [PATCH] Backported de09752972bd6e1c8a68d8c1d06c3311721dc1bd. --- lib/games/shogi/psn.rb | 2 ++ lib/plugins/clocks/digital.rb | 2 ++ lib/plugins/engines/loader.rb | 3 +++ lib/plugins/loader.rb | 4 ++++ lib/plugins/movelist/simple_movelist.rb | 1 + test/plugins/test_loadable.rb | 30 ++++++++++++++++++++++++++++++ 6 files changed, 42 insertions(+) create mode 100644 test/plugins/test_loadable.rb diff --git a/lib/games/shogi/psn.rb b/lib/games/shogi/psn.rb index a8eb23a..0dbb008 100644 --- a/lib/games/shogi/psn.rb +++ b/lib/games/shogi/psn.rb @@ -5,6 +5,8 @@ # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. +require 'games/chess/pgn' + module Shogi class PSN < Chess::PGN diff --git a/lib/plugins/clocks/digital.rb b/lib/plugins/clocks/digital.rb index bd4d6ec..463699f 100644 --- a/lib/plugins/clocks/digital.rb +++ b/lib/plugins/clocks/digital.rb @@ -5,9 +5,11 @@ # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. +require 'qtutils' require 'plugins/plugin' require 'constrained_text_item' require 'board/item_bag' +require 'observer_utils' class DigitalClock < Qt::GraphicsItemGroup include Plugin diff --git a/lib/plugins/engines/loader.rb b/lib/plugins/engines/loader.rb index bcf8a76..1618752 100644 --- a/lib/plugins/engines/loader.rb +++ b/lib/plugins/engines/loader.rb @@ -5,8 +5,11 @@ # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. +require 'qtutils' +require 'plugins/plugin' require 'factory' + class EngineLoader include Plugin include Enumerable diff --git a/lib/plugins/loader.rb b/lib/plugins/loader.rb index 2b45474..a91f066 100644 --- a/lib/plugins/loader.rb +++ b/lib/plugins/loader.rb @@ -52,4 +52,8 @@ class PluginLoader @instance ||= PluginLoader.internal_new end end + + def self.base_dir + File.expand_path(BASE_DIR) + end end diff --git a/lib/plugins/movelist/simple_movelist.rb b/lib/plugins/movelist/simple_movelist.rb index 0807d06..57a213e 100644 --- a/lib/plugins/movelist/simple_movelist.rb +++ b/lib/plugins/movelist/simple_movelist.rb @@ -5,6 +5,7 @@ # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. +require 'qtutils' require 'plugins/plugin' require 'observer_utils' diff --git a/test/plugins/test_loadable.rb b/test/plugins/test_loadable.rb new file mode 100644 index 0000000..cf1757a --- /dev/null +++ b/test/plugins/test_loadable.rb @@ -0,0 +1,30 @@ +# Copyright (c) 2009 Paolo Capriotti +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +require 'test/unit' +require 'plugins/loader' +require 'rbconfig' + +class TestLoadable < Test::Unit::TestCase + RUBY_EXE = Config::CONFIG['ruby_install_name'] + + def test_load_plugins + plugins = PluginLoader.base_dir + lib = File.join(plugins, '..') + + Dir[File.join(plugins, '*')].each do |f| + if File.directory?(f) + Dir[File.join(f, '*.rb')].each do |rb_file| + `#{RUBY_EXE} -I#{lib} #{rb_file}` + assert_equal 0, $? + end + end + end + end + +end + -- 2.11.4.GIT