soca 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +10 -8
- data/Gemfile.lock +34 -26
- data/HISTORY +16 -0
- data/Rakefile +4 -4
- data/lib/soca.rb +1 -1
- data/lib/soca/plugin.rb +3 -5
- data/lib/soca/plugins/coffeescript.rb +3 -3
- data/lib/soca/plugins/compass.rb +12 -4
- data/lib/soca/plugins/haml.rb +35 -0
- data/lib/soca/plugins/jim.rb +3 -1
- data/lib/soca/plugins/macro.rb +23 -19
- data/lib/soca/plugins/mustache.rb +1 -1
- data/lib/soca/pusher.rb +39 -12
- data/lib/soca/templates/config.js.erb +4 -1
- data/soca.gemspec +35 -49
- data/test/helper.rb +2 -0
- data/test/test_compass_plugin.rb +57 -0
- data/test/test_macro_plugin.rb +35 -0
- data/test/test_soca_pusher.rb +16 -2
- data/test/testapp/config.js +5 -1
- data/test/testapp/hooks/before_build.rb +1 -1
- data/test/testapp/hooks/before_push.rb +1 -1
- metadata +148 -258
- data/test/test_plugins.rb +0 -39
data/test/test_plugins.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class TestSocaPusher < Test::Unit::TestCase
|
4
|
-
|
5
|
-
context "macro plugin" do
|
6
|
-
setup do
|
7
|
-
@pusher = Soca::Pusher.new(@test_app_dir)
|
8
|
-
@sammy = File.read("#{@test_app_dir}/js/vendor/sammy-0.5.4.js")
|
9
|
-
@views = "#{@test_app_dir}/db/views/"
|
10
|
-
end
|
11
|
-
|
12
|
-
should "replace !code macros with file contents" do
|
13
|
-
@pusher.push!
|
14
|
-
assert @pusher.document['views']['recent'].all?{|part| part[1].include?(@sammy)}
|
15
|
-
end
|
16
|
-
|
17
|
-
should "keep the original code" do
|
18
|
-
@pusher.push!
|
19
|
-
parts = ['map','reduce'].inject({}){|res,part| res[part] = File.read("#{@views}/recent/#{part}.js").split("\n");res}
|
20
|
-
parts.each do |part,lines|
|
21
|
-
assert contain_lines(part,lines)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
should "be able to process views with map only" do
|
26
|
-
@pusher.push!
|
27
|
-
lines = File.read("#{@views}/only_map/map.js").split("\n")
|
28
|
-
assert contain_lines('map',lines)
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def contain_lines(part,lines)
|
34
|
-
lines.delete(' // !code js/vendor/sammy-0.5.4.js')
|
35
|
-
lines.all? { |line| @pusher.document['views']['recent'][part].include?(line)}
|
36
|
-
end
|
37
|
-
|
38
|
-
|
39
|
-
end
|