jammit 0.5.1 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/jammit.gemspec +2 -2
- data/lib/jammit.rb +2 -4
- data/lib/jammit/compressor.rb +9 -4
- data/rails/routes.rb +2 -2
- metadata +13 -4
data/jammit.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'jammit'
|
3
|
-
s.version = '0.5.
|
4
|
-
s.date = '2010-
|
3
|
+
s.version = '0.5.3' # Keep version in sync with jammit.rb
|
4
|
+
s.date = '2010-9-15'
|
5
5
|
|
6
6
|
s.homepage = "http://documentcloud.github.com/jammit/"
|
7
7
|
s.summary = "Industrial Strength Asset Packaging for Rails"
|
data/lib/jammit.rb
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.push File.expand_path(File.dirname(__FILE__))
|
|
4
4
|
# to all of the configuration options.
|
5
5
|
module Jammit
|
6
6
|
|
7
|
-
VERSION = "0.5.
|
7
|
+
VERSION = "0.5.3"
|
8
8
|
|
9
9
|
ROOT = File.expand_path(File.dirname(__FILE__) + '/..')
|
10
10
|
|
@@ -168,9 +168,7 @@ module Jammit
|
|
168
168
|
|
169
169
|
def self.warn(message)
|
170
170
|
message = "Jammit Warning: #{message}"
|
171
|
-
|
172
|
-
defined?(RAILS_DEFAULT_LOGGER) ? RAILS_DEFAULT_LOGGER : nil)
|
173
|
-
@logger ? @logger.warn(message) : STDERR.puts(message)
|
171
|
+
$stderr.puts message
|
174
172
|
end
|
175
173
|
|
176
174
|
# Clone of active_support's symbolize_keys, so that we don't have to depend
|
data/lib/jammit/compressor.rb
CHANGED
@@ -16,7 +16,8 @@ module Jammit
|
|
16
16
|
'.tif' => 'image/tiff',
|
17
17
|
'.tiff' => 'image/tiff',
|
18
18
|
'.ttf' => 'font/truetype',
|
19
|
-
'.otf' => 'font/opentype'
|
19
|
+
'.otf' => 'font/opentype',
|
20
|
+
'.woff' => 'font/woff'
|
20
21
|
}
|
21
22
|
|
22
23
|
# Font extensions for which we allow embedding:
|
@@ -96,7 +97,8 @@ module Jammit
|
|
96
97
|
paths = paths.grep(Jammit.template_extension_matcher).sort
|
97
98
|
base_path = find_base_path(paths)
|
98
99
|
compiled = paths.map do |path|
|
99
|
-
contents = File.
|
100
|
+
contents = File.open(path, 'r:binary') {|f| f.read }
|
101
|
+
contents = contents.gsub(/\n/, '').gsub("'", '\\\\\'')
|
100
102
|
name = template_name(path, base_path)
|
101
103
|
"#{namespace}['#{name}'] = #{Jammit.template_function}('#{contents}');"
|
102
104
|
end
|
@@ -135,7 +137,8 @@ module Jammit
|
|
135
137
|
# at it.
|
136
138
|
def concatenate_and_tag_assets(paths, variant=nil)
|
137
139
|
stylesheets = [paths].flatten.map do |css_path|
|
138
|
-
File.
|
140
|
+
contents = File.open(css_path, 'r:binary') {|f| f.read }
|
141
|
+
contents.gsub(EMBED_DETECTOR) do |url|
|
139
142
|
ipath, cpath = Pathname.new($1), Pathname.new(File.expand_path(css_path))
|
140
143
|
is_url = URI.parse($1).absolute?
|
141
144
|
is_url ? url : "url(#{construct_asset_path(ipath, cpath, variant)})"
|
@@ -224,7 +227,9 @@ module Jammit
|
|
224
227
|
|
225
228
|
# Return the Base64-encoded contents of an asset on a single line.
|
226
229
|
def encoded_contents(asset_path)
|
227
|
-
@asset_contents[asset_path]
|
230
|
+
return @asset_contents[asset_path] if @asset_contents[asset_path]
|
231
|
+
data = File.open(asset_path, 'rb') {|f| f.read }
|
232
|
+
@asset_contents[asset_path] = Base64.encode64(data).gsub(/\n/, '')
|
228
233
|
end
|
229
234
|
|
230
235
|
# Grab the mime-type of an asset, by filename.
|
data/rails/routes.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jammit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 13
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
9
|
+
- 3
|
10
|
+
version: 0.5.3
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Jeremy Ashkenas
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-09-15 00:00:00 -04:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: yui-compressor
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 57
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
- 9
|
@@ -35,9 +38,11 @@ dependencies:
|
|
35
38
|
name: closure-compiler
|
36
39
|
prerelease: false
|
37
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
38
42
|
requirements:
|
39
43
|
- - ">="
|
40
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 27
|
41
46
|
segments:
|
42
47
|
- 0
|
43
48
|
- 1
|
@@ -85,23 +90,27 @@ rdoc_options:
|
|
85
90
|
require_paths:
|
86
91
|
- lib
|
87
92
|
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
88
94
|
requirements:
|
89
95
|
- - ">="
|
90
96
|
- !ruby/object:Gem::Version
|
97
|
+
hash: 3
|
91
98
|
segments:
|
92
99
|
- 0
|
93
100
|
version: "0"
|
94
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
95
103
|
requirements:
|
96
104
|
- - ">="
|
97
105
|
- !ruby/object:Gem::Version
|
106
|
+
hash: 3
|
98
107
|
segments:
|
99
108
|
- 0
|
100
109
|
version: "0"
|
101
110
|
requirements: []
|
102
111
|
|
103
112
|
rubyforge_project: jammit
|
104
|
-
rubygems_version: 1.3.
|
113
|
+
rubygems_version: 1.3.7
|
105
114
|
signing_key:
|
106
115
|
specification_version: 3
|
107
116
|
summary: Industrial Strength Asset Packaging for Rails
|