barista 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -12,4 +12,12 @@ for me), it provides `Barista.compile_all!` which takes all coffee files and com
12
12
  If you're using Jammit, this means you can simple run a rake task (`rake barista:brew` before running jammit) and
13
13
  your coffeescripts will be automatically provided, ready for bundling.
14
14
 
15
+ To add to your project, simply add:
16
+
17
+ gem 'barista', '>= 0.1.0'
18
+
19
+ To your Gemfile and run bundle install.
20
+
21
+ As you place .coffee files in app/scripts, it will automatically handle them for you.
22
+
15
23
  Barista require rails 3+ (but patches for Rails 2 will be accepted.)
@@ -2,6 +2,7 @@ class BaristaController < ActionController::Base
2
2
 
3
3
  caches_page :show if Rails.env.production?
4
4
 
5
+ # Used for rendering on the fly.
5
6
  def show
6
7
  headers['Content-Type'] = "application/javascript"
7
8
  path = normalize_path(params[:js_path])
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.0"
8
+ s.version = "0.1.1"
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-24}
12
+ s.date = %q{2010-04-25}
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 = [
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
26
26
  "barista.gemspec",
27
27
  "config/routes.rb",
28
28
  "lib/barista.rb",
29
+ "lib/barista/around_filter.rb",
29
30
  "lib/barista/compiler.rb",
30
31
  "lib/barista/tasks/barista.rake",
31
32
  "lib/barista/version.rb"
data/lib/barista.rb CHANGED
@@ -3,7 +3,8 @@ require 'pathname'
3
3
 
4
4
  module Barista
5
5
 
6
- autoload :Compiler, 'barista/compiler'
6
+ autoload :Compiler, 'barista/compiler'
7
+ autoload :AroundFilter, 'barista/around_filter'
7
8
 
8
9
  class << self
9
10
 
@@ -53,13 +54,24 @@ module Barista
53
54
  true
54
55
  end
55
56
 
57
+ # By default, only add it in dev / test
58
+ def add_filter?
59
+ Rails.env.test? || Rails.env.development?
60
+ end
61
+
56
62
  end
57
63
 
58
64
  if defined?(Rails::Engine)
59
65
  class Engine < Rails::Engine
66
+
60
67
  rake_tasks do
61
68
  load File.expand_path('./barista/tasks/barista.rake', File.dirname(__FILE__))
62
69
  end
70
+
71
+ initializer "barista.wrap_filter" do
72
+ ApplicationController.around_filter(Barista::AroundFilter) if Barista.add_filter?
73
+ end
74
+
63
75
  end
64
76
  end
65
77
 
@@ -0,0 +1,10 @@
1
+ module Barista
2
+ class AroundFilter
3
+
4
+ def self.filter(controller)
5
+ Barista.compile_all!
6
+ yield if block_given?
7
+ end
8
+
9
+ end
10
+ end
@@ -2,7 +2,7 @@ module Barista
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 0
5
+ PATCH = 1
6
6
  STRING = [MAJOR, MINOR, PATCH].join(".")
7
7
  end
8
8
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
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-24 00:00:00 +08:00
17
+ date: 2010-04-25 00:00:00 +08:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -37,6 +37,7 @@ files:
37
37
  - barista.gemspec
38
38
  - config/routes.rb
39
39
  - lib/barista.rb
40
+ - lib/barista/around_filter.rb
40
41
  - lib/barista/compiler.rb
41
42
  - lib/barista/tasks/barista.rake
42
43
  - lib/barista/version.rb