Skip to content
This repository has been archived by the owner on Jul 17, 2018. It is now read-only.

Commit

Permalink
Remove the admin UI and clean up a ton of technical debt.
Browse files Browse the repository at this point in the history
The admin UI had a bunch of problems and was never going to be the thing
I wanted it to be. It also caused more deployment headaches because now
you have to keep the admin app running. I'm cutting things down to focus
on just the simpler use case of ssh with rsync, etc.

Ordinarily I'd have kept all these commits logical and separate, but
there was so much to rip out that I got too far along. Didn't seem worth
it.
  • Loading branch information
aprescott committed Nov 25, 2015
1 parent c6b0d07 commit 8858b0e
Show file tree
Hide file tree
Showing 127 changed files with 2,053 additions and 4,076 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -2,7 +2,6 @@
/serif-*.gem
/coverage
/spec/*/_site
/spec/*/_trash
/spec/examples.txt
/.rbx
/docs
4 changes: 3 additions & 1 deletion .travis.yml
Expand Up @@ -6,13 +6,15 @@ cache:
language: ruby
cache: bundler
rvm:
- 2.0.0
- 2.1
- 2.2
- ruby-head
script:
- bundle exec rspec
- "bundle exec bundle-audit update && bundle exec bundle-audit check"
env:
- USE_SHELL=no
- USE_SHELL=yes
matrix:
allow_failures:
- rvm: ruby-head
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,6 +1,11 @@
# next release

