Capcode 0.8.6 → 0.8.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +72 -1
- data/doc/rdoc/classes/Capcode.html +549 -444
- data/doc/rdoc/classes/Capcode/Helpers.html +293 -133
- data/doc/rdoc/classes/Capcode/Helpers/Authorization.html +60 -29
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README_rdoc.html +94 -8
- data/doc/rdoc/files/lib/capcode/configuration_rb.html +101 -0
- data/doc/rdoc/files/lib/capcode/helpers/auth_rb.html +1 -32
- data/doc/rdoc/files/lib/capcode/render/erb_rb.html +1 -1
- data/doc/rdoc/files/lib/capcode/render/haml_rb.html +1 -1
- data/doc/rdoc/files/lib/capcode/render/markaby_rb.html +1 -1
- data/doc/rdoc/files/lib/capcode/render/sass_rb.html +1 -1
- data/doc/rdoc/files/lib/capcode/render/text_rb.html +1 -1
- data/doc/rdoc/files/lib/capcode_rb.html +8 -1
- data/doc/rdoc/fr_file_index.html +1 -0
- data/doc/rdoc/fr_method_index.html +19 -11
- data/examples/blog-couchdb.rb +4 -3
- data/examples/erb/cf.rhtml +1 -0
- data/examples/haml/cf.haml +4 -1
- data/examples/render-erb.rb +4 -1
- data/examples/render-haml_sass.rb +6 -2
- data/examples/render-image.rb +70 -0
- data/examples/render-static.rb +4 -1
- data/examples/render-static.ru +0 -2
- data/examples/render-use.rb +31 -0
- data/examples/static/coderay.css +131 -0
- data/examples/static/index.html +19 -0
- data/lib/capcode.rb +125 -76
- data/lib/capcode/configuration.rb +39 -0
- data/lib/capcode/helpers/auth.rb +22 -23
- data/lib/capcode/render/erb.rb +25 -18
- data/lib/capcode/render/haml.rb +28 -19
- data/lib/capcode/render/markaby.rb +2 -1
- data/lib/capcode/render/sass.rb +19 -13
- data/lib/capcode/render/text.rb +1 -1
- data/lib/capcode/version.rb +1 -1
- metadata +8 -2
data/lib/capcode/render/haml.rb
CHANGED
@@ -2,15 +2,16 @@ require "haml"
|
|
2
2
|
|
3
3
|
module Capcode
|
4
4
|
module Helpers
|
5
|
-
@@__HAML_PATH__ = nil
|
6
5
|
# Set the path to Haml files. If this path is not set, Capcode will search in the static path.
|
7
|
-
|
8
|
-
|
6
|
+
# This method is deprecated and will be removed in version 1.0
|
7
|
+
def self.haml_path=( p )
|
8
|
+
warn "Capcode::Helpers.haml_path is deprecated and will be removed in version 1.0, please use `set :haml'"
|
9
|
+
Capcode.set :haml, p
|
9
10
|
end
|
10
11
|
|
11
12
|
def render_haml( f, opts ) #:nodoc:
|
12
|
-
if
|
13
|
-
|
13
|
+
if @haml_path.nil?
|
14
|
+
@haml_path = Capcode.get( :haml ) || Capcode.static()
|
14
15
|
end
|
15
16
|
|
16
17
|
f = f.to_s
|
@@ -19,28 +20,36 @@ module Capcode
|
|
19
20
|
end
|
20
21
|
|
21
22
|
if /Windows/.match( ENV['OS'] )
|
22
|
-
unless( /.:\\/.match(
|
23
|
-
|
23
|
+
unless( /.:\\/.match( @haml_path[0] ) )
|
24
|
+
@haml_path = File.expand_path( File.join(".", @haml_path) )
|
24
25
|
end
|
25
26
|
else
|
26
|
-
unless(
|
27
|
-
|
27
|
+
unless( @haml_path[0].chr == "/" )
|
28
|
+
@haml_path = File.expand_path( File.join(".", @haml_path) )
|
28
29
|
end
|
29
30
|
end
|
30
|
-
|
31
|
+
|
32
|
+
# Get Layout file
|
31
33
|
layout = opts.delete(:layout)||:layout
|
32
|
-
layout_file = File.join(
|
34
|
+
layout_file = File.join( @haml_path, layout.to_s+".haml" )
|
33
35
|
|
36
|
+
# Get HAML File
|
34
37
|
f = f + ".haml" if File.extname( f ) != ".haml"
|
35
|
-
file = File.join(
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
Haml::Engine.new( open(
|
41
|
-
|
38
|
+
file = File.join( @haml_path, f )
|
39
|
+
|
40
|
+
# Render
|
41
|
+
if( File.exist?( file ) )
|
42
|
+
if( File.exist?( layout_file ) )
|
43
|
+
Haml::Engine.new( open( layout_file ).read ).to_html(self) { |*args|
|
44
|
+
#@@__ARGS__ = args
|
45
|
+
Capcode::Helpers.args = args
|
46
|
+
Haml::Engine.new( open( file ).read ).render(self)
|
47
|
+
}
|
48
|
+
else
|
49
|
+
Haml::Engine.new( open( file ).read ).to_html( self )
|
50
|
+
end
|
42
51
|
else
|
43
|
-
|
52
|
+
raise Capcode::RenderError, "Error rendering `haml', #{file} does not exist !"
|
44
53
|
end
|
45
54
|
end
|
46
55
|
end
|
data/lib/capcode/render/sass.rb
CHANGED
@@ -2,16 +2,16 @@ require "sass"
|
|
2
2
|
|
3
3
|
module Capcode
|
4
4
|
module Helpers
|
5
|
-
@@__SASS_PATH__ = "."
|
6
|
-
|
7
5
|
# Set the path to Sass files. If this path is not set, Capcode will search in the static path.
|
8
|
-
|
9
|
-
|
6
|
+
# This method is deprecated and will be removed in version 1.0
|
7
|
+
def self.sass_path=( p )
|
8
|
+
warn "Capcode::Helpers.sass_path is deprecated and will be removed in version 1.0, please use `set :sass'"
|
9
|
+
Capcode.set :sass, p
|
10
10
|
end
|
11
11
|
|
12
12
|
def render_sass( f, _ ) #:nodoc:
|
13
|
-
if
|
14
|
-
|
13
|
+
if @sass_path.nil?
|
14
|
+
@sass_path = Capcode.get( :sass ) || Capcode.static()
|
15
15
|
end
|
16
16
|
|
17
17
|
f = f.to_s
|
@@ -20,19 +20,25 @@ module Capcode
|
|
20
20
|
end
|
21
21
|
|
22
22
|
if /Windows/.match( ENV['OS'] )
|
23
|
-
unless( /.:\\/.match(
|
24
|
-
|
23
|
+
unless( /.:\\/.match( @sass_path[0] ) )
|
24
|
+
@sass_path = File.expand_path( File.join(".", @sass_path) )
|
25
25
|
end
|
26
26
|
else
|
27
|
-
unless(
|
28
|
-
|
27
|
+
unless( @sass_path[0].chr == "/" )
|
28
|
+
@sass_path = File.expand_path( File.join(".", @sass_path) )
|
29
29
|
end
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
|
+
# Get File
|
32
33
|
f = f + ".sass" if File.extname( f ) != ".sass"
|
33
|
-
file = File.join(
|
34
|
+
file = File.join( @sass_path, f )
|
34
35
|
|
35
|
-
|
36
|
+
# Render
|
37
|
+
if( File.exist?( file ) )
|
38
|
+
Sass::Engine.new( open( file ).read ).to_css
|
39
|
+
else
|
40
|
+
raise Capcode::RenderError, "Error rendering `sass', #{file} does not exist !"
|
41
|
+
end
|
36
42
|
end
|
37
43
|
end
|
38
44
|
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.8.
|
4
|
+
version: 0.8.7
|
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-10-
|
12
|
+
date: 2009-10-21 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -43,6 +43,7 @@ extra_rdoc_files:
|
|
43
43
|
- AUTHORS
|
44
44
|
- COPYING
|
45
45
|
- lib/capcode.rb
|
46
|
+
- lib/capcode/configuration.rb
|
46
47
|
- lib/capcode/base/db.rb
|
47
48
|
- lib/capcode/render/erb.rb
|
48
49
|
- lib/capcode/render/haml.rb
|
@@ -70,6 +71,7 @@ files:
|
|
70
71
|
- doc/rdoc/files/AUTHORS.html
|
71
72
|
- doc/rdoc/files/COPYING.html
|
72
73
|
- doc/rdoc/files/lib/capcode/base/db_rb.html
|
74
|
+
- doc/rdoc/files/lib/capcode/configuration_rb.html
|
73
75
|
- doc/rdoc/files/lib/capcode/helpers/auth_rb.html
|
74
76
|
- doc/rdoc/files/lib/capcode/render/erb_rb.html
|
75
77
|
- doc/rdoc/files/lib/capcode/render/haml_rb.html
|
@@ -90,6 +92,7 @@ files:
|
|
90
92
|
- lib/capcode/base/couchdb.rb
|
91
93
|
- lib/capcode/base/db.rb
|
92
94
|
- lib/capcode/base/dm.rb
|
95
|
+
- lib/capcode/configuration.rb
|
93
96
|
- lib/capcode/core_ext.rb
|
94
97
|
- lib/capcode/helpers/auth.rb
|
95
98
|
- lib/capcode/render/erb.rb
|
@@ -124,11 +127,13 @@ files:
|
|
124
127
|
- examples/my_blog.db
|
125
128
|
- examples/render-erb.rb
|
126
129
|
- examples/render-haml_sass.rb
|
130
|
+
- examples/render-image.rb
|
127
131
|
- examples/render-json.rb
|
128
132
|
- examples/render-markaby.rb
|
129
133
|
- examples/render-static.rb
|
130
134
|
- examples/render-static.ru
|
131
135
|
- examples/render-text.rb
|
136
|
+
- examples/render-use.rb
|
132
137
|
- examples/render-webdav.rb
|
133
138
|
- examples/render-xml.rb
|
134
139
|
- examples/rest-run.rb
|
@@ -137,6 +142,7 @@ files:
|
|
137
142
|
- examples/rss.rb
|
138
143
|
- examples/sample.rb
|
139
144
|
- examples/session.rb
|
145
|
+
- examples/static/coderay.css
|
140
146
|
- examples/static/index.html
|
141
147
|
- examples/test/index.html
|
142
148
|
- examples/upload.rb
|