README.md in barista-1.2.1 vs README.md in barista-1.3.0
- old
+ new
@@ -34,15 +34,21 @@
Much like on Rails 3, Barista supports deep integration into Rails 2. The only thing missing (that is currently supported in the Rails 3 version) is built in support for generating a config file. If you're using bundler in your application, all you need to do is add:
gem "json" # Only needed if on Ruby 1.8 / a platform that ships without JSON
gem "barista"
-
+
To your `Gemfile`. If you're not using bundler, doing `gem install json barista` and requiring barista both in your application should be enough to get you started.
If you wish to change the barista configuration, take a look at the [Rails 3 initializer](https://github.com/Sutto/barista/blob/master/lib/generators/barista/install/templates/initializer.rb) and modify it to suite your application as needed.
+If you wish to use barista tasks with rails 2 project, add
+
+ load "barista/tasks/barista.rake"
+
+To your `Rakefile`.
+
### Sinatra
Adding Barista to a Sinatra application is a relatively straight forward affair. Like in Rails 2 and Rails 3, you first need to add and require the barista gem and (optionally, the json gem). Unlike Rails 2 and 3 (which set it up automatically), you must also register the extension in your application. So, in the scope of your app (either the top level scope or the `Sinatra::Application` subclass you're using), you then need to simple add:
register Barista::Integration::Sinatra
@@ -60,20 +66,20 @@
# Setup goes here...
use Barista::Filter if Barista.add_filter?
use Barista::Server::Proxy
run MyRackApplication
-
+
Next, you need to configure barista anywhere before your the above code is run. e.g by adding the following immediatly preceeding it:
# Barista (for CoffeeScript Support)
Barista.app_root = root
Barista.root = File.join(root, 'coffeescripts')
Barista.setup_defaults
barista_config = root + '/barista_config.rb'
require barista_config if File.exist?(barista_config)
-
+
Hence, if you'e using, for example, [serve](https://github.com/jlong/serve) users should have a `config.ru` that looks similar to [this example](https://github.com/YouthTree/site-design/blob/master/config.ru).
### A Quick Note on the JSON Gem
Barista indirectly requires the json gem via the coffee-script gem, but it isn't listed as a dependency for very
@@ -152,10 +158,18 @@
* `env` – The application environment. (Defaults to `Rails.env`.)
* `app_root` – The application's root path.
* `bin_path` – The path to the `node` executable if non-standard and not using `therubyracer`.
* All of the hook methods mentioned below.
+### Custom Preamble
+
+You can generate a custom preamble using a code block. For example, you can replace the location of the original `.coffee` file by a relative one to `Rails.root`.
+
+ Barista.add_preamble do |location|
+ "/* : DO NOT MODIFY - compiled from #{Pathname.new(location).relative_path_from(Rails.root).to_s}\n\n"
+ end
+
## Frameworks
One of the other main features Barista adds (over other tools) is frameworks similar
to Compass. The idea being, you add CoffeeScripts at runtime from gems etc. To do this,
in your gem just have a `coffeescript` directory and then in your gem add the following code:
@@ -217,16 +231,23 @@
* [Trevor Burnham](https://github.com/TrevorBurnham) – Misc. documentation tweaks and hooks idea.
* [Sean McCullough](https://github.com/mcculloughsean) – Initial switch to support bare (vs. no\_wrap)
* [Ben Atkin](https://github.com/benatkin) – Docs work.
* [Ben Hoskings](https://github.com/benhoskings) – Misc. fixes, added preamble support.
* [Kim Joar Bekkelund](https://github.com/kjbekkelund) – Docs work.
+* [Jeffrey ODell](https://github.com/jodell) - Fixed an issue with messages during autocompile.
+* [Paul McMahon](https://github.com/pwim) - Fixed a typo.
+* [Ravil Bayramgalin](https://github.com/brainopia) - Fixes for Rakefiles on Rails 2.
+* [Daniel Doubrovkine](https://github.com/dblock) - Dynamic Preambles, Making it easier to spec the application.
Barista was originally heavily inspired by [Bistro Car](https://github.com/jnicklas/bistro_car), but has taken a few fundamentally
different approach in a few areas.
Barista builds upon the awesome [coffee-script](https://github.com/josh/ruby-coffee-script) gem.
It's all possible thanks to [CoffeeScript](https://github.com/jashkenas/coffee-script) by Jeremy Ashkenas.
+
+If I've missed you're name and you've contributed to Barista, please let me know and I'll add you to the list (or
+fork this document and send a pull request).
## Note on Patches/Pull Requests ##
1. Fork the project.
2. Make your feature addition or bug fix.