file-timestamp 1.1.0 → 1.2.0
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/bin/timestamp +9 -2
- metadata +2 -2
data/bin/timestamp
CHANGED
@@ -9,20 +9,26 @@ def collectFileMtime dir, file_ext, exclude_dir
|
|
9
9
|
map = {}
|
10
10
|
full_dir = File.expand_path dir
|
11
11
|
Dir.chdir full_dir
|
12
|
+
is_empty = true
|
12
13
|
Dir.foreach "." do |file|
|
13
14
|
if File.directory? file
|
14
15
|
unless exclude_dir.include? file
|
15
|
-
|
16
|
+
submap = collectFileMtime file, file_ext, exclude_dir
|
17
|
+
is_empty = false unless submap.nil? or submap.empty?
|
18
|
+
unless submap.nil?
|
19
|
+
map[file] = submap
|
20
|
+
end
|
16
21
|
Dir.chdir ".."
|
17
22
|
end
|
18
23
|
else
|
19
24
|
if file_ext.include? File.extname file
|
20
25
|
map[file] = (File.mtime file).strftime "%m%d%H%M%S"
|
26
|
+
is_empty = false
|
21
27
|
end
|
22
28
|
end
|
23
29
|
end
|
24
30
|
|
25
|
-
return map
|
31
|
+
return is_empty ? nil : map
|
26
32
|
end
|
27
33
|
|
28
34
|
option = {
|
@@ -47,6 +53,7 @@ begin
|
|
47
53
|
end.parse!
|
48
54
|
|
49
55
|
tree = collectFileMtime(ARGV[0] || ".", option[:include_ext], option[:exclude_dir])
|
56
|
+
|
50
57
|
if option[:pretty]
|
51
58
|
output = JSON.pretty_generate(tree)
|
52
59
|
else
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: file-timestamp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-02 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! ' output timestamp of directory for web front-end developer
|
15
15
|
|