vcpkg_pipeline 0.1.2 → 0.1.3

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: bec9347d6f9cbeb02afb322a7011cc50859d3b489e33a244f4d809ed90594dc3
4
- data.tar.gz: 2e8411883dcc7a7cf7f502ea58dee01490f2711bfca8a182a8bd6c281f8fd1a3
3
+ metadata.gz: 5010aa5bfd34c56e05d6c8a1993d943610c6c1926c751918b1912b8f21e07d4f
4
+ data.tar.gz: 5ae3189936a34d87a5d8ebe3c177f2553f8893d6f7a94dccfcd22b9ebaff8bae
5
5
  SHA512:
6
- metadata.gz: 6199e01e27504350f80a1609973e97e21c2d9d8f8c4c93216750d3f940e5c030768db0e1c50f94033e1087f0e6c9d90a38db1363b81b7411550f52c86ab3c2c1
7
- data.tar.gz: 8cc55c454cdbf12463213a033af6725530560ca7f275e856e302915bb9d581309f17b65a41f86dcefabc150b2d62358e1c214e813805e48ec58798404cc1ab55
6
+ metadata.gz: 8d71c841df08f944b8c1016419b5590112e563a364a216f2bdef2ba35255258249e569763feb179282dc9fe502b9c8daea7c1661c8dfa94c739346d2fd6e9db6
7
+ data.tar.gz: 6b67b01c803d575413e8ce5168b3e4f54ceea1ede43456a3aaec1542b0ed6cff89c7c3388523dda759c00271f408d6b16b4880282bbf2bcda1471679acff7869
@@ -46,12 +46,15 @@ module VPL
46
46
  def distfile_package(output_path = nil)
47
47
  output_path ||= '.'
48
48
  distfile_path = "#{output_path}/#{distfile_name}"
49
- `zip #{distfile_path} #{sources.join(' ')}`
50
- if File.exist? distfile_path
51
- VPL.info("Dist包 打包成功: #{distfile_path}")
52
- else
53
- VPL.error("Dist包 打包失败: #{distfile_path}")
49
+
50
+ zip_sources = []
51
+ @sources.each do |source|
52
+ zip_sources += Dir[source]
54
53
  end
54
+ VPL.info(zip_sources.join('\n'))
55
+ `zip #{distfile_path} #{zip_sources.join(' ')}`
56
+
57
+ VPL.error("Dist包 打包失败: #{distfile_path}") unless File.exist? distfile_path
55
58
  VCPkg.hash(distfile_path)
56
59
  end
57
60
 
@@ -10,10 +10,6 @@ module VCPkg
10
10
  VCPkg::Base.new(path || root)
11
11
  end
12
12
 
13
- def self.root
14
- `echo $VCPKG_ROOT`.sub(/\n/, '')
15
- end
16
-
17
13
  def self.hash(zip_path)
18
14
  `vcpkg hash #{zip_path}`.sub(/\n/, '')
19
15
  end
@@ -24,32 +20,48 @@ module VCPkg
24
20
 
25
21
  # VCPkg::Base
26
22
  class Base
27
- attr_accessor :path
23
+ attr_accessor :path, :git
28
24
 
29
25
  def initialize(path)
30
26
  @path = path
27
+
28
+ @git = Git.open(@path)
31
29
  end
32
30
 
33
31
  def ports
34
32
  "#{@path}/ports"
35
33
  end
36
34
 
35
+ def copy_port(vcport, commit_message)
36
+ name = vcport.vcpkg.name
37
+
38
+ `cp #{vcport.port_path}/* #{ports}/#{name}`
39
+ @git.add('.')
40
+ @git.commit(commit_message)
41
+ end
42
+
43
+ def add_version(vcport, commit_message)
44
+ name = vcport.vcpkg.name
45
+
46
+ `vcpkg x-add-version #{name} --vcpkg-root=#{@path}`
47
+ @git.add('.')
48
+ @git.commit(commit_message, amend: true)
49
+ end
50
+
37
51
  def publish(vcport)
38
52
  name = vcport.vcpkg.name
39
- version = vcport.vcpkg.version
40
53
 
41
- git_vcpkg = Git.open(@path)
54
+ @git.quick_stash('保存之前的修改')
42
55
 
43
- git_vcpkg.quick_stash('保存之前的修改')
56
+ port_exist = File.directory? "#{@path}/ports/#{name}"
57
+ `mkdir -p #{@path}/ports/#{name}` unless port_exist
44
58
 
45
- port_exist = File.directory? "#{VCPkg.root}/ports/#{name}"
59
+ commit_message = "[#{name}] #{port_exist ? 'Update' : 'Add'} #{vcport.vcpkg.version}"
46
60
 
47
- `cp -fr #{vcport.port_path} #{ports}/#{name}`
48
- `vcpkg x-add-version #{name} --vcpkg-root=#{@path}`
61
+ copy_port(vcport, commit_message)
62
+ add_version(vcport, commit_message)
49
63
 
50
- git_vcpkg.add('.')
51
- git_vcpkg.commit("[#{name}] #{port_exist ? 'Update' : 'Add'} #{version}")
52
- git_vcpkg.quick_push
64
+ @git.quick_push
53
65
  end
54
66
  end
55
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vcpkg_pipeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - 郑贤达