tipsy 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -73,15 +73,14 @@ module Tipsy
73
73
  compass_config = ::Compass::Configuration::Data.new("project")
74
74
  compass_config.project_type = :stand_alone
75
75
  compass_config.project_path = Tipsy.root
76
- compass_config.images_dir = File.join('assets', 'images')
77
- compass_config.sass_dir = File.join('assets', 'stylesheets')
78
- compass_config.http_images_path = "/#{File.basename(Tipsy::Site.images_path)}"
79
- compass_config.relative_assets = false
80
- compass_config.line_comments = false
76
+
77
+ Tipsy::Site.compass.keys.each do |setting|
78
+ compass_config.send("#{setting.to_s}=", Tipsy::Site.compass[setting])
79
+ end
81
80
 
82
81
  Compass.add_project_configuration(compass_config)
83
82
  ::Sass::Plugin.engine_options.merge!(Compass.sass_engine_options)
84
-
83
+
85
84
  rescue LoadError
86
85
  require 'tipsy/helpers/sass'
87
86
  end
@@ -1,6 +1,7 @@
1
1
  module Tipsy
2
2
  module Helpers
3
3
  module Rendering
4
+ include Tipsy::Helpers::Capture
4
5
 
5
6
  def render(options = {})
6
7
  options.symbolize_keys!
@@ -26,8 +27,8 @@ module Tipsy
26
27
 
27
28
  unless render_path.nil?
28
29
  local_vars = options.delete(:locals) || {}
29
- results = Tilt[render_path].new(render_path, nil)
30
- return results.render(self, local_vars)
30
+ results = Tilt[render_path].new(render_path, nil, :outvar => "_inline_template")
31
+ return capture{ results.render(self, local_vars).to_s }
31
32
  end
32
33
 
33
34
  raise "Missing #{ partial ? 'partial' : 'template' } #{to_render}."
@@ -8,8 +8,8 @@ module Tipsy
8
8
  end
9
9
 
10
10
  def content_tag(name, content = nil, html_attrs = {}, &capt)
11
- buffer = "<#{name}#{make_attributes(html_attrs)}>"
12
- content = capture(&capt) if block_given?
11
+ buffer = "<#{name}#{make_attributes(html_attrs)}>"
12
+ content = capture(&capt) if block_given? and content.nil?
13
13
  "<#{name}#{make_attributes(html_attrs)}>#{content}</#{name}>"
14
14
  end
15
15
 
data/lib/tipsy/runner.rb CHANGED
@@ -25,7 +25,7 @@ module Tipsy
25
25
  require 'tipsy/server'
26
26
  require 'tipsy/view'
27
27
  require 'rack'
28
-
28
+
29
29
  app = Rack::Builder.new {
30
30
  use Rack::Reloader
31
31
  use Rack::ShowStatus
data/lib/tipsy/site.rb CHANGED
@@ -5,7 +5,7 @@ module Tipsy
5
5
  class Site
6
6
  include ActiveSupport::Configurable
7
7
  config_accessor :asset_path, :compile_to, :css_path, :javascripts_path, :images_path, :fonts_path,
8
- :public_path, :load_paths, :compile_to, :compile
8
+ :public_path, :load_paths, :compile_to, :compile, :compass
9
9
  ##
10
10
  # Site configuration options
11
11
  #
@@ -46,13 +46,26 @@ module Tipsy
46
46
  config.compile.enable_rewrite = true
47
47
  config.compile.rewrite_mode = :htaccess
48
48
 
49
+ config.compass = ::ActiveSupport::OrderedOptions.new
50
+ config.compass.images_path = File.join('assets', 'images')
51
+ config.compass.sass_dir = File.join('assets', 'stylesheets')
52
+ config.compass.http_images_path = "/#{File.basename(config.images_path)}"
53
+ config.compass.relative_assets = false
54
+ config.compass.line_comments = false
55
+
56
+
49
57
  def self.configure!
50
58
  @_callbacks = { :before => [], :after => [] }
51
59
  local_config = File.join(Tipsy.root, 'config.rb')
52
60
  if File.exists?(local_config)
53
- class_eval(File.open(local_config).readlines.join("\n"))
61
+ bind = binding
62
+ self.class_exec do
63
+ File.open(local_config).each do |line|
64
+ next if line.to_s[0] == "#" || line.to_s.strip.blank?
65
+ eval("config."+ line.to_s, bind, local_config)
66
+ end
67
+ end
54
68
  end
55
-
56
69
  end
57
70
 
58
71
  ##
@@ -79,8 +92,7 @@ module Tipsy
79
92
  end
80
93
 
81
94
 
82
- def initialize
83
- @_callbacks = {}
95
+ def initialize
84
96
  end
85
97
 
86
98
  end
data/lib/tipsy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tipsy
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -4,8 +4,7 @@ module Tipsy
4
4
  # All views are rendered within a context object. This object handles
5
5
  # transitioning data between templates and layouts.
6
6
  #
7
- class Context
8
- include Tipsy::Helpers
7
+ class Context
9
8
  attr_reader :request, :template, :layout, :virtual_path, :lookup_context
10
9
 
11
10
  def initialize(request, template, path, lookup)
@@ -15,6 +14,9 @@ module Tipsy
15
14
  @virtual_path = path
16
15
  @lookup_context = lookup
17
16
  @output_buffer = nil
17
+ self.class_eval do
18
+ include Tipsy::Helpers
19
+ end
18
20
  end
19
21
 
20
22
  def layout(set = nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tipsy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-05 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
16
- requirement: &70121952819080 !ruby/object:Gem::Requirement
16
+ requirement: &70264932961280 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.3'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70121952819080
24
+ version_requirements: *70264932961280
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rack-test
27
- requirement: &70121952807700 !ruby/object:Gem::Requirement
27
+ requirement: &70264932960720 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0.6'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70121952807700
35
+ version_requirements: *70264932960720
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: tilt
38
- requirement: &70121952807120 !ruby/object:Gem::Requirement
38
+ requirement: &70264932949400 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '1.3'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70121952807120
46
+ version_requirements: *70264932949400
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: i18n
49
- requirement: &70121952806540 !ruby/object:Gem::Requirement
49
+ requirement: &70264932948880 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0.6'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70121952806540
57
+ version_requirements: *70264932948880
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: sass
60
- requirement: &70121952806020 !ruby/object:Gem::Requirement
60
+ requirement: &70264932948300 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '3.1'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70121952806020
68
+ version_requirements: *70264932948300
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: activesupport
71
- requirement: &70121952805500 !ruby/object:Gem::Requirement
71
+ requirement: &70264932947720 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '3.1'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70121952805500
79
+ version_requirements: *70264932947720
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: sprockets
82
- requirement: &70121952804900 !ruby/object:Gem::Requirement
82
+ requirement: &70264932947120 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '2.0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70121952804900
90
+ version_requirements: *70264932947120
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: hike
93
- requirement: &70121952804320 !ruby/object:Gem::Requirement
93
+ requirement: &70264932946540 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '1.2'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70121952804320
101
+ version_requirements: *70264932946540
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: erubis
104
- requirement: &70121952803760 !ruby/object:Gem::Requirement
104
+ requirement: &70264932945980 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '2.7'
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *70121952803760
112
+ version_requirements: *70264932945980
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: minitest
115
- requirement: &70121952803200 !ruby/object:Gem::Requirement
115
+ requirement: &70264932945420 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ~>
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: '2.5'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70121952803200
123
+ version_requirements: *70264932945420
124
124
  description: Tipsy is a mini Rack application for working with static websites using
125
125
  Tilt, and Sprockets.
126
126
  email: