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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d598fdb8c38b12f9946058d06f4904f8c4e279c5973d7173061869ebeb8e4db8
4
- data.tar.gz: b37c176948435b13ee2a494e5e0973fd14d5660e3bbe1da3c419b5a7328286b5
3
+ metadata.gz: f48f7f4d8486419b770c7b1e76f3f6b8186bd31d3f21503f8e8c65b29ec748ee
4
+ data.tar.gz: b5d0d902388a22d2813d6f261f31f0596d2c09e96d9536241c868e04b8e84c59
5
5
  SHA512:
6
- metadata.gz: 991cbfc6556e45618971ab059c8bb8a23a106abf73d86f3f1409d47ce03920b7b5ab67287bbb43a920f6443bafe0e18e71c3890b381e89e8da9c2bd828f0cbb0
7
- data.tar.gz: 3054fb61cf64fe18e12e203fd97ebc49cc54d846e2ad28a46269128041c9e4e4785cac92d5560acdc102a0450460df8dd2b5b944b3756a7ab3b0fc315371a758
6
+ metadata.gz: 99f79946945bb30f660125c5d615a060fbd9cb32e2d994c5912076fc7f0e5bb01ee3df0cb3a9d874d0dd4f6980db527df2666fe07d4b547e4d5421841cf0d37e
7
+ data.tar.gz: 955ce588e7a118f4709783898faab44789a7d37355e82bf793fc812dcb8f711d6c3ea463d384ce7fc118ed9d1af4e39cf7fc85043f088d11b826a27bb0e30e43
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- advance (0.3.3)
4
+ advance (0.3.4)
5
5
  team_effort
6
6
 
7
7
  GEM
@@ -1,3 +1,3 @@
1
1
  module Advance
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
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(basename) do
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
- tmp_dir_name = "tmp_#{stripped_dir_name}"
206
- FileUtils.rm_rf tmp_dir_name
207
- FileUtils.mkdir_p tmp_dir_name
208
- FileUtils.cd tmp_dir_name
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 tmp_dir_name, stripped_dir_name
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: advance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - janemacfarlane