vcpkg_pipeline 0.1.3 → 0.1.4

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
  SHA256:
3
- metadata.gz: 5010aa5bfd34c56e05d6c8a1993d943610c6c1926c751918b1912b8f21e07d4f
4
- data.tar.gz: 5ae3189936a34d87a5d8ebe3c177f2553f8893d6f7a94dccfcd22b9ebaff8bae
3
+ metadata.gz: a83fd1758201558e655fe32d360ee002c627b400335669f07e800586fd26e5ed
4
+ data.tar.gz: 8343c0d5f8632597ecf0c1a9467ce9919f69e5404e0b4e0cf0130358b49db126
5
5
  SHA512:
6
- metadata.gz: 8d71c841df08f944b8c1016419b5590112e563a364a216f2bdef2ba35255258249e569763feb179282dc9fe502b9c8daea7c1661c8dfa94c739346d2fd6e9db6
7
- data.tar.gz: 6b67b01c803d575413e8ce5168b3e4f54ceea1ede43456a3aaec1542b0ed6cff89c7c3388523dda759c00271f408d6b16b4880282bbf2bcda1471679acff7869
6
+ metadata.gz: 507b8233aa0555f23819573f57f5baf0680d6c2cbc27672e7d2f2b54b65a817b0495abff134531ea88479ff28dd1a8f7203380abb80f64a42348c85fc445aa55
7
+ data.tar.gz: 74009f7ff89ec979f9ba610c15a32438931ddb0cce3660866c2d1d23dfac403b349164fbf6a9888a288032e96eb0a05d63256161f7c8d6c3649541dd1694b436
@@ -23,13 +23,13 @@ module VPL
23
23
 
24
24
  def self.options
25
25
  [
26
- '--template-url=https://github.com/TKCMake/vcport-template.git',
27
- 'vcport模版地址'
26
+ ['--template-url=https://github.com/TKCMake/vcport-template.git', 'vcport模版地址']
28
27
  ].concat(super).concat(options_extension)
29
28
  end
30
29
 
31
30
  def initialize(argv)
32
- @name = argv.shift_argument
31
+ @name = argv.shift_argument || ''
32
+
33
33
  VPL.error('未输入port名称') if @name.empty?
34
34
 
35
35
  @template = argv.option('template-url', '').split(',').first
@@ -37,13 +37,16 @@ module VPL
37
37
  super
38
38
  end
39
39
 
40
- def run
41
- Git.clone(@template, @name, depth: 1)
42
-
43
- replacements = {
40
+ def replacements
41
+ {
44
42
  'PT_PORT_NAME' => @name,
45
43
  'PT_USER_NAME' => Git.global_config('user.name')
46
44
  }
45
+ end
46
+
47
+ def run
48
+ Git.clone(@template, @name, depth: 1)
49
+
47
50
  Dir.replace_all(@name, replacements)
48
51
 
49
52
  git = Git.open(@name)
@@ -21,7 +21,7 @@ module VPL
21
21
  ]
22
22
  def self.options
23
23
  [
24
- ['--registry=.', '指定vcpkg的registry目录, 不可为空']
24
+ ['--reg=.', '指定vcpkg的reg目录, 不可为空']
25
25
  ].concat(super).concat(options_extension)
26
26
  end
27
27
 
@@ -34,18 +34,18 @@ module VPL
34
34
  def initialize(argv)
35
35
  @path = argv.shift_argument || Dir.pwd
36
36
 
37
- @registry = argv.option('registry', '').split(',').first
37
+ @reg = argv.option('reg', '').split(',').first
38
38
  super
39
39
  end
40
40
 
41
41
  def run
42
- VPL.error("registry目录异常: #{@registry}") unless File.directory? @registry
42
+ VPL.error("reg目录异常: #{@reg}") unless File.directory? @reg
43
43
 
44
44
  Update::All.run([@path] + argv_extension['update'])
45
45
 
46
46
  scanner = Scanner.new(@path)
47
47
 
48
- vcpkg = VCPkg.open(@registry)
48
+ vcpkg = VCPkg.open(@reg)
49
49
  vcpkg.publish(scanner.vcport)
50
50
  end
51
51
  end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vcpkg_pipeline/core/register'
