middleman 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.6
1
+ 0.2.7
data/lib/middleman.rb CHANGED
@@ -23,8 +23,23 @@ class Middleman < Sinatra::Base
23
23
  helpers Sinatra::ContentFor
24
24
 
25
25
  helpers do
26
- def link_to(title, url="#")
27
- %Q{<a href="#{url}">#{title}</a>}
26
+ def link_to(title, url="#", params={})
27
+ params = params.map { |k,v| %Q{#{k}="#{v}"}}.join(' ')
28
+ %Q{<a href="#{url}" #{params}>#{title}</a>}
29
+ end
30
+
31
+ def page_classes(*additional)
32
+ classes = []
33
+ parts = @full_request_path.split('.')[0].split('/')
34
+ parts.each_with_index { |path, i| classes << parts.first(i+1).join('_') }
35
+
36
+ classes << "index" if classes.empty?
37
+ classes += additional unless additional.empty?
38
+ classes.join(' ')
39
+ end
40
+
41
+ def sprite(name)
42
+ image_tag("spacer.gif", :class => "#{name}-img")
28
43
  end
29
44
  end
30
45
 
@@ -55,7 +70,7 @@ class Middleman < Sinatra::Base
55
70
  config.project_path = Dir.pwd
56
71
  config.sass_dir = File.join(File.expand_path(self.views), "stylesheets")
57
72
  config.output_style = :nested
58
- config.images_dir = File.join(File.expand_path(self.public), "images")
73
+ config.images_dir = File.join(File.basename(self.public), "images")
59
74
  config.http_images_path = "/images/"
60
75
  end
61
76
  end
@@ -71,6 +86,7 @@ class Middleman < Sinatra::Base
71
86
  path << "index.html" if path.match(%r{/$})
72
87
  path.gsub!(%r{^/}, '')
73
88
  template = path.gsub(File.extname(path), '').to_sym
89
+ @full_request_path = path
74
90
 
75
91
  result = nil
76
92
 
@@ -13,5 +13,10 @@ configure :build do
13
13
 
14
14
  # Or use a different image path
15
15
  # config.http_images_path = "/Content/images/"
16
+
17
+ # Disable cache buster
18
+ # config.asset_cache_buster do
19
+ # false
20
+ # end
16
21
  end
17
22
  end
data/middleman.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{middleman}
5
- s.version = "0.2.6"
5
+ s.version = "0.2.7"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Thomas Reynolds"]
9
- s.date = %q{2009-07-29}
9
+ s.date = %q{2009-07-30}
10
10
  s.email = %q{tdreyno@gmail.com}
11
11
  s.executables = ["mm-init", "mm-build", "mm-server"]
12
12
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Reynolds
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-29 00:00:00 -07:00
12
+ date: 2009-07-30 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency