jammit 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/jammit.gemspec +1 -1
- data/lib/jammit.rb +1 -1
- data/lib/jammit/packager.rb +8 -2
- metadata +1 -1
data/jammit.gemspec
CHANGED
data/lib/jammit.rb
CHANGED
data/lib/jammit/packager.rb
CHANGED
@@ -7,7 +7,7 @@ module Jammit
|
|
7
7
|
class Packager
|
8
8
|
|
9
9
|
# In Rails, the difference between a path and an asset URL is "public".
|
10
|
-
PATH_TO_URL = /\A
|
10
|
+
PATH_TO_URL = /\A#{ASSET_ROOT}(\/public)?/
|
11
11
|
|
12
12
|
# Creating a new Packager will rebuild the list of assets from the
|
13
13
|
# Jammit.configuration. When assets.yml is being changed on the fly,
|
@@ -88,6 +88,12 @@ module Jammit
|
|
88
88
|
pack || not_found(package, extension)
|
89
89
|
end
|
90
90
|
|
91
|
+
# Absolute globs are absolute -- relative globs are relative to ASSET_ROOT.
|
92
|
+
def glob_files(glob)
|
93
|
+
absolute = Pathname.new(glob).absolute?
|
94
|
+
Dir[absolute ? glob : File.join(ASSET_ROOT, glob)]
|
95
|
+
end
|
96
|
+
|
91
97
|
# Compiles the list of assets that goes into each package. Runs an ordered
|
92
98
|
# list of Dir.globs, taking the merged unique result.
|
93
99
|
def create_packages(config)
|
@@ -96,7 +102,7 @@ module Jammit
|
|
96
102
|
config.each do |name, globs|
|
97
103
|
globs ||= []
|
98
104
|
packages[name] = {}
|
99
|
-
paths = globs.map {|glob|
|
105
|
+
paths = globs.map {|glob| glob_files(glob) }.flatten.uniq
|
100
106
|
packages[name][:paths] = paths
|
101
107
|
packages[name][:urls] = paths.map {|path| path.sub(PATH_TO_URL, '') }
|
102
108
|
end
|