crash_analysis 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/crash_analysis/version.rb +1 -1
- data/lib/crash_analysis.rb +30 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 121ce33664df8108025e9ea5f6497389c847fa9f
|
4
|
+
data.tar.gz: 3f6898d5d7f0bd2daf666ee5a1aaaf729c6915d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 898307096f3932cdf5a81688fbf7518a152ca8884fb5d8f5d272d3e8452d3612db3a8aa8cee12de0dade70b21d943201623851a36ed60ce7d2c93d8aca4c6d18
|
7
|
+
data.tar.gz: 9f07866c61f097a3e26c2fd552d65ffa3c88a2dd9705b2c272e0552ce2557572da7484de2113ea8b92d4f43ab1152e9bf37d09232d396efdbb37612e339d24f6
|
data/lib/crash_analysis.rb
CHANGED
@@ -2,6 +2,8 @@ require "crash_analysis/version"
|
|
2
2
|
|
3
3
|
def traverse(filePath)
|
4
4
|
crashFileNames = Array.new
|
5
|
+
countApp = 0
|
6
|
+
countDSYM = 0
|
5
7
|
if File.directory?(filePath)
|
6
8
|
Dir.foreach(filePath) do |fileName|
|
7
9
|
fileSuffixArray = fileName.strip.split(".")
|
@@ -9,10 +11,23 @@ def traverse(filePath)
|
|
9
11
|
fileSuffixArray.pop
|
10
12
|
crashFileNames << (filePath + "/" + fileSuffixArray.first)
|
11
13
|
end
|
14
|
+
if fileSuffixArray.last == "app"
|
15
|
+
countApp += 1
|
16
|
+
end
|
17
|
+
if fileSuffixArray.last == "dSYM"
|
18
|
+
countDSYM += 1
|
19
|
+
end
|
12
20
|
end
|
13
21
|
else
|
14
22
|
puts "Files:" + filePath
|
15
23
|
end
|
24
|
+
|
25
|
+
if countApp != 1 || countDSYM !=1
|
26
|
+
puts "error:\n"
|
27
|
+
puts "make sure the directory contains those files: one .app file & one .dSYM file & related crash files"
|
28
|
+
return
|
29
|
+
end
|
30
|
+
|
16
31
|
return crashFileNames
|
17
32
|
end
|
18
33
|
|
@@ -54,14 +69,24 @@ class Array
|
|
54
69
|
end
|
55
70
|
end
|
56
71
|
|
72
|
+
# 文件目录内容校验
|
73
|
+
|
57
74
|
module CrashAnalysis
|
58
75
|
def self.run(filePath)
|
59
|
-
|
60
|
-
if
|
61
|
-
|
62
|
-
AnalysisLog(crashFileNames)
|
76
|
+
puts "running..."
|
77
|
+
if filePath.nil? || filePath.empty?
|
78
|
+
puts "error: need directory path"
|
63
79
|
else
|
64
|
-
|
80
|
+
if File.directory?(filePath)
|
81
|
+
crashFileNames = traverse(filePath)
|
82
|
+
if crashFileNames.nil? || crashFileNames.empty?
|
83
|
+
return
|
84
|
+
else
|
85
|
+
AnalysisLog(crashFileNames)
|
86
|
+
end
|
87
|
+
else
|
88
|
+
puts "error: not a directory"
|
89
|
+
end
|
65
90
|
end
|
66
91
|
end
|
67
92
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crash_analysis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HongliYu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|