Capcode 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +10 -0
- data/doc/rdoc/classes/Capcode.html +322 -296
- data/doc/rdoc/classes/Capcode/Helpers.html +59 -59
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README.html +28 -1
- data/doc/rdoc/files/lib/capcode_rb.html +2 -1
- data/examples/sample.rb +3 -3
- data/examples/{index.html → static/index.html} +0 -0
- data/lib/capcode.rb +60 -75
- data/lib/capcode/render/erb.rb +2 -2
- data/lib/capcode/render/haml.rb +3 -3
- data/lib/capcode/render/sass.rb +32 -0
- data/lib/capcode/render/static.rb +8 -0
- data/lib/capcode/render/text.rb +1 -1
- data/lib/capcode/version.rb +1 -1
- metadata +5 -3
data/lib/capcode/render/erb.rb
CHANGED
@@ -19,11 +19,11 @@ module Capcode
|
|
19
19
|
|
20
20
|
if /Windows/.match( ENV['OS'] )
|
21
21
|
unless( /.:\\/.match( @@__ERB_PATH__[0] ) )
|
22
|
-
@@__ERB_PATH__ = File.expand_path( File.join(
|
22
|
+
@@__ERB_PATH__ = File.expand_path( File.join(".", @@__ERB_PATH__) )
|
23
23
|
end
|
24
24
|
else
|
25
25
|
unless( @@__ERB_PATH__[0].chr == "/" )
|
26
|
-
@@__ERB_PATH__ = File.expand_path( File.join(
|
26
|
+
@@__ERB_PATH__ = File.expand_path( File.join(".", @@__ERB_PATH__) )
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
data/lib/capcode/render/haml.rb
CHANGED
@@ -14,12 +14,12 @@ module Capcode
|
|
14
14
|
end
|
15
15
|
|
16
16
|
if /Windows/.match( ENV['OS'] )
|
17
|
-
unless( /.:\\/.match( @@
|
18
|
-
@@__HAML_PATH__ = File.expand_path( File.join(
|
17
|
+
unless( /.:\\/.match( @@__HAML_PATH__[0] ) )
|
18
|
+
@@__HAML_PATH__ = File.expand_path( File.join(".", @@__HAML_PATH__) )
|
19
19
|
end
|
20
20
|
else
|
21
21
|
unless( @@__HAML_PATH__[0].chr == "/" )
|
22
|
-
@@__HAML_PATH__ = File.expand_path( File.join(
|
22
|
+
@@__HAML_PATH__ = File.expand_path( File.join(".", @@__HAML_PATH__) )
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "sass"
|
2
|
+
|
3
|
+
module Capcode
|
4
|
+
module Helpers
|
5
|
+
@@__SASS_PATH__ = "."
|
6
|
+
def self.sass_path=( p )
|
7
|
+
@@__SASS_PATH__ = p
|
8
|
+
end
|
9
|
+
|
10
|
+
def render_sass( f, _ ) #:nodoc:
|
11
|
+
f = f.to_s
|
12
|
+
if f.include? '..'
|
13
|
+
return [403, {}, '403 - Invalid path']
|
14
|
+
end
|
15
|
+
|
16
|
+
if /Windows/.match( ENV['OS'] )
|
17
|
+
unless( /.:\\/.match( @@__SASS_PATH__[0] ) )
|
18
|
+
@@__SASS_PATH__ = File.expand_path( File.join(".", @@__SASS_PATH__) )
|
19
|
+
end
|
20
|
+
else
|
21
|
+
unless( @@__SASS_PATH__[0].chr == "/" )
|
22
|
+
@@__SASS_PATH__ = File.expand_path( File.join(".", @@__SASS_PATH__) )
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
f = f + ".sass" if File.extname( f ) != ".sass"
|
27
|
+
file = File.join( @@__SASS_PATH__, f )
|
28
|
+
|
29
|
+
Sass::Engine.new( open( file ).read ).to_css
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/capcode/render/text.rb
CHANGED
data/lib/capcode/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Capcode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Gr\xC3\xA9goire Lejeune"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-07-
|
12
|
+
date: 2009-07-08 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -104,6 +104,8 @@ files:
|
|
104
104
|
- lib/capcode/render/haml.rb
|
105
105
|
- lib/capcode/render/json.rb
|
106
106
|
- lib/capcode/render/markaby.rb
|
107
|
+
- lib/capcode/render/sass.rb
|
108
|
+
- lib/capcode/render/static.rb
|
107
109
|
- lib/capcode/render/text.rb
|
108
110
|
- lib/capcode/version.rb
|
109
111
|
- lib/capcode.rb
|
@@ -119,10 +121,10 @@ files:
|
|
119
121
|
- examples/haml/cf_layout.haml
|
120
122
|
- examples/haml/layout.haml
|
121
123
|
- examples/haml/m_hello.haml
|
122
|
-
- examples/index.html
|
123
124
|
- examples/my_blog.db
|
124
125
|
- examples/sample.rb
|
125
126
|
- examples/session.rb
|
127
|
+
- examples/static/index.html
|
126
128
|
- examples/test/index.html
|
127
129
|
has_rdoc: true
|
128
130
|
homepage: http://algorithmique.net
|