jammit 0.4.0 → 0.4.1
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 +1 -5
- data/lib/jammit/compressor.rb +3 -7
- data/lib/jammit/packager.rb +1 -7
- metadata +2 -2
data/jammit.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'jammit'
|
3
|
-
s.version = '0.4.
|
4
|
-
s.date = '2009-1-
|
3
|
+
s.version = '0.4.1' # Keep version in sync with jammit.rb
|
4
|
+
s.date = '2009-1-5'
|
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.4.
|
7
|
+
VERSION = "0.4.1"
|
8
8
|
|
9
9
|
ROOT = File.expand_path(File.dirname(__FILE__) + '/..')
|
10
10
|
|
@@ -26,10 +26,6 @@ module Jammit
|
|
26
26
|
|
27
27
|
DEFAULT_COMPRESSOR = :yui
|
28
28
|
|
29
|
-
# Extension matchers for JavaScript and JST, which need to be disambiguated.
|
30
|
-
JS_EXT = /\.js\Z/
|
31
|
-
JST_EXT = /\.jst\Z/
|
32
|
-
|
33
29
|
# Jammit raises a @PackageNotFound@ exception when a non-existent package is
|
34
30
|
# requested by a browser -- rendering a 404.
|
35
31
|
class PackageNotFound < NameError; end
|
data/lib/jammit/compressor.rb
CHANGED
@@ -61,13 +61,9 @@ module Jammit
|
|
61
61
|
end
|
62
62
|
|
63
63
|
# Concatenate together a list of JavaScript paths, and pass them through the
|
64
|
-
# YUI Compressor (with munging enabled).
|
64
|
+
# YUI Compressor (with munging enabled).
|
65
65
|
def compress_js(paths)
|
66
|
-
|
67
|
-
js = concatenate(paths)
|
68
|
-
else
|
69
|
-
js = concatenate(paths - jst_paths) + compile_jst(jst_paths)
|
70
|
-
end
|
66
|
+
js = concatenate(paths)
|
71
67
|
Jammit.compress_assets ? @js_compressor.compress(js) : js
|
72
68
|
end
|
73
69
|
|
@@ -92,7 +88,7 @@ module Jammit
|
|
92
88
|
# JST templates are named with the basename of their file.
|
93
89
|
def compile_jst(paths)
|
94
90
|
namespace = Jammit.template_namespace
|
95
|
-
compiled = paths.
|
91
|
+
compiled = paths.map do |path|
|
96
92
|
template_name = File.basename(path, File.extname(path))
|
97
93
|
contents = File.read(path).gsub(/\n/, '').gsub("'", '\\\\\'')
|
98
94
|
"#{namespace}.#{template_name} = #{Jammit.template_function}('#{contents}');"
|
data/lib/jammit/packager.rb
CHANGED
@@ -93,7 +93,6 @@ module Jammit
|
|
93
93
|
# package has gone missing.
|
94
94
|
def package_for(package, extension)
|
95
95
|
pack = @packages[extension] && @packages[extension][package]
|
96
|
-
pack ||= @packages[:js] && @packages[:js][package] if extension == :jst
|
97
96
|
pack || not_found(package, extension)
|
98
97
|
end
|
99
98
|
|
@@ -127,12 +126,7 @@ module Jammit
|
|
127
126
|
packages[name] = {}
|
128
127
|
paths = globs.map {|glob| glob_files(glob) }.flatten.uniq
|
129
128
|
packages[name][:paths] = paths
|
130
|
-
|
131
|
-
packages[name][:urls] = paths.grep(JS_EXT).map {|path| path.sub(PATH_TO_URL, '') }
|
132
|
-
packages[name][:urls] += [Jammit.asset_url(name, :jst)]
|
133
|
-
else
|
134
|
-
packages[name][:urls] = paths.map {|path| path.sub(PATH_TO_URL, '') }
|
135
|
-
end
|
129
|
+
packages[name][:urls] = paths.map {|path| path.sub(PATH_TO_URL, '') }
|
136
130
|
end
|
137
131
|
packages
|
138
132
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jammit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Ashkenas
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-01-
|
12
|
+
date: 2009-01-05 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|