* Prevent /tmp from filling up over time. (#77)
* Remove /tmp/_site snapshots altogether.
* The admin interface is removed. When upgrading to this version, you should update your site. This includes:
* Remove any deployment webserver configuration (e.g., mapping `/admin` to the correct port).
* Update `_config.yml` since the entire `admin:` section is now unused.
* Remove `css/admin/admin.css` since it's now unused.

# v0.6

Expand Down
42 changes: 5 additions & 37 deletions Gemfile.lock
Expand Up @@ -4,14 +4,10 @@ PATH
serif (0.6)
kramdown (>= 1.9.0)
liquid (~> 2.0)
nokogiri
rack
redhead
reverse_markdown
rouge (>= 1.10.0)
rubypants
sinatra
timeout_cache

GEM
remote: https://rubygems.org/
Expand All @@ -20,13 +16,6 @@ GEM
bundler (~> 1.2)
thor (~> 0.18)
byebug (8.2.0)
capybara (2.5.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
cliver (0.3.2)
coderay (1.1.0)
coveralls (0.8.9)
json (~> 1.8)
Expand All @@ -39,8 +28,6 @@ GEM
docile (1.1.5)
domain_name (0.5.25)
unf (>= 0.0.5, < 1.0.0)
gherkin (2.12.2)
multi_json (~> 1.3)
http-cookie (1.0.2)
domain_name (~> 0.5)
json (1.8.3)
Expand All @@ -49,15 +36,9 @@ GEM
method_source (0.8.2)
mime-types (2.6.2)
mini_portile (0.6.2)
multi_json (1.11.2)
netrc (0.11.0)
nokogiri (1.6.6.3)
mini_portile (~> 0.6.0)
poltergeist (1.8.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
pry (0.10.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
Expand All @@ -68,17 +49,12 @@ GEM
rack (1.6.4)
rack-protection (1.5.3)
rack
rack-test (0.6.3)
rack (>= 1.0)
rake (10.4.2)
rdoc (4.2.0)
redhead (0.0.9)
rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
reverse_markdown (1.0.0)
nokogiri
rouge (1.10.1)
rspec (3.4.0)
rspec-core (~> 3.4.0)
Expand All @@ -89,6 +65,9 @@ GEM
rspec-expectations (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-its (1.2.0)
rspec-core (>= 3.0.0)
rspec-expectations (>= 3.0.0)
rspec-mocks (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
Expand All @@ -109,36 +88,25 @@ GEM
thor (0.19.1)
tilt (2.0.1)
timecop (0.8.0)
timeout_cache (0.0.2)
tins (1.6.0)
turnip (1.3.1)
gherkin (>= 2.5)
rspec (>= 2.14.0, < 4.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.1)
websocket-driver (0.6.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
xpath (2.0.0)
nokogiri (~> 1.3)

PLATFORMS
ruby

DEPENDENCIES
bundler-audit
capybara
coveralls
poltergeist
nokogiri
pry-byebug
rake
rdoc
rspec
rspec-its
serif!
simplecov
timecop
turnip

BUNDLED WITH
1.10.6
114 changes: 19 additions & 95 deletions README.md
Expand Up @@ -2,11 +2,7 @@

[![Build Status](https://travis-ci.org/aprescott/serif.png?branch=master)](https://travis-ci.org/aprescott/serif) [![Code Climate](https://codeclimate.com/github/aprescott/serif.png)](https://codeclimate.com/github/aprescott/serif) [![Coverage Status](https://coveralls.io/repos/aprescott/serif/badge.png?branch=master)](https://coveralls.io/r/aprescott/serif)

Serif is a static site generator and blogging system powered by markdown files and an optional admin interface complete with drag-and-drop image uploading. ([Check out the simple video demo](https://docs.google.com/open?id=0BxPQpxGSOOyKS1J4MmlnM3JIaXM).)

Serif releases you from managing a file system so you can focus on writing content.

Having problems with Serif? [Open an issue on GitHub](https://github.com/aprescott/serif/issues) or use the [Serif Google Group](https://groups.google.com/forum/#!forum/serif-rb).
Serif is a static site generator and blogging system powered by markdown files.

## First time use

Expand Down Expand Up @@ -36,7 +32,6 @@ Now visit <http://localhost:8000/> to view the site.
* [Archive pages](#archive-pages)
* [Configuration](#configuration)
* [Deploying](#deploying)
* [Customising the admin interface](#customising-the-admin-interface)
* [Custom tags and filters](#custom-tags-and-filters)
* [Template variables](#template-variables)
* [Developing Serif](#developing-serif)
Expand Down Expand Up @@ -82,17 +77,6 @@ $ cd path/to/site/directory
$ serif generate
```

## Starting the admin server

```bash
$ cd path/to/site/directory
$ ENV=production serif admin
```

Once this is run, visit <http://localhost:4567/admin> and log in with whatever is in `_config.yml` as auth credentials.

Drop the `ENV=production` part if you're running it locally.

## Serving up the site for development

This runs a very simple web server that is mainly designed to test what the site will look like and let you make changes to stuff like CSS files without having to regenerate everything. Changes to post content will not be detected (yet).
Expand Down Expand Up @@ -216,11 +200,10 @@ Used for configuration settings.
Here's a sample configuration:

```yaml
admin:
username: username
password: password
permalink: /blog/:year/:month/:title
image_upload_path: /images/:timestamp_:name
permalink: /blog/:title
archive:
enabled: yes
url_format: /blog/:year/:month
```

If a permalink setting is not given in the configuration, the default is `/:title`. There are the following options available for permalinks:
Expand All @@ -234,31 +217,11 @@ Placeholder | Value

<b>NOTE</b>: if you change the permalink value, you will break existing URLs for published posts, in addition to, e.g., any feed ID values that depend on the post URL never changing.

### Admin drag-and-drop upload path

The `image_upload_path` configuration setting is an _absolute path_ and will be relative to the base directory of your site, used in the admin interface to control where files are sent. The default value is `/images/:timestamp_:name`. Similar to permalinks, the following placeholders are available:

Placeholder | Value
----------- |:-----
`:slug` | URL "slug" at the time of upload, e.g., "your-post-title"
`:year` | Year at the time of upload, e.g., "2013"
`:month` | Month at the time of upload, e.g., "02"
`:day` | Day at the time of upload, e.g., "16"
`:name` | Original filename string of the image being uploaded
`:timestamp`| Unix timestamp, e.g., "1361057832685"

Any slashes in `image_upload_path` are converted to directories.

## Other files

Any other file in the directory's root will be copied over exactly as-is, with two caveats.

First, `images/` (by default) is used for the drag-and-drop file uploads from the admin interface. Files are named with `<timestamp>_ <name>.<extension>`. This is configurable, see the section on configuration.

Second, for any file ending in `.html` or `.xml`:
Any other file in the directory's root will mostly be copied over exactly as-is.

1. These files are assumed to contain [Liquid markup](http://liquidmarkup.org/) and will be processed as such.
2. Any header data will not be included in the processed output.
An exception is any file ending in `.html` or `.xml`. These files are assumed to contain [Liquid markup](http://liquidmarkup.org/) and will be processed as such. Header values will be available on `page`.

For example, this would work as an `about.html`:

Expand All @@ -270,24 +233,24 @@ For example, this would work as an `about.html`:
And so would this:

```html
title: My about page
x: y

<h1>All about me</h1>
<p>Where do I begin? Well...</p>
<p>Where do I begin? Well... First, x is {{ page.x }}.</p>
```

In both cases, the output is, of course:
If you have a file like `feed.xml` that you wish to _not_ be contained within a layout, specify `layout: none` in the header for the file:

```html
<h1>All about me</h1>
<p>Where do I begin? Well...</p>
```
layout: none

If you have a file like `feed.xml` that you wish to _not_ be contained within a layout, specify `layout: none` in the header for the file.
<?xml version="1.0" encoding="utf-8"?>
<!-- ... -->
```

# Publishing drafts

To publish a draft, either do so through the admin interface available with `serif admin`, or add a `publish: now` header to the draft:
To automatically publish a draft, add a `publish: now` header to the draft:

```
title: A draft that will be published
Expand Down Expand Up @@ -316,8 +279,6 @@ Created: 2013-01-01T12:01:30+00:00
Updated: 2013-03-18T19:03:30+00:00
```

Admin users: this is all done for you.

# Archive pages

By default, archive pages are made available at `/archive/:year/month`, e.g., `/archive/2012/11`. Individual archive pages can be customised by editing the `_templates/archive_page.html` file, which is used for each month.
Expand All @@ -330,7 +291,7 @@ To disable archive pages, or configure the URL format, see the section on config

To link to archive pages, there is a `site.archive` template variable available in all pages. The structure of `site.archive` is a nested map starting at years:

```
```ruby
{
"posts" => [...],
"years" => [
Expand All @@ -353,18 +314,13 @@ Using `site.archive`, you can iterate over `years`, then iterate over `months` a

Configuration goes in `_config.yml` and must be valid YAML. Here's a sample configuration with available options:

```
admin:
username: myusername
password: mypassword
```yaml
permalink: /posts/:title
archive:
enabled: yes
url_format: /archive/:year/:month
```

`admin` contains the credentials used when accessing the admin interface. This information is private, of course.

`permalink` is the URL format for individual post pages. The default permalink value is `/:title`. For an explanation of the format of permalinks, see above.

`archive` contains configuration options concerning archive pages. `enabled` can be used to toggle whether archive pages are generated. If set to `no` or `false`, no archive pages will be generated. By default, this value is `yes`.
Expand Down Expand Up @@ -393,23 +349,6 @@ location @not_found_page {

Use `ENV=production serif generate` to regenerate the site for production.

## Admin interface

The admin server can be started on the live server the same way it's started locally (with `ENV=production`). To access it from anywhere on the web, you will need to proxy/forward `/admin` HTTP requests to port 4567 to let the admin web server handle it. As an alternative, you could forward a local port with SSH --- you might use this if you didn't want to rely on just HTTP basic auth, which isn't very secure over non-HTTPS connections.

# Customising the admin interface

The admin interface is intended to be a minimal place to focus on writing content. You are free to customise the admin interface by creating a stylesheet at `$your_site_directory/css/admin/admin.css`. As an example, if your main site's stylesheet is `/css/style.css`, you can use an `@import` rule to inherit the look-and-feel of your main site editing content and looking at rendered previews.


```css
/* Import the main site's CSS to provide a similar look-and-feel for the admin interface */

@import url("/css/style.css");

/* more customisation below */
```

# Custom tags and filters

These tags can be used in templates, in addition to the [standard Liquid filters and tags](https://github.com/Shopify/liquid/wiki/Liquid-for-Designers). For example:
Expand All @@ -424,11 +363,6 @@ These tags can be used in templates, in addition to the [standard Liquid filters

## List of filters

* `date` with `'now'`

This is a standard filter, but there is a [workaround](https://github.com/Shopify/liquid/pull/117) for
`{{ 'now' | date: "%Y" }}` to work, so you can use this in templates.

* `markdown`

e.g., `{{ post.content | markdown }}`.
Expand Down Expand Up @@ -527,9 +461,8 @@ Variable | Value

## Broad outline

* `./bin/serif {dev,admin,generate}` to run Serif commands.
* `rake test` to run the tests.
* Unit tests are written in RSpec.
* `./bin/serif {dev,generate}` to run Serif commands.
* `rspec` to run the tests.
* `rake docs` will generate HTML documentation in `docs/`. Open `docs/index.html` in a browser to start.

## Directory structure
Expand All @@ -540,12 +473,3 @@ Variable | Value
# Changes and what's new

See `CHANGELOG`.

# Planned features

Some things I'm hoping to implement one day:

1. Custom hooks to fire after particular events, such as minifying CSS after publish, or committing changes and pushing to a git repository.
2. Simple Markdown pages instead of plain HTML for non-post content.
3. Automatically detecting file changes and regenerating the site.
4. Adding custom Liquid filters and tags.

0 comments on commit 8858b0e

Please sign in to comment.