tipsy 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
File without changes
@@ -26,7 +26,18 @@ module Tipsy
26
26
  @data = d
27
27
  end
28
28
 
29
- def render
29
+ def render
30
+ file = Tempfile.new("tipsy_php_#{Time.now.to_i}")
31
+ result = ""
32
+ begin
33
+ file.write(@data)
34
+ file.rewind
35
+ result = `php #{file.path}`
36
+ ensure
37
+ file.close
38
+ file.unlink
39
+ end
40
+ result
30
41
  end
31
42
  end
32
43
 
data/lib/tipsy/runner.rb CHANGED
@@ -25,12 +25,16 @@ module Tipsy
25
25
  require 'tipsy/server'
26
26
  require 'tipsy/view'
27
27
  require 'rack'
28
-
28
+
29
+ conf = Tipsy::Site.config
30
+ require 'rack-legacy' if conf.enable_php
31
+
29
32
  app = Rack::Builder.new {
30
33
  use Rack::Reloader
31
34
  use Rack::ShowStatus
35
+ (use Rack::Legacy::Php, Tipsy::Site.config.public_path) if conf.enable_php
32
36
  use Rack::ShowExceptions
33
- use Tipsy::Handler::StaticHandler, :root => Tipsy::Site.config.public_path, :urls => %w[/]
37
+ use Tipsy::Handler::StaticHandler, :root => conf.public_path, :urls => %w[/]
34
38
  run Rack::Cascade.new([
35
39
  Rack::URLMap.new(Tipsy::Handler::AssetHandler.map!),
36
40
  Tipsy::Server.new
@@ -11,6 +11,10 @@ module Tipsy
11
11
  @dest_path = File.join(Tipsy.root, site_name)
12
12
  ensure_destination
13
13
  copy_tree(source_path, dest_path)
14
+
15
+ public_dir = File.join(Tipsy.root, site_name, "public")
16
+ File.mkdir_p(public_dir) unless ::Dir.exists?(public_dir)
17
+
14
18
  end
15
19
 
16
20
  private
data/lib/tipsy/site.rb CHANGED
@@ -54,7 +54,8 @@ module Tipsy
54
54
  config.compass.http_images_path = "/#{File.basename(config.images_path)}"
55
55
  config.compass.relative_assets = false
56
56
  config.compass.line_comments = false
57
-
57
+
58
+ config.enable_php = false
58
59
 
59
60
  def self.configure!
60
61
  @_callbacks = { :before => [], :after => [] }
data/lib/tipsy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tipsy
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -7,7 +7,7 @@ module Tipsy
7
7
  def initialize
8
8
  super(Tipsy.root)
9
9
  append_path('.')
10
- append_extensions '.erb','.html', '.json', '.xml'
10
+ append_extensions '.erb','.html', '.json', '.xml', '.php'
11
11
  end
12
12
 
13
13
  def locate_template(view_path)
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.6
4
+ version: 0.0.7
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: 2011-09-22 00:00:00.000000000Z
12
+ date: 2011-10-08 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
16
- requirement: &70338554616740 !ruby/object:Gem::Requirement
16
+ requirement: &70194631990440 !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: *70338554616740
24
+ version_requirements: *70194631990440
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rack-test
27
- requirement: &70338554616140 !ruby/object:Gem::Requirement
27
+ requirement: &70194631989920 !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: *70338554616140
35
+ version_requirements: *70194631989920
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: tilt
38
- requirement: &70338554615580 !ruby/object:Gem::Requirement
38
+ requirement: &70194631989460 !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: *70338554615580
46
+ version_requirements: *70194631989460
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: i18n
49
- requirement: &70338554615020 !ruby/object:Gem::Requirement
49
+ requirement: &70194631988940 !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: *70338554615020
57
+ version_requirements: *70194631988940
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: sass
60
- requirement: &70338554614560 !ruby/object:Gem::Requirement
60
+ requirement: &70194631988480 !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: *70338554614560
68
+ version_requirements: *70194631988480
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: activesupport
71
- requirement: &70338554613980 !ruby/object:Gem::Requirement
71
+ requirement: &70194631988000 !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: *70338554613980
79
+ version_requirements: *70194631988000
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: sprockets
82
- requirement: &70338554613420 !ruby/object:Gem::Requirement
82
+ requirement: &70194631983360 !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: *70338554613420
90
+ version_requirements: *70194631983360
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: hike
93
- requirement: &70338554612860 !ruby/object:Gem::Requirement
93
+ requirement: &70194631982780 !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: *70338554612860
101
+ version_requirements: *70194631982780
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: erubis
104
- requirement: &70338554612340 !ruby/object:Gem::Requirement
104
+ requirement: &70194631982280 !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: *70338554612340
112
+ version_requirements: *70194631982280
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: minitest
115
- requirement: &70338554611840 !ruby/object:Gem::Requirement
115
+ requirement: &70194631981720 !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: *70338554611840
123
+ version_requirements: *70194631981720
124
124
  description: Tipsy is a mini Rack application for working with static websites using
125
125
  Tilt, and Sprockets.
126
126
  email:
@@ -142,6 +142,7 @@ files:
142
142
  - lib/templates/site/config.rb
143
143
  - lib/templates/site/deploy.yml
144
144
  - lib/templates/site/layouts/default.html.erb
145
+ - lib/templates/site/public/.gitkeep
145
146
  - lib/templates/site/views/index.html.erb
146
147
  - lib/tipsy.rb
147
148
  - lib/tipsy/compressors/css_compressor.rb