Comments (5)
Added to beta-4 milestone. @rnagle is assigned but we need @alexbordens @aepton @hbillings and the whole team's input ...
from tarbell.
~/.tarbell/hooks.py
is a terrible idea. I have a better one but it needs some details worked out.
Tarbell smooshes together _base/base.py and tarbell_config.py when previewing or building a project. So it seems simple enough to be able to declare hooks in both of those files.
Before we get into more of the mechanics, here's key the hooks I think we need:
- Post-newproject: E.g. create tickets and a repository.
- Pre-generate: E.g. set up default context.
- Post-generate: E.g. upload to your favorite CDN.
- Pre-publish: E.g. gzip or build out assets
- Post-publish: E.g. clear out Facebook opengraph cache
My current best guess at what this should look like is that there should be a @tarbell_hook
decorator available in both base.py
and tarbell_config.py
. Hooks would be explicitly configured in tarbell_config.py
, but all the base hooks would automatically be included.
base or tarbell_config:
@tarbell_hook("newproject")
def create_repo(project):
# ... interact with github or unfuddle to create repo
tarbell_config:
TARBELL_HOOKS = [
'base.create_repo',
'base.create_tickets',
'config.do_crazy_project_specific_thing',
]
from tarbell.
Paging @rnagle paging @hbillings I need feeeedback on this... I even have a good use case right now from a current internal project.
When publishing to s3, we need to iterate over content in the spreadsheet and for each row (which represents an element in a listicle) create a stub page, a redirect on amazon s3, and finally ping the Facebook opengraph debugger so that each item can be shared individually and seamlessly.
from tarbell.
This sounds logical to me. Question: Why in both tarbell_config and in _base? Just so you can add your own in tarbell_config? Or only enable the ones you want to use?
from tarbell.
That's an excellent question. One reason would simply be being consistent -- there's a common try tarbell_config.py -> fall back to base.py pattern in Tarbell. You pretty much answered your own question -- I think a good architecture is:
- Default hooks (via base template)
- Project hooks (e.g. handle weird social media needs for just one project)
- Ability for a project to specify what hooks to run in case the base template has something you don't need or want.
from tarbell.
Related Issues (20)
- Update requirements to allow latest versions of dependencies HOT 1
- Include git in requirements HOT 5
- dateutil: 'module' object has no attribute 'parser'
- Roll new release
- Use Drive API v3
- Tarbell shell
- Feature request: Optional setting for different AWS zones in staging & production HOT 2
- New project grabs old version of google sheet HOT 7
- VERSION is defined twice, differently
- When generating, copy static files instead of requesting
- Use freeze_yield when generating
- Show build process HOT 1
- Trouble installing HOT 2
- AttributeError hides an easy way to break "values" sheet
- Deleting a directory fails on Python 3
- oauth2client is deprecated
- Problem with S3 deployment - "S3ResponseError: 301 Moved Permanently" HOT 3
- Erratic issue: Variables sometimes not properly passed into templates HOT 5
- Seeking new maintainer
- vulnerabilities in outdated dependencies
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tarbell.