asset_id 0.1.2 → 0.1.3
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/lib/asset_id.rb +10 -23
- metadata +3 -3
data/lib/asset_id.rb
CHANGED
@@ -21,35 +21,22 @@ module AssetID
|
|
21
21
|
@@asset_paths
|
22
22
|
end
|
23
23
|
|
24
|
-
def self.
|
25
|
-
|
26
|
-
asset_paths.each do |asset_path|
|
27
|
-
path = File.join path_prefix, asset_path
|
28
|
-
next unless File.exists? path
|
29
|
-
if File.directory? path
|
30
|
-
a += gather_assets_for(path)
|
31
|
-
else
|
32
|
-
a << path
|
33
|
-
end
|
34
|
-
end
|
35
|
-
a
|
24
|
+
def self.absolute_path(path)
|
25
|
+
File.join path_prefix, path
|
36
26
|
end
|
37
27
|
|
38
|
-
def self.
|
39
|
-
|
40
|
-
|
41
|
-
if File.directory?
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
47
|
-
a
|
28
|
+
def self.assets
|
29
|
+
asset_paths.inject([]) {|assets, path|
|
30
|
+
path = absolute_path(path)
|
31
|
+
assets << path if File.exists? path and !File.directory? path
|
32
|
+
assets += Dir.glob(path+'/**/*').inject([]) {|m, file|
|
33
|
+
m << file unless File.directory? file; m
|
34
|
+
}
|
35
|
+
}
|
48
36
|
end
|
49
37
|
|
50
38
|
def self.fingerprint(path)
|
51
39
|
path = File.join path_prefix, path unless path =~ /#{path_prefix}/
|
52
|
-
#d = File.mtime(path).to_i.to_s
|
53
40
|
d = Digest::MD5.hexdigest(File.read(path))
|
54
41
|
path = path.gsub(path_prefix, '')
|
55
42
|
File.join File.dirname(path), "#{File.basename(path, File.extname(path))}-id-#{d}#{File.extname(path)}"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asset_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Richard Taylor
|