Update for Configurability 3.x. v0.2.0
authorMahlon E. Smith <mahlon@martini.nu>
Mon, 16 Jan 2017 12:47:50 -0800
changeset 11 b1f97f6063a3
parent 10 8388c2d1d7af
child 12 2f9a295bdba7
Update for Configurability 3.x.
History.md
LICENSE.rdoc
README.md
Rakefile
lib/thingfish/metastore/pggraph.rb
--- a/History.md	Mon Nov 14 15:17:46 2016 -0800
+++ b/History.md	Mon Jan 16 12:47:50 2017 -0800
@@ -1,3 +1,8 @@
+## v0.2.0 [2017-01-16] Mahlon E. Smith <mahlon@martini.nu>
+
+Update for Configurability 3.x.
+
+
 ## v0.1.3 [2016-11-14] Mahlon E. Smith <mahlon@martini.nu>
 
 Various bugfixes, first public release.
--- a/LICENSE.rdoc	Mon Nov 14 15:17:46 2016 -0800
+++ b/LICENSE.rdoc	Mon Jan 16 12:47:50 2017 -0800
@@ -1,4 +1,4 @@
-Copyright (c) 2007-2016, Michael Granger and Mahlon E. Smith.
+Copyright (c) 2007-2017, Michael Granger and Mahlon E. Smith.
 
 All rights reserved.
 
--- a/README.md	Mon Nov 14 15:17:46 2016 -0800
+++ b/README.md	Mon Jan 16 12:47:50 2017 -0800
@@ -35,8 +35,8 @@
         thingfish:
           metastore: pggraph
 
-        pggraph_metastore:
-          uri: postgres://thingfish:password@db.example.com/database
+          pggraph_metastore:
+            uri: postgres://thingfish:password@db.example.com/database
 
 
 When Thingfish starts, it will install the necessary database schema
@@ -44,7 +44,7 @@
 
 ## License
 
-Copyright (c) 2014-2016, Michael Granger and Mahlon E. Smith.
+Copyright (c) 2014-2017, Michael Granger and Mahlon E. Smith.
 
 All rights reserved.
 
--- a/Rakefile	Mon Nov 14 15:17:46 2016 -0800
+++ b/Rakefile	Mon Jan 16 12:47:50 2017 -0800
@@ -50,9 +50,8 @@
 	EOF
 	s.required_ruby_version = '>= 2.3'
 
-	s.add_dependency 'thingfish', '~> 0.5'
+	s.add_dependency 'thingfish', '~> 0.6'
 	s.add_dependency 'loggability', '~> 0.11'
-	s.add_dependency 'configurability', '~> 2.2'
 	s.add_dependency 'sequel', '~> 4.35'
 	s.add_dependency 'pg', '~> 0.19'
 end
--- a/lib/thingfish/metastore/pggraph.rb	Mon Nov 14 15:17:46 2016 -0800
+++ b/lib/thingfish/metastore/pggraph.rb	Mon Jan 16 12:47:50 2017 -0800
@@ -24,7 +24,7 @@
 
 
 	# Package version
-	VERSION = '0.1.3'
+	VERSION = '0.2.0'
 
 	# Version control revision
 	REVISION = %q$Revision$
@@ -40,31 +40,21 @@
 				'data' + 'thingfish-metastore-pggraph'
 		end
 
-	# The default config values
-	DEFAULT_CONFIG = {
-		uri: 'postgres:/thingfish',
-		slow_query_seconds: 0.01,
-	}
-
-
-	# Loggability API -- use a separate logger
 	log_as :thingfish_metastore_pggraph
 
 	# Configurability API -- load the `pg_metastore`
-	config_key :pggraph_metastore
+	configurability 'thingfish.pggraph_metastore' do
+
+		# The Sequel::Database that's used to access the metastore tables
+		setting :uri, default: 'postgres:/thingfish'
 
-	##
-	# The URI of the database to use for the metastore
-	singleton_attr_accessor :uri
+		# The number of seconds to consider a "slow" query
+		setting :slow_query_seconds, default: 0.01
+	end
 
-	##
 	# The Sequel::Database that's used to access the metastore tables
 	singleton_attr_accessor :db
 
-	##
-	# The number of seconds to consider a "slow" query
-	singleton_attr_accessor :slow_query_seconds
-
 
 	### Set up the metastore database and migrate to the latest version.
 	def self::setup_database
@@ -104,12 +94,8 @@
 	### Configurability API -- set up the metastore with the `pg_metastore` section of
 	### the config file.
 	def self::configure( config=nil )
-		config = self.defaults.merge( config || {} )
-
-		self.uri                = config[:uri]
-		self.slow_query_seconds = config[:slow_query_seconds]
-
-		self.setup_database
+		super
+		self.setup_database if self.uri
 	end