barista 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -4,9 +4,9 @@ Barista is very, very similar to [bistro\_car](http://github.com/jnicklas/bistro
4
4
  code / is almost a fork).
5
5
 
6
6
  The main difference being, it lets you use coffee as you would javascript. Simply put, Write coffee
7
- and place it in `app/scripts` and Barista will automatically serve it as if it was placed in `public/javascripts`
7
+ and place it in `app/coffeescripts` and Barista will automatically serve it as if it was placed in `public/javascripts`
8
8
 
9
- That is, `app/scripts/demo.coffee` will work for `/javascripts/demo.js`. Even better (and more importantly
9
+ That is, `app/coffeescripts/demo.coffee` will work for `/javascripts/demo.js`. Even better (and more importantly
10
10
  for me), it provides `Barista.compile_all!` which takes all coffee files and compiles them into `public/javascripts`.
11
11
 
12
12
  If you're using Jammit, this means you can simple run a rake task (`rake barista:brew` before running jammit) and
@@ -23,4 +23,20 @@ As you place .coffee files in app/scripts, it will automatically handle them for
23
23
  Please note that for Jammit compatibility etc, by default in test and dev mode it will
24
24
  automatically compile all coffeescripts that have changed before rendering the page.
25
25
 
26
- Barista require rails 3+ (but patches for Rails 2 will be accepted.)
26
+ Barista require rails 3+ (but patches for Rails 2 will be accepted.)
27
+
28
+ ## Configuration ##
29
+
30
+ Please note that barista lets you configure several options. To do this,
31
+ it's as simple as setting up an initializer with:
32
+
33
+ rails generate barista_install
34
+
35
+ Then editing `config/initializers/barista_config.rb`.
36
+
37
+ Currently available options are:
38
+
39
+ * root - the folder path to read coffeescripts from, defaults to app/coffeescripts
40
+ * output\_root - the folder to write them into, defautls to public/javascripts.
41
+ * no\_wrap - stop coffee from automatically wrapping JS in a closure.
42
+
data/barista.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{barista}
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
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-04-25}
12
+ s.date = %q{2010-04-27}
13
13
  s.description = %q{Automatically compiles app/scripts/*.coffee to javascript for rails awesomesauce.}
14
14
  s.email = %q{sutto@sutto.net}
15
15
  s.extra_rdoc_files = [
@@ -29,7 +29,10 @@ Gem::Specification.new do |s|
29
29
  "lib/barista/compiler.rb",
30
30
  "lib/barista/filter.rb",
31
31
  "lib/barista/tasks/barista.rake",
32
- "lib/barista/version.rb"
32
+ "lib/barista/version.rb",
33
+ "lib/generators/barista_install/USAGE",
34
+ "lib/generators/barista_install/barista_install_generator.rb",
35
+ "lib/generators/barista_install/templates/initializer.rb"
33
36
  ]
34
37
  s.homepage = %q{http://github.com/Sutto/barista}
35
38
  s.rdoc_options = ["--charset=UTF-8"]
data/lib/barista.rb CHANGED
@@ -8,8 +8,12 @@ module Barista
8
8
 
9
9
  class << self
10
10
 
11
+ def configure
12
+ yield self if block_given?
13
+ end
14
+
11
15
  def root
12
- @root ||= Rails.root.join("app", "scripts")
16
+ @root ||= Rails.root.join("app", "coffeescripts")
13
17
  end
14
18
 
15
19
  def root=(value)
@@ -65,6 +69,10 @@ module Barista
65
69
  defined?(@no_wrap) && @no_wrap
66
70
  end
67
71
 
72
+ def no_wrap!
73
+ self.no_wrap = true
74
+ end
75
+
68
76
  def no_wrap=(value)
69
77
  @no_wrap = !!value
70
78
  end
@@ -2,7 +2,7 @@ module Barista
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 4
5
+ PATCH = 5
6
6
  STRING = [MAJOR, MINOR, PATCH].join(".")
7
7
  end
8
8
  end
@@ -0,0 +1,3 @@
1
+ To copy a Barista initializer to your Rails App, with some configuration values, just do:
2
+
3
+ rails generate barista_install
@@ -0,0 +1,11 @@
1
+ class BaristaInstallGenerator < Rails::Generators::Base
2
+
3
+ def self.source_root
4
+ @_ps_source_root ||= File.expand_path("templates", File.dirname(__FILE__))
5
+ end
6
+
7
+ def create_initializer
8
+ copy_file 'initializer.rb', 'config/initializers/barista_config.rb'
9
+ end
10
+
11
+ end
@@ -0,0 +1,15 @@
1
+ # Configure barista.
2
+ Barista.configure do |c|
3
+
4
+ # Change the root to use app/scripts
5
+ # c.root = Rails.root.join("app", "scripts")
6
+
7
+ # Change the output root, causing Barista to compile into public/coffeescripts
8
+ # c.output_root = Rails.root.join("public", "coffeescripts")
9
+
10
+ # Disable wrapping in a closure:
11
+ # c.no_wrap = true
12
+ # ... or ...
13
+ # c.no_wrap!
14
+
15
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 5
9
+ version: 0.1.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Darcy Laycock
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-25 00:00:00 +08:00
17
+ date: 2010-04-27 00:00:00 +08:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -41,6 +41,9 @@ files:
41
41
  - lib/barista/filter.rb
42
42
  - lib/barista/tasks/barista.rake
43
43
  - lib/barista/version.rb
44
+ - lib/generators/barista_install/USAGE
45
+ - lib/generators/barista_install/barista_install_generator.rb
46
+ - lib/generators/barista_install/templates/initializer.rb
44
47
  has_rdoc: true
45
48
  homepage: http://github.com/Sutto/barista
46
49
  licenses: []