vcpkg_pipeline 0.1.0 → 0.1.2

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: 5cc2e64a36ee7d26974d7d9a0fe558aef0912e2d8164cc173eeb45e253ba73c5
4
- data.tar.gz: 2db353e8a206c29dc3229d548b7cb502b12e6611dc7286146744af279472a079
3
+ metadata.gz: bec9347d6f9cbeb02afb322a7011cc50859d3b489e33a244f4d809ed90594dc3
4
+ data.tar.gz: 2e8411883dcc7a7cf7f502ea58dee01490f2711bfca8a182a8bd6c281f8fd1a3
5
5
  SHA512:
6
- metadata.gz: ec12ab0a8d6ff34e70a747a13ef87c09d22a1b55cfd9db23e6512f57d761393bdc2c83150bdc50da51543c6f97b84ffe2a71e964a783cb47bf8e6f7f6996cdb7
7
- data.tar.gz: 360c1fbb0f5f53e34707ab915f1a651a5e908a08b9c762dd1719770344c5118b5b586758760236ed952ed9adb9ba23137891a11deba371a53da241584bfe2ebd
6
+ metadata.gz: 6199e01e27504350f80a1609973e97e21c2d9d8f8c4c93216750d3f940e5c030768db0e1c50f94033e1087f0e6c9d90a38db1363b81b7411550f52c86ab3c2c1
7
+ data.tar.gz: 8cc55c454cdbf12463213a033af6725530560ca7f275e856e302915bb9d581309f17b65a41f86dcefabc150b2d62358e1c214e813805e48ec58798404cc1ab55
@@ -2,9 +2,11 @@
2
2
 
3
3
  require 'vcpkg_pipeline/extension/vcpkg_vpl'
4
4
 
5
+ require 'vcpkg_pipeline/core/log'
5
6
  require 'vcpkg_pipeline/core/scanner'
6
7
 
7
8
  require 'vcpkg_pipeline/command/update'
9
+ require 'vcpkg_pipeline/command/update/all'
8
10
 
9
11
  module VPL
10
12
  class Command
@@ -18,27 +20,33 @@ module VPL
18
20
  CLAide::Argument.new('项目根目录(默认使用当前目录)', false)
19
21
  ]
20
22
  def self.options
21
- [].concat(super).concat(options_extension)
23
+ [
24
+ ['--registry=.', '指定vcpkg的registry目录, 不可为空']
25
+ ].concat(super).concat(options_extension)
22
26
  end
23
27
 
24
28
  def self.options_extension_hash
25
29
  Hash[
26
- 'update' => Update.options,
30
+ 'update' => Update::All.options,
27
31
  ]
28
32
  end
29
33
 
30
34
  def initialize(argv)
31
35
  @path = argv.shift_argument || Dir.pwd
32
36
 
37
+ @registry = argv.option('registry', '').split(',').first
33
38
  super
34
39
  end
35
40
 
36
41
  def run
42
+ VPL.error("registry目录异常: #{@registry}") unless File.directory? @registry
43
+
37
44
  Update::All.run([@path] + argv_extension['update'])
38
45
 
39
46
  scanner = Scanner.new(@path)
40
47
 
41
- VCPkg.publish(scanner.vcport)
48
+ vcpkg = VCPkg.open(@registry)
49
+ vcpkg.publish(scanner.vcport)
42
50
  end
43
51
  end
44
52
  end
@@ -30,7 +30,7 @@ module VPL
30
30
  def run
31
31
  scanner = Scanner.new(@path)
32
32
 
33
- VPL.info("Release: #{ENV['Release'] ? true : false}")
33
+ VPL.info("Debug: #{ENV['Debug'] ? true : false}")
34
34
  VPL.info("Git: #{scanner.git}")
35
35
  VPL.info("CMake: #{scanner.cmake}")
36
36
  VPL.info("VCPort: #{scanner.vcport}")
@@ -10,7 +10,7 @@ module VPL
10
10
  self.summary = '更新项目内容'
11
11
 
12
12
  self.description = <<-DESC
13
- 更新项目CMake、VCPort、Git Tag内容。
13
+ 更新项目Spec、CMake、VCPort、Git Tag内容。
14
14
  DESC
15
15
 
16
16
  self.arguments = [
@@ -19,7 +19,9 @@ module VPL
19
19
  ]
20
20
 
21
21
  def self.options
22
- [].concat(super)
22
+ [
23
+ ['--version=x.x.x', '新版本号。(默认使用patch+1)']
24
+ ].concat(super)
23
25
  end
24
26
 
25
27
  def initialize(argv)
@@ -18,7 +18,9 @@ module VPL
18
18
  ]
19
19
 
20
20
  def self.options
21
- [].concat(super)
21
+ [
22
+ ['--output=./', '项目打包的输出目录。(默认使用项目 根目录/build)']
23
+ ].concat(super)
22
24
  end
23
25
 
24
26
  def initialize(argv)
@@ -2,11 +2,11 @@
2
2
 
3
3
  require 'vcpkg_pipeline/core/updater'
4
4
 
5
- require 'vcpkg_pipeline/command/update/all'
6
5
  require 'vcpkg_pipeline/command/update/spec'
7
6
  require 'vcpkg_pipeline/command/update/cmake'
8
7
  require 'vcpkg_pipeline/command/update/vcport'
9
8
  require 'vcpkg_pipeline/command/update/git'
9
+ require 'vcpkg_pipeline/command/update/all'
10
10
 
