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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a61a81ea6144bb12d1ddb53a53b8ad2ca6484dbd
4
- data.tar.gz: 8abd6e0b1290275bd0540b329620f8999c2956d8
3
+ metadata.gz: 121ce33664df8108025e9ea5f6497389c847fa9f
4
+ data.tar.gz: 3f6898d5d7f0bd2daf666ee5a1aaaf729c6915d5
5
5
  SHA512:
6
- metadata.gz: d9b6da53043e32047f800f02f84180dd72d7560d07d5a19d3af84331edb5df2da51f3c9257ed7998e73520683963cdf0f6333a8c320b7b28368113bd525e66fd
7
- data.tar.gz: 24a5a93dfc9607294ea95c60effecc12928bef6ba9b9d22f41927f6ff43a3e2d520f236b2672ad6b4d4a25dfbe17aabc290eafcfccd7c21570fd8a9b38ef9570
6
+ metadata.gz: 898307096f3932cdf5a81688fbf7518a152ca8884fb5d8f5d272d3e8452d3612db3a8aa8cee12de0dade70b21d943201623851a36ed60ce7d2c93d8aca4c6d18
7
+ data.tar.gz: 9f07866c61f097a3e26c2fd552d65ffa3c88a2dd9705b2c272e0552ce2557572da7484de2113ea8b92d4f43ab1152e9bf37d09232d396efdbb37612e339d24f6
@@ -1,3 +1,3 @@
1
1
  module CrashAnalysis
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -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
- system("echo running...")
60
- if File.directory?(filePath)
61
- crashFileNames = traverse(filePath)
62
- AnalysisLog(crashFileNames)
76
+ puts "running..."
77
+ if filePath.nil? || filePath.empty?
78
+ puts "error: need directory path"
63
79
  else
64
- puts "error: not a directory"
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.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-18 00:00:00.000000000 Z
11
+ date: 2015-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler