Skip to content
This repository

Quick and Dirty Little Printer Publications

branch: master
README.rdoc

easylittleprinter

easylittleprinter is a static image server for the BERG Cloud Little Printer. Image editions, icons, samples, and meta.json should be stored in the root directory of a remote static server. NOT this server.

Incidentally, Github Pages works fantastically as a remote static server.

You could probably set it up so that you don't have to use a remote server, but that ain't no fun.

You can either run this guy locally, or on heroku.

Installation

“gem install easylittleprinter”

Image naming format

The image editions should be named in the following format:

yyyy-mm-dd

The file extension is specified in the Environment Vars

Required Environment Variables

EXTENSION , the file extension for all of your images. Pick one. The icon will always be .png

HOSTURL , the address of your static image host, e.g. yourname.github.com . NO TRAILING SLASH!

TITLE , the title of the pages with images on them. Purely cosmetic.

SAMPLE , the filename of the sample image, no slashes, no extensions

ICON , the filename of the icon image, no slashes, no extensions. Must be a png.

You can configure the application to publish on certain days. Non-temporally-bound publications are not supported at this time. You can totally mod my code if you want, though.

The following are the options for the FREQUENCY variable:

every_monday, every_tuesday, every_wednesday, every_thursday, every_friday, every_saturday, every_sunday, everyday, every_mwf

NOTE!!! Once the user passes the check to make sure the date they're accessing from is within your publishing specs, the server will then attempt to serve an image with a corresponding filename, e.g. 2012-08-30.png

Deploying to Heroku

Create a config.ru file containing:

require 'easylittleprinter'

run easylittleprinter

This part of the process can also be used for deploying to a physical server.

You'll also need a Gemfile:

source :rubygems

gem “easylittleprinter”, “>=0.2.1”

gem “camping”

gem “markaby”

Initialize a git repo in the folder where your files are, add them, commit

Then run “heroku create {your app anme here, minus brackets}”

Then run “git push heroku master”

Next, set your environment variables with “heroku config:add {put the vars here}

You're done!

How to Use, a walkthrough

Get this server up and running. I recommend using Heroku, for now, although you can always run it just as easily as a rack app on a physical server. Same deal as it's configured for heroku, just without the heroku-y bit.

Now that you've got it up and running, you should set up a github pages account. This will be your static image server. eLP (easylittleprinter) serves images based on criteria. In your github pages repo, place your image files. The images files should be named as described above. You should also have a meta.json in the same directory as your images. make sure that local_delivery_time is set to true. Also have your icon png and your sample there.

A brief overview of serving the file: BERG Cloud requests it, eLP checks whether the date being sent matches the delivery criteria you set in FREQUENCY. if it does, eLP serves the file with the same name as the date that the user is requesting from. This way, you can make sure that your image for monday the 26th will be served wherever it is monday the 26th, and nowhere else. Trust me, it's easier on both of us this way.

It's imperative that you use the image file extension set in EXTENSION for all of your image files. icon.png will always be served as a png, though. When specifying the names of the sample and the icon, only put the names of the files without extensions.

There you go! Test it out. Try out all the hooks.

Contributing to easylittleprinter

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.

  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

easylittleprinter is released under the WTFPL version 2.

           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 

                   Version 2, December 2004 

Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> 

Everyone is permitted to copy and distribute verbatim or modified 
copies of this license document, and changing it is allowed as long 
as the name is changed. 

           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 
  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 

 0. You just DO WHAT THE FUCK YOU WANT TO.
Something went wrong with that request. Please try again.