Class: VCPkg::Base
- Inherits:
-
Object
- Object
- VCPkg::Base
- Defined in:
- lib/vcpkg_pipeline/extension/vcpkg_vpl.rb
Overview
VCPkg::Base
Instance Attribute Summary collapse
-
#git ⇒ Object
Returns the value of attribute git.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #add_version(vcport, commit_message) ⇒ Object
- #copy_port(vcport, commit_message) ⇒ Object
-
#initialize(path) ⇒ Base
constructor
A new instance of Base.
- #ports ⇒ Object
- #publish(vcport) ⇒ Object
Constructor Details
Instance Attribute Details
#git ⇒ Object
Returns the value of attribute git.
23 24 25 |
# File 'lib/vcpkg_pipeline/extension/vcpkg_vpl.rb', line 23 def git @git end |
#path ⇒ Object
Returns the value of attribute path.
23 24 25 |
# File 'lib/vcpkg_pipeline/extension/vcpkg_vpl.rb', line 23 def path @path end |
Instance Method Details
#add_version(vcport, commit_message) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/vcpkg_pipeline/extension/vcpkg_vpl.rb', line 43 def add_version(vcport, ) name = vcport.vcpkg.name `vcpkg x-add-version #{name} --vcpkg-root=#{@path}` @git.add('.') @git.commit(, amend: true) end |
#copy_port(vcport, commit_message) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/vcpkg_pipeline/extension/vcpkg_vpl.rb', line 35 def copy_port(vcport, ) name = vcport.vcpkg.name `cp #{vcport.port_path}/* #{ports}/#{name}` @git.add('.') @git.commit() end |
#ports ⇒ Object
31 32 33 |
# File 'lib/vcpkg_pipeline/extension/vcpkg_vpl.rb', line 31 def ports "#{@path}/ports" end |
#publish(vcport) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/vcpkg_pipeline/extension/vcpkg_vpl.rb', line 51 def publish(vcport) name = vcport.vcpkg.name @git.quick_stash('保存之前的修改') port_exist = File.directory? "#{@path}/ports/#{name}" `mkdir -p #{@path}/ports/#{name}` unless port_exist = "[#{name}] #{port_exist ? 'Update' : 'Add'} #{vcport.vcpkg.version}" copy_port(vcport, ) add_version(vcport, ) @git.quick_push end |