Code Monkey home page Code Monkey logo

Comments (5)

eads avatar eads commented on May 19, 2024

Added to beta-4 milestone. @rnagle is assigned but we need @alexbordens @aepton @hbillings and the whole team's input ...

from tarbell.

eads avatar eads commented on May 19, 2024

~/.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.

eads avatar eads commented on May 19, 2024

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.

hbillings avatar hbillings commented on May 19, 2024

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.

eads avatar eads commented on May 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.