Code Monkey home page Code Monkey logo

tarbell's People

Contributors

aepton avatar alexbordens avatar andymboyle avatar bepetersn avatar eads avatar eyeseast avatar ghing avatar hbillings avatar hunterowens avatar j-e-d avatar jheasly avatar myersjustinc avatar ryanmark avatar vfulco avatar wilbertom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tarbell's Issues

pip install tarbell fails for me...

@ryanmark I'm seeing this trying pip install tarbell

Downloading/unpacking tarbell
  Running setup.py egg_info for package tarbell
    /usr/local/Cellar/python/2.7.1/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'entry_points'
      warnings.warn(msg)
    /usr/local/Cellar/python/2.7.1/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
      warnings.warn(msg)
    /usr/local/Cellar/python/2.7.1/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'zip_safe'
      warnings.warn(msg)
    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help

    error: invalid command 'egg_info'
    Complete output from command python setup.py egg_info:
    /usr/local/Cellar/python/2.7.1/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'entry_points'

  warnings.warn(msg)

/usr/local/Cellar/python/2.7.1/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'

  warnings.warn(msg)

/usr/local/Cellar/python/2.7.1/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'zip_safe'

  warnings.warn(msg)

usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

   or: -c --help [cmd1 cmd2 ...]

   or: -c --help-commands

   or: -c cmd --help



error: invalid command 'egg_info'

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /usr/local/var/pip/pip.log

Should requirements use >=?

In some cases it would seem the set up script is installing, say, requests 2.0.1 but then tarbell throws an error because it requires 2.0.0. I'm still a little foggy on why this is happening. Can you use inequality style requirements with setuptools?

Handle slashes in s3 urls

Add/remove as necessary for display and upload purposes... there are some places where slashes are doubled up. This is not a show stopper, the current S3 upload seems to handle it OK.

shutil error if ~/.tarbell/client_secrets.json specified during google spreadsheet configure

$ tarbell configure
Configuring Tarbell. Press ctrl-c to bail out!
/Users/davideads/.tarbell already exists

Would you like to reconfigure Tarbell? All existing files will be backed up. [y/N] y

Would you like to use Google spreadsheets [Y/n]? y

Login in to Google and go to https://code.google.com/apis/console/ to create an app and generate the 
client_secrets.json authentication file. You should create credentials for an `installed app`. See 
http://tarbell.readthedocs.com/#correctlink for more information.

Where is your client secrets file? [~/Downloads/client_secrets.json] ~/.tarbell/client_secrets.json

Copying /Users/davideads/.tarbell/client_secrets.json to /Users/davideads/.tarbell


-- Backing up /Users/davideads/.tarbell/client_secrets.json to /Users/davideads/.tarbell/client_secrets.json.2013-11-09T21:14:42.928907.backup

Traceback (most recent call last):
  File "/usr/local/bin/tarbell", line 9, in <module>
    load_entry_point('tarbell==0.9b2', 'console_scripts', 'tarbell')()
  File "/usr/local/lib/python2.7/site-packages/tarbell/cli.py", line 59, in main
    command.__call__(args)
  File "/usr/local/lib/python2.7/site-packages/tarbell/cli.py", line 638, in __call__
    return self.fn(*args, **kw_args)
  File "/usr/local/lib/python2.7/site-packages/tarbell/configure.py", line 37, in tarbell_configure
    settings.update(_setup_google_spreadsheets(path))
  File "/usr/local/lib/python2.7/site-packages/tarbell/configure.py", line 106, in _setup_google_spreadsheets
    shutil.copy(secrets_path, path)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 119, in copy
    copyfile(src, dst)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 69, in copyfile
    raise Error("`%s` and `%s` are the same file" % (src, dst))
shutil.Error: `/Users/davideads/.tarbell/client_secrets.json` and `/Users/davideads/.tarbell/client_secrets.json` are the same file

Should we ditch s3cmd?

It might make sense if we want to offer hooks to do things like gzip assets. And s3cmd is fussy / user unfriendly to configure.

Message is repeated when running Tarbell serve / Tarbell switch

Serve example:

$ tarbell serve
Visit http://127.0.0.1:5000 in your browser to view base
* Running on http://127.0.0.1:5000/
* Restarting with reloader
Visit http://127.0.0.1:5000 in your browser to view base

Switch example:

