Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start work on a Lineman chapter #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
63 changes: 63 additions & 0 deletions chapters/scaffolding/lineman/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Getting started

## Installation

Lineman is a Node.js-based tool, and it requires `npm` to install it.

Lineman is installed globally:

```bash
npm install -g lineman
```

You can test it by running:

```bash
lineman --version
```

## Creating a project

To create a new lineman project, just run:

```bash
lineman new some-project-name
```

This will create a project in `some-project-name/` with a small scaffold of directories and files. It'll include several safe-to-delete example files. Once you're comfortable, you may want to generate the project again with the "--skip-examples" flag to start completely fresh.

## Developing

Once you've changed into your project directory, you can see your app in action by running:

``` bash
lineman run
```

This will do an initial build of the application into a transient folder named "generated/" and start a local server out of that directory. You can access it at [localhost:8000](http://localhost:8000).

The `run` command also watches for file changes, re-running any appropriate tasks. It also exposes powerful API proxying and stubbing tools that let you develop your web application in concert with other backend services (whether or not they actually exist yet).

## Building

When you're ready to deploy, run:

``` bash
lineman build
```

And this will build a ready-to-deploy set of artifacts in a directory named "dist/". By default, this means minifying your scripts & stylsheets.

## Configuration

TODO: configuring asset fingerprinting

TODO: Setting up an API proxy

TODO: API Stubbing

TODO: deploying to heroku

TODO: Ruby on Rails integration

TODO: using Lineman plugins
27 changes: 27 additions & 0 deletions chapters/scaffolding/lineman/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Lineman

## What is Lineman?

[Lineman.js](http://linemanjs.com) is a command-line tool that can build a ready-to-deploy modern web application out-of-the-box.

Lineman's ready-to-deploy behavior is accomplished by way of a number of its conventions about how web applications should be structured (e.g. client-side JavaScript should be placed under "app/js", whereas third-party stylesheets should be placed under "vendor/css"). This aspect of Lineman was heavily inspired by [Ruby on Rails](http://rubyonrails.org), aiming to occupy a niche of convention-oriented workflow tools for the Node.js community.

The real value of Lineman is that it can help you get started working on a project very easily, all without enforcing any opinions about the front-end application frameworks you use.

Additionally, Lineman projects tend to be easy-to-upgrade because generated files are kept to a minimum. Literally any configuration property can be overridden dynamically, so each Lineman project only needs to declare how it's different from the norm, without any boilerplate describing how its defaults.

You can grow your project's toolset by installing Lineman plug-ins, which take the form of community-managed Lineman configurations. Like Lineman itself, the tasks and configuration included by plugins are dynamically applied and as such, won't clutter your application's repo. Also like Lineman, anything a plugin can do can be just as easily overridden when your needs differ from the norm.

## How does Lineman work, technically?

Lineman depends on Grunt and, no less importantly, the terrific Grunt community for the implementation of all the individual build tasks a web project might make use of.

You can think of Lineman as a sort of workflow-aware Grunt configuration aggregator. Lineman itself, its plugins, and users' projects each contribute to one entire grunt task configuration.

Managing Grunt's configuration is useful for providing defaults, enabling extensions, and allowing for user overrides. On its own, this has some value, as it prevent the same massive Gruntfile from being copied and pasted from project to project. Where Lineman really shines, however, is by organizing all of a project's grunt tasks into ordered task lists that describe the workflows needed by every application:

* Activities that need to happen regardless of how we build the app
* Tasks that need to run, but only when developing
* Deployment-minded tasks that only need to run when it's time to distribute the app.

From a user's perspective, these tasks are exposed through Lineman's CLI commands (`lineman run`, `lineman build`, `lineman spec`, and so on).
4 changes: 4 additions & 0 deletions chapters/scaffolding/lineman/references.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# References

* [http://linemanjs.com](http://linemanjs.com)
* [https://github.com/linemanjs/lineman](https://github.com/linemanjs/lineman)
1 change: 1 addition & 0 deletions chapters/scaffolding/lineman/troubleshooting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Troubleshooting