specific_install_pixie 0.3.9 → 0.3.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
  SHA256:
3
- metadata.gz: 75d59e543ad54d9a82845bf0fe681d428704c8bbb0543b1949d7c836c2327584
4
- data.tar.gz: 36320b53cb0f1629ef7b9c178f7fe993b36d28f2a4b234763cd2426658d89103
3
+ metadata.gz: '059cd647bf09c13b6b127678fe4c50605ced85d3cb9539448d37c703b766118f'
4
+ data.tar.gz: 62b91381b30f1c62e0f24a81271a80a7fc950753b9eb8e8ac9f0a3962056ae35
5
5
  SHA512:
6
- metadata.gz: 30fea7ca9f1265da4a35c37312366017fe567d93a8e1e9baa649514222e4d8d6281bf24472a0a308e4a47b49bbbc4e31006b34eed1f1dbe6c03ddb1cf99194c5
7
- data.tar.gz: aad222c9f941d1dbbbcbff330bf0db0823be53a27f565964c3c0309e6516703bd8086dbab8dfe1697d0146b6c7f7c87a7e3a3a3e998360109757d8be0d5c4adc
6
+ metadata.gz: 43c9babc084a170c3032e204d975e486a680ff4ac3456b69bdd0c1da22c48d5c94f75a47b79425638cf8051e3d22a7f9dc78123d42c4c08652f248a612a8f021
7
+ data.tar.gz: d66a471ebc98d0a5d4051b257aabb87004e63a2c8275a2312d9370b8147e68c3f33325789fd16d87458b14bc715e36f52ef7fd1f07cb728aa0125f9b0df4ae31
data/.gitignore CHANGED
@@ -6,3 +6,4 @@ pkg
6
6
  .bundle
7
7
  coverage/
8
8
  coverage.vim
9
+ .idea
@@ -43,8 +43,8 @@ class Gem::Commands::SpecificInstallPixieCommand < Gem::Command
43
43
 
44
44
  def arguments
45
45
  "LOCATION like http://github.com/rdp/ruby_tutorials_core or git://github.com/rdp/ruby_tutorials_core.git or http://host/gem_name.gem\n" +
46
- "BRANCH (optional) like beta, or new-feature\n" +
47
- "DIRECTORY (optional) This will change the directory in the downloaded source directory before building the gem."
46
+ "BRANCH (optional) like beta, or new-feature\n" +
47
+ "DIRECTORY (optional) This will change the directory in the downloaded source directory before building the gem."
48
48
  end
49
49
 
50
50
  def usage
@@ -101,7 +101,7 @@ class Gem::Commands::SpecificInstallPixieCommand < Gem::Command
101
101
  install_shorthand
102
102
  else
103
103
  warn 'Error: must end with .git to be a git repository' +
104
- 'or be in shorthand form: rdp/specific_install'
104
+ 'or be in shorthand form: rdp/specific_install'
105
105
  end
106
106
  end
107
107
 
@@ -215,7 +215,15 @@ class Gem::Commands::SpecificInstallPixieCommand < Gem::Command
215
215
  install_options[:install_dir] = options[:installdir] if options[:installdir]
216
216
  install_options[:force] = true
217
217
  inst = Gem::DependencyInstaller.new install_options
218
- inst.install gem
218
+ installed_gems = inst.install gem
219
+ installed_gem = inst.installed_gems[0]
220
+ # 如果是安装 tpod,则自动 source 自动补全脚本
221
+ if installed_gem.name == 'tpod'
222
+ installed_path = installed_gem.full_gem_path
223
+ auto_complete_script_path = "#{installed_path}/lib/tpod/Resources/tpod_completion.sh"
224
+ source_tpod_auto_complete(auto_complete_script_path)
225
+ end
226
+ return installed_gems
219
227
  else
220
228
  nil
221
229
  end
@@ -273,6 +281,39 @@ class Gem::Commands::SpecificInstallPixieCommand < Gem::Command
273
281
  subdir !~ DOTDOT_REGEX &&
274
282
  subdir !~ ABS_REGEX
275
283
  end
284
+
285
+
286
+ # source 脚本到 ~/.zshrc
287
+ def source_tpod_auto_complete(tpod_auto_complete_script_path)
288
+ unless File.exist?(tpod_auto_complete_script_path)
289
+ puts("\033[0;31m%s\033[0m" % "未找到 #{tpod_auto_complete_script_path} 文件,将不会自动 source tpod 自动补全脚本")
290
+ return
291
+ end
292
+ zsh_rc_path = '~/.zshrc'
293
+ source_tpod_str = "source #{tpod_auto_complete_script_path}"
294
+ res = system("chmod +x #{tpod_auto_complete_script_path}")
295
+ puts("执行: chmod +x #{tpod_auto_complete_script_path} 结果:#{res}")
296
+ check_and_add_source_tpod(zsh_rc_path, source_tpod_str)
297
+ end
298
+
299
+ # source 脚本到 file_path
300
+ def check_and_add_source_tpod(file_path, string_to_check)
301
+ expanded_path = File.expand_path(file_path)
302
+ unless File.exist?(expanded_path)
303
+ puts("\033[0;31m%s\033[0m" % "未找到 #{expanded_path} 文件,将不会自动 source tpod 自动补全脚本")
304
+ return
305
+ end
306
+ file_contents = File.read(expanded_path)
307
+
308
+ if file_contents.include?(string_to_check)
309
+ puts "tpod 自动补全脚本已正确 source 到 #{file_path},可以使用 tpod 命令自动补全了!"
310
+ else
311
+ File.open(expanded_path, 'a') do |file|
312
+ file.puts(string_to_check)
313
+ end
314
+ puts "tpod 自动补全脚本已 source 到 #{file_path},现在可以使用 tpod 命令自动补全了!"
315
+ end
316
+ end
276
317
  end
277
318
 
278
319
  class Gem::Commands::GitInstallPixieCommand < Gem::Commands::SpecificInstallPixieCommand
@@ -1,3 +1,3 @@
1
1
  module SpecificInstallPixie
2
- VERSION = "0.3.9"
2
+ VERSION = "0.3.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specific_install_pixie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roger Pack
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-12-27 00:00:00.000000000 Z
12
+ date: 2025-01-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec