Skip to content

Commit

Permalink
Update docs, change paths.build to paths.public.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Apr 15, 2012
1 parent 0a1795f commit 9c2d19c
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 20 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
@@ -1,4 +1,4 @@
## Brunch 1.1.0 (unreleased)
## Brunch 1.1.0 (April 15, 2012)
* Added windows support.
* Added node.js 0.7 / 0.8 support.
* Added support for chain compilation. For example, if `_user.styl` changes
Expand All @@ -13,7 +13,7 @@ and `main.styl` depends on it, `main.styl` will be recompiled too.
`--skeleton` supports relative / absolute path and git repo URLs.
Also, git metadata is automatically removed in cloned / copied projects.
* Improved config API:
* `buildPath` is now deprecated, `paths.build` is used instead of it.
* `buildPath` is now deprecated, `paths.public` is used instead of it.
* Added `paths.app`, `paths.root`, `paths.assets`, `paths.test`,
`paths.vendor`.
* Scripts that are not in the config[lang].order are now compiled in
Expand Down
22 changes: 14 additions & 8 deletions docs/commands.rst
Expand Up @@ -6,41 +6,47 @@ Command line API
Create new brunch project. Options:

* ``rootPath``: (required) name of project directory that would be created
* ``-t PATH_TO_TEMPLATE --template PATH_TO_TEMPLATE``: path to project, contents of which will be copied to new .
* ``-s PATH_TO_SKELETON, --skeleton PATH_TO_SKELETON``: path or
git repo address of project, contents of which will be copied to new dir.

`.git` directory is automatically removed when copying.

Short-cut: ``brunch n``.

Examples:

* ``brunch new twitter -t ~/brunch-templates/simple``
* ``brunch n twitter -s ~/brunch-templates/simple``
* ``brunch n twitter -s git://github.com/paulmillr/brunch-with-chaplin.git``

``brunch build``
----------------
Build a brunch project. Options:

* ``-o DIRECTORY, --output DIRECTORY``: build path (deprecated, use config)
* ``-m, --minify``: minify the result js & css files? Analog of ``minify`` option in config file.
* ``-c CONFIG_PATH, --config CONFIG_PATH``: path to config (default: ``config``)

Short-cut: ``brunch b``.

Examples:

* ``brunch build -o .``: would build application and place results to current directory.
* ``brunch b -c ios_config -m``: would load ios_config.(js,coffee), build application and minify the output.

``brunch watch``
----------------
Watch brunch directory and rebuild if something changed. Options:

* ``-o DIRECTORY, --output DIRECTORY``: build path (deprecated, use config)
* ``-s, --server``: run a simple http server that would server `output` dir
* ``-p PORT, --port PORT``: if a `server` option was specified, define on which port the server would run
* ``-c CONFIG_PATH, --config CONFIG_PATH``: path to config (default: ``config``)
* ``-m, --minify``: minify the result js & css files? Analog of ``minify`` option in config file.

Short-cut: ``brunch w``.

Examples:

* ``brunch watch``: simply watch current directory & compile the output to `build` directory.
* ``brunch watch --output . --server``: watch current directory, compile the output to current directory and run a webserver that would work on current directory.
* ``brunch watch --output /tmp --server --port 8841``: watch current directory, compile the output to ``/tmp`` and run a webserver that would work on ``/tmp`` on port :8841.
* ``brunch w``: simply watch current directory & compile the output to ``build`` directory.
* ``brunch w -s``: watch current project and run a webserver that would work on ``public`` directory (by default).
* ``brunch w -s -p 8841 -m``: watch current project and run a webserver that would work on ``public`` directory (by default). Also, auto-minify files.

``brunch generate <type> <name>``
---------------------------------
Expand Down
7 changes: 4 additions & 3 deletions docs/config.rst
Expand Up @@ -4,12 +4,13 @@ Configuration file

Brunch uses configuration file (``config.coffee`` or ``config.js``) located in the root directory to control various aspects of your application.

``buildPath``
``paths``
=============

`Optional, string`: sets directory which will contain files, generated by ``brunch build`` or ``brunch watch``.
`Optional, object`: ``paths`` contains application paths to key directories. Paths are simple strings.

Default value is ``'public'``.
* ``public`` key: path to build directory that would contain output.
* Other valid keys: ``app``, ``vendor``, ``root``.

Examples: ``'../../deploy'``, ``'build'``, ``'/Users/john/web'``.

