barista 0.7.0.pre3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
File without changes
data/README.md CHANGED
@@ -1,33 +1,89 @@
1
1
  # Barista #
2
2
 
3
- Barista is a rails plugin that transparently compiles CoffeeScript to JavaScript. When a `.coffee` file is changed and the page is refreshed, it delays sending the `.js` file until it's been regenerated from the newly modified CoffeeScript. This way, you can refresh immediately after saving the `.coffee` file, and not worry about an old `.js` file being sent to the browser (as often happens when using `coffee --watch`).
3
+ Barista is a set of tools to make using [CoffeeScript](http://jashkenas.github.com/coffee-script/) in Rails 3, Rails 2 and Rack applications
4
+ easier. You can think of it as similar to [Compass]() but instead of for Sass, it's for CoffeeScript.
4
5
 
5
- Barista supports using `therubyracer` when installed or, by default, the node.js version of CoffeeScript via the `coffee` executable.
6
+ Getting started is fairly simple - The short version for Rails 3 is simply:
6
7
 
7
- Barista is very, very similar to [bistro\_car](http://github.com/jnicklas/bistro_car) (infact, credit where credit is due - it shares similar
8
- code / is almost a fork).
8
+ 1. Add `gem 'barista', '~> 1.0'` to your Gemfile
9
+ 2. Run `bundle install`
10
+ 3. Run `rails generate barista:install`
9
11
 
10
- The main difference being, it lets you use coffee as you would javascript. Simply put, Write coffee
11
- and place it in `app/coffeescripts` and Barista will automatically serve it as if it was placed in `public/javascripts`
12
+ Place your CoffeeScript's in `app/coffeescripts` and Barista will automatically compile them on change into `public/javascripts`.
12
13
 
13
- That is, `app/coffeescripts/demo.coffee` will work for `/javascripts/demo.js`. Even better (and more importantly
14
- for me), it provides `Barista.compile_all!` which takes all coffee files and compiles them into `public/javascripts`.
15
14
 
16
- If you're using Jammit, this means you can simple run a rake task (`rake barista:brew` before running jammit) and
17
- your coffeescripts will be automatically provided, ready for bundling.
15
+ As an added bonus, Barista also gives:
16
+
17
+ * Automatic support for a `:coffeescript` filter in Haml (when Haml is loaded before barista) - Automatically converting inline CoffeeScript
18
+ to JavaScript for you.
19
+ * Where possible, support for `coffeescript_include_tag` and `coffeescript_tag`.
20
+ * When possible, instead of pre-compiling in development and test modes, Barista will embed CoffeeScript in the page for you.
21
+ * Support for Heroku via `therubyracer` and either pre-compiled JS or, optionally, a lightweight Rack app that generates on request.
22
+
23
+
24
+ ## General Information
25
+
26
+ Barista transparently compiles CoffeeScript to JavaScript - When a `.coffee` file is changed and the page is refreshed, it first regenerates all `.js` files whose `.coffee` sources have been recently changed. This way, you can refresh immediately after saving the `.coffee` file, and not worry about an old `.js` file being sent to the browser (as often happens when using `coffee --watch`).
27
+
28
+ Barista supports using `therubyracer` when installed or, by default, using either the `node` executable or `jsc` (on OSX) to compile your scripts. There is
29
+ no need for you to install the coffee script executable in node - having Node itself or any of the alternatives available is enough for you to get support.
30
+
31
+ When you want to deploy, you can simple run `rake barista:brew` to force the compilation of all JavaScripts fro the current application.
32
+
33
+ ## In Practice
34
+
35
+ Barista not only supports compiling all JavaScripts on demand (via `rake barista:brew` as above, or `Barista.compile_all!`) but it
36
+ also ships with a simple Rack server app that will compile on demand for platforms such as Heroku, meaning you don't need write access
37
+ (although it is helpful).
38
+
39
+ If you're using Jammit, the precompilation phase (e.g. `rake barista:brew` before running jammit) will make it possible for your application
40
+ to automatically bundle not only normal JavaScripts but also your CoffeeScripts.
18
41
 
19
42
  To add to your project, simply add:
20
43
 
21
- gem 'barista', '>= 0.5.0'
44
+ gem 'barista', '~> 1.0'
22
45
 
23
46
  To your Gemfile and run bundle install.
24
47
 
25
- As you place .coffee files in app/coffeescripts, it will automatically handle them for you.
48
+ Please note that for Jammit compatibility, in test and dev mode (by default) it will
49
+ automatically compile all CoffeeScripts that have changed before rendering the page.
50
+
51
+ Barista works out of the box with Rails 3 (and theoretically, Rails 2) - with support for Rack if
52
+ you're willing to set it up manually. More docs on how to set it up for other platforms
53
+ will be posted in the near future.
54
+
55
+ ## Configuration ##
56
+
57
+ Please note that barista lets you configure several options. To do this,
58
+ it's as simple as setting up an initializer with:
59
+
60
+ rails generate barista:install
61
+
62
+ Then editing `config/initializers/barista_config.rb`. The options available are:
63
+
64
+ ### Boolean Options
65
+
66
+ All of these come in the form of `#option?` (to check it's status), `#option=(value)` (to set it)
67
+ and `#option!` (to set the value to true):
26
68
 
27
- Please note that for Jammit compatibility etc, by default in test and dev mode it will
28
- automatically compile all coffeescripts that have changed before rendering the page.
69
+ * `verbose` - Output debugging error messages. (Defaults to true in test / dev)
70
+ * `bare` - Don't wrap the compiled JS in a Closure
71
+ * `add_filter` - Automatically add an around filter for processing changes. (Defaults to true in test / dev)
72
+ * `add_preamble` - Add a time + path preamble to compiled JS. (Defaults to true in test / dev)
73
+ * `exception_on_error` - Raise an exception on compilation errors (defaults to true)
74
+ * `embedded_interpreter` - Embeds coffeescript + link to coffee file instead of compiling for include tags and haml filters. (Defaults to true in test / dev)
29
75
 
30
- Barista require rails 3+ (but patches for Rails 2 will be accepted.)
76
+ ### Path options
77
+
78
+ * `root` - the folder path to read coffeescripts from, defaults to app/coffeescripts
79
+ * `output_root` - the folder to write them into, defaults to public/javascripts.
80
+ * `change_output_prefix!` - method to change the output prefix for a framework.
81
+ * `verbose` - whether or not barista will add a preamble to files.
82
+ * `js_path` - Path to the pure-javascript compiler.
83
+ * `env` - The application environment. (defaults to Rails.env)
84
+ * `app_root` - The root of the application.
85
+ * `bin_path` - The path to the `node` executable if non-standard and not using therubyracer.
86
+ * All of the hook methods mentioned below.
31
87
 
32
88
  ## Frameworks ##
33
89
 
@@ -82,27 +138,6 @@ An excellent example of these hooks in use is [barista\_growl](http://github.com
82
138
  by Trevor Burnham - a gem perfect for development purposes that automatically shows growl messages
83
139
  on compilation.
84
140
 
85
- ## Configuration ##
86
-
87
- Please note that barista lets you configure several options. To do this,
88
- it's as simple as setting up an initializer with:
89
-
90
- rails generate barista:install
91
-
92
- Then editing `config/initializers/barista_config.rb`.
93
-
94
- Currently available options are:
95
-
96
- * `root` - the folder path to read coffeescripts from, defaults to app/coffeescripts
97
- * `output_root` - the folder to write them into, defaults to public/javascripts.
98
- * `no_wrap` and `bare` - stop coffee from automatically wrapping JS in a closure.
99
- * `change_output_prefix!` - method to change the output prefix for a framework.
100
- * All of the hooks mentioned above.
101
- * `verbose` - whether or not barista will add a preamble to files.
102
- * `compiler` - One of `:native` or `:node`, to force the compiler version.
103
- * `compiler_klass` - A custom compiler class.
104
- * `js_path` - Path to the pure-javascript compiler
105
-
106
141
  # Contributors / Credits
107
142
 
108
143
  The following people have all contributed to Barista:
@@ -113,12 +148,14 @@ The following people have all contributed to Barista:
113
148
  * [Trevor Burnham](https://github.com/TrevorBurnham) - Misc. documentation tweaks and hooks idea.
114
149
  * [Sean McCullough](https://github.com/mcculloughsean) - Initial switch to support bare (vs. no\_wrap)
115
150
  * [Ben Atkin](https://github.com/benatkin) - Docs work.
151
+ * [Ben Hoskings](https://github.com/benhoskings) Misc fixes, added preamble support.
116
152
 
117
- Barista was originally heavily inspired by [Bistro Car](https://github.com/jnicklas/bistro_car), but taking a fundamentally
153
+ Barista was originally heavily inspired by [Bistro Car](https://github.com/jnicklas/bistro_car), but has taken a few fundamentally
118
154
  different approach in a few areas.
119
155
 
120
- The Native JavaScript compiler was heavily inspired by and based on [Sam Stephenson's](https://github.com/sstephenson) fork of
121
- the ruby-coffee-script gem. All credit for the idea goes to him and the code is based on his simple approach.
156
+ Barista builds upon the awesome [coffee-script](https://github.com/josh/ruby-coffee-script) gem.
157
+
158
+ It's all possible thanks to [CoffeeScript](https://github.com/jashkenas/coffee-script) by Jeremy Ashkenas.
122
159
 
123
160
  ## Note on Patches/Pull Requests ##
124
161
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{barista}
8
- s.version = "0.7.0.pre3"
8
+ s.version = "1.0.0"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Darcy Laycock"]
12
- s.date = %q{2010-12-10}
12
+ s.date = %q{2011-01-01}
13
13
  s.description = %q{Barista provides simple, integrated support for CoffeeScript in Rack and Rails applications.
14
14
 
15
15
  Much like Compass does for Sass, It also provides Frameworks (bundleable code which can be shared via Gems).
@@ -25,7 +25,7 @@ For more details, please see the the README file bundled with it.}
25
25
  s.files = [
26
26
  ".document",
27
27
  ".rspec",
28
- ".rvmrc",
28
+ ".rvmrc.example",
29
29
  "DESCRIPTION",
30
30
  "Gemfile",
31
31
  "Gemfile.lock",
@@ -52,7 +52,7 @@ module Barista
52
52
 
53
53
  # Configuration - Tweak how you use Barista.
54
54
 
55
- has_boolean_options :verbose, :bare, :add_filter, :add_preamble, :exception_on_error, :embedded_interpreter
55
+ has_boolean_options :verbose, :bare, :add_filter, :add_preamble, :exception_on_error, :embedded_interpreter
56
56
  has_delegate_methods Compiler, :bin_path, :bin_path=, :js_path, :js_path=
57
57
  has_deprecated_methods :compiler, :compiler=, :compiler_klass, :compiler_klass=
58
58
 
@@ -35,6 +35,7 @@ module Barista
35
35
 
36
36
  def self.setup
37
37
  if defined?(Haml)
38
+ require 'haml/filters'
38
39
  CoffeeScript.module_eval { include Haml::Filters::Base }
39
40
  end
40
41
  end
@@ -1,8 +1,8 @@
1
1
  module Barista
2
2
  module Version
3
- MAJOR = 0
4
- MINOR = 7
3
+ MAJOR = 1
4
+ MINOR = 0
5
5
  PATCH = 0
6
- STRING = [MAJOR, MINOR, PATCH, 'pre3'].join(".")
6
+ STRING = [MAJOR, MINOR, PATCH].join(".")
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barista
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1876988218
5
- prerelease: true
4
+ hash: 23
5
+ prerelease: false
6
6
  segments:
7
+ - 1
7
8
  - 0
8
- - 7
9
9
  - 0
10
- - pre3
11
- version: 0.7.0.pre3
10
+ version: 1.0.0
12
11
  platform: ruby
13
12
  authors:
14
13
  - Darcy Laycock
@@ -16,7 +15,7 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2010-12-10 00:00:00 +08:00
18
+ date: 2011-01-01 00:00:00 +08:00
20
19
  default_executable:
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
@@ -99,7 +98,7 @@ extra_rdoc_files:
99
98
  files:
100
99
  - .document
101
100
  - .rspec
102
- - .rvmrc
101
+ - .rvmrc.example
103
102
  - DESCRIPTION
104
103
  - Gemfile
105
104
  - Gemfile.lock
@@ -149,14 +148,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
149
148
  required_rubygems_version: !ruby/object:Gem::Requirement
150
149
  none: false
151
150
  requirements:
152
- - - ">"
151
+ - - ">="
153
152
  - !ruby/object:Gem::Version
154
- hash: 25
153
+ hash: 3
155
154
  segments:
156
- - 1
157
- - 3
158
- - 1
159
- version: 1.3.1
155
+ - 0
156
+ version: "0"
160
157
  requirements: []
161
158
 
162
159
  rubyforge_project: