diff --git a/CHANGELOG.md b/CHANGELOG.md index da6948d89..775165509 100644 --- a/CHANGELOG.md +++ b/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 @@ -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 diff --git a/docs/commands.rst b/docs/commands.rst index dc48c830a..d8d2448c9 100644 --- a/docs/commands.rst +++ b/docs/commands.rst @@ -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 `` --------------------------------- diff --git a/docs/config.rst b/docs/config.rst index 4c41b8fba..c6fb61992 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -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'``. diff --git a/docs/plugins.rst b/docs/plugins.rst index 5886cf7f0..2ee849f7c 100644 --- a/docs/plugins.rst +++ b/docs/plugins.rst @@ -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: diff --git a/docs/upgrading.rst b/docs/upgrading.rst index 4af7efc36..107655d8f 100644 --- a/docs/upgrading.rst +++ b/docs/upgrading.rst @@ -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 ================ diff --git a/src/commands/watch.coffee b/src/commands/watch.coffee index 88301f707..77351d0a4 100644 --- a/src/commands/watch.coffee +++ b/src/commands/watch.coffee @@ -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" diff --git a/src/fs_utils/write.coffee b/src/fs_utils/write.coffee index 23d6e86c1..c3940c562 100644 --- a/src/fs_utils/write.coffee +++ b/src/fs_utils/write.coffee @@ -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) -> diff --git a/src/helpers.coffee b/src/helpers.coffee index f09bd778f..961cf8642 100644 --- a/src/helpers.coffee +++ b/src/helpers.coffee @@ -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, '\\') @@ -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' @@ -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