11
11
  module VPL
12
12
  class Command
@@ -11,22 +11,28 @@ module Git
11
11
  branches.current.first
12
12
  end
13
13
 
14
- def quick_push_tag(has_tag)
15
- push(remote, current_branch, has_tag)
16
- VPL.info("Git上传 #{remote} #{current_branch} #{new_version}")
14
+ def quick_push_tag(new_tag = nil)
15
+ unless ENV['Debug']
16
+ has_tag = !new_tag.nil?
17
+ push(remote, current_branch, has_tag)
18
+ end
19
+ VPL.info("Git上传 #{remote} #{current_branch} #{new_tag}")
17
20
  end
18
21
 
19
22
  def quick_push(new_tag = nil)
20
- return unless ENV['Release']
21
-
22
- has_tag = !new_tag.empty?
23
+ has_tag = !new_tag.nil?
23
24
  if has_tag
24
25
  tags.each { |tag| VPL.error("当前版本 #{new_tag} 已发布, 请尝试其他版本号") if tag.name.eql? new_tag }
25
26
 
26
27
  add_tag(new_tag)
27
28
  VPL.info("Git提交Tag: #{new_tag}")
28
29
  end
29
- quick_push_tag(has_tag)
30
+ quick_push_tag(new_tag)
31
+ end
32
+
33
+ def quick_stash(msg)
34
+ add('.')
35
+ branch.stashes.save(msg)
30
36
  end
31
37
 
32
38
  def to_s
@@ -6,12 +6,12 @@ require 'vcpkg_pipeline/core/log'
6
6
 
7
7
  # VCPkg
8
8
  module VCPkg
9
- def self.root
10
- `echo $VCPKG_ROOT`
9
+ def self.open(path = nil)
10
+ VCPkg::Base.new(path || root)
11
11
  end
12
12
 
13
- def self.ports
14
- "#{root}/ports"
13
+ def self.root
14
+ `echo $VCPKG_ROOT`.sub(/\n/, '')
15
15
  end
16
16
 
17
17
  def self.hash(zip_path)
@@ -22,20 +22,34 @@ module VCPkg
22
22
  `vcpkg format-manifest #{vcpkg_json_path}`
23
23
  end
24
24
 
25
- def self.publish(vcport)
26
- name = vcport.vcpkg.name
27
- version = vcport.vcpkg.version
25
+ # VCPkg::Base
26
+ class Base
27
+ attr_accessor :path
28
+
29
+ def initialize(path)
30
+ @path = path
31
+ end
32
+
33
+ def ports
34
+ "#{@path}/ports"
35
+ end
36
+
37
+ def publish(vcport)
38
+ name = vcport.vcpkg.name
39
+ version = vcport.vcpkg.version
40
+
41
+ git_vcpkg = Git.open(@path)
28
42
 
29
- git_vcpkg = Git.open(root)
30
- git_vcpkg.stashes.all
43
+ git_vcpkg.quick_stash('保存之前的修改')
31
44
 
32
- port_exist = File.directory? "#{VCPkg.root}/ports/#{name}"
45
+ port_exist = File.directory? "#{VCPkg.root}/ports/#{name}"
33
46
 
34
- `cp -fr #{vcport.port_path} #{ports}`
35
- `vcpkg x-add-version #{name}`
47
+ `cp -fr #{vcport.port_path} #{ports}/#{name}`
48
+ `vcpkg x-add-version #{name} --vcpkg-root=#{@path}`
36
49
 
37
- git_vcpkg.add('.')
38
- git_vcpkg.commit("[#{name}] #{port_exist ? 'Update' : 'Add'} #{version}")
39
- git_vcpkg.quick_push
50
+ git_vcpkg.add('.')
51
+ git_vcpkg.commit("[#{name}] #{port_exist ? 'Update' : 'Add'} #{version}")
52
+ git_vcpkg.quick_push
53
+ end
40
54
  end
41
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.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - 郑贤达
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-21 00:00:00.000000000 Z
11
+ date: 2022-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: claide
@@ -86,7 +86,6 @@ files:
86
86
  - lib/vcpkg_pipeline/command/scan/all.rb
87
87
  - lib/vcpkg_pipeline/command/scan/branch.rb
88
88
  - lib/vcpkg_pipeline/command/scan/name.rb
89
- - lib/vcpkg_pipeline/command/scan/release.rb
90
89
  - lib/vcpkg_pipeline/command/scan/remote.rb
91
90
  - lib/vcpkg_pipeline/command/scan/version.rb
92
91
  - lib/vcpkg_pipeline/command/update.rb
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'vcpkg_pipeline/core/scanner'
4
-
5
- module VPL
6
- class Command
7
- class Scan < Command
8
- # VPL::Command::Scan::Release
9
- class Release < Scan
10
- self.summary = '输出 Github Release URL'
11
-
12
- self.description = <<-DESC
13
- 输出 Github Release URL。
14
- DESC
15
-
16
- self.arguments = [
17
- CLAide::Argument.new('项目根目录(默认使用当前目录)', false)
18
- ]
19
-
20
- def self.options
21
- [].concat(super)
22
- end
23
-
24
- def initialize(argv)
25
- @path = argv.shift_argument || Dir.pwd
26
-
27
- super
28
- end
29
-
30
- def run
31
- scanner = Scanner.new(@path)
32
-
33
- puts scanner.disturl
34
- end
35
- end
36
- end
37
- end
38
- end