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.
@@ -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(@@__ROOT_DIRECTORY, @@__ERB_PATH__) )
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(@@__ROOT_DIRECTORY, @@__ERB_PATH__) )
26
+ @@__ERB_PATH__ = File.expand_path( File.join(".", @@__ERB_PATH__) )
27
27
  end
28
28
  end
29
29
 
@@ -14,12 +14,12 @@ module Capcode
14
14
  end
15
15
 
16
16
  if /Windows/.match( ENV['OS'] )
17
- unless( /.:\\/.match( @@__ERB_PATH__[0] ) )
18
- @@__HAML_PATH__ = File.expand_path( File.join(@@__ROOT_DIRECTORY, @@__HAML_PATH__) )
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(@@__ROOT_DIRECTORY, @@__HAML_PATH__) )
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
@@ -0,0 +1,8 @@
1
+ module Capcode
2
+ module Helpers
3
+ def render_static( f, _ )
4
+ puts ":static => #{f}"
5
+ redirect File.join( Capcode.static, f )
6
+ end
7
+ end
8
+ end
@@ -1,6 +1,6 @@
1
1
  module Capcode
2
2
  module Helpers
3
- def render_text( f )
3
+ def render_text( f, _ )
4
4
  f
5
5
  end
6
6
  end
@@ -1,3 +1,3 @@
1
1
  module Capcode
2
- CAPCOD_VERION="0.7.1"
2
+ CAPCOD_VERION="0.8.0"
3
3
  end
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.7.1
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-02 00:00:00 +02:00
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