barista 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -3
- data/Rakefile +1 -1
- data/barista.gemspec +3 -3
- data/lib/barista.rb +10 -0
- data/lib/barista/compiler.rb +6 -1
- data/lib/barista/tasks/barista.rake +1 -1
- data/lib/barista/version.rb +1 -1
- metadata +5 -5
data/README.md
CHANGED
@@ -14,11 +14,11 @@ your coffeescripts will be automatically provided, ready for bundling.
|
|
14
14
|
|
15
15
|
To add to your project, simply add:
|
16
16
|
|
17
|
-
gem 'barista', '>= 0.
|
17
|
+
gem 'barista', '>= 0.5.0'
|
18
18
|
|
19
19
|
To your Gemfile and run bundle install.
|
20
20
|
|
21
|
-
As you place .coffee files in app/
|
21
|
+
As you place .coffee files in app/coffeescripts, it will automatically handle them for you.
|
22
22
|
|
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.
|
@@ -61,6 +61,7 @@ Barista lets you hook into the compilation at several stages. Namely:
|
|
61
61
|
* before compilation
|
62
62
|
* after compilation
|
63
63
|
* after compilation fails
|
64
|
+
* after compilation complete
|
64
65
|
|
65
66
|
To hook into these hooks, you can use like so:
|
66
67
|
|
@@ -68,11 +69,15 @@ To hook into these hooks, you can use like so:
|
|
68
69
|
* `Barista.on_compilation { |path| puts "Barista: Successfully compiled #{path}" }`
|
69
70
|
* `Barista.on_compilation_with_warning { |path, output| puts "Barista: Compilation of #{path} had a warning:\n#{output}" }`
|
70
71
|
* `Barista.on_compilation_error { |path, output| puts "Barista: Compilation of #{path} failed with:\n#{output}" }`
|
71
|
-
|
72
|
+
* `Barista.on_compilation_complete { puts "Barista: Successfully compiled all files" }`
|
72
73
|
|
73
74
|
These allow you to do things such as notify on compilation, automatically
|
74
75
|
perform compression post compilation and a variety of other cool things.
|
75
76
|
|
77
|
+
An excellent example of these hooks in use is [barista\_growl](http://github.com/TrevorBurnham/barista_growl),
|
78
|
+
by Trevor Burnham - a gem perfect for development purposes that automatically shows growl messages
|
79
|
+
on compilation.
|
80
|
+
|
76
81
|
## Configuration ##
|
77
82
|
|
78
83
|
Please note that barista lets you configure several options. To do this,
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ begin
|
|
8
8
|
Jeweler::Tasks.new do |gem|
|
9
9
|
gem.name = "barista"
|
10
10
|
gem.summary = %Q{Transparent coffeescript support for rails 3.}
|
11
|
-
gem.description = %Q{Automatically compiles app/
|
11
|
+
gem.description = %Q{Automatically compiles app/coffeescripts/*.coffee to javascript for rails awesomesauce.}
|
12
12
|
gem.email = "sutto@sutto.net"
|
13
13
|
gem.homepage = "http://github.com/Sutto/barista"
|
14
14
|
gem.version = Barista::Version::STRING
|
data/barista.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{barista}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.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-
|
13
|
-
s.description = %q{Automatically compiles app/
|
12
|
+
s.date = %q{2010-09-19}
|
13
|
+
s.description = %q{Automatically compiles app/coffeescripts/*.coffee to javascript for rails awesomesauce.}
|
14
14
|
s.email = %q{sutto@sutto.net}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
data/lib/barista.rb
CHANGED
@@ -34,9 +34,17 @@ module Barista
|
|
34
34
|
on_hook :compiled, &blk
|
35
35
|
end
|
36
36
|
|
37
|
+
def on_compilation_complete(&blk)
|
38
|
+
on_hook :all_compiled, &blk
|
39
|
+
end
|
40
|
+
|
37
41
|
def on_compilation_with_warning(&blk)
|
38
42
|
on_hook :compiled_with_warning, &blk
|
39
43
|
end
|
44
|
+
|
45
|
+
def before_full_compilation(&blk)
|
46
|
+
on_hook :before_full_compilation, &blk
|
47
|
+
end
|
40
48
|
|
41
49
|
def before_compilation(&blk)
|
42
50
|
on_hook :before_compilation, &blk
|
@@ -101,9 +109,11 @@ module Barista
|
|
101
109
|
|
102
110
|
def compile_all!(force = false, silence_error = true)
|
103
111
|
debug "Compiling all coffeescripts"
|
112
|
+
Barista.invoke_hook :before_full_compilation
|
104
113
|
Framework.exposed_coffeescripts.each do |coffeescript|
|
105
114
|
compile_file! coffeescript, force, silence_error
|
106
115
|
end
|
116
|
+
Barista.invoke_hook :all_compiled
|
107
117
|
true
|
108
118
|
end
|
109
119
|
|
data/lib/barista/compiler.rb
CHANGED
@@ -55,7 +55,12 @@ module Barista
|
|
55
55
|
def invoke_coffee(path)
|
56
56
|
command = "#{self.class.bin_path} #{coffee_options} '#{path}'".squeeze(' ')
|
57
57
|
Barista.invoke_hook :before_compilation, path
|
58
|
-
|
58
|
+
|
59
|
+
#jruby cannot use open4 because it uses fork.
|
60
|
+
#This should hopefully work for both jruby and ruby
|
61
|
+
popen_class = IO.respond_to?(:popen4) ? IO : Open4
|
62
|
+
|
63
|
+
pid, stdin, stdout, stderr = popen_class.popen4(command)
|
59
64
|
stdin.close
|
60
65
|
_, status = Process.waitpid2(pid)
|
61
66
|
out = stdout.read.strip
|
@@ -1,6 +1,6 @@
|
|
1
1
|
namespace :barista do
|
2
2
|
|
3
|
-
desc "Compiles coffeescripts from app/
|
3
|
+
desc "Compiles coffeescripts from app/coffeescripts into public/javascripts"
|
4
4
|
task :brew => :environment do
|
5
5
|
if !Barista::Compiler.available?
|
6
6
|
$stderr.puts "'#{Barista::Compiler.bin_path}' was unavailable."
|
data/lib/barista/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barista
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 1
|
10
|
+
version: 0.5.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Darcy Laycock
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-09-19 00:00:00 +08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: "0"
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
|
-
description: Automatically compiles app/
|
35
|
+
description: Automatically compiles app/coffeescripts/*.coffee to javascript for rails awesomesauce.
|
36
36
|
email: sutto@sutto.net
|
37
37
|
executables: []
|
38
38
|
|