Commits

Michael Granger committed 30d7d83

Updated for newer versions of Foreman.

  • Participants
  • Parent commits e1f90e9

Comments (0)

Files changed (7)

 \.foreman
 ChangeLog
 doc/
+pkg/
-foreman -v0.45.0
+foreman -v0.60.2
-.env
-.foreman
 ChangeLog
 History.rdoc
 Manifest.txt
 data/foreman-export-daemontools/templates/log-run.erb
 data/foreman-export-daemontools/templates/run.erb
 lib/foreman/export/daemontools.rb
-spec/data/.env
-spec/data/.foreman
 spec/data/Procfile
 spec/foreman/export/daemontools_spec.rb
 spec/helpers.rb
 
 	self.developer 'Michael Granger', 'ged@FaerieMUD.org'
 
-	self.dependency 'foreman', '~> 0.45'
+	self.dependency 'foreman', '~> 0.60'
 	self.dependency 'hoe-deveiate',    '~> 0.1', :developer
 
 	self.spec_extras[:licenses] = ["BSD"]

data/foreman-export-daemontools/templates/log-run.erb

 #!/bin/sh
 
 <% if self.log %>
-% logdir = self.log + '/' + procdir.basename
+% logdir = Pathname(self.log) + '/' + procdir.basename
 exec setuidgid <%= user %> multilog t <%= logdir %>
 <% else %>
 exec setuidgid <%= user %> multilog t ./main

lib/foreman/export/daemontools.rb

 			servicedir.mkpath
 		end
 
-	    engine.procfile.entries.each do |process|
-			say "Setting up %s-%s service directories..." % [ app, process.name ]
-			count   = self.concurrency[ process.name ]
+	    engine.each_process do |name, process|
+			say "Setting up %s-%s service directories..." % [ app, name ]
+			count   = engine.formation[ name ]
 			say "  concurrency = #{count}"
-			procdir = servicedir + "%s-%s" % [ app, process.name ]
+			next unless count >= 1
+			procdir = servicedir + "%s-%s" % [ app, name ]
 
 			# Create a numbered service dir for each instance if there are
 			# more than one
 
 		# Write the down file to keep the service from spinning up before the user has
 		# a chance to look things over
+		say "  writing the 'down' file"
 		write_file( procdir + 'down', '' )
 
 		# Set up logging
 		say "  setting up environment variables..."
 		envdir = procdir + 'env'
 		envdir.mkpath
-        port = engine.port_for( process, num, self.port )
+        port = engine.port_for( process, num )
 		environment_variables = { 'PORT' => port }.
 			merge( engine.environment ).
 			merge( inline_variables(process.command) )

spec/foreman/export/daemontools_spec.rb

 	let( :servicedir ) { Pathname(Dir.tmpdir) + 'service' }
 	let( :datadir )    { Pathname(__FILE__).dirname.parent.parent + 'data' }
 	let( :procfile )   { datadir + 'Procfile' }
-	let( :engine )     { Foreman::Engine.new(procfile) }
+	let( :engine )     { Foreman::Engine.new(options).load_procfile(procfile) }
 	let( :options )    {{
 		:app_root    => datadir,
 		:app         => 'test',
 		:env         => datadir + '.env',
-		:concurrency => 'cms=2,api=0,mongrel2=1',
+		:formation   => 'cms=2,api=0,mongrel2=1',
 		:user        => 'www',
 	}}
 
 
 
 	it "exports to the filesystem" do
+		engine.env['HOMEDIR']       = '/Users/ged'
+		engine.env['MONGREL2_HOME'] = '/var/run/mongrel2'
+
 		subject.export
 		servicedir.should exist()