Writefully

Build Status Coverage Status Code Climate

Allows developers who love to write to publish easily

Getting Started

There are 2 ways to use Writefully, generate a brand new app or integrate it into an existing application.

Writefully depends on PostgreSQL with hstore extension activated so make sure you set that up if your going with the existing application route.

New App

gem install writefully

wf-app new [name]

This will generate the boilerplate rails app to get you started using writefully.

Existing App

gem 'writefully'

Once you've installed the gem run

rake writefully:migrations:install

In config/routes.rb add the following

mount Writefully::Engine, at: '/writefully'

Create any model for Writefully. This is the model writefully will use.

rails g model [ModelName (Post|Article|Whatever)] --skip-migration --parent=writefully/post

The last step is to run the migration to generate the database structure for writefully

rake db:migrate

Configuration

Github Application

Writefully integrates with github, which means you'll need to set up a github application.

Create new Application

Or just create an application in an organization.

Config file (app/config/writefully.yml)

You'll need to fill out the configuration file for your development environment

development: &default
  :pidfile: <%= Rails.root.join('log', 'writefully.log') %>
  :logfile: <%= Rails.root.join('tmp', 'pids', 'writefully.pid') %>
  :content: <%= Rails.root.join('content') %> # create a content folder for development
  :storage_key: 'aws-key'
  :storage_secret: 'aws-secret'
  :storage_folder: 'bucket-name'
  :storage_provider: "AWS" # only supports AWS for now
  :app_directory: <%= Rails.root %>
  :github_client: 'github-app-client'
  :github_secret: 'github-app-secret'
  :hook_secret: 'generate-with-securerandom' 

test:
  <<: *default

These settings might seem obvious in development however you might want to change this in your production / staging environment. We assume you use capistrano style deployment where you have a separate config for those environments

The hook_secret config is required to ensure that any web hooks you get from github is legitimate. You can generate it with anything you like. The most simplest thing to do is go into IRB and run

require 'securerandom' ; SecureRandom.hex

I recommend you use a different one in production / staging than the one in development.

Running Writefully

In development to run writefully all you have to do is

# from your app root
bin/writefully start config/writefully.yml

This will start the writefully process and start listening for changes in the :content folder.

Tunneling

If you want to test the github webhook process you'll need to use some tunneling magic. Here are a few options to choose from.

For development mode use the localtunnel url when you fill out the details for site creation. The url will be used with github webhooks

Admin Interface

Once you've set everything up simply head over to

http://localhost:3000/writefully

You will be asked to sign in with github. Once your logged in you'll have access to the admin interface and will be promted to setup your first site.

Once you create your first site simply head over to the repository in your github account and follow the readme there.

Who uses Writefully?

Codemy.net Is powered by Writefully

Why did you make writefully?

I just want to write locally using my text editor in markdown, intead of logging into the admin interface and wrangling with the online editor and mucking about with image uploading.

I just want to do a git push and the server takes care of the rest (updating content / assets uploading etc...). The same way I deploy my applications.

Why don't you just use static page generators like Jekyll or Middleman?

Because I need real business objects.

  • I want to have control over my content. I want to be able to control which user can see which content. (needed if you want to sell digital goods)

  • I want to use full text search technologies like Elasticsearch or in Database Full Text Search.

  • I want to be able to taxonomize my content, put them into groups etc...

Manifesto

  • Writefully Core

    • Separate lightweight process that manages all the work
    • Main rails process should be able to communicate with Writefully via Redis queue
    • When a site is created it sets up a repository / hooks with sample content
    • Manages content taxonomy via Tags / Taggings
    • Easily Extendable from main rails app
    • Content Localization
    • Backend Interface for managing sites
    • Receive WebHook from github and updates site
    • Turns repository collaborators into authors
    • Converts local based images into content provider URL
    • S3 / Cloudfront
    • Akamai
    • Cloudfiles
    • etc...
  • Writefully Desktop App

    • Probably going to use node-webkit
    • Quill JS
    • More details to come
  • Writefully mobile app

    • Probably going to use Framework7
    • More details to come