squash_ios_symbolicator 1.0.1 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -38,6 +38,13 @@ This gem uses `dwarfdump` to perform its symbolication. You'll therefore need
38
38
  the Xcode Command Line tools installed on the machine that will be performing
39
39
  the symbolication upload.
40
40
 
41
+ If you wish to use the symbolication tools provided in your own Ruby program,
42
+ you will need to add this gem to your Gemfile:
43
+
44
+ ```` ruby
45
+ gem 'squash_ios_symbolicator', :require => 'squash/symbolicator'
46
+ ````
47
+
41
48
  Usage
42
49
  -----
43
50
 
data/bin/squash_release CHANGED
@@ -17,6 +17,7 @@
17
17
  require 'optparse'
18
18
  require 'rubygems'
19
19
  require 'squash/uploader'
20
+ require 'plist'
20
21
 
21
22
  def git_revision(dir)
22
23
  head = File.read(File.join(dir, '.git', 'HEAD')).chomp
@@ -27,25 +28,31 @@ def git_revision(dir)
27
28
  end
28
29
  end
29
30
 
31
+ infoplist = Plist.parse_xml(ENV['INFOPLIST_FILE'])
32
+
30
33
  project_dir = Dir.getwd
31
34
  revision = nil
32
- options = {}
35
+ build = infoplist['CFBundleVersion']
36
+ version = infoplist['CFBundleShortVersionString']
37
+ options = {:success => [Net::HTTPSuccess, 422]}
33
38
 
34
39
  parser = OptionParser.new do |parser|
35
- parser.banner = "Usage: squash_release [options] YOUR_SQUASH_HOST YOUR_API_KEY ENVIRONMENT BUILD_NUMBER"
40
+ parser.banner = "Usage: squash_release [options] YOUR_SQUASH_HOST YOUR_API_KEY ENVIRONMENT"
36
41
  parser.on('-o', '--open-timeout N', Integer, "HTTP connection open timeout") { |ot| options[:open_timeout] = ot }
37
42
  parser.on('-r', '--read-timeout N', Integer, "HTTP connection data received timeout") { |rt| options[:read_timeout] = rt }
38
43
  parser.on('-k', '--[no-]skip-verification', "Do not perform SSL peer verification") { |sv| options[:skip_verification] = sv }
39
44
 
40
45
  parser.on('-p', '--project-dir F', "Specify a custom project directory (default current directory)") { |pd| project_dir = pd }
41
46
  parser.on('-r', '--revision R', "Specify a code revision that was deployed (default current revision)") { |r| revision = r }
47
+ parser.on('-b', '--build B', "Specify a machine-readble build number that was deployed (default from Info.plist)") { |b| build = b }
48
+ parser.on('-v', '--product-version V', "Specify a human-readable version that was deployed (default from Info.plist)") { |v| version = v }
42
49
 
43
50
  parser.on('-h', '--help', "Show this message") { puts parser; exit }
44
51
  parser.on('--version', "Display version number of this program") { puts "1.0.0"; exit }
45
52
  end
46
53
  parser.parse!(ARGV)
47
54
 
48
- if ARGV.size != 4
55
+ if ARGV.size != 3
49
56
  puts parser
50
57
  exit 1
51
58
  end
@@ -53,7 +60,6 @@ end
53
60
  host = ARGV.shift
54
61
  api_key = ARGV.shift
55
62
  environment = ARGV.shift
56
- build = ARGV.shift
57
63
  revision = revision || git_revision(project_dir)
58
64
 
59
65
  Squash::Uploader.new(host, options).transmit '/api/1.0/deploy.json',
@@ -63,6 +69,7 @@ Squash::Uploader.new(host, options).transmit '/api/1.0/deploy.json',
63
69
  'deploy' => {
64
70
  'deployed_at' => Time.now,
65
71
  'revision' => revision,
66
- 'build' => build
72
+ 'build' => build,
73
+ 'version' => version
67
74
  }
68
75
  }
data/bin/symbolicate CHANGED
@@ -21,7 +21,7 @@ require 'yaml'
21
21
 
22
22
  require 'rubygems'
23
23
  require 'squash/uploader'
24
- require 'squash_ios_symbolicator'
24
+ require 'squash/symbolicator'
25
25
 
26
26
  def git_revision(dir)
27
27
  head = File.read(File.join(dir, '.git', 'HEAD')).chomp
@@ -66,7 +66,7 @@ else
66
66
  end
67
67
  end
68
68
 
69
- sym = Symbolicator.new(dsym_file, project_dir)
69
+ sym = Squash::Symbolicator.new(dsym_file, project_dir)
70
70
  archs = sym.architectures
71
71
  uuids = Hash.new
72
72
  archs.each do |arch, uuid|
@@ -75,10 +75,10 @@ end
75
75
 
76
76
  Squash::Uploader.new(host, options).transmit '/api/1.0/symbolication.json',
77
77
  'symbolications' =>
78
- uuids.map do |uuid, (symbols, lines)|
78
+ uuids.map { |uuid, (symbols, lines)|
79
79
  {
80
80
  'uuid' => uuid,
81
81
  'symbols' => Base64.encode64(Zlib::Deflate.deflate(symbols.to_yaml)),
82
82
  'lines' => Base64.encode64(Zlib::Deflate.deflate(lines.to_yaml))
83
83
  }
84
- end
84
+ }
@@ -78,6 +78,7 @@ module Squash
78
78
 
79
79
  current_subprogram[tag] = value
80
80
  elsif line =~ /^0x[0-9a-f]+:\s+TAG_(\w+)/
