sprockets 3.0.0.beta.9 → 3.0.0.beta.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da01c3bbf8752fe3705b073775d7067b1a984239
4
- data.tar.gz: 934f3ea753eba823e957005907d594771d053ec2
3
+ metadata.gz: 62bc83e5dba29c526fc06ee79618cac3013f5ab1
4
+ data.tar.gz: 8d5716e9158a481ac8893badaddba2562b2d5e2d
5
5
  SHA512:
6
- metadata.gz: 86023eba8d65c22262182f2602b8c22a6347a634bf894cc969d4d5e7bf94a75198ea4034a3cad71f80c4bfb4ea46cf7bcdf2cad5f1dcdc1877589c9b1a967589
7
- data.tar.gz: af13b0c540e0e78f0fa36a567aa2aa98f50680f20468c9d3d8433563f0d16c21d19279e3cac3b6369d532104cecb667a48cf9c6d150061cea41c86bfccb35465
6
+ metadata.gz: 4e31bcaac28fe9d231373471e49c91edf25bc27775ebc80f14949258be4dea66ddf9f48340b5e44613d195ade34b96c74898fd482224fe91a0204d69cea5312a
7
+ data.tar.gz: 48002bb898333ca896ec592603ef32ece5a1528d8dbc45d12618e5f80cd2cc905f758795f7d1305a6e44086fcf47f4ecdb422ca78404b70b2a454cbfd7df0473
data/lib/sprockets.rb CHANGED
@@ -1,32 +1,11 @@
1
1
  require 'sprockets/version'
2
2
  require 'sprockets/autoload'
3
+ require 'sprockets/cache'
4
+ require 'sprockets/environment'
5
+ require 'sprockets/errors'
6
+ require 'sprockets/manifest'
3
7
 
4
8
  module Sprockets
5
- # Environment
6
- autoload :Asset, 'sprockets/asset'
7
- autoload :Base, 'sprockets/base'
8
- autoload :CachedEnvironment, 'sprockets/cached_environment'
9
- autoload :Environment, 'sprockets/environment'
10
- autoload :Manifest, 'sprockets/manifest'
11
-
12
- # Processing
13
- autoload :Bundle, 'sprockets/bundle'
14
- autoload :Context, 'sprockets/context'
15
- autoload :DirectiveProcessor, 'sprockets/directive_processor'
16
- autoload :FileReader, 'sprockets/file_reader'
17
-
18
- # Internal utilities
19
- autoload :ArgumentError, 'sprockets/errors'
20
- autoload :Cache, 'sprockets/cache'
21
- autoload :ContentTypeMismatch, 'sprockets/errors'
22
- autoload :DigestUtils, 'sprockets/digest_utils'
23
- autoload :EncodingUtils, 'sprockets/encoding_utils'
24
- autoload :Error, 'sprockets/errors'
25
- autoload :FileNotFound, 'sprockets/errors'
26
- autoload :HTTPUtils, 'sprockets/http_utils'
27
- autoload :PathUtils, 'sprockets/path_utils'
28
- autoload :Utils, 'sprockets/utils'
29
-
30
9
  require 'sprockets/processor_utils'
31
10
  extend ProcessorUtils
32
11
 
@@ -19,9 +19,8 @@ module Sprockets
19
19
  # bower.json can only be nested one level deep
20
20
  if !logical_path.index('/')
21
21
  dirname = File.join(load_path, logical_path)
22
- stat = self.stat(dirname)
23
22
 
24
- if stat && stat.directory?
23
+ if directory?(dirname)
25
24
  filenames = POSSIBLE_BOWER_JSONS.map { |basename| File.join(dirname, basename) }
26
25
  filename = filenames.detect { |fn| self.file?(fn) }
27
26
 
@@ -108,7 +108,11 @@ module Sprockets
108
108
  # the dependency file with invalidate the cache of the
109
109
  # source file.
110
110
  def depend_on(path)
111
- resolve(path, compat: false)
111
+ if environment.absolute_path?(path) && environment.directory?(path)
112
+ @dependencies << environment.build_file_digest_uri(path)
113
+ else
114
+ resolve(path, compat: false)
115
+ end
112
116
  nil
113
117
  end
114
118
 
