1. Michael Granger
  2. Strelka

Commits

Michael Granger  committed 2b5ec37

Swap PluginFactory for Pluggability

  • Participants
  • Parent commits b697fcf
  • Branches default

Comments (0)

Files changed (10)

File .rvm.gems

View file
 configurability -v2.0.0
 foreman -v0.61.0
 highline -v1.6.15
-hoe-deveiate -v0.1.1
-inversion -v0.11.2
+hoe-deveiate -v0.2.0
+inversion -v0.12.0
 loggability -v0.5.0
 sequel -v3.44.0
 mongrel2 -v0.36.0
-pluginfactory -v1.0.8
+pluggability -v0.0.1
 simplecov -v0.7.1
 sysexits -v1.1.0
 trollop -v2.0

File Rakefile

View file
 	self.dependency 'configurability', '~> 2.0'
 	self.dependency 'foreman',         '~> 0.61'
 	self.dependency 'highline',        '~> 1.6'
-	self.dependency 'inversion',       '~> 0.11'
+	self.dependency 'inversion',       '~> 0.12'
 	self.dependency 'loggability',     '~> 0.5'
 	self.dependency 'mongrel2',        '~> 0.36'
-	self.dependency 'pluginfactory',   '~> 1.0'
+	self.dependency 'pluggability',    '~> 0.0'
 	self.dependency 'sysexits',        '~> 1.1'
 	self.dependency 'trollop',         '~> 2.0'
 	self.dependency 'uuidtools',       '~> 2.1'

File lib/strelka/app/auth.rb

View file
 #        plugins :auth, :errors, :templating
 #
 #        layout 'examples/layout.tmpl'
-#        templates \ 
+#        templates \
 #            form: 'examples/auth-form.tmpl',
 #            success: 'examples/auth-success.tmpl'
 #

File lib/strelka/app/parameters.rb

View file
 #       param :id, /\d+/, "The user's numeric ID"
 #       param :mode, /^\s*(?<prefix>[A-Z]{2})-(?<sku>\p{Print}+)/
 #
+#       # ...
+#
+#   end # class UserManager
+#
 # The first item is the parameter _key_, which corresponds to the field 'name' attribute for
 # a form, or the key for JSON or YAML data.
 #
 #
 # The inclusion of this plugin also allows you to use parameters in your routes:
 #
-#       # :username gets validated and merged into query args; URI parameters
-#       # clobber query params
-#       get '/info/:username' do |req|
-#           req.params.add( :id, /[XRT]\d{4}-\d{8}/ )
-#           req.params.okay?
-#           req.params[:username]
-#           req.params.values_at( :id, :username )
-#           req.params.username
+#   # :username gets validated and merged into query args; URI parameters
+#   # clobber query params
+#   get '/info/:username' do |req|
+#       req.params.add( :id, /[XRT]\d{4}-\d{8}/ )
+#       req.params.okay?
+#       req.params[:username]
+#       req.params.values_at( :id, :username )
+#       req.params.username
 #
-#           req.params.error_messages
-#       end
-#
-#   end # class UserManager
+#       req.params.error_messages
+#   end
 #
 # [:FIXME:] Add more docs.
 module Strelka::App::Parameters
 		end
 
 
-		### Add a 'builtin' constraint type with the specified +name+.
-		def add_param_type( name, &block )
-			
-		end
-
-
 		### Get/set the untainting flag. If set, all parameters which match their constraints
 		### will also be untainted.
 		def untaint_all_constraints( newval=nil )

File lib/strelka/authprovider.rb

View file
 # vim: set nosta noet ts=4 sw=4:
 # encoding: utf-8
 
-require 'pluginfactory'
+require 'pluggability'
 
 require 'strelka' unless defined?( Strelka )
 require 'strelka/mixins'
 #
 class Strelka::AuthProvider
 	extend Loggability,
+	       Pluggability,
 	       Strelka::Delegation
-	include PluginFactory,
-	        Strelka::Constants,
+	include Strelka::Constants,
 	        Strelka::AbstractClass,
 	        Strelka::ResponseHelpers
 
 	log_to :strelka
 
 
-	### PluginFactory API -- return the Array of directories to search for concrete
-	### AuthProvider classes.
-	def self::derivative_dirs
-		return ['strelka/authprovider']
-	end
+	# Pluggability API -- Specify the list of prefixes to try when loading plugins
+	plugin_prefixes 'strelka/authprovider'
 
 
 	#################################################################

File lib/strelka/router.rb

View file
 # encoding: utf-8
 
 require 'loggability'
-require 'pluginfactory'
+require 'pluggability'
 
 require 'strelka' unless defined?( Strelka )
 require 'strelka/app' unless defined?( Strelka::App )
 # <tt>strelka/router/{something}.rb</tt>, and be sure to override the
 # #add_route and #route_request methods.
 class Strelka::Router
-	extend Loggability
-	include PluginFactory,
-	        Strelka::AbstractClass
+	extend Loggability,
+	       Pluggability
+	include Strelka::AbstractClass
 
 	# Loggability API -- set up logging under the 'strelka' log host
 	log_to :strelka
 
-
-	### PluginFactory API -- return the Array of directories to search for plugins.
-	def self::derivative_dirs
-		return ['strelka/router']
-	end
+	# Pluggability API -- Specify the list of prefixes to try when loading plugins
+	plugin_prefixes 'strelka/router'
 
 
 	### Create a new router that will route requests according to the specified

File lib/strelka/session.rb

View file
 # vim: set nosta noet ts=4 sw=4:
 
 require 'digest/sha1'
-require 'pluginfactory'
+require 'pluggability'
 require 'loggability'
 
 require 'strelka' unless defined?( Strelka )
 #
 #
 class Strelka::Session
-	extend Loggability
-	include PluginFactory,
-	        Strelka::AbstractClass
+	extend Loggability,
+	       Pluggability
+	include Strelka::AbstractClass
+
 
 	# Loggability API -- set up logging under the 'strelka' log host
 	log_to :strelka
 
-
-	### PluginFactory API -- return the Array of directories to search for concrete
-	### Session classes.
-	def self::derivative_dirs
-		return ['strelka/session']
-	end
+	# Pluggability API -- Specify the list of prefixes to try when loading plugins
+	plugin_prefixes 'strelka/session'
 
 
 	### Configure the session class with the given +options+, which should be a

File spec/strelka/authprovider_spec.rb

View file
 
 
 	it "looks for plugins under strelka/authprovider" do
-		described_class.derivative_dirs.should include( 'strelka/authprovider' )
+		described_class.plugin_prefixes.should include( 'strelka/authprovider' )
 	end
 
 

File spec/strelka/router_spec.rb

View file
 
 
 	it "looks for plugins under strelka/router" do
-		Strelka::Router.derivative_dirs.should include( 'strelka/router' )
+		Strelka::Router.plugin_prefixes.should include( 'strelka/router' )
 	end
 
 

File spec/strelka/session_spec.rb

View file
 
 
 	it "looks for plugins under strelka/session" do
-		described_class.derivative_dirs.should include( 'strelka/session' )
+		described_class.plugin_prefixes.should include( 'strelka/session' )
 	end