master_delivery 1.0.4 → 1.0.5

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: c96b7a6e293146f06482ae8ee3f286b970ba9c0410697ed5634d2bacb4efc907
4
- data.tar.gz: ab74ed9c5b3498778d26bae2fc9a8eaab8c4075bd9b124293bd9213a439db9bc
3
+ metadata.gz: d57694762f369b51254410b1275d131512d6ee485a7ead16ad8287e8ace819a5
4
+ data.tar.gz: 1adbdc9c1b0340d42c9c226b6ea6a7b82fb1954b6fb280cbf8e8f1b8778e8712
5
5
  SHA512:
6
- metadata.gz: 714ee4ae4fc50a90e93ba853262b9aa3a197134c6b649fdc3815854c70db39b84e14faef62982c29c7767787de95927697613fadd45afbb1e35385039b8db1dc
7
- data.tar.gz: c5b463336afde3099108678a7235d4f6242b6cc5374b4c365716a724424b4deb967a5c5c5e492e64d1f9828729a376d0e3c6a5582ab9f5c187bc2e41ac5a571a
6
+ metadata.gz: dcd1c969e89bc5224b898acc9081ed95e9ce5cddd14ef4a7c26cf56d68e07f864a61ac948d69c76d61dc0c7a50a2ade1ec41ab7b39a9704c27fe96dfe1331a6e
7
+ data.tar.gz: aa87c276ff2bbc72c0b5fe3e8e0fd14c820b9afa2917f531dadc5e965c529303365940c01bb35f7666e93b3737c304e21c94fcd29321ec27570124628d9a5507
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [v1.0.5](https://github.com/shinyaohtani/master_delivery/tree/v1.0.5) (2020-05-03)
4
+
5
+ [Full Changelog](https://github.com/shinyaohtani/master_delivery/compare/v1.0.4...v1.0.5)
6
+
7
+ - fixed pathname to clean '//' etc.
8
+
9
+ **Fixed bugs:**
10
+
11
+ - Avoid slash duplication of delivery\_root when -d '/' [\#10](https://github.com/shinyaohtani/master_delivery/issues/10)
12
+
13
+ **Merged pull requests:**
14
+
15
+ - fixed path'//' using pathname.cleanpath [\#20](https://github.com/shinyaohtani/master_delivery/pull/20) ([shinyaohtani](https://github.com/shinyaohtani))
16
+
3
17
  ## [v1.0.4](https://github.com/shinyaohtani/master_delivery/tree/v1.0.4) (2020-04-28)
4
18
 
5
19
  [Full Changelog](https://github.com/shinyaohtani/master_delivery/compare/v1.0.3...v1.0.4)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- master_delivery (1.0.4)
4
+ master_delivery (1.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -63,7 +63,7 @@ GEM
63
63
  faraday (>= 0.9)
64
64
  sawyer (~> 0.8.0, >= 0.5.3)
65
65
  parallel (1.19.1)
66
- parser (2.7.1.1)
66
+ parser (2.7.1.2)
67
67
  ast (~> 2.4.0)
68
68
  protocol-hpack (1.4.2)
69
69
  protocol-http (0.18.0)
@@ -87,15 +87,15 @@ GEM
87
87
  rspec-core (~> 3.9.0)
88
88
  rspec-expectations (~> 3.9.0)
89
89
  rspec-mocks (~> 3.9.0)
90
- rspec-core (3.9.1)
91
- rspec-support (~> 3.9.1)
90
+ rspec-core (3.9.2)
91
+ rspec-support (~> 3.9.3)
92
92
  rspec-expectations (3.9.1)
93
93
  diff-lcs (>= 1.2.0, < 2.0)
94
94
  rspec-support (~> 3.9.0)
95
95
  rspec-mocks (3.9.1)
96
96
  diff-lcs (>= 1.2.0, < 2.0)
97
97
  rspec-support (~> 3.9.0)
98
- rspec-support (3.9.2)
98
+ rspec-support (3.9.3)
99
99
  rubocop (0.82.0)
100
100
  jaro_winkler (~> 1.5.1)
101
101
  parallel (~> 1.10)
@@ -106,7 +106,7 @@ GEM
106
106
  unicode-display_width (>= 1.4.0, < 2.0)
107
107
  rubocop-performance (1.5.2)
108
108
  rubocop (>= 0.71.0)
109
- rubocop-rspec (1.38.1)
109
+ rubocop-rspec (1.39.0)
110
110
  rubocop (>= 0.68.1)
111
111
  ruby-progressbar (1.10.1)
112
112
  sawyer (0.8.2)
@@ -5,6 +5,7 @@
5
5
  module MasterDelivery
6
6
  require 'master_delivery'
7
7
  require 'optparse'
8
+ require 'pathname'
8
9
 
9
10
  DESC_MASTER_DIR = <<~MASTER
10
11
  Master snapshot directory. All master files in this
@@ -87,9 +88,10 @@ module MasterDelivery
87
88
  def run
88
89
  return unless check_param_consistency
89
90
 
90
- master_dir = File.expand_path(@params[:master])
91
- md = MasterDelivery.new(File.dirname(master_dir), @params[:backup])
92
- arg_set = [File.basename(master_dir), @params[:delivery]]
91
+ fix_param_paths(%i[master delivery backup])
92
+ master = @params[:master]
93
+ md = MasterDelivery.new(File.dirname(master), @params[:backup])
94
+ arg_set = [File.basename(master), @params[:delivery]]
93
95
  return unless md.confirm(*arg_set, @params.slice(:type, :quiet, :dryrun, :yes))
94
96
 
95
97
  md.deliver(*arg_set, **@params.slice(:type, :dryrun))
@@ -201,5 +203,17 @@ module MasterDelivery
201
203
  puts "Invalid arguments are given: #{ARGV}"
202
204
  false
203
205
  end
206
+
207
+ def fix_param_paths(options)
208
+ options.each do |opt|
209
+ @params[opt] = fix_path_format(@params[opt])
210
+ end
211
+ end
212
+
213
+ def fix_path_format(param_path)
214
+ return param_path if !param_path.nil? && !param_path.empty?
215
+
216
+ Pathname.new(File.expand_path(param_path)).cleanpath.to_s
217
+ end
204
218
  end
205
219
  end
@@ -6,6 +6,7 @@ require 'master_delivery/version'
6
6
  module MasterDelivery
7
7
  require 'fileutils'
8
8
  require 'find'
9
+ require 'pathname'
9
10
  require 'tmpdir'
10
11
  MSG_CONFIRMATION_INTRO = <<~CONFIRM_INTRO
11
12
 
@@ -147,11 +148,13 @@ module MasterDelivery
147
148
  end
148
149
 
149
150
  def backup_file_path(master, master_id, backup_dir)
150
- File.expand_path(backup_dir) + relative_master_path(master, master_id)
151
+ path = File.expand_path(backup_dir) + relative_master_path(master, master_id)
152
+ Pathname.new(path).cleanpath.to_s
151
153
  end
152
154
 
153
155
  def target_file_path(master, master_id, target_prefix)
154
- relative_master_path(master, master_id).prepend(File.expand_path(target_prefix))
156
+ path = relative_master_path(master, master_id).prepend(File.expand_path(target_prefix))
157
+ Pathname.new(path).cleanpath.to_s
155
158
  end
156
159
  end
157
160
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MasterDelivery
4
- VERSION = '1.0.4'
4
+ VERSION = '1.0.5'
5
5
  DESCRIPTION = <<~DESC
6
6
  Deliver all master files managed in a single master snapshot directory
7
7
  into the specified directory while maintaining the hierarchy of the
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: master_delivery
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shinya Ohtani (shinyaohtani@github)
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-28 00:00:00.000000000 Z
11
+ date: 2020-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler