master_delivery 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/Gemfile.lock +1 -1
- data/README.md +52 -16
- data/lib/cli_master_delivery.rb +9 -5
- data/lib/master_delivery.rb +8 -4
- data/lib/master_delivery/version.rb +14 -1
- metadata +15 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fd9a6ebb7e41f0328c46e274a36d8a0baf7e4b1549e0f88865bfcdae47462ec
|
4
|
+
data.tar.gz: 23dff41dd71f145e7bf5f3b835e049080d6ce210784b859a301f7c40aed1af2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b486c93913a8b1c7a572eb5fae14fb394a9ea94f4da36ffccf3fe0acdaeee70adef7addafbfa856b35e7eb22d5030308c6413e34a1caf88ecf584944151866c
|
7
|
+
data.tar.gz: 8155f6027b8af3e52ed1728f71dfc7a91d46f1e1e48f1fe8f47cef92a484db116b038dbf1cdf81d57de161019a260155580134f73f4168d7aad62c64e0d0abad
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v1.0.3](https://github.com/shinyaohtani/master_delivery/tree/v1.0.3) (2020-04-28)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/shinyaohtani/master_delivery/compare/v1.0.2...v1.0.3)
|
6
|
+
|
7
|
+
- Option to suppress non-error message
|
8
|
+
- Described the difference with rsync on README.md
|
9
|
+
|
10
|
+
**Implemented enhancements:**
|
11
|
+
|
12
|
+
- Option to suppress messages [\#4](https://github.com/shinyaohtani/master_delivery/issues/4)
|
13
|
+
|
14
|
+
**Merged pull requests:**
|
15
|
+
|
16
|
+
- Implemented message suppressor [\#12](https://github.com/shinyaohtani/master_delivery/pull/12) ([shinyaohtani](https://github.com/shinyaohtani))
|
17
|
+
- release note [\#9](https://github.com/shinyaohtani/master_delivery/pull/9) ([shinyaohtani](https://github.com/shinyaohtani))
|
18
|
+
|
3
19
|
## [v1.0.2](https://github.com/shinyaohtani/master_delivery/tree/v1.0.2) (2020-04-27)
|
4
20
|
|
5
21
|
[Full Changelog](https://github.com/shinyaohtani/master_delivery/compare/v1.0.1...v1.0.2)
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,41 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/master_delivery.svg)](https://badge.fury.io/rb/master_delivery)
|
2
|
+
|
1
3
|
# MasterDelivery
|
2
4
|
|
3
5
|
`MasterDelivery` is a master file manager utility. `MasterDelivery` delivers all master files managed in a single master snapshot directory into the specified directory while maintaining the hierarchy of the master snapshot directory. If the destination file already exists, back it up first and then deliver the master file.
|
4
6
|
|
7
|
+
**The difference with rsync** is that `MasterDelivery` creates a symlinks instead of copying the master files. They are symlinks, so you have to keep in mind that you have to keep the master files in the same location,
|
8
|
+
but it also has the advantage that the master file is updated at the same time when you directly make changes to the delivered file.
|
9
|
+
|
10
|
+
Do you have any experience that the master file is getting old gradually? `MasterDelivery` can prevent this.
|
11
|
+
|
12
|
+
If the master directory is git or svn managed, you can manage revisions of files that are delivered here and there at once with commands like git diff and git commit.
|
13
|
+
|
14
|
+
## Example
|
15
|
+
|
16
|
+
If you specify command line arguments `MASTER_DIR` and `DELIVERY_ROOT` as follows:
|
17
|
+
```bash
|
18
|
+
$ master_delivery -m ~/master/my_home_setting -d /Users/foo
|
19
|
+
```
|
20
|
+
This means:
|
21
|
+
```
|
22
|
+
(-m) MASTER_DIR: -m ~/master/my_home_setting
|
23
|
+
(-d) DELIVER_ROOT: -d /Users/foo
|
24
|
+
```
|
25
|
+
|
26
|
+
and suppose master files now in `MASTER_DIR` are as follows:
|
27
|
+
```
|
28
|
+
~/master/my_home_setting/.zshrc
|
29
|
+
~/master/my_home_setting/work/.rubocop.yml
|
30
|
+
```
|
31
|
+
|
32
|
+
then these files will be delivered as the following files:
|
33
|
+
```
|
34
|
+
/Users/foo/.zshrc
|
35
|
+
/Users/foo/work/.rubocop.yml
|
36
|
+
```
|
37
|
+
|
38
|
+
|
5
39
|
## Installation
|
6
40
|
|
7
41
|
Add this line to your application's Gemfile:
|
@@ -21,19 +55,6 @@ Or install it yourself as:
|
|
21
55
|
## Usage
|
22
56
|
|
23
57
|
```
|
24
|
-
Example:
|
25
|
-
If you specify MASTER_DIR and DELIVERY_ROOT as follows:
|
26
|
-
MASTER_DIR: -m ~/masters/my_home_setting
|
27
|
-
DELIVERY_ROOT: -d /Users/foo
|
28
|
-
|
29
|
-
and suppose master files in MASTER_DIR are as follows:
|
30
|
-
~/master/my_home_setting/.zshrc
|
31
|
-
~/master/my_home_setting/work/.rubocop.yml
|
32
|
-
|
33
|
-
then these files will be delivered as the following files:
|
34
|
-
/Users/foo/.zshrc
|
35
|
-
/Users/foo/work/.rubocop.yml
|
36
|
-
|
37
58
|
Usage: master_delivery -m <dir> -d <dir> [options]
|
38
59
|
Required:
|
39
60
|
-m, --master [MASTER_DIR] Master snapshot directory. All master files in this
|
@@ -60,6 +81,17 @@ Usage: master_delivery -m <dir> -d <dir> [options]
|
|
60
81
|
the commands on stderr.
|
61
82
|
We strongly recommend "--dryrun" before running.
|
62
83
|
(default: --no-dryrun)
|
84
|
+
-q, --[no-]quiet Suppress non-error messages
|
85
|
+
(default: --no-quiet)
|
86
|
+
-y, --[no-]yes Skip confirmation. It is recommended to execute
|
87
|
+
the command carefully without skipping confirmation.
|
88
|
+
With the "--yes" option, if you want to change the
|
89
|
+
command line argument even a little, remove the
|
90
|
+
"--yes" option once, execute it several times,
|
91
|
+
and experience confirmation several times.
|
92
|
+
Also, it's a good idea to add the "--yes" option
|
93
|
+
only after you start to feel confirmation annoying.
|
94
|
+
(default: --no-yes)
|
63
95
|
|
64
96
|
Common options:
|
65
97
|
-h, --help Show this message
|
@@ -75,8 +107,12 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
75
107
|
|
76
108
|
## Contributing
|
77
109
|
|
78
|
-
Bug reports and pull requests are welcome
|
79
|
-
|
110
|
+
Bug reports and pull requests are welcome!
|
111
|
+
1. Fork it ( https://github.com/shinyaohtani/master_delivery )
|
112
|
+
1. Create your feature branch (git checkout -b my-new-feature)
|
113
|
+
1. Commit your changes (git commit -am 'Add some feature')
|
114
|
+
1. Push to the branch (git push origin my-new-feature)
|
115
|
+
1. Create a new Pull Request
|
80
116
|
|
81
117
|
## License
|
82
118
|
|
@@ -84,4 +120,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
84
120
|
|
85
121
|
## Code of Conduct
|
86
122
|
|
87
|
-
Everyone interacting in the MasterDelivery project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
123
|
+
Everyone interacting in the MasterDelivery project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/shinyaohtani/master_delivery/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/cli_master_delivery.rb
CHANGED
@@ -39,6 +39,10 @@ module MasterDelivery
|
|
39
39
|
We strongly recommend "--dryrun" before running.
|
40
40
|
(default: --no-dryrun)
|
41
41
|
DRYRUN
|
42
|
+
DESC_QUIET = <<~QUIET
|
43
|
+
Suppress non-error messages
|
44
|
+
(default: --no-quiet)
|
45
|
+
QUIET
|
42
46
|
DESC_SKIP_CONF = <<~SKIP_CONF
|
43
47
|
Skip confirmation. It is recommended to execute
|
44
48
|
the command carefully without skipping confirmation.
|
@@ -70,7 +74,7 @@ module MasterDelivery
|
|
70
74
|
attr_accessor :params
|
71
75
|
|
72
76
|
def initialize
|
73
|
-
@params = { type: VALUE_DELIVERY_TYPE[0].to_sym, dryrun: false }
|
77
|
+
@params = { type: VALUE_DELIVERY_TYPE[0].to_sym, dryrun: false, quiet: false }
|
74
78
|
end
|
75
79
|
|
76
80
|
def parse_options
|
@@ -86,11 +90,10 @@ module MasterDelivery
|
|
86
90
|
master_dir = File.expand_path(@params[:master])
|
87
91
|
md = MasterDelivery.new(File.dirname(master_dir), @params[:backup])
|
88
92
|
arg_set = [File.basename(master_dir), @params[:delivery]]
|
89
|
-
|
90
|
-
return unless md.confirm(*arg_set, skip_conf: @params[:yes], **arg_hash)
|
93
|
+
return unless md.confirm(*arg_set, **(@params.slice(:type, :quiet, :dryrun, :skip_conf)))
|
91
94
|
|
92
|
-
md.deliver(*arg_set, **
|
93
|
-
puts 'done!'
|
95
|
+
md.deliver(*arg_set, **(@params.slice(:type, :dryrun)))
|
96
|
+
puts 'done!' unless @params[:quiet]
|
94
97
|
end
|
95
98
|
|
96
99
|
private
|
@@ -105,6 +108,7 @@ module MasterDelivery
|
|
105
108
|
opts.on('-t [DELIVERY_TYPE]', '--type [DELIVERY_TYPE]', *DESC_DELIVERY_TYPE.split(/\R/), &:to_sym)
|
106
109
|
opts.on('-b [BACKUP_ROOT]', '--backup [BACKUP_ROOT]', *DESC_BACKUP_ROOT.split(/\R/)) { |v| v }
|
107
110
|
opts.on('-D', '--[no-]dryrun', *DESC_DRYRUN.split(/\R/)) { |v| v }
|
111
|
+
opts.on('-q', '--[no-]quiet', *DESC_QUIET.split(/\R/)) { |v| v }
|
108
112
|
opts.on('-y', '--[no-]yes', *DESC_SKIP_CONF.split(/\R/)) { |v| v }
|
109
113
|
opts.separator ''
|
110
114
|
opts.separator ' Common options:'
|
data/lib/master_delivery.rb
CHANGED
@@ -69,14 +69,18 @@ module MasterDelivery
|
|
69
69
|
backup_dir
|
70
70
|
end
|
71
71
|
|
72
|
-
def confirm(master_id, target_prefix,
|
73
|
-
|
72
|
+
def confirm(master_id, target_prefix,
|
73
|
+
type: :symbolic_link, dryrun: false, skip_conf: false, quiet: false)
|
74
74
|
|
75
|
-
|
76
|
-
|
75
|
+
unless quiet
|
76
|
+
puts MSG_CONFIRMATION_INTRO unless skip_conf
|
77
|
+
print_params(master_id, target_prefix, type: type, dryrun: dryrun)
|
78
|
+
print_sample(master_id, target_prefix)
|
79
|
+
end
|
77
80
|
print MSG_CONFIRMATION.chomp unless skip_conf # use print instead of puts for '\n'
|
78
81
|
return true if skip_conf || gets.chomp == 'y'
|
79
82
|
|
83
|
+
puts 'aborted.'
|
80
84
|
false
|
81
85
|
end
|
82
86
|
|
@@ -1,11 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module MasterDelivery
|
4
|
-
VERSION = '1.0.
|
4
|
+
VERSION = '1.0.3'
|
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
|
8
8
|
master snapshot directory. If the destination file already exists,
|
9
9
|
back it up first and then deliver the master file.
|
10
|
+
|
11
|
+
The difference with rsync is that master_delivery creates a symlinks
|
12
|
+
instead of copying the master files. They are symlinks, so you have to
|
13
|
+
keep in mind that you have to keep the master files in the same location,
|
14
|
+
but it also has the advantage that the master file is updated at the same
|
15
|
+
time when you directly make changes to the delivered file.
|
16
|
+
|
17
|
+
Do you have any experience that the master file is getting old gradually?
|
18
|
+
master_delivery can prevent this.
|
19
|
+
|
20
|
+
If the master directory is git or svn managed, you can manage revisions
|
21
|
+
of files that are delivered here and there at once with commands
|
22
|
+
like git diff and git commit.
|
10
23
|
DESC
|
11
24
|
end
|
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
|
+
version: 1.0.3
|
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-
|
11
|
+
date: 2020-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -141,6 +141,19 @@ description: |
|
|
141
141
|
into the specified directory while maintaining the hierarchy of the
|
142
142
|
master snapshot directory. If the destination file already exists,
|
143
143
|
back it up first and then deliver the master file.
|
144
|
+
|
145
|
+
The difference with rsync is that master_delivery creates a symlinks
|
146
|
+
instead of copying the master files. They are symlinks, so you have to
|
147
|
+
keep in mind that you have to keep the master files in the same location,
|
148
|
+
but it also has the advantage that the master file is updated at the same
|
149
|
+
time when you directly make changes to the delivered file.
|
150
|
+
|
151
|
+
Do you have any experience that the master file is getting old gradually?
|
152
|
+
master_delivery can prevent this.
|
153
|
+
|
154
|
+
If the master directory is git or svn managed, you can manage revisions
|
155
|
+
of files that are delivered here and there at once with commands
|
156
|
+
like git diff and git commit.
|
144
157
|
email:
|
145
158
|
- shinya_ohtani@yahoo.co.jp
|
146
159
|
executables:
|