appetizer-ui 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/appetizer-ui.gemspec CHANGED
@@ -10,13 +10,14 @@ Gem::Specification.new do |gem|
10
10
  gem.test_files = `git ls-files -- test/*`.split("\n")
11
11
  gem.name = "appetizer-ui"
12
12
  gem.require_paths = ["lib"]
13
- gem.version = "0.2.1"
13
+ gem.version = "0.3.0"
14
14
 
15
15
  gem.required_ruby_version = ">= 1.9.2"
16
16
 
17
17
  gem.add_dependency "appetizer", "~> 0.0"
18
18
  gem.add_dependency "coffee-script", "~> 2.2"
19
19
  gem.add_dependency "eco", "~> 1.0"
20
+ gem.add_dependency "rack-contrib", "~> 1.1"
20
21
  gem.add_dependency "rack-ssl", "~> 1.3"
21
22
  gem.add_dependency "sass", "~> 3.1"
22
23
  gem.add_dependency "sinatra", "~> 1.3"
@@ -11,7 +11,7 @@ require "yui/compressor"
11
11
  module App
12
12
  def self.assets
13
13
  @sprockets ||= Sprockets::Environment.new.tap do |s|
14
- if App.production? || ENV["APPETIZER_MINIFY_ASSETS"]
14
+ if Appetizer::UI::Assets.compiled?
15
15
  s.register_bundle_processor "application/javascript", :uglifier do |ctx, data|
16
16
  Uglifier.compile data
17
17
  end
@@ -26,7 +26,7 @@ module App
26
26
  # don't understand it yet), so we're manually creating the
27
27
  # over-nested directory for the moment.
28
28
 
29
- unless App.production?
29
+ unless Appetizer::UI::Assets.compiled?
30
30
  FileUtils.mkdir_p "tmp/sprockets/sprockets"
31
31
  s.cache = Sprockets::Cache::FileStore.new "tmp/sprockets"
32
32
  end
@@ -44,6 +44,10 @@ end
44
44
  module Appetizer
45
45
  module UI
46
46
  module Assets
47
+ def self.compiled?
48
+ App.production? or ENV["APPETIZER_USE_COMPILED_ASSETS"]
49
+ end
50
+
47
51
  def self.manifest
48
52
  return @manifest if defined? @manifest
49
53
 
@@ -60,7 +64,7 @@ module Appetizer
60
64
  def self.registered app
61
65
  app.helpers do
62
66
  def asset name
63
- if App.production?
67
+ if Appetizer::UI::Assets.compiled?
64
68
  return cdnify "/assets/#{Appetizer::UI::Assets.manifest[name]}"
65
69
  end
66
70
 
@@ -69,7 +73,7 @@ module Appetizer
69
73
 
70
74
  def assets *names
71
75
  names.flat_map do |name|
72
- next asset name if App.production?
76
+ next asset name if Appetizer::UI::Assets.compiled?
73
77
 
74
78
  asset = App.assets[name]
75
79
 
@@ -89,3 +93,8 @@ module Appetizer
89
93
  end
90
94
 
91
95
  Sinatra.register Appetizer::UI::Assets
96
+
97
+ # Required at the bottom so it can conditionally require a few things
98
+ # based on Appetizer::UI::Assets.compiled?.
99
+
100
+ require "appetizer/ui/assets/delivery"
@@ -0,0 +1,29 @@
1
+ module Appetizer
2
+ module UI
3
+ module Assets
4
+ class Delivery < Struct.new(:app)
5
+ require "rack/contrib/static_cache" if Assets.compiled?
6
+
7
+ STATIC = {
8
+ root: "public",
9
+ urls: Dir["public/*"].map { |s| s[6..-1] }
10
+ }
11
+
12
+ def call env
13
+ cached(env) || asset(env) || app.call(env)
14
+ end
15
+
16
+ def asset env
17
+ if !Assets.compiled? and env["PATH_INFO"].start_with? "/assets"
18
+ env["PATH_INFO"] = env["PATH_INFO"][7..-1]
19
+ App.assets.call env
20
+ end
21
+ end
22
+
23
+ def cached env
24
+ Rack::StaticCache.new(app, STATIC).call env if Assets.compiled?
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appetizer-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-10 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: appetizer
16
- requirement: &70117728740140 !ruby/object:Gem::Requirement
16
+ requirement: &70355474646500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70117728740140
24
+ version_requirements: *70355474646500
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: coffee-script
27
- requirement: &70117728739100 !ruby/object:Gem::Requirement
27
+ requirement: &70355474645960 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '2.2'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70117728739100
35
+ version_requirements: *70355474645960
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: eco
38
- requirement: &70117728738120 !ruby/object:Gem::Requirement
38
+ requirement: &70355474636360 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,21 @@ dependencies:
43
43
  version: '1.0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70117728738120
