ice 0.4.4 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +49 -20
- data/js/coffee-script.js +469 -0
- data/js/coffeekup.js +217 -0
- data/js/lib/coffeekup-path-helper.coffee +23 -0
- data/js/lib/coffeekup-path-helper.js +37 -0
- data/js/lib/{path-helper.coffee → eco-path-helper.coffee} +0 -0
- data/js/lib/{path-helper.js → eco-path-helper.js} +0 -0
- data/lib/ice.rb +6 -3
- data/lib/ice/{eco_template/generated_helpers.rb → generated_helpers.rb} +1 -3
- data/lib/ice/handlers/base.rb +39 -0
- data/lib/ice/handlers/coffeekup/handler.rb +34 -0
- data/lib/ice/handlers/eco/handler.rb +32 -0
- metadata +12 -7
- data/lib/ice/eco_template/base.rb +0 -28
- data/lib/ice/eco_template/handler.rb +0 -30
@@ -1,28 +0,0 @@
|
|
1
|
-
require "ice/eco_template/generated_helpers"
|
2
|
-
require 'eco'
|
3
|
-
require 'v8'
|
4
|
-
|
5
|
-
module Ice
|
6
|
-
module EcoTemplate
|
7
|
-
|
8
|
-
def self.convert_template(template_text, vars = {})
|
9
|
-
V8::C::Locker() do
|
10
|
-
context = V8::Context.new
|
11
|
-
context.eval(open "#{File.dirname(__FILE__)}/../../../js/lib/path-helper.js")
|
12
|
-
|
13
|
-
IceJavascriptHelpers.each do |helper|
|
14
|
-
context.eval(helper)
|
15
|
-
end
|
16
|
-
IceCoffeescriptHelpers.each do |helper|
|
17
|
-
context.eval CoffeeScript.compile(helper, :bare => true)
|
18
|
-
end
|
19
|
-
|
20
|
-
context.eval CoffeeScript.compile(GeneratedHelpers.get_routes, :bare => true)
|
21
|
-
context.eval(Eco::Source.combined_contents)
|
22
|
-
template = context["eco"]["compile"].call(template_text)
|
23
|
-
|
24
|
-
template.call(vars.to_ice)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require "ice/eco_template/base"
|
2
|
-
|
3
|
-
module Ice
|
4
|
-
module EcoTemplate
|
5
|
-
class Handler < ActionView::Template::Handler
|
6
|
-
def self.call(template)
|
7
|
-
<<-ECO
|
8
|
-
|
9
|
-
template_source = <<-ECO_TEMPLATE
|
10
|
-
#{template.source}
|
11
|
-
ECO_TEMPLATE
|
12
|
-
|
13
|
-
variable_names = controller.instance_variable_names
|
14
|
-
variable_names -= %w[@template]
|
15
|
-
if controller.respond_to?(:protected_instance_variables)
|
16
|
-
variable_names -= controller.protected_instance_variables
|
17
|
-
end
|
18
|
-
|
19
|
-
variables = {}
|
20
|
-
variable_names.each do |name|
|
21
|
-
variables[name.sub(/^@/, "")] = controller.instance_variable_get(name)
|
22
|
-
end
|
23
|
-
|
24
|
-
Ice::EcoTemplate.convert_template(template_source, variables.merge(local_assigns))
|
25
|
-
|
26
|
-
ECO
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|