Class: VPL::Updater

Inherits:
Object
  • Object
show all
Defined in:
lib/vcpkg_pipeline/core/updater.rb

Overview

VPL::Updater

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Updater

Returns a new instance of Updater.



12
13
14
15
# File 'lib/vcpkg_pipeline/core/updater.rb', line 12

def initialize(path)
  @path = path
  @scanner = Scanner.new(path)
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



10
11
12
# File 'lib/vcpkg_pipeline/core/updater.rb', line 10

def path
  @path
end

#scannerObject

Returns the value of attribute scanner.



10
11
12
# File 'lib/vcpkg_pipeline/core/updater.rb', line 10

def scanner
  @scanner
end

Instance Method Details

#update_all(version = nil, output_path = nil) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/vcpkg_pipeline/core/updater.rb', line 54

def update_all(version = nil, output_path = nil)
  @scanner.git.reset

  update_spec(version)
  @scanner.git.add('*.vplspec')
  update_cmake
  @scanner.git.add('CMakeLists.txt')
  update_vcport(output_path)
  @scanner.git.add('vcport')

  @scanner.git.commit(@scanner.cmake.version)

  update_git
end

#update_cmakeObject



22
23
24
25
26
# File 'lib/vcpkg_pipeline/core/updater.rb', line 22

def update_cmake
  @scanner.cmake.version_update(
    @scanner.spec.version
  )
end

#update_gitObject



48
49
50
51
52
# File 'lib/vcpkg_pipeline/core/updater.rb', line 48

def update_git
  @scanner.git.quick_push(
    @scanner.spec.version
  )
end

#update_spec(version = nil) ⇒ Object



17
18
19
20
# File 'lib/vcpkg_pipeline/core/updater.rb', line 17

def update_spec(version = nil)
  @scanner.spec.version_update(version)
  @scanner.scan_spec
end

#update_vcport(output_path = nil) ⇒ Object



43
44
45
46
# File 'lib/vcpkg_pipeline/core/updater.rb', line 43

def update_vcport(output_path = nil)
  update_vcport_vcpkg
  update_vcport_portfile(output_path)
end

#update_vcport_portfile(output_path = nil) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/vcpkg_pipeline/core/updater.rb', line 34

def update_vcport_portfile(output_path = nil)
  distfile_hash = @scanner.spec.distfile_package(output_path)
  @scanner.vcport.portfile.download_distfile_update(
    @scanner.spec.disturl,
    @scanner.spec.distfile_name,
    distfile_hash
  )
end

#update_vcport_vcpkgObject



28
29
30
31
32
# File 'lib/vcpkg_pipeline/core/updater.rb', line 28

def update_vcport_vcpkg
  vcpkg = @scanner.vcport.vcpkg
  vcpkg.version_update(@scanner.spec.version)
  VCPkg.format(vcpkg.content_path)
end