Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove :bundle argument for plugins.

  • Loading branch information...
commit 9d236d351e0fea95bccd28f2848983cf07a0eff2 1 parent 6e95cf9
@pcapriotti authored
View
3  examples/helloworld/hello_world.rb
@@ -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,
View
3  lib/plugins/celtic/celtic.rb
@@ -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)
View
3  lib/plugins/chess/chess.rb
@@ -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,
View
3  lib/plugins/crazyhouse/crazyhouse.rb
@@ -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,
View
3  lib/plugins/engines/gnushogi.rb
@@ -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])
View
3  lib/plugins/engines/xboard.rb
@@ -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)
View
3  lib/plugins/fantasy/fantasy.rb
@@ -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
3  lib/plugins/ics/ics.rb
@@ -19,8 +19,7 @@ class ICSPlugin
include ActionProvider
plugin :name => 'ICS Plugin',
- :interface => :action_provider,
- :bundle => 'ics'
+ :interface => :action_provider
attr_reader :gui
View
3  lib/plugins/layouts/cool.rb
@@ -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 lib/plugins/plugin.rb
@@ -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
View
3  lib/plugins/shogi/shogi.rb
@@ -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,
View
6 lib/plugins/shogi/theme.rb
@@ -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')
View
2  test/plugins/chess/test_chess_move.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.