tipsy 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/templates/site/compiled/.gitkeep +0 -0
- data/lib/templates/site/layouts/default.html.erb +3 -0
- data/lib/tipsy.rb +15 -12
- data/lib/tipsy/compressors/css_compressor.rb +1 -1
- data/lib/tipsy/helpers/rendering.rb +13 -3
- data/lib/tipsy/runner.rb +4 -2
- data/lib/tipsy/runners/compiler.rb +3 -0
- data/lib/tipsy/site.rb +5 -1
- data/lib/tipsy/version.rb +1 -1
- data/lib/tipsy/view.rb +1 -0
- data/lib/tipsy/view/base.rb +13 -3
- metadata +24 -23
File without changes
|
@@ -22,6 +22,9 @@
|
|
22
22
|
<meta property="og:description" content="" />
|
23
23
|
<meta property="og:image" content="" />
|
24
24
|
<%= stylesheet_link_tag 'screen' %>
|
25
|
+
<!--[if lt IE 9]>
|
26
|
+
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
27
|
+
<![endif]-->
|
25
28
|
</head>
|
26
29
|
<body id="<%= page_id %>">
|
27
30
|
<div id="wrapper">
|
data/lib/tipsy.rb
CHANGED
@@ -2,6 +2,7 @@ require "active_support/all"
|
|
2
2
|
require "tipsy/version"
|
3
3
|
|
4
4
|
module Tipsy
|
5
|
+
extend self
|
5
6
|
|
6
7
|
module Handler
|
7
8
|
autoload :AssetHandler, 'tipsy/handler/asset'
|
@@ -29,19 +30,21 @@ module Tipsy
|
|
29
30
|
autoload :CssCompressor, 'tipsy/compressors/css_compressor'
|
30
31
|
end
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
@env ||= ENV['TIPSY_ENV'] || 'development'
|
35
|
-
end
|
36
|
-
|
37
|
-
def root
|
38
|
-
@root ||= ENV['TIPSY_ROOT']
|
39
|
-
end
|
40
|
-
|
41
|
-
def logger
|
42
|
-
@logger ||= Tipsy::Utils::Logger.new($stdout)
|
43
|
-
end
|
33
|
+
def compiling?
|
34
|
+
Tipsy.env == "compile"
|
44
35
|
end
|
36
|
+
|
37
|
+
def env
|
38
|
+
@env ||= ENV['TIPSY_ENV'] || 'development'
|
39
|
+
end
|
40
|
+
|
41
|
+
def root
|
42
|
+
@root ||= ENV['TIPSY_ROOT']
|
43
|
+
end
|
44
|
+
|
45
|
+
def logger
|
46
|
+
@logger ||= Tipsy::Utils::Logger.new($stdout)
|
47
|
+
end
|
45
48
|
|
46
49
|
end
|
47
50
|
|
@@ -4,7 +4,7 @@ module Tipsy
|
|
4
4
|
module Compressors
|
5
5
|
class CssCompressor
|
6
6
|
def compress(css)
|
7
|
-
css_style = Tipsy::Site.config.compile.compress_css ? :compressed : :
|
7
|
+
css_style = Tipsy::Site.config.compile.compress_css ? :compressed : :compact
|
8
8
|
Sass::Engine.new(css, :syntax => :scss, :cache => false, :read_cache => false, :line_comments => false, :style => css_style).render
|
9
9
|
end
|
10
10
|
end
|
@@ -3,16 +3,26 @@ module Tipsy
|
|
3
3
|
module Rendering
|
4
4
|
include Tipsy::Helpers::Capture
|
5
5
|
|
6
|
+
def public_path
|
7
|
+
Tipsy::Site.config.public_path
|
8
|
+
end
|
9
|
+
|
6
10
|
def render(options = {})
|
7
11
|
options.symbolize_keys!
|
8
|
-
assert_valid_keys!(options, :template, :partial, :collection, :locals)
|
12
|
+
assert_valid_keys!(options, :ssi, :template, :partial, :collection, :locals)
|
9
13
|
|
10
14
|
if template = options.delete(:template)
|
11
15
|
render_inline_template(template, options)
|
12
16
|
elsif template = options.delete(:partial)
|
13
17
|
render_inline_template(template, options, true)
|
18
|
+
elsif template = options.delete(:ssi)
|
19
|
+
if Tipsy.compiling?
|
20
|
+
ssi_path = Pathname.new(template).absolute? ? template : "/#{template}"
|
21
|
+
return "<!--#include virtual=\"#{ssi_path}\" -->"
|
22
|
+
end
|
23
|
+
render_inline_template(template, options)
|
14
24
|
else
|
15
|
-
raise 'Render requires a :template or :partial option.'
|
25
|
+
raise 'Render requires a :ssi, :template, or :partial option.'
|
16
26
|
end
|
17
27
|
end
|
18
28
|
|
@@ -24,7 +34,7 @@ module Tipsy
|
|
24
34
|
to_render = "_#{to_render}" if partial
|
25
35
|
render_path = Pathname.new(path)
|
26
36
|
render_path = render_path.absolute? ? render_path : lookup_context.locate_relative(render_path.dirname, to_render)
|
27
|
-
|
37
|
+
|
28
38
|
unless render_path.nil?
|
29
39
|
local_vars = options.delete(:locals) || {}
|
30
40
|
results = Tilt[render_path].new(render_path, nil, :outvar => "_inline_template")
|
data/lib/tipsy/runner.rb
CHANGED
@@ -31,7 +31,8 @@ module Tipsy
|
|
31
31
|
|
32
32
|
if conf.enable_php
|
33
33
|
begin
|
34
|
-
require 'rack-legacy'
|
34
|
+
require 'rack-legacy'
|
35
|
+
require 'tipsy/handler/php'
|
35
36
|
rescue LoadError
|
36
37
|
puts missing_legacy_message
|
37
38
|
end
|
@@ -42,7 +43,8 @@ module Tipsy
|
|
42
43
|
use Rack::ShowStatus
|
43
44
|
if conf.enable_php
|
44
45
|
begin
|
45
|
-
|
46
|
+
puts "PHP Enabled"
|
47
|
+
use Rack::Legacy::Php, conf.public_path
|
46
48
|
rescue
|
47
49
|
end
|
48
50
|
end
|
data/lib/tipsy/site.rb
CHANGED
@@ -34,6 +34,7 @@ module Tipsy
|
|
34
34
|
config.images_path = asset_path
|
35
35
|
config.fonts_path = "/fonts"
|
36
36
|
config.javascripts_path = asset_path
|
37
|
+
config.view_path = File.join(Tipsy.root, 'views')
|
37
38
|
config.css_path = asset_path
|
38
39
|
config.compile_to = File.join(Tipsy.root, 'compiled')
|
39
40
|
|
@@ -51,11 +52,14 @@ module Tipsy
|
|
51
52
|
config.compass = ::ActiveSupport::OrderedOptions.new
|
52
53
|
config.compass.images_path = File.join('assets', 'images')
|
53
54
|
config.compass.sass_dir = File.join('assets', 'stylesheets')
|
55
|
+
config.compass.images_dir = File.join('assets', 'images')
|
54
56
|
config.compass.http_images_path = "/#{File.basename(config.images_path)}"
|
55
57
|
config.compass.relative_assets = false
|
56
58
|
config.compass.line_comments = false
|
57
59
|
|
58
|
-
|
60
|
+
# enables php processing during development.
|
61
|
+
# at compile time, php code is left in-tact
|
62
|
+
config.enable_php = false
|
59
63
|
|
60
64
|
def self.configure!
|
61
65
|
@_callbacks = { :before => [], :after => [] }
|
data/lib/tipsy/version.rb
CHANGED
data/lib/tipsy/view.rb
CHANGED
data/lib/tipsy/view/base.rb
CHANGED
@@ -11,8 +11,8 @@ module Tipsy
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def render
|
14
|
-
|
15
|
-
@template
|
14
|
+
started = Time.now
|
15
|
+
@template = lookup_context.locate_template(current_path)
|
16
16
|
|
17
17
|
if template.nil?
|
18
18
|
return generate_response(nil)
|
@@ -23,7 +23,6 @@ module Tipsy
|
|
23
23
|
handler = Tilt[template]
|
24
24
|
tilt = handler.new(template, nil, :outvar => '@output_buffer')
|
25
25
|
result = tilt.render(view_context)
|
26
|
-
|
27
26
|
unless view_context.layout == false
|
28
27
|
layout = lookup_context.locate_layout(view_context.layout)
|
29
28
|
raise Tipsy::View::LayoutMissing.new("Missing layout '#{view_context.layout}'") and return if layout.nil?
|
@@ -31,6 +30,9 @@ module Tipsy
|
|
31
30
|
result = wrapped.render(view_context) do |*args|
|
32
31
|
result
|
33
32
|
end
|
33
|
+
#puts "Rendered #{local_path(template)} within #{local_path(layout)} (#{time_diff(started, Time.now)}ms)"
|
34
|
+
else
|
35
|
+
#puts "Rendered #{local_path(template)} (#{time_diff(started, Time.now)}ms)"
|
34
36
|
end
|
35
37
|
|
36
38
|
generate_response(result)
|
@@ -39,10 +41,18 @@ module Tipsy
|
|
39
41
|
|
40
42
|
private
|
41
43
|
|
44
|
+
def local_path(path)
|
45
|
+
path.to_s.sub(Tipsy.root, '').to_s.sub(/^\//, '')
|
46
|
+
end
|
47
|
+
|
42
48
|
def current_path
|
43
49
|
@_current_path ||= request.path_info.to_s.sub(/^\//, '')
|
44
50
|
end
|
45
51
|
|
52
|
+
def time_diff(start, finish)
|
53
|
+
((finish - start) * 1000).ceil
|
54
|
+
end
|
55
|
+
|
46
56
|
def generate_response(content)
|
47
57
|
response.status = ( content.nil? ? 404 : 200)
|
48
58
|
response.headers['content-type'] = "text/html"
|
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.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-04-21 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
16
|
-
requirement: &
|
16
|
+
requirement: &70279033501660 !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: *
|
24
|
+
version_requirements: *70279033501660
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rack-test
|
27
|
-
requirement: &
|
27
|
+
requirement: &70279033501160 !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: *
|
35
|
+
version_requirements: *70279033501160
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: tilt
|
38
|
-
requirement: &
|
38
|
+
requirement: &70279032833240 !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: *
|
46
|
+
version_requirements: *70279032833240
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: i18n
|
49
|
-
requirement: &
|
49
|
+
requirement: &70279033049920 !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: *
|
57
|
+
version_requirements: *70279033049920
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: sass
|
60
|
-
requirement: &
|
60
|
+
requirement: &70279033314340 !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: *
|
68
|
+
version_requirements: *70279033314340
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: activesupport
|
71
|
-
requirement: &
|
71
|
+
requirement: &70279033470780 !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: *
|
79
|
+
version_requirements: *70279033470780
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: sprockets
|
82
|
-
requirement: &
|
82
|
+
requirement: &70279033473000 !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: *
|
90
|
+
version_requirements: *70279033473000
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: hike
|
93
|
-
requirement: &
|
93
|
+
requirement: &70279033474900 !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: *
|
101
|
+
version_requirements: *70279033474900
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: erubis
|
104
|
-
requirement: &
|
104
|
+
requirement: &70279033491680 !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: *
|
112
|
+
version_requirements: *70279033491680
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: minitest
|
115
|
-
requirement: &
|
115
|
+
requirement: &70279033494720 !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: *
|
123
|
+
version_requirements: *70279033494720
|
124
124
|
description: Tipsy is a mini Rack application for working with static websites using
|
125
125
|
Tilt, and Sprockets.
|
126
126
|
email:
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- lib/templates/site/Gemfile
|
140
140
|
- lib/templates/site/assets/stylesheets/_config.css.scss
|
141
141
|
- lib/templates/site/assets/stylesheets/screen.css.scss
|
142
|
+
- lib/templates/site/compiled/.gitkeep
|
142
143
|
- lib/templates/site/config.rb
|
143
144
|
- lib/templates/site/deploy.yml
|
144
145
|
- lib/templates/site/helpers/site_helper.rb
|
@@ -218,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
219
|
version: '0'
|
219
220
|
requirements: []
|
220
221
|
rubyforge_project: tipsy
|
221
|
-
rubygems_version: 1.8.
|
222
|
+
rubygems_version: 1.8.17
|
222
223
|
signing_key:
|
223
224
|
specification_version: 3
|
224
225
|
summary: A mini Rack application server for developing static sites.
|