Add some work on repositories
5 files changed, 23 insertions(+), 11 deletions(-)

M README.md
M Rakefile
M lib/assemblage.rb
M lib/assemblage/command/create.rb
M lib/assemblage/repository.rb
M README.md +3 -1
@@ 144,7 144,9 @@ operations:
 Now we'll need to register the repo on the server like we did before for the
 worker:
 
-    user@example $ assemblage add repo project1 http://repo.example.com/project1
+    user@example $ assemblage add repo --type=hg project1 \
+        'bq9VheQbLtcu]LGK4I&xzK3^UW0Iyak/6<YS=^$w' \
+        http://repo.example.com/project1
     Looking for repo registration... found.
     Approving repo events from http://repo.example.com/project1...
     done.

          
M Rakefile +1 -1
@@ 35,7 35,7 @@ hoespec = Hoe.spec 'assemblage' do |spec
 	spec.dependency 'configurability', '~> 3.2'
 	spec.dependency 'hglib', '~> 0'
 	spec.dependency 'git', '~> 1.3'
-	spec.dependency 'gli', '~> 2.17'
+	spec.dependency 'gli', '~> 2.18'
 	spec.dependency 'tty', '~> 0.7'
 	spec.dependency 'sequel', '~> 5.6'
 	spec.dependency 'msgpack', '~> 1.2'

          
M lib/assemblage.rb +2 -1
@@ 14,7 14,7 @@ module Assemblage
 	VERSION = '0.0.1'
 
 	# Version control revision
-	REVISION = %q$Revision$
+	REVISION = %q$Revision: 5cfdb9248f73 $
 
 	# The name of the environment variable which can be used to set the config path
 	CONFIG_ENV = 'ASSEMBLAGE_CONFIG'

          
@@ 46,6 46,7 @@ module Assemblage
 	autoload :CLI, 'assemblage/cli'
 	autoload :DbObject, 'assemblage/db_object'
 	autoload :Protocol, 'assemblage/protocol'
+	autoload :Repository, 'assemblage/repository'
 	autoload :Server, 'assemblage/server'
 	autoload :Worker, 'assemblage/worker'
 

          
M lib/assemblage/command/create.rb +15 -5
@@ 89,11 89,13 @@ module Assemblage::CLI::CreateServer
 		create.arg :DIRECTORY
 		create.command :worker do |worker|
 
-			worker.desc "Specify a name that will identify the worker on any servers it registers with"
+			worker.desc "Specify a name that will identify the worker on any " +
+				"servers it registers with"
 			worker.flag [:N, :name], type: String,
 				must_match: Assemblage::Auth::CLIENT_NAME_PATTERN
 
-			worker.desc "Specify one or more tags that indicate what assemblies the worker should accept"
+			worker.desc "Specify one or more tags that indicate what assemblies " +
+				"the worker should accept"
 			worker.flag [:t, :tags], type: Array
 
 			worker.action do |globals, options, args|

          
@@ 119,24 121,32 @@ module Assemblage::CLI::CreateServer
 		end
 
 
-		create.desc 'Set up a new assemblage repository run directory'
+		create.desc 'Set up a new run directory for repository hooks'
 		create.long_desc <<-END_DESC
 		Set up a new run directory for hooks that run in one or more repositories.
+		This is how the commit (or other) hook authenticates to the server when
+		it runs.
 		END_DESC
 		create.arg :DIRECTORY
 		create.command :repo do |repo|
 
+			repo.desc "Specify a name that will identify the repository server"
+			repo.flag [:R, :repo_name], type: String,
+				must_match: Assemblage::Auth::CLIENT_NAME_PATTERN,
+				required: true
+
 			repo.action do |globals, options, args|
 				directory = Pathname( args.shift || '.' ).expand_path
+				name = options.name
 
 				prompt.say "Creating a repo run directory in %s..." % [ directory ]
-				Assemblage::Repository.setup_run_directory( directory )
+				Assemblage::Repository.setup_run_directory( name, directory )
 
 				prompt.say "Generating a repo key..."
 				Assemblage::Repository.generate_cert
 
 				msg = REPO_ADVICE % {
-					public_key: Assemblage::Worker.public_key,
+					public_key: Assemblage::Repository.public_key,
 					directory: directory
 				}
 				prompt.say( msg )

          
M lib/assemblage/repository.rb +2 -3
@@ 35,7 35,7 @@ class Assemblage::Repository < Assemblag
 
 	### Set up the +directory+ as a repo run directory. Raises an
 	### exception if the directory already exists and is not empty.
-	def self::setup_run_directory( directory='.' )
+	def self::setup_run_directory( name, directory='.' )
 		directory = Pathname( directory || '.' )
 		raise "Directory not empty" if directory.exist? && !directory.empty?
 

          
@@ 45,8 45,7 @@ class Assemblage::Repository < Assemblag
 
 		config = Assemblage.config || Configurability.default_config
 		config.assemblage.auth.cert_store_dir ||= (directory + 'certs').to_s
-		config.assemblage.worker.name = name
-		config.assemblage.worker.tags = tags
+		config.assemblage.repo.name = name
 
 		Loggability.with_level( :fatal ) do
 			config.install