Permalink
Browse files

Remove :bundle argument for plugins.

  • Loading branch information...
1 parent 6e95cf9 commit 9d236d351e0fea95bccd28f2848983cf07a0eff2 @pcapriotti committed Apr 2, 2010
@@ -5,8 +5,7 @@ class HelloWorldPlugin
include ActionProvider
plugin :name => 'Hello World',
- :interface => :action_provider,
- :bundle => 'helloworld'
+ :interface => :action_provider
def initialize
action(:hello_world,
@@ -12,8 +12,7 @@ class CelticPieces < SvgTheme
include Plugin
plugin :name => 'Celtic Pieces',
:interface => :pieces,
- :keywords => %w(chess),
- :bundle => 'celtic'
+ :keywords => %w(chess)
def initialize(opts = {})
super(opts)
@@ -28,8 +28,7 @@ class Game
plugin :name => KDE::i18n('Chess'),
:id => :chess,
:interface => :game,
- :category => 'Chess',
- :bundle => 'chess'
+ :category => 'Chess'
attr_reader :size, :policy, :state, :board, :move,
:animator, :validator, :piece, :players,
@@ -20,8 +20,7 @@ class Game
:interface => :game,
:id => :crazyhouse,
:category => 'Chess',
- :depends => [:chess, :shogi],
- :bundle => 'crazyhouse'
+ :depends => [:chess, :shogi]
attr_reader :size, :state, :board, :pool,
:policy, :move, :animator, :validator,
@@ -14,8 +14,7 @@ class GNUShogiEngine < Engine
plugin :name => 'GNUShogi Engine Protocol',
:protocol => 'GNUShogi',
- :interface => :engine,
- :bundle => 'engines'
+ :interface => :engine
def on_move(data)
text = @serializer.serialize(data[:move], data[:old_state])
@@ -15,8 +15,7 @@ class XBoardEngine < Engine
plugin :name => 'XBoard Engine Protocol',
:protocol => 'XBoard',
- :interface => :engine,
- :bundle => 'engines'
+ :interface => :engine
FEATURES = %w(ping setboard playother san usermove time draw sigint sigterm
reuse analyze myname variants colors ics name pause done)
@@ -12,8 +12,7 @@ class FantasyPieces < SvgTheme
include Plugin
plugin :name => 'Fantasy Pieces',
:interface => :pieces,
- :keywords => %w(chess),
- :bundle => 'fantasy'
+ :keywords => %w(chess)
def initialize(opts = {})
super(opts)
View
@@ -19,8 +19,7 @@ class ICSPlugin
include ActionProvider
plugin :name => 'ICS Plugin',
- :interface => :action_provider,
- :bundle => 'ics'
+ :interface => :action_provider
attr_reader :gui
@@ -14,8 +14,7 @@ class CoolLayout
include ItemUtils
plugin :name => 'Cool Layout',
- :interface => :layout,
- :bundle => 'layouts'
+ :interface => :layout
# values relative to unit = 1
MARGIN = 0.2
View
@@ -18,13 +18,8 @@ def included(base)
end
module Bundle
- BASE_PLUGIN_PATH = File.expand_path(File.dirname(__FILE__))
- def bundle_rel(bundle, *args)
- File.join(BASE_PLUGIN_PATH, bundle, *args)
- end
-
def rel(*args)
- bundle_rel(bundle, *args)
+ File.join(bundle_dir, *args)
end
end
@@ -33,6 +28,8 @@ module ClassMethods
attr_reader :bundle_dir
def plugin(args)
+ plugin_file, *_ = caller[0].split(':')
+ @bundle_dir = File.dirname(plugin_file)
@plugin_data = args
end
@@ -51,11 +48,6 @@ def implements?(iface)
def data(key)
@plugin_data[key]
end
-
- def bundle
- @plugin_data[:bundle] or
- raise("No bundle specified")
- end
end
extend ModuleMethods
@@ -65,7 +57,7 @@ def keywords
self.class.data(:keywords)
end
- def bundle
- self.class.bundle
+ def bundle_dir
+ self.class.bundle_dir
end
end
@@ -28,8 +28,7 @@ class Game
:id => :shogi,
:interface => :game,
:category => 'Shogi',
- :depends => [:chess],
- :bundle => 'shogi'
+ :depends => [:chess]
attr_reader :size, :state, :board, :pool,
:policy, :move, :animator, :validator,
@@ -20,8 +20,7 @@ class ShogibanBackground
plugin :name => 'Shogiban',
:interface => :board,
- :keywords => %w(shogi),
- :bundle => 'shogi'
+ :keywords => %w(shogi)
def initialize(opts = {})
@squares = opts[:board_size] || opts[:game].size
@@ -61,8 +60,7 @@ class ShogiPieces
plugin :name => 'Shogi Pieces',
:interface => :pieces,
- :keywords => %w(shogi),
- :bundle => 'shogi'
+ :keywords => %w(shogi)
TYPES = { :knight => 'n' }
NUDE_TILE = rel('pics', 'nude_tile.svg')
@@ -7,7 +7,7 @@
require 'test/unit'
require 'require_bundle'
-require_bundle 'chess', 'move'
+require 'plugins/chess/lib/move'
class TestChessMove < Test::Unit::TestCase
def test_simple_move_fields

0 comments on commit 9d236d3

Please sign in to comment.