Class: VCPkg::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/vcpkg_pipeline/extension/vcpkg_vpl.rb

Overview

VCPkg::Base

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Base

Returns a new instance of Base.



29
30
31
# File 'lib/vcpkg_pipeline/extension/vcpkg_vpl.rb', line 29

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



27
28
29
# File 'lib/vcpkg_pipeline/extension/vcpkg_vpl.rb', line 27

def path
  @path
end

Instance Method Details

#portsObject



33
34
35
# File 'lib/vcpkg_pipeline/extension/vcpkg_vpl.rb', line 33

def ports
  "#{@path}/ports"
end

#publish(vcport) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/vcpkg_pipeline/extension/vcpkg_vpl.rb', line 37

def publish(vcport)
  name = vcport.vcpkg.name
  version = vcport.vcpkg.version

  git_vcpkg = Git.open(@path)

  git_vcpkg.quick_stash('保存之前的修改')

  port_exist = File.directory? "#{VCPkg.root}/ports/#{name}"

  `cp -fr #{vcport.port_path} #{ports}/#{name}`
  `vcpkg x-add-version #{name} --vcpkg-root=#{@path}`

  git_vcpkg.add('.')
  git_vcpkg.commit("[#{name}] #{port_exist ? 'Update' : 'Add'} #{version}")
  git_vcpkg.quick_push
end