rake_git 0.1.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +22 -0
- data/Gemfile.lock +155 -0
- data/LICENSE.txt +21 -0
- data/README.md +71 -0
- data/Rakefile +178 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/rake_git/mixins/support.rb +41 -0
- data/lib/rake_git/tasks/commit.rb +16 -0
- data/lib/rake_git/tasks.rb +8 -0
- data/lib/rake_git/version.rb +5 -0
- data/lib/rake_git.rb +7 -0
- data/rake_git.gemspec +43 -0
- metadata +86 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 356fffe3afc40a729723093062c4df0c432691e8e228e64f566255bffc81e60c
|
4
|
+
data.tar.gz: 77302c335cbb3b64840cff938c83720d10d52ab2e5961f515866d8fbaff627c8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0ca7d68d60bcf18b4730f7843962f80e4d1b8f6fb41ac4e3b1398d9a50a770f669efb0e518667cce42e918c12807bc8fe13bcf26bfd66c12871deae15e0cb8b5
|
7
|
+
data.tar.gz: d49987c1abbfa262d9739543adda020bb6e6b2c0adccaeacbfdc2f68c774d0c37f73c50a9795109d2414ecf723ce8ccaa1988d55caadc786be996d39875142bc
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at maintainers@infrablocks.io. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
71
|
+
version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in rake_git.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem 'activesupport'
|
9
|
+
gem 'bundler'
|
10
|
+
gem 'gem-release'
|
11
|
+
gem 'memfs'
|
12
|
+
gem 'rake'
|
13
|
+
gem 'rake_circle_ci'
|
14
|
+
gem 'rake_git_crypt'
|
15
|
+
gem 'rake_github'
|
16
|
+
gem 'rake_gpg'
|
17
|
+
gem 'rake_ssh'
|
18
|
+
gem 'rspec'
|
19
|
+
gem 'rubocop'
|
20
|
+
gem 'rubocop-rake'
|
21
|
+
gem 'rubocop-rspec'
|
22
|
+
gem 'simplecov'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rake_git (0.1.0.pre.1)
|
5
|
+
colored2 (~> 3.1)
|
6
|
+
rake_factory (= 0.32.0.pre.2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activesupport (7.0.4.2)
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
+
i18n (>= 1.6, < 2)
|
14
|
+
minitest (>= 5.1)
|
15
|
+
tzinfo (~> 2.0)
|
16
|
+
addressable (2.8.1)
|
17
|
+
public_suffix (>= 2.0.2, < 6.0)
|
18
|
+
ast (2.4.2)
|
19
|
+
colored2 (3.1.2)
|
20
|
+
concurrent-ruby (1.2.0)
|
21
|
+
diff-lcs (1.5.0)
|
22
|
+
docile (1.4.0)
|
23
|
+
excon (0.99.0)
|
24
|
+
faraday (2.7.4)
|
25
|
+
faraday-net_http (>= 2.0, < 3.1)
|
26
|
+
ruby2_keywords (>= 0.0.4)
|
27
|
+
faraday-net_http (3.0.2)
|
28
|
+
gem-release (2.2.2)
|
29
|
+
hamster (3.0.0)
|
30
|
+
concurrent-ruby (~> 1.0)
|
31
|
+
i18n (1.12.0)
|
32
|
+
concurrent-ruby (~> 1.0)
|
33
|
+
immutable-struct (2.4.1)
|
34
|
+
json (2.6.3)
|
35
|
+
lino (3.1.0)
|
36
|
+
hamster (~> 3.0)
|
37
|
+
open4 (~> 1.3)
|
38
|
+
memfs (1.0.0)
|
39
|
+
minitest (5.17.0)
|
40
|
+
octokit (6.0.1)
|
41
|
+
faraday (>= 1, < 3)
|
42
|
+
sawyer (~> 0.9)
|
43
|
+
open4 (1.3.4)
|
44
|
+
parallel (1.22.1)
|
45
|
+
parser (3.2.0.0)
|
46
|
+
ast (~> 2.4.1)
|
47
|
+
public_suffix (5.0.1)
|
48
|
+
rainbow (3.1.1)
|
49
|
+
rake (13.0.6)
|
50
|
+
rake_circle_ci (0.11.0)
|
51
|
+
colored2 (~> 3.1)
|
52
|
+
excon (~> 0.72)
|
53
|
+
rake_factory (~> 0.23)
|
54
|
+
sshkey (~> 2.0)
|
55
|
+
rake_factory (0.32.0.pre.2)
|
56
|
+
activesupport (>= 4)
|
57
|
+
rake (~> 13.0)
|
58
|
+
rake_git_crypt (0.1.0.pre.25)
|
59
|
+
colored2 (~> 3.1)
|
60
|
+
rake_factory (= 0.32.0.pre.2)
|
61
|
+
ruby_git_crypt (= 0.1.0.pre.2)
|
62
|
+
ruby_gpg2 (~> 0.6)
|
63
|
+
rake_github (0.11.0)
|
64
|
+
colored2 (~> 3.1)
|
65
|
+
octokit (>= 4.16, < 7.0)
|
66
|
+
rake_factory (~> 0.23)
|
67
|
+
sshkey (~> 2.0)
|
68
|
+
rake_gpg (0.18.0)
|
69
|
+
rake_factory (~> 0.23)
|
70
|
+
ruby_gpg2 (~> 0.6)
|
71
|
+
rake_ssh (0.8.0)
|
72
|
+
colored2 (~> 3.1)
|
73
|
+
rake_factory (~> 0.23)
|
74
|
+
sshkey (~> 2.0)
|
75
|
+
regexp_parser (2.6.2)
|
76
|
+
rexml (3.2.5)
|
77
|
+
rspec (3.12.0)
|
78
|
+
rspec-core (~> 3.12.0)
|
79
|
+
rspec-expectations (~> 3.12.0)
|
80
|
+
rspec-mocks (~> 3.12.0)
|
81
|
+
rspec-core (3.12.1)
|
82
|
+
rspec-support (~> 3.12.0)
|
83
|
+
rspec-expectations (3.12.2)
|
84
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
85
|
+
rspec-support (~> 3.12.0)
|
86
|
+
rspec-mocks (3.12.3)
|
87
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
88
|
+
rspec-support (~> 3.12.0)
|
89
|
+
rspec-support (3.12.0)
|
90
|
+
rubocop (1.44.1)
|
91
|
+
json (~> 2.3)
|
92
|
+
parallel (~> 1.10)
|
93
|
+
parser (>= 3.2.0.0)
|
94
|
+
rainbow (>= 2.2.2, < 4.0)
|
95
|
+
regexp_parser (>= 1.8, < 3.0)
|
96
|
+
rexml (>= 3.2.5, < 4.0)
|
97
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
98
|
+
ruby-progressbar (~> 1.7)
|
99
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
100
|
+
rubocop-ast (1.24.1)
|
101
|
+
parser (>= 3.1.1.0)
|
102
|
+
rubocop-capybara (2.17.0)
|
103
|
+
rubocop (~> 1.41)
|
104
|
+
rubocop-rake (0.6.0)
|
105
|
+
rubocop (~> 1.0)
|
106
|
+
rubocop-rspec (2.18.1)
|
107
|
+
rubocop (~> 1.33)
|
108
|
+
rubocop-capybara (~> 2.17)
|
109
|
+
ruby-progressbar (1.11.0)
|
110
|
+
ruby2_keywords (0.0.5)
|
111
|
+
ruby_git_crypt (0.1.0.pre.2)
|
112
|
+
immutable-struct (~> 2.4)
|
113
|
+
lino (~> 3.0)
|
114
|
+
ruby_gpg2 (0.10.0)
|
115
|
+
lino (~> 3.0)
|
116
|
+
sawyer (0.9.2)
|
117
|
+
addressable (>= 2.3.5)
|
118
|
+
faraday (>= 0.17.3, < 3)
|
119
|
+
simplecov (0.22.0)
|
120
|
+
docile (~> 1.1)
|
121
|
+
simplecov-html (~> 0.11)
|
122
|
+
simplecov_json_formatter (~> 0.1)
|
123
|
+
simplecov-html (0.12.3)
|
124
|
+
simplecov_json_formatter (0.1.4)
|
125
|
+
sshkey (2.0.0)
|
126
|
+
tzinfo (2.0.6)
|
127
|
+
concurrent-ruby (~> 1.0)
|
128
|
+
unicode-display_width (2.4.2)
|
129
|
+
|
130
|
+
PLATFORMS
|
131
|
+
arm64-darwin-21
|
132
|
+
x86_64-darwin-19
|
133
|
+
x86_64-darwin-21
|
134
|
+
x86_64-linux
|
135
|
+
|
136
|
+
DEPENDENCIES
|
137
|
+
activesupport
|
138
|
+
bundler
|
139
|
+
gem-release
|
140
|
+
memfs
|
141
|
+
rake
|
142
|
+
rake_circle_ci
|
143
|
+
rake_git!
|
144
|
+
rake_git_crypt
|
145
|
+
rake_github
|
146
|
+
rake_gpg
|
147
|
+
rake_ssh
|
148
|
+
rspec
|
149
|
+
rubocop
|
150
|
+
rubocop-rake
|
151
|
+
rubocop-rspec
|
152
|
+
simplecov
|
153
|
+
|
154
|
+
BUNDLED WITH
|
155
|
+
2.4.6
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 InfraBlocks Maintainers
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# RakeGit
|
2
|
+
|
3
|
+
Rake tasks for interacting with git.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'rake_git'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install rake_git
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write docs.
|
24
|
+
|
25
|
+
## Development
|
26
|
+
|
27
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
28
|
+
`rake spec` to run the tests. You can also run `bin/console` for an interactive
|
29
|
+
prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
32
|
+
release a new version, update the version number in `version.rb`, and then run
|
33
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
34
|
+
git commits and tags, and push the `.gem` file to
|
35
|
+
[rubygems.org](https://rubygems.org).
|
36
|
+
|
37
|
+
### Managing CircleCI keys
|
38
|
+
|
39
|
+
To encrypt a GPG key for use by CircleCI:
|
40
|
+
|
41
|
+
```bash
|
42
|
+
openssl aes-256-cbc \
|
43
|
+
-e \
|
44
|
+
-md sha1 \
|
45
|
+
-in ./config/secrets/ci/gpg.private \
|
46
|
+
-out ./.circleci/gpg.private.enc \
|
47
|
+
-k "<passphrase>"
|
48
|
+
```
|
49
|
+
|
50
|
+
To check decryption is working correctly:
|
51
|
+
|
52
|
+
```bash
|
53
|
+
openssl aes-256-cbc \
|
54
|
+
-d \
|
55
|
+
-md sha1 \
|
56
|
+
-in ./.circleci/gpg.private.enc \
|
57
|
+
-k "<passphrase>"
|
58
|
+
```
|
59
|
+
|
60
|
+
## Contributing
|
61
|
+
|
62
|
+
Bug reports and pull requests are welcome on GitHub at
|
63
|
+
https://github.com/infrablocks/rake_git. This project is intended to be a
|
64
|
+
safe, welcoming space for collaboration, and contributors are expected to
|
65
|
+
adhere to the [Contributor Covenant](http://contributor-covenant.org) code of
|
66
|
+
conduct.
|
67
|
+
|
68
|
+
## License
|
69
|
+
|
70
|
+
The gem is available as open source under the terms of the
|
71
|
+
[MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,178 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
require 'rake_circle_ci'
|
5
|
+
require 'rake_git_crypt'
|
6
|
+
require 'rake_github'
|
7
|
+
require 'rake_ssh'
|
8
|
+
require 'rake_gpg'
|
9
|
+
require 'securerandom'
|
10
|
+
require 'rspec/core/rake_task'
|
11
|
+
require 'rubocop/rake_task'
|
12
|
+
|
13
|
+
task default: %i[
|
14
|
+
library:fix
|
15
|
+
test:unit
|
16
|
+
]
|
17
|
+
|
18
|
+
RakeGitCrypt.define_standard_tasks(
|
19
|
+
namespace: :git_crypt,
|
20
|
+
|
21
|
+
provision_secrets_task_name: :'secrets:provision',
|
22
|
+
destroy_secrets_task_name: :'secrets:destroy',
|
23
|
+
|
24
|
+
install_commit_task_name: :'git:commit',
|
25
|
+
uninstall_commit_task_name: :'git:commit',
|
26
|
+
|
27
|
+
gpg_user_key_paths: %w[
|
28
|
+
config/gpg
|
29
|
+
config/secrets/ci/gpg.public
|
30
|
+
]
|
31
|
+
)
|
32
|
+
|
33
|
+
namespace :encryption do
|
34
|
+
namespace :directory do
|
35
|
+
desc 'Ensure CI secrets directory exists.'
|
36
|
+
task :ensure do
|
37
|
+
FileUtils.mkdir_p('config/secrets/ci')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
namespace :passphrase do
|
42
|
+
desc 'Generate encryption passphrase used by CI.'
|
43
|
+
task generate: ['directory:ensure'] do
|
44
|
+
File.write('config/secrets/ci/encryption.passphrase',
|
45
|
+
SecureRandom.base64(36))
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
namespace :keys do
|
51
|
+
namespace :deploy do
|
52
|
+
RakeSSH.define_key_tasks(
|
53
|
+
path: 'config/secrets/ci/',
|
54
|
+
comment: 'maintainers@infrablocks.io'
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
namespace :gpg do
|
59
|
+
RakeGPG.define_generate_key_task(
|
60
|
+
output_directory: 'config/secrets/ci',
|
61
|
+
name_prefix: 'gpg',
|
62
|
+
owner_name: 'InfraBlocks Maintainers',
|
63
|
+
owner_email: 'maintainers@infrablocks.io',
|
64
|
+
owner_comment: 'rake_git CI Key'
|
65
|
+
)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
namespace :secrets do
|
70
|
+
desc 'Generate all generatable secrets.'
|
71
|
+
task generate: %w[
|
72
|
+
encryption:passphrase:generate
|
73
|
+
keys:deploy:generate
|
74
|
+
keys:gpg:generate
|
75
|
+
]
|
76
|
+
|
77
|
+
desc 'Provision all secrets.'
|
78
|
+
task provision: [:generate]
|
79
|
+
|
80
|
+
desc 'Delete all secrets.'
|
81
|
+
task :destroy do
|
82
|
+
rm_rf 'config/secrets'
|
83
|
+
end
|
84
|
+
|
85
|
+
desc 'Rotate all secrets.'
|
86
|
+
task rotate: [:'git_crypt:reinstall']
|
87
|
+
end
|
88
|
+
|
89
|
+
namespace :git do
|
90
|
+
desc 'Commit all changes'
|
91
|
+
task :commit, [:message] do |_, args|
|
92
|
+
sh('git', 'add', '-A')
|
93
|
+
sh('git', 'commit', '-m', args.message)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
RuboCop::RakeTask.new
|
98
|
+
|
99
|
+
namespace :library do
|
100
|
+
desc 'Run all checks of the library'
|
101
|
+
task check: [:rubocop]
|
102
|
+
|
103
|
+
desc 'Attempt to automatically fix issues with the library'
|
104
|
+
task fix: [:'rubocop:autocorrect_all']
|
105
|
+
end
|
106
|
+
|
107
|
+
namespace :test do
|
108
|
+
RSpec::Core::RakeTask.new(:unit)
|
109
|
+
end
|
110
|
+
|
111
|
+
RakeCircleCI.define_project_tasks(
|
112
|
+
namespace: :circle_ci,
|
113
|
+
project_slug: 'github/infrablocks/rake_git'
|
114
|
+
) do |t|
|
115
|
+
circle_ci_config =
|
116
|
+
YAML.load_file('config/secrets/circle_ci/config.yaml')
|
117
|
+
|
118
|
+
t.api_token = circle_ci_config['circle_ci_api_token']
|
119
|
+
t.environment_variables = {
|
120
|
+
ENCRYPTION_PASSPHRASE:
|
121
|
+
File.read('config/secrets/ci/encryption.passphrase')
|
122
|
+
.chomp
|
123
|
+
}
|
124
|
+
t.checkout_keys = []
|
125
|
+
t.ssh_keys = [
|
126
|
+
{
|
127
|
+
hostname: 'github.com',
|
128
|
+
private_key: File.read('config/secrets/ci/ssh.private')
|
129
|
+
}
|
130
|
+
]
|
131
|
+
end
|
132
|
+
|
133
|
+
RakeGithub.define_repository_tasks(
|
134
|
+
namespace: :github,
|
135
|
+
repository: 'infrablocks/rake_git'
|
136
|
+
) do |t, args|
|
137
|
+
github_config =
|
138
|
+
YAML.load_file('config/secrets/github/config.yaml')
|
139
|
+
|
140
|
+
t.access_token = github_config['github_personal_access_token']
|
141
|
+
t.deploy_keys = [
|
142
|
+
{
|
143
|
+
title: 'CircleCI',
|
144
|
+
public_key: File.read('config/secrets/ci/ssh.public')
|
145
|
+
}
|
146
|
+
]
|
147
|
+
t.branch_name = args.branch_name
|
148
|
+
t.commit_message = args.commit_message
|
149
|
+
end
|
150
|
+
|
151
|
+
namespace :pipeline do
|
152
|
+
desc 'Prepare CircleCI Pipeline'
|
153
|
+
task prepare: %i[
|
154
|
+
circle_ci:env_vars:ensure
|
155
|
+
circle_ci:checkout_keys:ensure
|
156
|
+
circle_ci:ssh_keys:ensure
|
157
|
+
github:deploy_keys:ensure
|
158
|
+
]
|
159
|
+
end
|
160
|
+
|
161
|
+
namespace :version do
|
162
|
+
desc 'Bump version for specified type (pre, major, minor, patch)'
|
163
|
+
task :bump, [:type] do |_, args|
|
164
|
+
bump_version_for(args.type)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
desc 'Release gem'
|
169
|
+
task :release do
|
170
|
+
sh 'gem release --tag --push'
|
171
|
+
end
|
172
|
+
|
173
|
+
def bump_version_for(version_type)
|
174
|
+
sh "gem bump --version #{version_type} " \
|
175
|
+
'&& bundle install ' \
|
176
|
+
'&& export LAST_MESSAGE="$(git log -1 --pretty=%B)" ' \
|
177
|
+
'&& git commit -a --amend -m "${LAST_MESSAGE} [ci skip]"'
|
178
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'rake_git'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RakeGitCrypt
|
4
|
+
module Mixins
|
5
|
+
module Support
|
6
|
+
def task_by_name(task, name)
|
7
|
+
task.application.lookup(name, task.scope)
|
8
|
+
end
|
9
|
+
|
10
|
+
def task_defined?(task, name)
|
11
|
+
!task_by_name(task, name).nil?
|
12
|
+
end
|
13
|
+
|
14
|
+
def ensure_task_with_name_available(task, name)
|
15
|
+
raise_task_undefined(name) unless task_defined?(task, name)
|
16
|
+
end
|
17
|
+
|
18
|
+
def invoke_task_with_name(task, name, args)
|
19
|
+
ensure_task_with_name_available(task, name)
|
20
|
+
task_by_name(task, name).invoke(*args)
|
21
|
+
end
|
22
|
+
|
23
|
+
def reenable_task_with_name(task, name)
|
24
|
+
ensure_task_with_name_available(task, name)
|
25
|
+
task_by_name(task, name).reenable
|
26
|
+
end
|
27
|
+
|
28
|
+
def invoke_and_reenable_task_with_name(task, name, args)
|
29
|
+
invoke_task_with_name(task, name, args)
|
30
|
+
reenable_task_with_name(task, name)
|
31
|
+
end
|
32
|
+
|
33
|
+
def raise_task_undefined(name)
|
34
|
+
raise(
|
35
|
+
RakeFactory::DependencyTaskMissing,
|
36
|
+
"The task with name #{name} does not exist."
|
37
|
+
)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rake_factory'
|
4
|
+
|
5
|
+
module RakeGit
|
6
|
+
module Tasks
|
7
|
+
class Commit < RakeFactory::Task
|
8
|
+
default_name :commit
|
9
|
+
default_description 'Produce a commit on the current branch.'
|
10
|
+
|
11
|
+
action do
|
12
|
+
puts('Committing...')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/rake_git.rb
ADDED
data/rake_git.gemspec
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'rake_git/version'
|
6
|
+
|
7
|
+
files = %w[
|
8
|
+
bin
|
9
|
+
lib
|
10
|
+
CODE_OF_CONDUCT.md
|
11
|
+
rake_git.gemspec
|
12
|
+
Gemfile
|
13
|
+
LICENSE.txt
|
14
|
+
Rakefile
|
15
|
+
README.md
|
16
|
+
]
|
17
|
+
|
18
|
+
Gem::Specification.new do |spec|
|
19
|
+
spec.name = 'rake_git'
|
20
|
+
spec.version = RakeGit::VERSION
|
21
|
+
spec.authors = ['InfraBlocks Maintainers']
|
22
|
+
spec.email = ['maintainers@infrablocks.io']
|
23
|
+
|
24
|
+
spec.summary = 'Rake tasks for interacting with git.'
|
25
|
+
spec.description =
|
26
|
+
'Allows performing git actions such as committing.'
|
27
|
+
spec.homepage = 'https://github.com/infrablocks/rake_git'
|
28
|
+
spec.license = 'MIT'
|
29
|
+
|
30
|
+
spec.files = `git ls-files -z`.split("\x0").select do |f|
|
31
|
+
f.match(/^(#{files.map { |g| Regexp.escape(g) }.join('|')})/)
|
32
|
+
end
|
33
|
+
spec.bindir = 'exe'
|
34
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
35
|
+
spec.require_paths = ['lib']
|
36
|
+
|
37
|
+
spec.required_ruby_version = '>= 2.7'
|
38
|
+
|
39
|
+
spec.add_dependency 'colored2', '~> 3.1'
|
40
|
+
spec.add_dependency 'rake_factory', '0.32.0.pre.2'
|
41
|
+
|
42
|
+
spec.metadata['rubygems_mfa_required'] = 'false'
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rake_git
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0.pre.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- InfraBlocks Maintainers
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-02-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: colored2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake_factory
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.32.0.pre.2
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.32.0.pre.2
|
41
|
+
description: Allows performing git actions such as committing.
|
42
|
+
email:
|
43
|
+
- maintainers@infrablocks.io
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- CODE_OF_CONDUCT.md
|
49
|
+
- Gemfile
|
50
|
+
- Gemfile.lock
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- bin/console
|
55
|
+
- bin/setup
|
56
|
+
- lib/rake_git.rb
|
57
|
+
- lib/rake_git/mixins/support.rb
|
58
|
+
- lib/rake_git/tasks.rb
|
59
|
+
- lib/rake_git/tasks/commit.rb
|
60
|
+
- lib/rake_git/version.rb
|
61
|
+
- rake_git.gemspec
|
62
|
+
homepage: https://github.com/infrablocks/rake_git
|
63
|
+
licenses:
|
64
|
+
- MIT
|
65
|
+
metadata:
|
66
|
+
rubygems_mfa_required: 'false'
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.7'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 1.3.1
|
81
|
+
requirements: []
|
82
|
+
rubygems_version: 3.1.6
|
83
|
+
signing_key:
|
84
|
+
specification_version: 4
|
85
|
+
summary: Rake tasks for interacting with git.
|
86
|
+
test_files: []
|