leancloud 0.0.6 → 0.0.10

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ea3a36559564040abe311c634791161bfc9e1e8
4
- data.tar.gz: 9a035fae9c97c3e544da238b1da3ed568ba6a939
3
+ metadata.gz: 3e31eba0f5be72dbc3071862dbf67a5fe487de8b
4
+ data.tar.gz: be4d7fa18940163e5336380a691d9bf323f58270
5
5
  SHA512:
6
- metadata.gz: 09bed82e1611372f1c0f11cc6ae3fb50a7c4f9b2c6df38012a026b606f6ba8895647a699bee941975d87fa30956b6303fd308709293b0bae021565dc42fa8b39
7
- data.tar.gz: 32ba82b61fe48338e5ed0bc3a7ff9792d46fcc4504ee2c12b55894587c084bca1d7f3779c6f3d60161337b4a13b2d4cbaad7405d2f2fb4561013de0b1435f6e1
6
+ metadata.gz: f89941eb0eafd006ef9090c26846cbb365885a8c76954642b7679fffac7dea9951074956a9579a52d418dc270118c404cbcb3872d17da6458df718964855ea3e
7
+ data.tar.gz: 60517e3b4a268b1281bbe71787af72217e95eebe7564d9392e57151a9482ec154005be712929ccde2db738ac3cd74bc647966d086c97ada66ec1534553370d49
data/bin/leancloud CHANGED
@@ -19,8 +19,8 @@ CLActive do
19
19
  option :components, '-c c', '--components=componenets', 'Leancloud SDK componenets'
20
20
  action do |opts|
21
21
  begin
22
- leancloud = LeanCloud::Initializer.new(opts)
23
- leancloud.create
22
+ initializer = LeanCloud::Initializer.new(opts)
23
+ initializer.create
24
24
  rescue SignalException
25
25
  rescue Exception => e
26
26
  raise e
@@ -32,13 +32,13 @@ CLActive do
32
32
  option :file, '-f f', '--file=file', 'Install by the specified Leanfile'
33
33
  action do |opts|
34
34
  begin
35
- leancloud = LeanCloud::Installer.new
36
- leancloud.install(opts[:file])
35
+ installer = LeanCloud::Installer.new
36
+ installer.install(opts[:file])
37
37
  rescue SignalException
38
38
  rescue Exception => e
39
39
  raise e
40
40
  ensure
41
- leancloud.destroy
41
+ installer.destroy
42
42
  end
43
43
  end
44
44
  end
@@ -49,8 +49,25 @@ CLActive do
49
49
  option :file, '-f f', '--file=file', 'DSYM file path'
50
50
  option :verbose, '-v', '--verbose', 'Verbose mode'
51
51
  action do |opts|
52
- leancloud = LeanCloud::SymbolUploader.new(opts)
53
- leancloud.upload
52
+ uploader = LeanCloud::SymbolUploader.new(opts)
53
+ uploader.upload
54
+ end
55
+ end
56
+
57
+ subcmd :dump_symbol do
58
+ option :file, '-f f', '--file=file', 'DSYM file path'
59
+ option :dest, '-d d', '--dest=dest', 'Symbol files destination path'
60
+ option :verbose, '-v', '--verbose', 'Verbose mode'
61
+ action do |opts|
62
+ begin
63
+ dumper = LeanCloud::SymbolDumper.new(opts)
64
+ dumper.dump
65
+ rescue SignalException
66
+ rescue Exception => e
67
+ raise e
68
+ ensure
69
+ dumper.destroy
70
+ end
54
71
  end
55
72
  end
56
73
 
data/lib/leancloud.rb CHANGED
@@ -2,8 +2,9 @@ require 'leancloud/leanobject'
2
2
  require 'leancloud/http'
3
3
  require 'leancloud/installer'
4
4
  require 'leancloud/initializer'
5
+ require 'leancloud/symbol_dumper'
5
6
 