46
+ version_requirements: *70355474636360
47
+ - !ruby/object:Gem::Dependency
48
+ name: rack-contrib
49
+ requirement: &70355474635400 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.1'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *70355474635400
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: rack-ssl
49
- requirement: &70117728737340 !ruby/object:Gem::Requirement
60
+ requirement: &70355474634520 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ~>
@@ -54,10 +65,10 @@ dependencies:
54
65
  version: '1.3'
55
66
  type: :runtime
56
67
  prerelease: false
57
- version_requirements: *70117728737340
68
+ version_requirements: *70355474634520
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: sass
60
- requirement: &70117728736820 !ruby/object:Gem::Requirement
71
+ requirement: &70355474633540 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ~>
@@ -65,10 +76,10 @@ dependencies:
65
76
  version: '3.1'
66
77
  type: :runtime
67
78
  prerelease: false
68
- version_requirements: *70117728736820
79
+ version_requirements: *70355474633540
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: sinatra
71
- requirement: &70117728736340 !ruby/object:Gem::Requirement
82
+ requirement: &70355474632920 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ~>
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: '1.3'
77
88
  type: :runtime
78
89
  prerelease: false
79
- version_requirements: *70117728736340
90
+ version_requirements: *70355474632920
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: sprockets
82
- requirement: &70117728735860 !ruby/object:Gem::Requirement
93
+ requirement: &70355474632060 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ~>
@@ -87,10 +98,10 @@ dependencies:
87
98
  version: '2.1'
88
99
  type: :runtime
89
100
  prerelease: false
90
- version_requirements: *70117728735860
101
+ version_requirements: *70355474632060
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: uglifier
93
- requirement: &70117728735360 !ruby/object:Gem::Requirement
104
+ requirement: &70355474630720 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ~>
@@ -98,10 +109,10 @@ dependencies:
98
109
  version: '1.0'
99
110
  type: :runtime
100
111
  prerelease: false
101
- version_requirements: *70117728735360
112
+ version_requirements: *70355474630720
102
113
  - !ruby/object:Gem::Dependency
103
114
  name: yajl-ruby
104
- requirement: &70117728734860 !ruby/object:Gem::Requirement
115
+ requirement: &70355474618200 !ruby/object:Gem::Requirement
105
116
  none: false
106
117
  requirements:
107
118
  - - ~>
@@ -109,10 +120,10 @@ dependencies:
109
120
  version: '1.0'
110
121
  type: :runtime
111
122
  prerelease: false
112
- version_requirements: *70117728734860
123
+ version_requirements: *70355474618200
113
124
  - !ruby/object:Gem::Dependency
114
125
  name: yui-compressor
115
- requirement: &70117728734280 !ruby/object:Gem::Requirement
126
+ requirement: &70355474616500 !ruby/object:Gem::Requirement
116
127
  none: false
117
128
  requirements:
118
129
  - - ~>
@@ -120,7 +131,7 @@ dependencies:
120
131
  version: '0.9'
121
132
  type: :runtime
122
133
  prerelease: false
123
- version_requirements: *70117728734280
134
+ version_requirements: *70355474616500
124
135
  description: A painfully opinionated Appetizer extension for web apps.
125
136
  email:
126
137
  - tech@audiosocket.com
@@ -142,6 +153,7 @@ files:
142
153
  - lib/appetizer/ui/app/js/appetizer/xdr.coffee
143
154
  - lib/appetizer/ui/app/views/client/appetizer/missing.jst.eco
144
155
  - lib/appetizer/ui/assets.rb
156
+ - lib/appetizer/ui/assets/delivery.rb
145
157
  - lib/appetizer/ui/jasmine/css/jasmine.css
146
158
  - lib/appetizer/ui/jasmine/js/jasmine-html.js
147
159
  - lib/appetizer/ui/jasmine/js/jasmine-jquery-matchers.js