jammit 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'jammit'
3
- s.version = '0.2.4' # Keep version in sync with jammit.rb
3
+ s.version = '0.2.5' # Keep version in sync with jammit.rb
4
4
  s.date = '2009-11-18'
5
5
 
6
6
  s.homepage = "http://documentcloud.github.com/jammit/"
@@ -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.2.4"
7
+ VERSION = "0.2.5"
8
8
 
9
9
  ROOT = File.expand_path(File.dirname(__FILE__) + '/..')
10
10
 
@@ -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\/?public/
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| Dir[glob] }.flatten.uniq
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
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.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ashkenas