$ tarbell switch readme
Switching to readme.
Visit http://127.0.0.1:5000 in your browser to view readme
* Running on http://127.0.0.1:5000/
* Restarting with reloader
Switching to readme.
Visit http://127.0.0.1:5000 in your browser to view readme

Everything seems to work fine...

command: tarbell list

Proposed

tarbell list

Aliases: tarbell projects

List projects.

Usage

$ tarbell list
Use `tarbell switch <projectname>` to work on a project.

under-the-gun       Under the Gun         /news/local/crime/under-the-gun Last update 12-01-2012 @ 10:00am by Heather Billings
democracy-denied    Democracy Denied      /news/local/politics/democracy-denied Last update 01-17-2013 @ 01:32pm by Jen Lindner
hadiyas-friends     Hadiya's Friends      /news/local/crime/hadiyas-friends Last update 01-16-2013 @ 09:05am by Alex Bordens
school-utilization  School Utilization    /news/local/education/school-utilization Last update 01-19-2013 @ 11:15am by Abe Epton

'ensure_site' should be a context manager, not a decorator

Use python context managers instead of decorators to ensure the execution environment is in the tarbell root.

Instead of:

@ensure_site
 def tarbell_newproject(args, path):
     print path

Use:

def tarbell_newproject(args):
    with ensure_site() as path:
        print path

See http://docs.python.org/release/2.5.2/lib/typecontextmanager.html

We should also only use this where necessary. I introduced it in part while trying a different server strategy.

Some day, this context manager can set up the virtualenv as well which will help achieve our 1.0 goals.

Handle text templates jinja2 can't parse

It's possible for CSS or JS files to contain character sequences that break Jinja's parser. This causes a Jinja template error when trying to serve the files. Trap the error and print an error message in the preview server.

Use different base template inheritance mechanism

The current base template should become more of a dependency system. Base assets and templates should be mounted under current project directory and can be directly overridden with templates/assets of the same name in the project's 'static' dir.

Use s3cmd for publishing

Instead of our own library, let's just use s3cmd. We may have to store our own credentials though.

command: tarbell newproject

Proposed

tarbell newproject <projectname (optional)>

Aliases: tarbell create <projectname>

Create a new Tarbell project that uses optional directory name <projectname>.

Usage

$ tarbell create
@TODO stuff related to create

command: tarbell serve/stop

Proposed

tarbell serve --project/-p <projectname (optional)>

Manually run a Tarbell preview server. Defaults to parent directory or local config.

Usage

No project

(litfest) $ tarbell serve
Running Tarbell preview server for "Lit Fest 2013". To preview this site, visit 
    http://localhost:5000/
To stop the server, run 
    tarbell stop
Improve the project by editing the files in </path/to/project>.

Project specified

$ tarbell serve --project elections-general-2013
Running Tarbell preview server for "2013 General Elections". To preview this site, visit 
    http://localhost:5000/
To stop the server, run 
    tarbell stop
Improve the project by editing the files in </path/to/project>.

Error

$ tarbell serve
No active project. Work on a new project with `tarbell switch <projectname>`
or specify a project with the `--project` flag.

tarbell stop

Stop the currently running server.

Usage

(hadiyas-friends) $ tarbell stop
Stopping preview server for "Hadiya's Friends"...
Done!

Error

$ tarbell stop
No server running. Oh well!

Add bucket configuration to Tarbell configure

Dropping s3cmd means not calling the s3cmd --configure command from configure.py and instead asking about and writing some values to our configuration file ourselves. Bonus points if it can configure buckets by name, but that could be a beta-4 task, too.

command: tarbell newsite

Proposed

tarbell newsite <site git repository (optional)> <target directory (optional)>

Create a new site based on a git repository (by default, Chicago Tribune News Apps open source template will be used). By default, the command will prompt for a directory. If a target directory is specified, it will be used.

Usage

Standard usage