4
+
5
+ module VPL
6
+ class Command
7
+ class Reg < Command
8
+ # VPL::Command::Reg::Add
9
+ class Add < Reg
10
+ self.summary = '添加新的注册表'
11
+
12
+ self.description = <<-DESC
13
+ 添加新的注册表。
14
+ DESC
15
+
16
+ self.arguments = [
17
+ CLAide::Argument.new('注册表名称', true),
18
+ CLAide::Argument.new('注册表地址', true)
19
+ ]
20
+
21
+ def self.options
22
+ [].concat(super)
23
+ end
24
+
25
+ def initialize(argv)
26
+ @name = argv.shift_argument || ''
27
+ @url = argv.shift_argument || ''
28
+
29
+ VPL.error('未输入注册表名称') if @name.empty?
30
+ VPL.error('未输入注册表地址') if @url.empty?
31
+
32
+ super
33
+ end
34
+
35
+ def run
36
+ Register.new.add(@name, @url)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vcpkg_pipeline/core/register'
4
+
5
+ module VPL
6
+ class Command
7
+ class Reg < Command
8
+ # VPL::Command::Reg::List
9
+ class List < Reg
10
+ self.summary = '查看现有注册表'
11
+
12
+ self.description = <<-DESC
13
+ 查看现有注册表。
14
+ DESC
15
+
16
+ self.arguments = []
17
+
18
+ def self.options
19
+ [].concat(super)
20
+ end
21
+
22
+ def run
23
+ Register.new.list
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vcpkg_pipeline/core/register'
4
+
5
+ module VPL
6
+ class Command
7
+ class Reg < Command
8
+ # VPL::Command::Reg::Remove
9
+ class Remove < Reg
10
+ self.summary = '移除指定注册表'
11
+
12
+ self.description = <<-DESC
13
+ 移除指定注册表。
14
+ DESC
15
+
16
+ self.arguments = [
17
+ CLAide::Argument.new('注册表名称', true)
18
+ ]
19
+
20
+ def self.options
21
+ [].concat(super)
22
+ end
23
+
24
+ def initialize(argv)
25
+ @name = argv.shift_argument || ''
26
+
27
+ VPL.error('未输入注册表名称') if @name.empty?
28
+
29
+ super
30
+ end
31
+
32
+ def run
33
+ Register.new.remove(@name)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vcpkg_pipeline/core/log'
4
+ require 'vcpkg_pipeline/core/register'
5
+
6
+ require 'vcpkg_pipeline/command/reg/list'
7
+ require 'vcpkg_pipeline/command/reg/add'
8
+ require 'vcpkg_pipeline/command/reg/remove'
9
+
10
+ module VPL
11
+ # Command
12
+ class Command
13
+ # VPL::Command::Reg
14
+ class Reg < Command
15
+ self.abstract_command = true
16
+
17
+ self.summary = '注册表管理'
18
+ self.description = <<-DESC
19
+ 注册表添加、移除、展示
20
+ DESC
21
+ end
22
+ end
23
+ end
@@ -9,6 +9,7 @@ module VPL
9
9
  require 'vcpkg_pipeline/command/scan'
10
10
  require 'vcpkg_pipeline/command/update'
11
11
  require 'vcpkg_pipeline/command/publish'
12
+ require 'vcpkg_pipeline/command/reg'
12
13
 
13
14
  self.abstract_command = true
14
15
  self.command = 'vpl'
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'git'
4
+
5
+ require 'vcpkg_pipeline/core/log'
6
+
7
+ module VPL
8
+ # VPL::Register
9
+ class Register
10
+ def registeries
11
+ path = "#{ENV['HOME']}/.vpl/registries"
12
+ `mkdir -p #{path}` unless File.directory? path
13
+ path
14
+ end
15
+
16
+ def list
17
+ Dir["#{registeries}/*"].each do |reg|
18
+ git = Git.open(reg)
19
+ name = File.basename(reg)
20
+ url = git.remote.url
21
+ path = reg
22
+
23
+ VPL.info("#{name}")
24
+ puts "- URL:\t#{url}"
25
+ puts "- Path:\t#{path}"
26
+ puts "\n"
27
+ end
28
+ end
29
+
30
+ def exist(name)
31
+ is_exist = false
32
+ Dir["#{registeries}/*"].each do |reg|
33
+ is_exist = name.eql? File.basename(reg)
34
+ break if is_exist
35
+ end
36
+ is_exist
37
+ end
38
+
39
+ def add(name, url)
40
+ suffix = 0
41
+ while exist(name)
42
+ suffix += 1
43
+ name = "#{name}-#{suffix}"
44
+ end
45
+
46
+ Git.clone(url, "#{registeries}/#{name}")
47
+ end
48
+
49
+ def remove(name)
50
+ Dir["#{registeries}/*"].each do |reg|
51
+ `rm -fr #{reg}` if name.eql? File.basename(reg)
52
+ end
53
+ end
54
+ end
55
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vcpkg_pipeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - 郑贤达
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-22 00:00:00.000000000 Z
11
+ date: 2022-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide
@@ -82,6 +82,10 @@ files:
82
82
  - lib/vcpkg_pipeline/command.rb
83
83
  - lib/vcpkg_pipeline/command/new.rb
84
84
  - lib/vcpkg_pipeline/command/publish.rb
85
+ - lib/vcpkg_pipeline/command/reg.rb
86
+ - lib/vcpkg_pipeline/command/reg/add.rb
87
+ - lib/vcpkg_pipeline/command/reg/list.rb
88
+ - lib/vcpkg_pipeline/command/reg/remove.rb
85
89
  - lib/vcpkg_pipeline/command/scan.rb
86
90
  - lib/vcpkg_pipeline/command/scan/all.rb
87
91
  - lib/vcpkg_pipeline/command/scan/branch.rb
@@ -95,6 +99,7 @@ files:
95
99
  - lib/vcpkg_pipeline/command/update/spec.rb
96
100
  - lib/vcpkg_pipeline/command/update/vcport.rb
97
101
  - lib/vcpkg_pipeline/core/log.rb
102
+ - lib/vcpkg_pipeline/core/register.rb
98
103
  - lib/vcpkg_pipeline/core/scanner.rb
99
104
  - lib/vcpkg_pipeline/core/spec.rb
100
105
  - lib/vcpkg_pipeline/core/updater.rb
@@ -104,7 +109,7 @@ files:
104
109
  - lib/vcpkg_pipeline/extension/string_vpl.rb
105
110
  - lib/vcpkg_pipeline/extension/vcpkg_vpl.rb
106
111
  - lib/vcpkg_pipeline/extension/vcport_vpl.rb
107
- homepage: https://github.com/TokiGems/vcpkg_pipeline
112
+ homepage: https://github.com/TokiGems/vcpkg-pipeline
108
113
  licenses:
109
114
  - MIT
110
115
  metadata: {}