bake-github-pages 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: d299e7d90903fa1e5112a2ba6d37eaf67fdc9fa43f407a1879848347bbedb61b
4
+ data.tar.gz: 8b6cc1bbdd1ab9bff6cd8add60bde65652df56aa5e2873f43dbc7e9ee93f6245
5
+ SHA512:
6
+ metadata.gz: fbc2097fd5efe77a193899815d99c8ce3ffd86671d45f666c61e6b6bb4d561de4213cf0469f95835283a9008d9f3adfb8a4fb2b228486d551147cda4314b2998
7
+ data.tar.gz: d9edb7ee8d503d64eb0b3fdb31cf08157162f9f2dbcc14cd3b883e0760ed1464fd1f476b597064fe2391f4127272814f64518b216ac35f6f4ec6096e60a2848a
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ 7�oV?�]ܪ��ÊĪ܅��Zgӄ֖n�#���h��7�p%�3��|��f�I�c`1P` �R����^Mr. ě��Bz����Q�v�Ӭ���]� �S4�Mă��'�U��q���~�HSM�K��\�]�� Mr� eM'�6�'Z�1�fJ�i�����=s�.��oK( D��D��8���R�Ҏ�oг9�F� 5?���o�Ɠj��z~B �'�'��E�c ��Hx���a�7��չm|L
2
+ n١W��Lν�
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright, 2021, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ require 'build/files'
24
+
25
+ require 'bake/github/pages/shell'
26
+ include Bake::GitHub::Pages::Shell
27
+
28
+ def prepare(branch: "pages", directory: "pages")
29
+ root = Build::Files::Path.current
30
+ worktree = root + directory
31
+
32
+ system("git", "worktree", "add", "--detach", "--no-checkout", worktree.to_s)
33
+
34
+ # Ensure we have the latest branch from origin:
35
+ system("git", "fetch", "origin", branch)
36
+
37
+ begin
38
+ # Try checking out the remote branch if it exists:
39
+ system("git", "checkout", branch, chdir: worktree)
40
+ rescue
41
+ # Otherwise check out an orphan branch...
42
+ system("git", "checkout", "--orphan", branch, chdir: worktree)
43
+ system("git", "rm", "-rf", ".", chdir: worktree)
44
+ end
45
+ end
46
+
47
+ AUTHOR = {
48
+ "EMAIL" => "<>",
49
+ "GIT_AUTHOR_NAME" => "Bake GitHub Pages Automation",
50
+ "GIT_COMMITTER_NAME" => "Bake GitHub Pages Automation",
51
+ }
52
+
53
+ def commit(branch: "pages", directory: "pages", message: "Update GitHub Pages.")
54
+ root = Build::Files::Path.current
55
+ worktree = root + directory
56
+
57
+ unless clean?(worktree)
58
+ system("git", "add", "-A", chdir: worktree)
59
+
60
+ system(AUTHOR, "git", "commit", "-m", message, chdir: worktree)
61
+ system("git", "push", "--set-upstream", "origin", branch, chdir: worktree)
62
+ end
63
+ end
64
+
65
+ private
66
+
67
+ def clean?(directory)
68
+ lines = readlines("git", "status", "--porcelain", chdir: directory)
69
+
70
+ return lines.empty?
71
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright, 2022, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ module Bake
24
+ module GitHub
25
+ module Pages
26
+ module Shell
27
+ def system(*arguments, **options)
28
+ Console.logger.info(self, Console::Event::Spawn.for(*arguments, **options))
29
+
30
+ begin
31
+ pid = Process.spawn(*arguments, **options)
32
+ yield if block_given?
33
+ ensure
34
+ pid, status = Process.wait2(pid) if pid
35
+
36
+ unless status.success?
37
+ raise "Failed to execute #{arguments}: #{status}!"
38
+ end
39
+ end
40
+ end
41
+
42
+ def execute(*arguments, **options)
43
+ Console.logger.info(self, Console::Event::Spawn.for(*arguments, **options))
44
+
45
+ IO.pipe do |input, output|
46
+ pid = Process.spawn(*arguments, out: output, **options)
47
+ output.close
48
+
49
+ begin
50
+ yield input
51
+ ensure
52
+ pid, status = Process.wait2(pid)
53
+
54
+ unless status.success?
55
+ raise "Failed to execute #{arguments}: #{status}!"
56
+ end
57
+ end
58
+ end
59
+ end
60
+
61
+ def readlines(*arguments, **options)
62
+ execute(*arguments, **options) do |output|
63
+ return output.readlines
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright, 2022, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ module Bake
24
+ module GitHub
25
+ module Pages
26
+ VERSION = "0.1.0"
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright, 2022, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ require "bake/github/pages/version"
data.tar.gz.sig ADDED
Binary file
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bake-github-pages
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Samuel Williams
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEhDCCAuygAwIBAgIBATANBgkqhkiG9w0BAQsFADA3MTUwMwYDVQQDDCxzYW11
14
+ ZWwud2lsbGlhbXMvREM9b3Jpb250cmFuc2Zlci9EQz1jby9EQz1uejAeFw0yMTA4
15
+ MTYwNjMzNDRaFw0yMjA4MTYwNjMzNDRaMDcxNTAzBgNVBAMMLHNhbXVlbC53aWxs
16
+ aWFtcy9EQ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LR4J7ozmGLh4o4uJp7w
32
+ x9KCFaR8Lvn/r0oJWJOqb/DMAYI83YeN2Dlt3jpwrsmsONrtC5S3gOUle5afSGos
33
+ bYt5ocnEpKSomR9ZtnCGljds/aeO1Xgpn2r9HHcjwnH346iNrnHmMlC7BtHUFPDg
34
+ Ts92S47PTOXzwPBDsrFiq3VLbRjHSwf8rpqybQBH9MfzxGGxTaETQYOd6b4e4Ag6
35
+ y92abGna0bmIEb4+Tx9rQ10Uijh1POzvr/VTH4bbIPy9FbKrRsIQ24qDbNJRtOpE
36
+ RAOsIl+HOBTb252nx1kIRN5hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+a
37
+ HiLJ8VOFx6w=
38
+ -----END CERTIFICATE-----
39
+ date: 2022-04-20 00:00:00.000000000 Z
40
+ dependencies:
41
+ - !ruby/object:Gem::Dependency
42
+ name: build-files
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sus
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description:
70
+ email:
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - bake/github/pages.rb
76
+ - lib/bake/github/pages.rb
77
+ - lib/bake/github/pages/shell.rb
78
+ - lib/bake/github/pages/version.rb
79
+ homepage: https://github.com/ioquatix/bake-github-pages
80
+ licenses:
81
+ - MIT
82
+ metadata:
83
+ funding_uri: https://github.com/sponsors/ioquatix/
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 2.3.0
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubygems_version: 3.1.6
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: Publish to GitHub pages.
103
+ test_files: []
metadata.gz.sig ADDED
Binary file