Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example of subclassing the Unicorn resource
module MyUnicorn
# Subclass the resource.
class Resource < PoiseApplicationRuby::Resources::Unicorn::Resource
# Give it a new name so we can find it.
provides(:my_unicorn)
# Add a new property. Could do more here.
property(:listen)
end
# Subclass the provider.
class Provider < PoiseApplicationRuby::Resources::Unicorn::Provider
# Match the name from above.
provides(:my_unicorn)
# Set service resource options.
def service_options(resource)
super
# Replace the command from the base class.
resource.ruby_command("unicorn --listen #{new_resource.listen} #{configru_path}")
end
end
end
# Then use the new resource in your recipe.
application 'whatever' do
my_unicorn do
listen '127.0.0.1:8080'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.