mirror of
https://github.com/sprockets/sprockets.cli.git
synced 2024-09-28 10:10:59 +00:00
Add package importing, examples to README
This commit is contained in:
parent
df926bab64
commit
37a0551ca2
2 changed files with 16 additions and 1 deletions
15
README.rst
15
README.rst
|
@ -82,6 +82,21 @@ Plugin API Summary:
|
||||||
plugin.on_start(controller_module) # optional
|
plugin.on_start(controller_module) # optional
|
||||||
plugin.on_shutdown(controller_module) # optional
|
plugin.on_shutdown(controller_module) # optional
|
||||||
|
|
||||||
|
Example Entrypoints
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
Controller:
|
||||||
|
|
||||||
|
```python
|
||||||
|
{'sprockets.controller': ['http=sprockets.controllers.http:None']},
|
||||||
|
```
|
||||||
|
|
||||||
|
Application:
|
||||||
|
|
||||||
|
```python
|
||||||
|
{'sprockets.http.app': ['name=package.or.module:None']}
|
||||||
|
```
|
||||||
|
|
||||||
Applications
|
Applications
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
|
|
@ -292,7 +292,7 @@ class CLI(object):
|
||||||
"""
|
"""
|
||||||
for pkg in self._get_applications(controller):
|
for pkg in self._get_applications(controller):
|
||||||
if pkg.name == application:
|
if pkg.name == application:
|
||||||
return pkg.module_name
|
return importlib.import_module(pkg.module_name)
|
||||||
return importlib.import_module(application)
|
return importlib.import_module(application)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in a new issue