81
+ next unless %w(low_pc high_pc decl_file decl_line name).all? { |k| current_subprogram.include? k }
81
82
  current_subprogram['decl_file'].sub!(/^#{Regexp.escape @project_dir}\//, '') if @project_dir
82
83
  symbolications.add current_subprogram['low_pc'],
83
84
  current_subprogram['high_pc'],
@@ -12,14 +12,25 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ require 'serialbox'
16
+
17
+ Squash::Symbolicator::Line = Struct.new(:start_address, :file, :line, :column)
18
+
15
19
  # An address ranged mapped to a specific line of code, as part of a {Lines}
16
20
  # aggregation. No symbol data is included.
17
21
 
18
- Squash::Symbolicator::Line = Struct.new(:start_address, :file, :line, :column)
22
+ class Squash::Symbolicator::Line
23
+ include SerialBox
24
+ serialize_with :JSON
25
+ serialize_fields do |s|
26
+ s.serialize :start_address, :file, :line, :column
27
+ end
19
28
 
20
- Squash::Symbolicator::Line.send(:define_method, :<=>) do |other|
21
- raise ArgumentError unless other.kind_of?(Squash::Symbolicator::Line)
22
- start_address <=> other.start_address
29
+ # @private
30
+ def <=>(other)
31
+ raise ArgumentError unless other.kind_of?(Squash::Symbolicator::Line)
32
+ start_address <=> other.start_address
33
+ end
23
34
  end
24
35
 
25
36
  # An aggregation of the `Symbolicator::Line`s of a binary class. This class
@@ -28,6 +39,10 @@ end
28
39
  class Squash::Symbolicator::Lines
29
40
  include Enumerable
30
41
 
42
+ include SerialBox
43
+ serialize_with :JSON
44
+ serialize_fields { |s| s.serialize :@lines }
45
+
31
46
  # Creates a new empty aggregation.
32
47
 
33
48
  def initialize
@@ -12,18 +12,27 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ Squash::Symbolicator::Symbol = Struct.new(:start_address, :end_address, :file, :line, :ios_method)
16
+
15
17
  # An address ranged mapped to a symbol (method or function name), as part of a
16
18
  # {Symbols} aggregation. The file and line where the symbol is declared is also
17
19
  # included.
18
20
 
19
- Squash::Symbolicator::Symbol = Struct.new(:start_address, :end_address, :file, :line, :ios_method)
21
+ class Squash::Symbolicator::Symbol
22
+ include SerialBox
23
+ serialize_with :JSON
24
+ serialize_fields do |s|
25
+ s.serialize :start_address, :end_address, :file, :line, :ios_method
26
+ end
20
27
 
21
- Squash::Symbolicator::Symbol.send(:define_method, :<=>) do |other|
22
- raise ArgumentError unless other.kind_of?(Squash::Symbolicator::Symbol)
23
- if start_address == other.start_address
24
- end_address <=> other.end_address
25
- else
26
- start_address <=> other.start_address
28
+ # @private
29
+ def <=>(other)
30
+ raise ArgumentError unless other.kind_of?(Squash::Symbolicator::Symbol)
31
+ if start_address == other.start_address
32
+ end_address <=> other.end_address
33
+ else
34
+ start_address <=> other.start_address
35
+ end
27
36
  end
28
37
  end
29
38
 
@@ -33,6 +42,10 @@ end
33
42
  class Squash::Symbolicator::Symbols
34
43
  include Enumerable
35
44
 
45
+ include SerialBox
46
+ serialize_with :JSON
47
+ serialize_fields { |s| s.serialize :@symbols }
48
+
36
49
  # Creates a new empty aggregation.
37
50
 
38
51
  def initialize
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squash_ios_symbolicator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 0
9
8
  - 1
10
- version: 1.0.1
9
+ - 1
10
+ version: 1.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tim Morgan
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-01-04 00:00:00 Z
18
+ date: 2013-01-18 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  requirement: &id001 !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  - 0
43
43
  version: "0"
44
44
  version_requirements: *id002
45
- name: squash_uploader
45
+ name: serialbox
46
46
  prerelease: false
47
47
  type: :runtime
48
48
  - !ruby/object:Gem::Dependency
@@ -51,14 +51,16 @@ dependencies:
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- hash: 3
54
+ hash: 21
55
55
  segments:
56
+ - 1
56
57
  - 0
57
- version: "0"
58
+ - 1
59
+ version: 1.0.1
58
60
  version_requirements: *id003
59
- name: rspec
61
+ name: squash_uploader
60
62
  prerelease: false
61
- type: :development
63
+ type: :runtime
62
64
  - !ruby/object:Gem::Dependency
63
65
  requirement: &id004 !ruby/object:Gem::Requirement
64
66
  none: false
@@ -70,7 +72,7 @@ dependencies:
70
72
  - 0
71
73
  version: "0"
72
74
  version_requirements: *id004
73
- name: yard
75
+ name: rspec
74
76
  prerelease: false
75
77
  type: :development
76
78
  - !ruby/object:Gem::Dependency
@@ -84,7 +86,7 @@ dependencies:
84
86
  - 0
85
87
  version: "0"
86
88
  version_requirements: *id005
87
- name: redcarpet
89
+ name: yard
88
90
  prerelease: false
89
91
  type: :development
90
92
  - !ruby/object:Gem::Dependency
@@ -98,6 +100,20 @@ dependencies:
98
100
  - 0
99
101
  version: "0"
100
102
  version_requirements: *id006
103
+ name: redcarpet
104
+ prerelease: false
105
+ type: :development
106
+ - !ruby/object:Gem::Dependency
107
+ requirement: &id007 !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ hash: 3
113
+ segments:
114
+ - 0
115
+ version: "0"
116
+ version_requirements: *id007
101
117
  name: jeweler
102
118
  prerelease: false
103
119
  type: :development