isource_lldb 0.1.0 → 0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91588e08ebef26200f1ae981deadafa8bd5823b53c1bbef3c47651c9fae88d16
4
- data.tar.gz: 999e74c5efa57d410d97d72c4b8a790f73d072abd104f926144125b75057fa87
3
+ metadata.gz: 350bb3cb242d59576d8b1a8868a40a8093b5cd488bb7a250e7877aeee4d55624
4
+ data.tar.gz: 83998de347dcda804d05454b7f4ddc4a0e5d9355678af3335e643353a94b360c
5
5
  SHA512:
6
- metadata.gz: 37cf8bbe14bee4216eeee88866b301bb8dd788bd17bebc9d34bee0ab09f5feb11b65d00712f75868b0296f518eba798bb7679c7b2f38561f629145b0ecaeca58
7
- data.tar.gz: 5e787a8130bd72b5dc7fe8145a39392ce30c3d476db68952d0965f648e9b02a0dac8720ea832ca04ceb8bd3b157bc353aad40526ac6b2134150223108b73a8ca
6
+ metadata.gz: 305618a1d006bac0fa528f9e7940ce6151858532f084d0277a7264c3a6134b51a124ba3f6844b39da36d2ecaf92ca04f533fb8d9315467cb63217b74f176388c
7
+ data.tar.gz: 39d3ec1016e4887852bf50fcdeb84f48478cd1e653db1c26e49cbbe1c4d0df14982cffdbfa742391c934da697e464abeec23b3b0078e6085570f49f1b13e6b99
@@ -2,10 +2,16 @@
2
2
  require 'pathname'
3
3
 
4
4
  Lldb_init_path = File.expand_path('~')+'/.lldbinit'
5
+ Lldb_init_path_temp = File.expand_path('~')+'/.lldbinit_temp'
5
6
  Lldb_source_path = File.expand_path('~')+'/.isource_lldb'
6
7
  Lldb_file_path = File.expand_path('~')+'/.isource_lldb/isource_lldb.py'
7
8
  Commond_str = 'command script import '+Lldb_file_path
8
9
 
10
+
11
+ Gem.pre_install do
12
+ `PATH="\`ruby -e 'puts Gem.user_dir'\`/bin:$PATH"`
13
+ end
14
+
9
15
  Gem.post_install do
10
16
 
11
17
  # 配置 .lldbinit
@@ -37,8 +43,51 @@ Gem.post_install do
37
43
  end
38
44
  File.chmod(0775,Lldb_source_path)
39
45
  scriptPath = File.dirname(Pathname.new(__FILE__).realpath)
40
- File.rename scriptPath+'/setup.i', Lldb_file_path
46
+ File.rename scriptPath+'/setup', Lldb_file_path
41
47
  File.chmod(0775,Lldb_file_path)
42
48
 
43
49
  puts "Please use the isource command in your Xcode LLDB."
44
50
  end
51
+
52
+ def remove_dir(path)
53
+ if File.directory?(path)
54
+ Dir.foreach(path) do |file|
55
+ if ((file.to_s != ".") and (file.to_s != ".."))
56
+ remove_dir("#{path}/#{file}")
57
+ end
58
+ end
59
+ Dir.delete(path)
60
+ else
61
+ File.delete(path)
62
+ end
63
+ end
64
+
65
+ def remove_file()
66
+ f_temp = File.new(Lldb_init_path_temp,"w")
67
+ f = File.new(Lldb_init_path, 'r')
68
+ f.each do |line|
69
+ if !line.chomp.include?Commond_str
70
+ f_temp.puts line
71
+ end
72
+ end
73
+ f.close
74
+ f_temp.close
75
+
76
+ File.delete(Lldb_init_path)
77
+ File.rename Lldb_init_path_temp, Lldb_init_path
78
+ File.chmod(0664,Lldb_init_path)
79
+
80
+ end
81
+
82
+ Gem.post_uninstall do
83
+ if File.exist?(Lldb_source_path)
84
+ remove_dir(Lldb_source_path)
85
+ end
86
+
87
+ if File.exist?(Lldb_init_path)
88
+ remove_file()
89
+ end
90
+
91
+
92
+ end
93
+
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isource_lldb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ningyuan
@@ -18,7 +18,7 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - lib/rubygems_plugin.rb
21
- - lib/setup.i
21
+ - lib/setup
22
22
  homepage: https://github.com/Jeremi-LZ/isource_lldb
23
23
  licenses:
24
24
  - MIT