toto 0.4.6 → 0.4.7

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.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/toto.rb +7 -6
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.6
1
+ 0.4.7
@@ -97,11 +97,11 @@ module Toto
97
97
  self[:root]
98
98
  end
99
99
 
100
- def go route, type = :html
100
+ def go route, type = :html, env
101
101
  route << self./ if route.empty?
102
102
  type, path = type =~ /html|xml|json/ ? type.to_sym : :html, route.join('/')
103
103
  context = lambda do |data, page|
104
- Context.new(data, @config, path).render(page, type)
104
+ Context.new(data, @config, path, env).render(page, type)
105
105
  end
106
106
 
107
107
  body, status = if Context.new.respond_to?(:"to_#{type}")
@@ -147,9 +147,10 @@ module Toto
147
147
 
148
148
  class Context
149
149
  include Template
150
+ attr_reader :env
150
151
 
151
- def initialize ctx = {}, config = {}, path = "/"
152
- @config, @context, @path = config, ctx, path
152
+ def initialize ctx = {}, config = {}, path = "/", env = {}
153
+ @config, @context, @path, @env = config, ctx, path, env
153
154
  @articles = Site.articles(@config[:ext]).reverse.map do |a|
154
155
  Article.new(a, @config)
155
156
  end
@@ -183,7 +184,7 @@ module Toto
183
184
  class Repo < Hash
184
185
  include Template
185
186
 
186
- README = "http://github.com/%s/%s/raw/master/README.%s"
187
+ README = "https://github.com/%s/%s/raw/master/README.%s"
187
188
 
188
189
  def initialize name, config
189
190
  self[:name], @config = name, config
@@ -334,7 +335,7 @@ module Toto
334
335
  path, mime = @request.path_info.split('.')
335
336
  route = (path || '/').split('/').reject {|i| i.empty? }
336
337
 
337
- response = @site.go(route, *(mime ? mime : []))
338
+ response = @site.go(route, *(mime ? mime : []), env)
338
339
 
339
340
  @response.body = [response[:body]]
340
341
  @response['Content-Length'] = response[:body].length.to_s unless response[:body].empty?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - cloudhead
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-05-11 00:00:00 -04:00
12
+ date: 2010-11-11 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency