sashimi_tanpopo 0.3.2 → 0.3.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f419c456b6bd232d0af91f67a4a990b1207db12b186ee9ace48f736d5f4df7d
4
- data.tar.gz: 55128422045397cc07dc296585689bb4554257e3b00ab2478f961c002ca75c2e
3
+ metadata.gz: 67fece13651795cb4bb095869e0bb4a39605c3538dc7d025000828074249bee0
4
+ data.tar.gz: 176c9e5283bf71e67204bb750cfe2fac0ea0c252f80ccfc6c346fdb6a8a6bc2b
5
5
  SHA512:
6
- metadata.gz: 2c1da714d12deab14a91316d82b3aa21e1b7feb87d68ef0bdc2c21afbec363bfd55aa84cc7b01f69e9ff9367c0237a07b46a765e12f7ea26f57a328b5439ee6f
7
- data.tar.gz: 8c12b901499604591f683cbf4d11a79243d2abb40c97f414cb3bab33fe01cb9c2b1b06ccea2eb49e5024294c3be5b56884920725768b4dbb94705e781d43314b
6
+ metadata.gz: 57e5a36438ef78f83f7be086209e00bb8f421ffea722c1c4e0e6696f370fef8d577dae879a0489855535ff9daa1efe8802b9fa935fd23fd6a70bc281e7830e80
7
+ data.tar.gz: 7b7ad4c992cb797346d58c07bd9e008727d41654e2762222cb8e92ae351d535f538bcd1b06893b66f231e2bd26cdbc95e18124bcff8950be0e358994d09d43ce
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
- [full changelog](http://github.com/sue445/sashimi_tanpopo/compare/v0.3.2...main)
2
+ [full changelog](http://github.com/sue445/sashimi_tanpopo/compare/v0.3.3...main)
3
+
4
+ ## [0.3.3](https://github.com/sue445/sashimi_tanpopo/releases/tag/v0.3.3) - 2025-11-05
5
+ [full changelog](http://github.com/sue445/sashimi_tanpopo/compare/v0.3.2...v0.3.3)
6
+
7
+ * Fixed an issue where file was not updated when `update_file` was called multiple times on the same file
8
+ * https://github.com/sue445/sashimi_tanpopo/pull/70
3
9
 
4
10
  ## [0.3.2](https://github.com/sue445/sashimi_tanpopo/releases/tag/v0.3.2) - 2025-11-02
5
11
  [full changelog](http://github.com/sue445/sashimi_tanpopo/compare/v0.3.1...v0.3.2)
data/Dockerfile CHANGED
@@ -1,7 +1,7 @@
1
1
  ARG RUBY_VERSION=3.4
2
2
  FROM ruby:${RUBY_VERSION}-alpine
3
3
 
4
- ARG SASHIMI_TANPOPO_VERSION=0.3.1
4
+ ARG SASHIMI_TANPOPO_VERSION=0.3.2
5
5
 
6
6
  WORKDIR /work
7
7
 
@@ -122,22 +122,36 @@ module SashimiTanpopo
122
122
  def update_file(pattern, &block)
123
123
  Dir.glob(pattern).each do |path|
124
124
  full_file_path = File.join(@__target_dir__, path)
125
- before_content = File.read(full_file_path)
125
+
126
+ next unless File.exist?(full_file_path)
127
+
128
+ before_content =
129
+ if changed_files[path]
130
+ changed_files[path][:after_content]
131
+ else
132
+ File.read(full_file_path)
133
+ end
126
134
 
127
135
  SashimiTanpopo.logger.info "Checking #{full_file_path}"
128
136
 
129
- after_content = update_single_file(path, &block)
137
+ after_content = update_single_file(before_content, &block)
130
138
 
131
139
  unless after_content
132
140
  SashimiTanpopo.logger.info "#{full_file_path} isn't changed"
133
141
  next
134
142
  end
135
143
 
136
- changed_files[path] = {
137
- before_content: before_content,
138
- after_content: after_content,
139
- mode: File.stat(full_file_path).mode.to_s(8)
140
- }
144
+ File.write(full_file_path, after_content) if !dry_run? && @__is_update_local__
145
+
146
+ if changed_files[path]
147
+ changed_files[path][:after_content] = after_content
148
+ else
149
+ changed_files[path] = {
150
+ before_content: before_content,
151
+ after_content: after_content,
152
+ mode: File.stat(full_file_path).mode.to_s(8)
153
+ }
154
+ end
141
155
 
142
156
  if dry_run?
143
157
  SashimiTanpopo.logger.info "#{full_file_path} will be changed (dryrun)"
@@ -149,28 +163,23 @@ module SashimiTanpopo
149
163
 
150
164
  private
151
165
 
152
- # @param path [String]
166
+ # @param content [String]
153
167
  #
154
168
  # @yieldparam content [String] content of file
155
169
  #
156
170
  # @return [String] Content of changed file if file is changed
157
171
  # @return [nil] file isn't changed
158
- def update_single_file(path)
159
- return nil unless File.exist?(path)
172
+ def update_single_file(content)
173
+ after_content = content.dup
160
174
 
161
- content = File.read(path)
162
- before_content = content.dup
163
-
164
- yield content
175
+ yield after_content
165
176
 
166
177
  # File isn't changed
167
- return nil if content == before_content
168
-
169
- show_diff(before_content, content)
178
+ return nil if after_content == content
170
179
 
171
- File.write(path, content) if !dry_run? && @__is_update_local__
180
+ show_diff(content, after_content)
172
181
 
173
- content
182
+ after_content
174
183
  end
175
184
 
176
185
  # @param str1 [String]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SashimiTanpopo
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.3"
5
5
  end
@@ -33,6 +33,10 @@ gems:
33
33
  revision: 04ed82d7df5d5ee825d7864abfa29d624b52e549
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
36
40
  - name: dbm
37
41
  version: '0'
38
42
  source:
@@ -45,7 +45,7 @@ module SashimiTanpopo
45
45
 
46
46
  private
47
47
 
48
- def update_single_file: (String path) { (String) -> void } -> String?
48
+ def update_single_file: (String content) { (String) -> void } -> String?
49
49
 
50
50
  def show_diff: (String str1, String str2) -> void
51
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sashimi_tanpopo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445