Expand Down
2 changes: 2 additions & 0 deletions docs/plugins.rst
Expand Up @@ -29,6 +29,8 @@ Brunch language is a CoffeeScript class that has ``brunchPlugin`` property. It w
* ``type``: `(required in compilers & minifiers, string)`
* ``extension``: `(required in compilers, string)`
* ``compile(data, path, callback)``: `(required in compilers, function)` would be called every time brunch sees change in application source code. Data is contents of source file which will be compiled, path is path to the file and callback is a function that will be executed on compilation with arguments ``error`` and ``result``.
* ``getDependencies(data, path, callback)``: `(required in compilers, function)` would be called every time brunch sees change in application source code. Used as chain compilation rule. For example, if `_user.styl` changes
and `main.styl` depends on it, `main.styl` will be recompiled too. To know this, brunch needs to receive an array of dependent files from the function.
* ``minify(data, path, callback)``: `(required in minifiers, function)` would be called every time brunch sees change in application source code. Data is contents of destination file which will be minified, path is path to the file and callback is a function that will be executed on compilation with arguments ``error`` and ``result``.

Example:
Expand Down
6 changes: 6 additions & 0 deletions docs/upgrading.rst
Expand Up @@ -2,6 +2,12 @@
Upgrading brunch
****************

Upgrading to 1.1
================

* Change ``buildPath: ...`` in ``config.coffee`` to ``paths: build: ...``
* Update ``package.json`` packages versions from ``1.0.x`` to ``1.0.x || 1.1.x``

Upgrading to 1.0
================

Expand Down
2 changes: 1 addition & 1 deletion src/commands/watch.coffee
Expand Up @@ -90,7 +90,7 @@ class BrunchWatcher
compile: =>
paths = @config.paths
fs_utils.write @fileList, @config, @plugins, (error, result) =>
fs_utils.copyIfExists paths.assets, paths.build, yes, (error) =>
fs_utils.copyIfExists paths.assets, paths.public, yes, (error) =>
logger.error "Asset compilation failed: #{error}" if error?
logger.info "compiled."
logger.debug "compilation time: #{Date.now() - @start}ms"
Expand Down
2 changes: 1 addition & 1 deletion src/fs_utils/write.coffee
Expand Up @@ -52,7 +52,7 @@ getFiles = (fileList, config, minifiers) ->

Object.keys(map).map (generatedFilePath) =>
sourceFiles = map[generatedFilePath]
fullPath = sysPath.join config.paths.build, generatedFilePath
fullPath = sysPath.join config.paths.public, generatedFilePath
file = new GeneratedFile fullPath, sourceFiles, config
minifiers
.filter (minifier) ->
Expand Down
10 changes: 5 additions & 5 deletions src/helpers.coffee
Expand Up @@ -69,11 +69,11 @@ exports.startServer = (config, callback = (->)) ->
if config.server.path
try
server = require sysPath.resolve config.paths.server
server.startServer config.server.port, config.paths.build, callback
server.startServer config.server.port, config.paths.public, callback
catch error
logger.error "couldn\'t load server #{config.server.path}: #{error}"
else
startDefaultServer config.server.port, config.paths.build, callback
startDefaultServer config.server.port, config.paths.public, callback

exports.replaceSlashes = replaceSlashes = (config) ->
changePath = (string) -> string.replace(/\//g, '\\')
Expand Down Expand Up @@ -101,10 +101,10 @@ exports.setConfigDefaults = setConfigDefaults = (config, configPath) ->
join = (parent, name) =>
sysPath.join config.paths[parent], name
if config.buildPath
logger.warn 'config.buildPath is deprecated. Use config.paths.build.'
logger.warn 'config.buildPath is deprecated. Use config.paths.public.'
config.paths ?= {}
config.paths.root ?= config.rootPath ? '.'
config.paths.build ?= config.buildPath ? join 'root', 'public'
config.paths.public ?= config.buildPath ? join 'root', 'public'
config.paths.app ?= join 'root', 'app'
config.paths.config = configPath ? join 'root', 'config'
config.paths.packageConfig ?= join 'root', 'package.json'
Expand All @@ -117,7 +117,7 @@ exports.setConfigDefaults = setConfigDefaults = (config, configPath) ->
config.server.run ?= no
# Alias deprecated config params.
config.rootPath = config.paths.root
config.buildPath = config.paths.build
config.buildPath = config.paths.public
replaceSlashes config if process.platform is 'win32'
config

Expand Down

0 comments on commit 9c2d19c

Please sign in to comment.