advance 0.3.3 → 0.3.4
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/Gemfile.lock +1 -1
- data/lib/advance/version.rb +1 -1
- data/lib/advance.rb +14 -7
- 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: f48f7f4d8486419b770c7b1e76f3f6b8186bd31d3f21503f8e8c65b29ec748ee
|
4
|
+
data.tar.gz: b5d0d902388a22d2813d6f261f31f0596d2c09e96d9536241c868e04b8e84c59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99f79946945bb30f660125c5d615a060fbd9cb32e2d994c5912076fc7f0e5bb01ee3df0cb3a9d874d0dd4f6980db527df2666fe07d4b547e4d5421841cf0d37e
|
7
|
+
data.tar.gz: 955ce588e7a118f4709783898faab44789a7d37355e82bf793fc812dcb8f711d6c3ea463d384ce7fc118ed9d1af4e39cf7fc85043f088d11b826a27bb0e30e43
|
data/Gemfile.lock
CHANGED
data/lib/advance/version.rb
CHANGED
data/lib/advance.rb
CHANGED
@@ -176,14 +176,18 @@ module Advance
|
|
176
176
|
end
|
177
177
|
TeamEffort.work(file_paths, $cores, progress_proc: progress_proc) do |file_path|
|
178
178
|
begin
|
179
|
+
path_relative_to_step_dir = File.dirname(file_path.gsub(%r(^#{previous_dir_path}/?), ""))
|
180
|
+
path_relative_to_step_dir = path_relative_to_step_dir == "." ? "" : path_relative_to_step_dir
|
179
181
|
basename = File.basename(file_path)
|
182
|
+
new_dir_name = path_relative_to_step_dir == "" ? basename : File.join(path_relative_to_step_dir, basename)
|
180
183
|
root_file_name = basename.gsub(%r(\.[^.]+$), '')
|
181
184
|
|
185
|
+
command.gsub!("{input_dir}", File.dirname(file_path))
|
182
186
|
command.gsub!("{input_file}", file_path)
|
183
187
|
command.gsub!("{file_name}", basename)
|
184
188
|
command.gsub!("{file_name_without_extension}", root_file_name)
|
185
189
|
puts "#{YELLOW}#{command}#{RESET}"
|
186
|
-
work_in_sub_dir(
|
190
|
+
work_in_sub_dir(new_dir_name) do
|
187
191
|
do_command command, no_feedback
|
188
192
|
end
|
189
193
|
rescue
|
@@ -195,6 +199,7 @@ module Advance
|
|
195
199
|
end
|
196
200
|
|
197
201
|
def work_in_sub_dir(dir_name)
|
202
|
+
starting_dir = FileUtils.pwd
|
198
203
|
stripped_dir_name = strip_extensions(dir_name)
|
199
204
|
if $redo_mode == :checking && Dir.exist?(stripped_dir_name)
|
200
205
|
return
|
@@ -202,15 +207,17 @@ module Advance
|
|
202
207
|
|
203
208
|
$redo_mode = :replacing
|
204
209
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
FileUtils.
|
210
|
+
dirs = File.split(stripped_dir_name)
|
211
|
+
dirs[-1] = "tmp_#{dirs[-1]}"
|
212
|
+
tmp_dir = File.join(dirs)
|
213
|
+
FileUtils.rm_rf tmp_dir
|
214
|
+
FileUtils.mkdir_p tmp_dir
|
215
|
+
FileUtils.cd tmp_dir
|
209
216
|
|
210
217
|
yield
|
211
218
|
|
212
|
-
FileUtils.cd
|
213
|
-
FileUtils.mv
|
219
|
+
FileUtils.cd starting_dir
|
220
|
+
FileUtils.mv tmp_dir, stripped_dir_name
|
214
221
|
end
|
215
222
|
|
216
223
|
def strip_extensions(dir_name)
|