$ tarbell newsite https://github.com/newsapps/tarbell-template
What domain do you plan to publish to? (e.g. http://apps.chicagotribune.com)
[Required]: projects.mydomain.tld
Where would you like to install `tarbell-template`? 
[Default: /home/eads/Repos/projects.mydomain.tld] 
Installing `tarbell-template` in /home/eads/Repos/projects.mydomain.tld
...
Done! 
Would you like to set up Amazon S3 publication now? [y/N] Y

Awesome! 
What's your production bucket (e.g. projects.mydomain.tld)? 
What's your staging bucket (e.g. beta.projects.mydomain.tld)?
What's your Amazon S3 access key ID? 
What's your Amazon S3 access key?

Add support for named buckets to S3 deployment

There's a hardcoded "default" for the creds in the tarbell_publish function in cli.py. This needs to read the correct bucket configuration and fall back to default if it doesn't exist.

Should _base be a submodule?

git submodules can be kind of weird, but the current inheritance model is a little jacked... your history gets polluted with that of the upstream repo, which doesn't make a ton of sense.

Add hook system to Tarbell commands

Creating of a ~/.tarbell/hooks.py file that can accomodate pre/post command hooks to run (e.g. to allow custom linting on site generation or custom repo setup on new project creation).

command: tarbell switch

Proposed

tarbell switch <projectname (required)>

Aliases: tarbell workon <projectname (required)>

Use the switch command to work on an existing project. By default, this command activates the default virtual environment and runs a local preview server.

Flags:

--no-env: Don't activate Python virtualenv.

--no-server: Don't run preview server.

Usage

$ tarbell switch hadiyas-friends
You are now working on "Hadiya's Friends". To preview this site, visit 
    http://localhost:5000/

To stop the development server, run
    tarbell stop

Publish to staging:
    tarbell publish

Publish to production:
    tarbell publish -t production

(hadiyas-friends) $ 

Conflicting projects

$ tarbell switch gamechangers
Project `gamechangers` exists in:

  [1] /home/eads/Repos/apps.chicagotribune.com
  [2] /home/user/Code/mysite.com

Which project would you like to switch to? [1]

No project

$ tarbell switch truancy
Project 'truancy' does not exist. To create a new project with this name, run:

    tarbell newproject truancy 

tarbell deactivate

Deactivate a project.

Usage

(rabies) $ tarbell deactivate
No longer working on Rabies.
$

command: tarbell publish/unpublish

Proposed

tarbell publish --project/-p <projectname (optional)> --target/-t <target (optional)>

Publish a project to Amazon S3.

Usage

Basic

(democracy-denied) $ tarbell publish
This will publish "Democracy Denied" to Staging at:
  http://apps.beta.tribapps.com/news/local/democracy-denied
Do you want to continue (y/N): 
Rendering HTML...
Uploading to Amazon S3...
Done! 

Specify target

(democracy-denied) $ tarbell publish --target production
This will publish "Democracy Denied" to Production at:
  http://apps.tribapps.com/news/local/democracy-denied
Do you want to continue (y/N): 
Rendering HTML...
Uploading to Amazon S3...
Done! 

Specify project and target

$ tarbell publish --project restaurant_app --target restaurant_production
This will publish "Chicago Tribune Restaurant Reviews" to Restaurant Production at:
  http://restaurants.chicagotribune.com/entertainment/dining/reviews
Do you want to continue (y/N): 
Rendering HTML...
Uploading to Amazon S3...
Done!

tarbell unpublish --project/-p <projectname (optional)> --target/-t <target (required)>

Delete a project from the specified target.

Usage

Specify target

(gamechangers) $ tarbell unpublish --target production
This will remove "Game Changers" from Production at:
   http://apps.chicagotribune.com/sports/hawks/gamechangers
Do you want to continue (y/N): 
Deleting files...
Done!

Specify project and target

$ tarbell unpublish --project under-the-gun --target staging
This will remove "Under The Gun" from Staging at:
   http://apps.beta.tribapps.com/news/local/under-the-gun
Do you want to continue (y/N): 
Deleting files...
Done!

One line installer for OS X and Ubuntu

For OS X, Xcode will be required. Our script should

install brew
brew install python stack (new python, pip, virtualenv, virtualenv-wrapper)
pip install tarbell
clone new tarbell template somewhere

For ubuntu, our script should:

apt-get install python stack
pip install tarbell
clone new tarbell template somewhere

command: tarbell update

Proposed

tarbell update

Update the current project with any base updates.

Usage

(hadiyas-friends) $ tarbell update
This command will update your current project's dependencies to their latest versions.
Here are the outstanding changes:

   v1.01: Fix bug in navigation, upgrade to Flask-Tarbell v1.1.
   v1.02: Update Google analytics component to use spreadsheet variables.

Would you like to continue (y/N): 

Merging base changes...
Installing new requirements.... 

It worked! Your project is up to date.

Error

$ tarbell update
No project specified. To work on a project, run:

    tarbell switch <projectname>

To list available projects, run:

   tarbell list

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.