6
7
  # LeanCloud main module
7
8
  module LeanCloud
8
- VERSION = '0.0.6'
9
+ VERSION = '0.0.10'
9
10
  end
@@ -254,6 +254,7 @@ module LeanCloud
254
254
  references = []
255
255
  phase.files.each do |ref|
256
256
  file = ref.file_ref
257
+ next if file.name.nil?
257
258
  references << file if file.name.include?(@sdk_prefix)
258
259
  end
259
260
 
@@ -0,0 +1,101 @@
1
+ require 'mustache'
2
+ require 'fileutils'
3
+ require 'shellwords'
4
+
5
+ module LeanCloud
6
+
7
+ # Mach-O symbol dumper
8
+ class SymbolDumper < LeanObject
9
+
10
+ def initialize(opts)
11
+ @opts = opts
12
+ end
13
+
14
+ private
15
+
16
+ attr_reader :dsym_path
17
+ attr_reader :dest_path
18
+
19
+ def dsym_path
20
+ @opts[:file]
21
+ end
22
+
23
+ def dest_path
24
+ @opts[:dest]
25
+ end
26
+
27
+ def verbose?
28
+ @opts[:verbose]
29
+ end
30
+
31
+ def make_validation
32
+ exit_with_error('DSYM path not found') unless File.readable?(dsym_path.to_s)
33
+ exit_with_error('Destination path not found') unless File.directory?(dest_path.to_s)
34
+ end
35
+
36
+ def list_macho_files
37
+ files = []
38
+
39
+ if File.directory?(dsym_path)
40
+ files += Dir.glob(File.join(dsym_path, '**/*'))
41
+ else
42
+ files << dsym_path
43
+ end
44
+
45
+ files.each do |file|
46
+ path = Shellwords.escape(file)
47
+ info = %x(lipo -info #{path} 2>/dev/null)
48
+ yield path unless info.empty?
49
+ end
50
+ end
51
+
52
+ def temp_symbol_file
53
+ @temp_symbol_file ||= File.join(dest_path, '~.sym')
54
+ end
55
+
56
+ def move_temp_symbol_file
57
+ head = File.open(temp_symbol_file).first
58
+
59
+ components = head.split(' ')
60
+ arch = components[2]
61
+ uuid = components[3]
62
+ name = components[4]
63
+
64
+ file = File.join(dest_path, name, uuid, "#{name}.sym")
65
+
66
+ FileUtils.mkdir_p(File.dirname(file))
67
+ FileUtils.cp(temp_symbol_file, file)
68
+ end
69
+
70
+ def dump_symbol_file(file)
71
+ uuids = %x(dwarfdump --uuid #{file})
72
+ temp = Shellwords.escape(temp_symbol_file)
73
+
74
+ uuids.split("\n").each do |line|
75
+ next unless line =~ /^UUID/
76
+ arch = line.split(' ')[2][1...-1]
77
+ system("leancloud_dump_syms -a #{arch} #{file} > #{temp} 2>/dev/null")
78
+ move_temp_symbol_file
79
+ end
80
+ end
81
+
82
+ def dump_symbols
83
+ list_macho_files do |file|
84
+ dump_symbol_file(file)
85
+ end
86
+ end
87
+
88
+ public
89
+
90
+ def destroy
91
+ FileUtils.rm_rf(temp_symbol_file)
92
+ end
93
+
94
+ def dump
95
+ make_validation
96
+ dump_symbols
97
+ end
98
+
99
+ end
100
+
101
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leancloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tianyong Tang
@@ -80,6 +80,7 @@ files:
80
80
  - lib/leancloud/initializer.rb
81
81
  - lib/leancloud/installer.rb
82
82
  - lib/leancloud/leanobject.rb
83
+ - lib/leancloud/symbol_dumper.rb
83
84
  - lib/leancloud.rb
84
85
  - bin/leancloud
85
86
  - bin/leancloud_dump_syms