vcpkg_pipeline 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5cc2e64a36ee7d26974d7d9a0fe558aef0912e2d8164cc173eeb45e253ba73c5
4
+ data.tar.gz: 2db353e8a206c29dc3229d548b7cb502b12e6611dc7286146744af279472a079
5
+ SHA512:
6
+ metadata.gz: ec12ab0a8d6ff34e70a747a13ef87c09d22a1b55cfd9db23e6512f57d761393bdc2c83150bdc50da51543c6f97b84ffe2a71e964a783cb47bf8e6f7f6996cdb7
7
+ data.tar.gz: 360c1fbb0f5f53e34707ab915f1a651a5e908a08b9c762dd1719770344c5118b5b586758760236ed952ed9adb9ba23137891a11deba371a53da241584bfe2ebd
data/bin/vpl ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'vcpkg_pipeline'
6
+
7
+ if Encoding.default_external != Encoding::UTF_8
8
+
9
+ warn <<-DOC
10
+ \e[33m\
11
+ WARNING: vcpkg-Pipeline requires your terminal to be using UTF-8 encoding.
12
+ Consider adding the following to ~/.profile:
13
+
14
+ export LANG=en_US.UTF-8
15
+ \e[0m
16
+ DOC
17
+
18
+ end
19
+
20
+ VPL::Command.run(ARGV)
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'git'
4
+
5
+ require 'vcpkg_pipeline/extension/dir_vpl'
6
+
7
+ require 'vcpkg_pipeline/core/log'
8
+
9
+ module VPL
10
+ class Command
11
+ # VPL::Command::New
12
+ class New < Command
13
+ self.summary = '创建新项目'
14
+
15
+ self.description = <<-DESC
16
+ 根据TokiHunter的最佳实践, 为名为 'NAME' 的新Pod库的开发创建一个脚手架。
17
+ 如果未指定 '--template-url', 默认使用 'https://github.com/TKCMake/vcport-template.git'。
18
+ DESC
19
+
20
+ self.arguments = [
21
+ CLAide::Argument.new('项目名字', true)
22
+ ]
23
+
24
+ def self.options
25
+ [
26
+ '--template-url=https://github.com/TKCMake/vcport-template.git',
27
+ 'vcport模版地址'
28
+ ].concat(super).concat(options_extension)
29
+ end
30
+
31
+ def initialize(argv)
32
+ @name = argv.shift_argument
33
+ VPL.error('未输入port名称') if @name.empty?
34
+
35
+ @template = argv.option('template-url', '').split(',').first
36
+ @template ||= 'https://github.com/TKCMake/vcport-template.git'
37
+ super
38
+ end
39
+
40
+ def run
41
+ Git.clone(@template, @name, depth: 1)
42
+
43
+ replacements = {
44
+ 'PT_PORT_NAME' => @name,
45
+ 'PT_USER_NAME' => Git.global_config('user.name')
46
+ }
47
+ Dir.replace_all(@name, replacements)
48
+
49
+ git = Git.open(@name)
50
+ git.remote.remove
51
+ git.add('.')
52
+ git.commit("init #{@name}", amend: true)
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vcpkg_pipeline/extension/vcpkg_vpl'
4
+
5
+ require 'vcpkg_pipeline/core/scanner'
6
+
7
+ require 'vcpkg_pipeline/command/update'
8
+
9
+ module VPL
10
+ class Command
11
+ # VPL::Command::Publish
12
+ class Publish < Command
13
+ self.summary = '项目发布'
14
+ self.description = <<-DESC
15
+ 整合项目发布流程
16
+ DESC
17
+ self.arguments = [
18
+ CLAide::Argument.new('项目根目录(默认使用当前目录)', false)
19
+ ]
20
+ def self.options
21
+ [].concat(super).concat(options_extension)
22
+ end
23
+
24
+ def self.options_extension_hash
25
+ Hash[
26
+ 'update' => Update.options,
27
+ ]
28
+ end
29
+
30
+ def initialize(argv)
31
+ @path = argv.shift_argument || Dir.pwd
32
+
33
+ super
34
+ end
35
+
36
+ def run
37
+ Update::All.run([@path] + argv_extension['update'])
38
+
39
+ scanner = Scanner.new(@path)
40
+
41
+ VCPkg.publish(scanner.vcport)
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,42 @@
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::All
9
+ class All < Scan
10
+ self.summary = '输出项目完整信息'
11
+
12
+ self.description = <<-DESC
13
+ 输出项目完整信息。
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
+ VPL.info("Release: #{ENV['Release'] ? true : false}")
34
+ VPL.info("Git: #{scanner.git}")
35
+ VPL.info("CMake: #{scanner.cmake}")
36
+ VPL.info("VCPort: #{scanner.vcport}")
37
+ VPL.info("Spec: #{scanner.spec}")
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,38 @@
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::Branch
9
+ class Branch < Scan
10
+ self.summary = '输出 Git Branch'
11
+
12
+ self.description = <<-DESC
13
+ 输出 Git Branch。
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.git.branches.current.first
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,38 @@
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::Name
9
+ class Name < Scan
10
+ self.summary = '输出 CMake Name'
11
+
12
+ self.description = <<-DESC
13
+ 输出 CMake Name。
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.cmake.name
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,38 @@
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
@@ -0,0 +1,38 @@
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::Remote
9
+ class Remote < Scan
10
+ self.summary = '输出 Git Remote'
11
+
12
+ self.description = <<-DESC
13
+ 输出 Git Remote。
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.git.remote
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,38 @@
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::Version
9
+ class Version < Scan
10
+ self.summary = '输出 CMake Version'
11
+
12
+ self.description = <<-DESC
13
+ 输出 CMake Version。
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.spec.version
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vcpkg_pipeline/core/log'
4
+ require 'vcpkg_pipeline/core/scanner'
5
+
6
+ require 'vcpkg_pipeline/command/scan/all'
7
+ require 'vcpkg_pipeline/command/scan/name'
8
+ require 'vcpkg_pipeline/command/scan/version'
9
+ require 'vcpkg_pipeline/command/scan/remote'
10
+ require 'vcpkg_pipeline/command/scan/branch'
11
+
12
+ module VPL
13
+ # Command
14
+ class Command
15
+ # VPL::Command::Scan
16
+ class Scan < Command
17
+ self.abstract_command = true
18
+
19
+ self.summary = '项目扫描'
20
+ self.description = <<-DESC
21
+ 获取项目的关键参数
22
+ DESC
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vcpkg_pipeline/core/updater'
4
+
5
+ module VPL
6
+ class Command
7
+ class Update < Command
8
+ # VPL::Command::Update::All
9
+ class All < Update
10
+ self.summary = '更新项目内容'
11
+
12
+ self.description = <<-DESC
13
+ 更新项目CMake、VCPort、Git Tag内容。
14
+ DESC
15
+
16
+ self.arguments = [
17
+ CLAide::Argument.new('项目根目录(默认使用当前目录)', false)
18
+ ]
19
+
20
+ def self.options
21
+ [
22
+ ['--version=x.x.x', '新版本号。(默认使用patch+1)'],
23
+ ['--output=./', '项目打包的输出目录。(默认使用项目 根目录/build)']
24
+ ].concat(super)
25
+ end
26
+
27
+ def initialize(argv)
28
+ @path = argv.shift_argument || Dir.pwd
29
+
30
+ @new_version = argv.option('version', '').split(',').first
31
+ @output_path = argv.option('output', '').split(',').first
32
+ super
33
+ end
34
+
35
+ def run
36
+ updater = Updater.new(@path)
37
+
38
+ updater.update_all(@new_version, @output_path)
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vcpkg_pipeline/core/updater'
4
+
5
+ module VPL
6
+ class Command
7
+ class Update < Command
8
+ # VPL::Command::Update::CMake
9
+ class CMake < Update
10
+ self.summary = '更新项目内容'
11
+
12
+ self.description = <<-DESC
13
+ 更新项目CMake内容。
14
+ DESC
15
+
16
+ self.arguments = [
17
+ CLAide::Argument.new('项目根目录(默认使用当前目录)', false)
18
+ ]
19
+
20
+ def self.options
21
+ [
22
+ ['--version=x.x.x', '新版本号。(默认使用patch+1)']
23
+ ].concat(super)
24
+ end
25
+
26
+ def initialize(argv)
27
+ @path = argv.shift_argument || Dir.pwd
28
+
29
+ @new_version = argv.option('version', '').split(',').first
30
+ super
31
+ end
32
+
33
+ def run
34
+ updater = Updater.new(@path)
35
+
36
+ updater.update_cmake(@new_version)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vcpkg_pipeline/core/updater'
4
+
5
+ module VPL
6
+ class Command
7
+ class Update < Command
8
+ # VPL::Command::Update::Git
9
+ class Git < Update
10
+ self.summary = '更新项目内容'
11
+
12
+ self.description = <<-DESC
13
+ 更新项目Git内容。
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
+ updater = Updater.new(@path)
32
+
33
+ updater.update_git
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vcpkg_pipeline/core/spec'
4
+ require 'vcpkg_pipeline/core/updater'
5
+
6
+ module VPL
7
+ class Command
8
+ class Update < Command
9
+ # VPL::Command::Update::Spec
10
+ class Spec < Update
11
+ self.summary = '更新项目内容'
12
+
13
+ self.description = <<-DESC
14
+ 更新项目Spec内容。
15
+ DESC
16
+
17
+ self.arguments = [
18
+ CLAide::Argument.new('项目根目录(默认使用当前目录)', false)
19
+ ]
20
+
21
+ def self.options
22
+ [].concat(super)
23
+ end
24
+
25
+ def initialize(argv)
26
+ @path = argv.shift_argument || Dir.pwd
27
+
28
+ super
29
+ end
30
+
31
+ def run
32
+ updater = Updater.new(@path)
33
+
34
+ updater.update_spec
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vcpkg_pipeline/core/updater'
4
+
5
+ module VPL
6
+ class Command
7
+ class Update < Command
8
+ # VPL::Command::Update::VCPort
9
+ class VCPort < Update
10
+ self.summary = '更新项目内容'
11
+
12
+ self.description = <<-DESC
13
+ 更新项目VCPort内容。
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
+ updater = Updater.new(@path)
32
+
33
+ updater.update_vcport
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'vcpkg_pipeline/core/updater'
4
+
5
+ require 'vcpkg_pipeline/command/update/all'
6
+ require 'vcpkg_pipeline/command/update/spec'
7
+ require 'vcpkg_pipeline/command/update/cmake'
8
+ require 'vcpkg_pipeline/command/update/vcport'
9
+ require 'vcpkg_pipeline/command/update/git'
10
+
11
+ module VPL
12
+ class Command
13
+ # VPL::Command::Update
14
+ class Update < Command
15
+ self.abstract_command = true
16
+
17
+ self.summary = '项目扫描'
18
+ self.description = <<-DESC
19
+ 获取项目信息及关键参数
20
+ DESC
21
+ end
22
+ end
23
+ end