sashimi_tanpopo 0.3.3 → 0.4.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 +4 -4
- data/CHANGELOG.md +22 -10
- data/Dockerfile +1 -1
- data/docs/RECIPE.md +6 -0
- data/lib/sashimi_tanpopo/dsl.rb +68 -2
- data/lib/sashimi_tanpopo/version.rb +1 -1
- data/rbs_collection.lock.yaml +16 -20
- data/sig/sashimi_tanpopo/dsl.rbs +7 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 46221b29210109fddc0ba6ab25f4f22223996df144ba244836c8d327cfc2df60
|
|
4
|
+
data.tar.gz: 7f25ee609285783d8a06bf5d2b399b1bc4378530fece6e94fa4b930a823e527a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 809ade0b7206286166287964dc0bb4b8ebf2f4f559fe556bb9eaf7c7a0536f9714f03055dde888bd4f92561e90fb507910351a9b6e2dc7e656caf28051a67235
|
|
7
|
+
data.tar.gz: decfb336b8a602063f136b05c4f9db60a96f990819c722ef44e108659e897513ed3422b8716a61ebccf9582be46d30a9bc8768e55fdcb802d6fea17c6a4aae66
|
data/CHANGELOG.md
CHANGED
|
@@ -1,54 +1,66 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
|
-
[full changelog](http://github.com/sue445/sashimi_tanpopo/compare/v0.
|
|
2
|
+
[full changelog](http://github.com/sue445/sashimi_tanpopo/compare/v0.4.0...main)
|
|
3
3
|
|
|
4
|
-
## [
|
|
4
|
+
## [v0.3.4](https://github.com/sue445/sashimi_tanpopo/releases/tag/v0.4.0) - 2025-12-03
|
|
5
|
+
[full changelog](http://github.com/sue445/sashimi_tanpopo/compare/v0.3.4...v0.4.0)
|
|
6
|
+
|
|
7
|
+
* Add `create` arg to `update_file`
|
|
8
|
+
* https://github.com/sue445/sashimi_tanpopo/pull/80
|
|
9
|
+
|
|
10
|
+
## [v0.3.4](https://github.com/sue445/sashimi_tanpopo/releases/tag/v0.3.4) - 2025-11-30
|
|
11
|
+
[full changelog](http://github.com/sue445/sashimi_tanpopo/compare/v0.3.3...v0.3.4)
|
|
12
|
+
|
|
13
|
+
* Release gem from GitHub Actions
|
|
14
|
+
* https://github.com/sue445/sashimi_tanpopo/pull/73
|
|
15
|
+
|
|
16
|
+
## [v0.3.3](https://github.com/sue445/sashimi_tanpopo/releases/tag/v0.3.3) - 2025-11-05
|
|
5
17
|
[full changelog](http://github.com/sue445/sashimi_tanpopo/compare/v0.3.2...v0.3.3)
|
|
6
18
|
|
|
7
19
|
* Fixed an issue where file was not updated when `update_file` was called multiple times on the same file
|
|
8
20
|
* https://github.com/sue445/sashimi_tanpopo/pull/70
|
|
9
21
|
|
|
10
|
-
## [
|
|
22
|
+
## [v0.3.2](https://github.com/sue445/sashimi_tanpopo/releases/tag/v0.3.2) - 2025-11-02
|
|
11
23
|
[full changelog](http://github.com/sue445/sashimi_tanpopo/compare/v0.3.1...v0.3.2)
|
|
12
24
|
|
|
13
25
|
* Do not remove left-hand space in logger
|
|
14
26
|
* https://github.com/sue445/sashimi_tanpopo/pull/68
|
|
15
27
|
|
|
16
|
-
## [
|
|
28
|
+
## [v0.3.1](https://github.com/sue445/sashimi_tanpopo/releases/tag/v0.3.1) - 2025-10-31
|
|
17
29
|
[full changelog](http://github.com/sue445/sashimi_tanpopo/compare/v0.3.0...v0.3.1)
|
|
18
30
|
|
|
19
31
|
* Disable file existence checks when using `--github-step-summary`
|
|
20
32
|
* https://github.com/sue445/sashimi_tanpopo/pull/66
|
|
21
33
|
|
|
22
|
-
## [
|
|
34
|
+
## [v0.3.0](https://github.com/sue445/sashimi_tanpopo/releases/tag/v0.3.0) - 2025-10-30
|
|
23
35
|
[full changelog](http://github.com/sue445/sashimi_tanpopo/compare/v0.2.0...v0.3.0)
|
|
24
36
|
|
|
25
37
|
* Support GitHub Actions Job Summary
|
|
26
38
|
* https://github.com/sue445/sashimi_tanpopo/pull/62
|
|
27
39
|
|
|
28
|
-
## [
|
|
40
|
+
## [v0.2.0](https://github.com/sue445/sashimi_tanpopo/releases/tag/v0.2.0) - 2025-10-22
|
|
29
41
|
[full changelog](http://github.com/sue445/sashimi_tanpopo/compare/v0.1.3...v0.2.0)
|
|
30
42
|
|
|
31
43
|
* Change `--pr-target-branch` and `--mr-target-branch` 's default value to repository's default branch
|
|
32
44
|
* https://github.com/sue445/sashimi_tanpopo/pull/52
|
|
33
45
|
|
|
34
|
-
## [
|
|
46
|
+
## [v0.1.3](https://github.com/sue445/sashimi_tanpopo/releases/tag/v0.1.3) - 2025-10-19
|
|
35
47
|
[full changelog](http://github.com/sue445/sashimi_tanpopo/compare/v0.1.2...v0.1.3)
|
|
36
48
|
|
|
37
49
|
* Fix docker push on CI
|
|
38
50
|
* https://github.com/sue445/sashimi_tanpopo/pull/46
|
|
39
51
|
|
|
40
|
-
## [
|
|
52
|
+
## [v0.1.2](https://github.com/sue445/sashimi_tanpopo/releases/tag/v0.1.2) - 2025-10-19
|
|
41
53
|
[full changelog](http://github.com/sue445/sashimi_tanpopo/compare/v0.1.1...v0.1.2)
|
|
42
54
|
|
|
43
55
|
* Fix docker build on CI
|
|
44
56
|
* https://github.com/sue445/sashimi_tanpopo/pull/44
|
|
45
57
|
|
|
46
|
-
## [
|
|
58
|
+
## [v0.1.1](https://github.com/sue445/sashimi_tanpopo/releases/tag/v0.1.1) - 2025-10-19
|
|
47
59
|
[full changelog](http://github.com/sue445/sashimi_tanpopo/compare/v0.1.0...v0.1.1)
|
|
48
60
|
|
|
49
61
|
* Build and push docker image to ghcr.io
|
|
50
62
|
* https://github.com/sue445/sashimi_tanpopo/pull/42
|
|
51
63
|
|
|
52
|
-
## [
|
|
64
|
+
## [v0.1.0](https://github.com/sue445/sashimi_tanpopo/releases/tag/v0.1.0) - 2025-10-18
|
|
53
65
|
|
|
54
66
|
* Initial release
|
data/Dockerfile
CHANGED
data/docs/RECIPE.md
CHANGED
|
@@ -53,11 +53,17 @@ end
|
|
|
53
53
|
update_file ".github/workflows/*.yml" do |content|
|
|
54
54
|
content.gsub!(/ruby-version: "(.+)"/, %Q{ruby-version: "#{params[:ruby_version]}"})
|
|
55
55
|
end
|
|
56
|
+
|
|
57
|
+
# Create new file if file doesn’t exist
|
|
58
|
+
update_file "new_file.txt", create: true do |content|
|
|
59
|
+
content.replace("My name is " + params[:name])
|
|
60
|
+
end
|
|
56
61
|
```
|
|
57
62
|
|
|
58
63
|
Parameters:
|
|
59
64
|
|
|
60
65
|
* `pattern`: Path to target file (relative path from `--target-dir`). This supports [`Dir.glob`](https://ruby-doc.org/current/Dir.html#method-c-glob) pattern. (e.g. `.github/workflows/*.yml`)
|
|
66
|
+
* `create` (defaults to `false`): Whether create new file if file doesn’t exist
|
|
61
67
|
|
|
62
68
|
Yield Parameters:
|
|
63
69
|
|
data/lib/sashimi_tanpopo/dsl.rb
CHANGED
|
@@ -90,6 +90,15 @@ module SashimiTanpopo
|
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
# @return [Hash<String, { before_content: String, after_content: String, mode: String }>] key: file path, value: Hash
|
|
93
|
+
#
|
|
94
|
+
# @example
|
|
95
|
+
# {
|
|
96
|
+
# "path/to/changed-file.txt" => {
|
|
97
|
+
# before_content: "foo",
|
|
98
|
+
# after_content: "bar",
|
|
99
|
+
# mode: "100644",
|
|
100
|
+
# }
|
|
101
|
+
# }
|
|
93
102
|
def changed_files
|
|
94
103
|
@__changed_files__ ||= {}
|
|
95
104
|
end
|
|
@@ -107,6 +116,7 @@ module SashimiTanpopo
|
|
|
107
116
|
# Update files if exists
|
|
108
117
|
#
|
|
109
118
|
# @param pattern [String] Path to target file (relative path from `--target-dir`). This supports [`Dir.glob`](https://ruby-doc.org/current/Dir.html#method-c-glob) pattern. (e.g. `.github/workflows/*.yml`)
|
|
119
|
+
# @param create [Boolean] Whether create new file if file doesn't exist
|
|
110
120
|
#
|
|
111
121
|
# @yieldparam content [String] Content of file. If `content` is changed in block, file will be changed.
|
|
112
122
|
#
|
|
@@ -119,7 +129,21 @@ module SashimiTanpopo
|
|
|
119
129
|
# update_file ".github/workflows/*.yml" do |content|
|
|
120
130
|
# content.gsub!(/ruby-version: "(.+)"/, %Q{ruby-version: "#{params[:ruby_version]}"})
|
|
121
131
|
# end
|
|
122
|
-
|
|
132
|
+
#
|
|
133
|
+
# @example Create new file if file doesn't exist
|
|
134
|
+
# update_file "new_file.txt", create: true do |content|
|
|
135
|
+
# content.replace("My name is " + params[:name])
|
|
136
|
+
# end
|
|
137
|
+
def update_file(pattern, create: false, &block)
|
|
138
|
+
update_file_with_glob(pattern, &block)
|
|
139
|
+
create_new_file(pattern, &block) if create
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
private
|
|
143
|
+
|
|
144
|
+
# @param pattern [String]
|
|
145
|
+
# @yieldparam content [String] Content of file. If `content` is changed in block, file will be changed.
|
|
146
|
+
def update_file_with_glob(pattern, &block)
|
|
123
147
|
Dir.glob(pattern).each do |path|
|
|
124
148
|
full_file_path = File.join(@__target_dir__, path)
|
|
125
149
|
|
|
@@ -161,7 +185,49 @@ module SashimiTanpopo
|
|
|
161
185
|
end
|
|
162
186
|
end
|
|
163
187
|
|
|
164
|
-
|
|
188
|
+
# @param path [String]
|
|
189
|
+
# @yieldparam content [String] Content of file. If `content` is changed in block, file will be changed.
|
|
190
|
+
def create_new_file(path, &block)
|
|
191
|
+
return if glob_pattern?(path)
|
|
192
|
+
|
|
193
|
+
full_file_path = File.join(@__target_dir__, path)
|
|
194
|
+
|
|
195
|
+
return if File.exist?(full_file_path)
|
|
196
|
+
|
|
197
|
+
SashimiTanpopo.logger.info "Checking #{full_file_path}"
|
|
198
|
+
|
|
199
|
+
before_content = ""
|
|
200
|
+
after_content = update_single_file(before_content, &block)
|
|
201
|
+
|
|
202
|
+
unless after_content
|
|
203
|
+
SashimiTanpopo.logger.info "#{full_file_path} isn't created"
|
|
204
|
+
return
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
File.write(full_file_path, after_content) if !dry_run? && @__is_update_local__
|
|
208
|
+
|
|
209
|
+
if changed_files[path]
|
|
210
|
+
changed_files[path][:after_content] = after_content
|
|
211
|
+
else
|
|
212
|
+
changed_files[path] = {
|
|
213
|
+
before_content: before_content,
|
|
214
|
+
after_content: after_content,
|
|
215
|
+
mode: File.stat(full_file_path).mode.to_s(8)
|
|
216
|
+
}
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
if dry_run?
|
|
220
|
+
SashimiTanpopo.logger.info "#{full_file_path} will be created (dryrun)"
|
|
221
|
+
else
|
|
222
|
+
SashimiTanpopo.logger.info "#{full_file_path} is created"
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# @param pattern [String]
|
|
227
|
+
# @return [Boolean]
|
|
228
|
+
def glob_pattern?(pattern)
|
|
229
|
+
["*", "?", "[", "]", "{", "}", "**/"].any? { |str| pattern.include?(str) }
|
|
230
|
+
end
|
|
165
231
|
|
|
166
232
|
# @param content [String]
|
|
167
233
|
#
|
data/rbs_collection.lock.yaml
CHANGED
|
@@ -6,7 +6,7 @@ gems:
|
|
|
6
6
|
source:
|
|
7
7
|
type: git
|
|
8
8
|
name: ruby/gem_rbs_collection
|
|
9
|
-
revision:
|
|
9
|
+
revision: f1d2dae32fe8d46683fbc79bbd0f1ca391d5e11a
|
|
10
10
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
11
11
|
repo_dir: gems
|
|
12
12
|
- name: base64
|
|
@@ -14,7 +14,7 @@ gems:
|
|
|
14
14
|
source:
|
|
15
15
|
type: git
|
|
16
16
|
name: ruby/gem_rbs_collection
|
|
17
|
-
revision:
|
|
17
|
+
revision: f1d2dae32fe8d46683fbc79bbd0f1ca391d5e11a
|
|
18
18
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
19
19
|
repo_dir: gems
|
|
20
20
|
- name: bigdecimal
|
|
@@ -22,7 +22,7 @@ gems:
|
|
|
22
22
|
source:
|
|
23
23
|
type: git
|
|
24
24
|
name: ruby/gem_rbs_collection
|
|
25
|
-
revision:
|
|
25
|
+
revision: f1d2dae32fe8d46683fbc79bbd0f1ca391d5e11a
|
|
26
26
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
27
27
|
repo_dir: gems
|
|
28
28
|
- name: csv
|
|
@@ -30,13 +30,9 @@ gems:
|
|
|
30
30
|
source:
|
|
31
31
|
type: git
|
|
32
32
|
name: ruby/gem_rbs_collection
|
|
33
|
-
revision:
|
|
33
|
+
revision: f1d2dae32fe8d46683fbc79bbd0f1ca391d5e11a
|
|
34
34
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
35
35
|
repo_dir: gems
|
|
36
|
-
- name: date
|
|
37
|
-
version: '0'
|
|
38
|
-
source:
|
|
39
|
-
type: stdlib
|
|
40
36
|
- name: dbm
|
|
41
37
|
version: '0'
|
|
42
38
|
source:
|
|
@@ -46,7 +42,7 @@ gems:
|
|
|
46
42
|
source:
|
|
47
43
|
type: git
|
|
48
44
|
name: ruby/gem_rbs_collection
|
|
49
|
-
revision:
|
|
45
|
+
revision: f1d2dae32fe8d46683fbc79bbd0f1ca391d5e11a
|
|
50
46
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
51
47
|
repo_dir: gems
|
|
52
48
|
- name: diffy
|
|
@@ -54,7 +50,7 @@ gems:
|
|
|
54
50
|
source:
|
|
55
51
|
type: git
|
|
56
52
|
name: ruby/gem_rbs_collection
|
|
57
|
-
revision:
|
|
53
|
+
revision: f1d2dae32fe8d46683fbc79bbd0f1ca391d5e11a
|
|
58
54
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
59
55
|
repo_dir: gems
|
|
60
56
|
- name: erb
|
|
@@ -66,7 +62,7 @@ gems:
|
|
|
66
62
|
source:
|
|
67
63
|
type: git
|
|
68
64
|
name: ruby/gem_rbs_collection
|
|
69
|
-
revision:
|
|
65
|
+
revision: f1d2dae32fe8d46683fbc79bbd0f1ca391d5e11a
|
|
70
66
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
71
67
|
repo_dir: gems
|
|
72
68
|
- name: fileutils
|
|
@@ -82,7 +78,7 @@ gems:
|
|
|
82
78
|
source:
|
|
83
79
|
type: git
|
|
84
80
|
name: ruby/gem_rbs_collection
|
|
85
|
-
revision:
|
|
81
|
+
revision: f1d2dae32fe8d46683fbc79bbd0f1ca391d5e11a
|
|
86
82
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
87
83
|
repo_dir: gems
|
|
88
84
|
- name: hashdiff
|
|
@@ -90,7 +86,7 @@ gems:
|
|
|
90
86
|
source:
|
|
91
87
|
type: git
|
|
92
88
|
name: ruby/gem_rbs_collection
|
|
93
|
-
revision:
|
|
89
|
+
revision: f1d2dae32fe8d46683fbc79bbd0f1ca391d5e11a
|
|
94
90
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
95
91
|
repo_dir: gems
|
|
96
92
|
- name: httparty
|
|
@@ -98,7 +94,7 @@ gems:
|
|
|
98
94
|
source:
|
|
99
95
|
type: git
|
|
100
96
|
name: ruby/gem_rbs_collection
|
|
101
|
-
revision:
|
|
97
|
+
revision: f1d2dae32fe8d46683fbc79bbd0f1ca391d5e11a
|
|
102
98
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
103
99
|
repo_dir: gems
|
|
104
100
|
- name: io-console
|
|
@@ -118,7 +114,7 @@ gems:
|
|
|
118
114
|
source:
|
|
119
115
|
type: git
|
|
120
116
|
name: ruby/gem_rbs_collection
|
|
121
|
-
revision:
|
|
117
|
+
revision: f1d2dae32fe8d46683fbc79bbd0f1ca391d5e11a
|
|
122
118
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
123
119
|
repo_dir: gems
|
|
124
120
|
- name: monitor
|
|
@@ -138,7 +134,7 @@ gems:
|
|
|
138
134
|
source:
|
|
139
135
|
type: git
|
|
140
136
|
name: ruby/gem_rbs_collection
|
|
141
|
-
revision:
|
|
137
|
+
revision: f1d2dae32fe8d46683fbc79bbd0f1ca391d5e11a
|
|
142
138
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
143
139
|
repo_dir: gems
|
|
144
140
|
- name: parallel
|
|
@@ -146,7 +142,7 @@ gems:
|
|
|
146
142
|
source:
|
|
147
143
|
type: git
|
|
148
144
|
name: ruby/gem_rbs_collection
|
|
149
|
-
revision:
|
|
145
|
+
revision: f1d2dae32fe8d46683fbc79bbd0f1ca391d5e11a
|
|
150
146
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
151
147
|
repo_dir: gems
|
|
152
148
|
- name: pp
|
|
@@ -170,7 +166,7 @@ gems:
|
|
|
170
166
|
source:
|
|
171
167
|
type: git
|
|
172
168
|
name: ruby/gem_rbs_collection
|
|
173
|
-
revision:
|
|
169
|
+
revision: f1d2dae32fe8d46683fbc79bbd0f1ca391d5e11a
|
|
174
170
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
175
171
|
repo_dir: gems
|
|
176
172
|
- name: rdoc
|
|
@@ -186,7 +182,7 @@ gems:
|
|
|
186
182
|
source:
|
|
187
183
|
type: git
|
|
188
184
|
name: ruby/gem_rbs_collection
|
|
189
|
-
revision:
|
|
185
|
+
revision: f1d2dae32fe8d46683fbc79bbd0f1ca391d5e11a
|
|
190
186
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
191
187
|
repo_dir: gems
|
|
192
188
|
- name: timeout
|
|
@@ -206,7 +202,7 @@ gems:
|
|
|
206
202
|
source:
|
|
207
203
|
type: git
|
|
208
204
|
name: ruby/gem_rbs_collection
|
|
209
|
-
revision:
|
|
205
|
+
revision: f1d2dae32fe8d46683fbc79bbd0f1ca391d5e11a
|
|
210
206
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
211
207
|
repo_dir: gems
|
|
212
208
|
gemfile_lock_path: Gemfile.lock
|
data/sig/sashimi_tanpopo/dsl.rbs
CHANGED
|
@@ -41,10 +41,16 @@ module SashimiTanpopo
|
|
|
41
41
|
|
|
42
42
|
def dry_run?: () -> bool
|
|
43
43
|
|
|
44
|
-
def update_file: (String pattern) { (String) -> void } -> void
|
|
44
|
+
def update_file: (String pattern, ?create: bool) { (String) -> void } -> void
|
|
45
45
|
|
|
46
46
|
private
|
|
47
47
|
|
|
48
|
+
def update_file_with_glob: (String pattern) { (String) -> void } -> void
|
|
49
|
+
|
|
50
|
+
def create_new_file: (String path) { (String) -> void } -> void
|
|
51
|
+
|
|
52
|
+
def glob_pattern?: (String pattern) -> bool
|
|
53
|
+
|
|
48
54
|
def update_single_file: (String content) { (String) -> void } -> String?
|
|
49
55
|
|
|
50
56
|
def show_diff: (String str1, String str2) -> void
|