haml-edge 2.3.224 → 2.3.225
Sign up to get free protection for your applications and to get access to all the features.
- data/EDGE_GEM_VERSION +1 -1
- data/VERSION +1 -1
- data/lib/sass/plugin/merb.rb +2 -23
- data/lib/sass/plugin/rack.rb +0 -18
- data/test/haml/spec/README.md +97 -0
- data/test/haml/spec/lua_haml_spec.lua +30 -0
- data/test/haml/spec/ruby_haml_test.rb +19 -0
- data/test/haml/spec/tests.json +534 -0
- data/vendor/fssm/LICENSE +20 -0
- data/vendor/fssm/README.markdown +55 -0
- data/vendor/fssm/Rakefile +59 -0
- data/vendor/fssm/VERSION.yml +5 -0
- data/vendor/fssm/example.rb +9 -0
- data/vendor/fssm/fssm.gemspec +77 -0
- data/vendor/fssm/lib/fssm/backends/fsevents.rb +36 -0
- data/vendor/fssm/lib/fssm/backends/inotify.rb +26 -0
- data/vendor/fssm/lib/fssm/backends/polling.rb +25 -0
- data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +131 -0
- data/vendor/fssm/lib/fssm/monitor.rb +26 -0
- data/vendor/fssm/lib/fssm/path.rb +91 -0
- data/vendor/fssm/lib/fssm/pathname.rb +502 -0
- data/vendor/fssm/lib/fssm/state/directory.rb +57 -0
- data/vendor/fssm/lib/fssm/state/file.rb +24 -0
- data/vendor/fssm/lib/fssm/support.rb +63 -0
- data/vendor/fssm/lib/fssm/tree.rb +176 -0
- data/vendor/fssm/lib/fssm.rb +33 -0
- data/vendor/fssm/profile/prof-cache.rb +40 -0
- data/vendor/fssm/profile/prof-fssm-pathname.html +1231 -0
- data/vendor/fssm/profile/prof-pathname.rb +68 -0
- data/vendor/fssm/profile/prof-plain-pathname.html +988 -0
- data/vendor/fssm/profile/prof.html +2379 -0
- data/vendor/fssm/spec/path_spec.rb +75 -0
- data/vendor/fssm/spec/root/duck/quack.txt +0 -0
- data/vendor/fssm/spec/root/file.css +0 -0
- data/vendor/fssm/spec/root/file.rb +0 -0
- data/vendor/fssm/spec/root/file.yml +0 -0
- data/vendor/fssm/spec/root/moo/cow.txt +0 -0
- data/vendor/fssm/spec/spec_helper.rb +14 -0
- metadata +36 -1
data/EDGE_GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.225
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.225
|
data/lib/sass/plugin/merb.rb
CHANGED
@@ -24,27 +24,6 @@ unless defined?(Sass::MERB_LOADED)
|
|
24
24
|
|
25
25
|
Sass::Plugin.options.merge!(config)
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
class Merb::Rack::Application
|
30
|
-
def call_with_sass(env)
|
31
|
-
Sass::Plugin.check_for_updates
|
32
|
-
call_without_sass(env)
|
33
|
-
end
|
34
|
-
alias_method :call_without_sass, :call
|
35
|
-
alias_method :call, :call_with_sass
|
36
|
-
end
|
37
|
-
|
38
|
-
else
|
39
|
-
|
40
|
-
class MerbHandler
|
41
|
-
def process_with_sass(request, response)
|
42
|
-
Sass::Plugin.check_for_updates
|
43
|
-
process_without_sass(request, response)
|
44
|
-
end
|
45
|
-
alias_method :process_without_sass, :process
|
46
|
-
alias_method :process, :process_with_sass
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
27
|
+
require 'sass/plugin/rack'
|
28
|
+
Merb::Config[:app].use Sass::Plugin::Rack
|
50
29
|
end
|
data/lib/sass/plugin/rack.rb
CHANGED
@@ -31,7 +31,6 @@ module Sass
|
|
31
31
|
# @param app [#call] The Rack application
|
32
32
|
def initialize(app)
|
33
33
|
@app = app
|
34
|
-
self.class.disable_native_plugin!
|
35
34
|
end
|
36
35
|
|
37
36
|
# Process a request, checking the Sass stylesheets for changes
|
@@ -43,23 +42,6 @@ module Sass
|
|
43
42
|
Sass::Plugin.check_for_updates
|
44
43
|
@app.call(env)
|
45
44
|
end
|
46
|
-
|
47
|
-
# Disable the native Rails or Merb plugins, if they're enabled.
|
48
|
-
# This is automatically done once the Rack plugin is activated.
|
49
|
-
# This is done so that the stylesheets aren't checked twice for each request.
|
50
|
-
def self.disable_native_plugin!
|
51
|
-
if defined?(Merb::Rack) && defined?(Merb::Rack::Application) &&
|
52
|
-
Haml::Util.has?(:instance_method, Merb::Rack::Application, :call_without_sass)
|
53
|
-
Merb::Rack::Application.instance_eval {alias_method :call, :call_without_sass}
|
54
|
-
end
|
55
|
-
|
56
|
-
if defined?(ActionDispatch::Callbacks) && defined?(ActionDispatch::Callbacks.to_prepare)
|
57
|
-
ActionDispatch::Callbacks.skip_callback(:prepare, :__sass_process)
|
58
|
-
elsif defined?(ActionController::Base) &&
|
59
|
-
Haml::Util.has?(:instance_method, ActionController::Base, :sass_old_process)
|
60
|
-
ActionController::Base.instance_eval {alias_method :process, :sass_old_process}
|
61
|
-
end
|
62
|
-
end
|
63
45
|
end
|
64
46
|
end
|
65
47
|
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# Haml Spec #
|
2
|
+
|
3
|
+
Haml Spec provides a basic suite of tests for Haml interpreters.
|
4
|
+
|
5
|
+
It is intented for developers who are creating or maintaining an implementation
|
6
|
+
of the [Haml](http://haml-lang.com) markup language.
|
7
|
+
|
8
|
+
At the moment, there are test runners for the [original Haml](http://github.com/nex3/haml)
|
9
|
+
in Ruby, and for [Lua Haml](http://github.com/norman/lua-haml). Support for
|
10
|
+
other versions of Haml will be added if their developers/maintainers
|
11
|
+
are interested in using it.
|
12
|
+
|
13
|
+
## The Tests ##
|
14
|
+
|
15
|
+
The tests are kept in JSON format for portability across languages. Each test
|
16
|
+
is a JSON object with expected input, output, local variables and configuration
|
17
|
+
parameters (see below). The test suite only provides tests for features which
|
18
|
+
are portable, therefore no tests for script are provided, nor for external
|
19
|
+
filters such as :markdown or :textile.
|
20
|
+
|
21
|
+
The one major exception to this are the tests for interpolation, which you may
|
22
|
+
need to modify with a regular expression to run under PHP or Perl, which
|
23
|
+
require a symbol before variable names. These tests are included despite being
|
24
|
+
less than 100% portable because interpolation is an important part of Haml and
|
25
|
+
can be tricky to implement.
|
26
|
+
|
27
|
+
## Running the Tests ##
|
28
|
+
|
29
|
+
### Ruby ###
|
30
|
+
|
31
|
+
In order to make it as easy as possible for non-Ruby programmers to run the
|
32
|
+
Ruby Haml tests, the Ruby test runner uses test/unit, rather than something
|
33
|
+
fancier like Rspec. To run them you probably only need to install `haml`, and
|
34
|
+
possibly `ruby` if your platform doesn't come with it by default. If you're
|
35
|
+
using Ruby 1.8.x, you'll also need to install `json`:
|
36
|
+
|
37
|
+
sudo gem install haml
|
38
|
+
# for Ruby 1.8.x; check using "ruby --version" if unsure
|
39
|
+
sudo gem install json
|
40
|
+
|
41
|
+
Then, running the Ruby test suite is easy:
|
42
|
+
|
43
|
+
ruby ruby_haml_test.rb
|
44
|
+
|
45
|
+
### Lua ###
|
46
|
+
|
47
|
+
The Lua test depends on [Telescope](http://telescope.luaforge.net/),
|
48
|
+
[jason4lua](http://json.luaforge.net/), and
|
49
|
+
[Lua Haml](http://github.com/norman/lua-haml). Install and
|
50
|
+
run `tsc lua_haml_spec.lua`.
|
51
|
+
|
52
|
+
## Contributing ##
|
53
|
+
|
54
|
+
### Getting it ###
|
55
|
+
|
56
|
+
You can access the [Git repository](http://github.com/norman/haml-spec) at:
|
57
|
+
|
58
|
+
git://github.com/norman/haml-spec.git
|
59
|
+
|
60
|
+
Patches are *very* welcome, as are test runners for your Haml implementation.
|
61
|
+
|
62
|
+
As long as any test you add run against Ruby Haml and are not redundant, I'll
|
63
|
+
be very happy to add them.
|
64
|
+
|
65
|
+
### Test JSON format ###
|
66
|
+
|
67
|
+
"test name" : {
|
68
|
+
"haml" : "haml input",
|
69
|
+
"html" : "expected html output",
|
70
|
+
"result" : "expected test result",
|
71
|
+
"locals" : "local vars",
|
72
|
+
"config" : "config params"
|
73
|
+
}
|
74
|
+
|
75
|
+
* test name: This should be a *very* brief description of what's being tested. It can
|
76
|
+
be used by the test runners to name test methods, or to exclude certain tests from being
|
77
|
+
run.
|
78
|
+
* haml: The Haml code to be evaluated. Always required.
|
79
|
+
* html: The HTML output that should be generated. Required unless "result" is "error".
|
80
|
+
* result: Can be "pass" or "error". If it's absent, then "pass" is assumed. If it's "error",
|
81
|
+
then the goal of the test is to make sure that malformed Haml code generates an error.
|
82
|
+
* locals: An object containing local variables needed for the test.
|
83
|
+
* config: An object containing configuration parameters used to run the test.
|
84
|
+
The configuration parameters should be usable directly by Ruby's Haml with no
|
85
|
+
modification. If your implementation uses config parameters with different
|
86
|
+
names, you may need to process them to make them match your implementation.
|
87
|
+
If your implementation has options that do not exist in Ruby's Haml, then you
|
88
|
+
should add tests for this in your implementation's test rather than here.
|
89
|
+
|
90
|
+
## License ##
|
91
|
+
|
92
|
+
This project is released under the [WTFPL](http://sam.zoy.org/wtfpl/) in order
|
93
|
+
to be as usable as possible in any project, commercial or free.
|
94
|
+
|
95
|
+
## Author ##
|
96
|
+
|
97
|
+
[Norman Clarke](mailto:norman@njclarke.com)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'luarocks.require'
|
2
|
+
require 'json'
|
3
|
+
require 'telescope'
|
4
|
+
require 'haml'
|
5
|
+
|
6
|
+
local function get_tests(filename)
|
7
|
+
local self = debug.getinfo(1).short_src
|
8
|
+
if self:match("/") then return "./" .. self:gsub("[^/]*%.lua$", "/" .. filename)
|
9
|
+
elseif self:match("\\") then return self:gsub("[^\\]*%.lua$", "\\" .. filename)
|
10
|
+
else return filename
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
local fh = assert(io.open(get_tests("tests.json")))
|
15
|
+
local input = fh:read '*a'
|
16
|
+
fh:close()
|
17
|
+
|
18
|
+
local contexts = json.decode(input)
|
19
|
+
|
20
|
+
describe("LuaHaml", function()
|
21
|
+
for context, expectations in pairs(contexts) do
|
22
|
+
describe("When handling " .. context, function()
|
23
|
+
for name, exp in pairs(expectations) do
|
24
|
+
it(string.format("should correctly render %s", name), function()
|
25
|
+
assert_equal(haml.render(exp.haml, exp.config or {}, exp.locals or {}), exp.html)
|
26
|
+
end)
|
27
|
+
end
|
28
|
+
end)
|
29
|
+
end
|
30
|
+
end)
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "test/unit"
|
2
|
+
require "json"
|
3
|
+
require "haml"
|
4
|
+
|
5
|
+
class HamlTest < Test::Unit::TestCase
|
6
|
+
contexts = JSON.parse(File.read(File.dirname(__FILE__) + "/tests.json"))
|
7
|
+
contexts.each do |context|
|
8
|
+
context[1].each do |name, test|
|
9
|
+
class_eval(<<-EOTEST)
|
10
|
+
def test_#{name.gsub(/\s+|[^a-zA-Z0-9_]/, "_")}
|
11
|
+
locals = Hash[*(#{test}["locals"] || {}).collect {|k, v| [k.to_sym, v] }.flatten]
|
12
|
+
options = Hash[*(#{test}["config"] || {}).collect {|k, v| [k.to_sym, v.to_sym] }.flatten]
|
13
|
+
engine = Haml::Engine.new(#{test}["haml"], options)
|
14
|
+
assert_equal(engine.render(Object.new, locals).chomp, #{test}["html"])
|
15
|
+
end
|
16
|
+
EOTEST
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|