@@ -240,6 +240,7 @@ module Sprockets
240
240
  # Persist manfiest back to FS
241
241
  def save
242
242
  if @rename_filename
243
+ logger.info "Renaming #{@filename} to #{@rename_filename}"
243
244
  FileUtils.mv(@filename, @rename_filename)
244
245
  @filename = @rename_filename
245
246
  @rename_filename = nil
@@ -8,7 +8,7 @@ module Sprockets
8
8
  module PathUtils
9
9
  extend self
10
10
 
11
- # Internal: Like `File.stat`.
11
+ # Public: Like `File.stat`.
12
12
  #
13
13
  # path - String file or directory path
14
14
  #
@@ -21,7 +21,7 @@ module Sprockets
21
21
  end
22
22
  end
23
23
 
24
- # Internal: Like `File.file?`.
24
+ # Public: Like `File.file?`.
25
25
  #
26
26
  # path - String file path.
27
27
  #
@@ -34,7 +34,20 @@ module Sprockets
34
34
  end
35
35
  end
36
36
 
37
- # Internal: A version of `Dir.entries` that filters out `.` files and `~`
37
+ # Public: Like `File.directory?`.
38
+ #
39
+ # path - String file path.
40
+ #
41
+ # Returns true path exists and is a directory.
42
+ def directory?(path)
43
+ if stat = self.stat(path)
44
+ stat.directory?
45
+ else
46
+ false
47
+ end
48
+ end
49
+
50
+ # Public: A version of `Dir.entries` that filters out `.` files and `~`
38
51
  # swap files.
39
52
  #
40
53
  # path - String directory path
@@ -48,7 +61,7 @@ module Sprockets
48
61
  end
49
62
  end
50
63
 
51
- # Internal: Check if path is absolute or relative.
64
+ # Public: Check if path is absolute or relative.
52
65
  #
53
66
  # path - String path.
54
67
  #
@@ -73,7 +86,7 @@ module Sprockets
73
86
  SEPARATOR_PATTERN = "#{Regexp.quote(File::SEPARATOR)}"
74
87
  end
75
88
 
76
- # Internal: Check if path is explicitly relative.
89
+ # Public: Check if path is explicitly relative.
77
90
  # Starts with "./" or "../".
78
91
  #
79
92
  # path - String path.
@@ -178,7 +191,7 @@ module Sprockets
178
191
  nil
179
192
  end
180
193
 
181
- # Internal: Stat all the files under a directory.
194
+ # Public: Stat all the files under a directory.
182
195
  #
183
196
  # dir - A String directory
184
197
  #
@@ -196,7 +209,7 @@ module Sprockets
196
209
  nil
197
210
  end
198
211
 
199
- # Internal: Recursive stat all the files under a directory.
212
+ # Public: Recursive stat all the files under a directory.
200
213
  #
201
214
  # dir - A String directory
202
215
  #
@@ -215,7 +228,7 @@ module Sprockets
215
228
  nil
216
229
  end
217
230
 
218
- # Internal: Recursive stat all the files under a directory in alphabetical
231
+ # Public: Recursive stat all the files under a directory in alphabetical
219
232
  # order.
220
233
  #
221
234
  # dir - A String directory
@@ -237,7 +250,7 @@ module Sprockets
237
250
  nil
238
251
  end
239
252
 
240
- # Internal: Write to a file atomically. Useful for situations where you
253
+ # Public: Write to a file atomically. Useful for situations where you
241
254
  # don't want other processes or threads to see half-written files.
242
255
  #
243
256
  # Utils.atomic_write('important.file') do |file|
@@ -1,4 +1,5 @@
1
1
  require 'sprockets/engines'
2
+ require 'sprockets/file_reader'
2
3
  require 'sprockets/legacy_proc_processor'
3
4
  require 'sprockets/legacy_tilt_processor'
4
5
  require 'sprockets/mime'
@@ -1,3 +1,3 @@
1
1
  module Sprockets
2
- VERSION = "3.0.0.beta.9"
2
+ VERSION = "3.0.0.beta.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.beta.9
4
+ version: 3.0.0.beta.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Stephenson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-22 00:00:00.000000000 Z
12
+ date: 2015-03-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack