flexdot 3.2.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +13 -12
- data/.gitignore +0 -1
- data/README.md +9 -182
- data/doc/example.md +182 -0
- data/flexdot.gemspec +1 -1
- data/lib/flexdot/backup.rb +12 -1
- data/lib/flexdot/installer.rb +5 -4
- data/lib/flexdot/tasks.rb +6 -6
- data/lib/flexdot/version.rb +1 -1
- data/lib/flexdot.rb +26 -2
- metadata +8 -8
- data/CHANGELOG.md +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65c16358e0213298deaf8a7de7af3f08df723b098fb65f8ac80822bac7669ecb
|
4
|
+
data.tar.gz: 502a030fa9dae8f2c82be1131157b28a2027731ccac2cb76c932d9371cc074ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50dffc8b877c4a91595c68314aae51129da3f1addd02f36423240cb56394bbaf13088487163315f4a0cdaf75215cc42f90fd0ecc98c08da8ef0bc07c6acf80fc
|
7
|
+
data.tar.gz: d22f233daaa40d98cd2f7c435e80be593ad0d2c78de827cb19d2d59d680ef37af974a6e708772136178fb1cf3eb6fcccb5d273416af76e71bc41a446b23ea423
|
data/.github/workflows/test.yml
CHANGED
@@ -1,33 +1,34 @@
|
|
1
1
|
|
2
2
|
name: Test
|
3
3
|
|
4
|
-
on:
|
4
|
+
on:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- main
|
8
|
+
- 'dev**'
|
9
|
+
pull_request:
|
5
10
|
|
6
11
|
jobs:
|
7
12
|
test:
|
8
13
|
name: Test on ruby ${{ matrix.ruby_version }}
|
9
14
|
runs-on: ubuntu-latest
|
10
|
-
# Run this build only on either pull request or push.
|
11
|
-
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
|
12
15
|
|
13
16
|
strategy:
|
14
17
|
matrix:
|
15
18
|
ruby_version:
|
16
|
-
-
|
17
|
-
-
|
18
|
-
- 3.
|
19
|
+
- '3.0'
|
20
|
+
- '3.1'
|
21
|
+
- '3.2'
|
22
|
+
- '3.3'
|
23
|
+
|
19
24
|
steps:
|
20
|
-
- uses: actions/checkout@
|
25
|
+
- uses: actions/checkout@v3
|
21
26
|
|
22
27
|
- name: Set up Ruby ${{ matrix.ruby_version }}
|
23
28
|
uses: ruby/setup-ruby@v1
|
24
29
|
with:
|
25
30
|
ruby-version: ${{ matrix.ruby_version }}
|
26
|
-
|
27
|
-
- name: Install dependencies
|
28
|
-
run: |
|
29
|
-
gem install bundler
|
30
|
-
bundle install --jobs 4 --retry 3
|
31
|
+
bundler-cache: true
|
31
32
|
|
32
33
|
- name: Run tests
|
33
34
|
run: bundle exec rake test
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -9,7 +9,7 @@ A Flexible and Rake based dotfile manager.
|
|
9
9
|
|
10
10
|
### Prerequisite
|
11
11
|
|
12
|
-
Ruby
|
12
|
+
Ruby 3.0+
|
13
13
|
|
14
14
|
### Installing
|
15
15
|
|
@@ -53,6 +53,12 @@ Flexdot.setup(
|
|
53
53
|
# Whether or not to colorize the output
|
54
54
|
# Default: true
|
55
55
|
output_colorize: true
|
56
|
+
|
57
|
+
# (optional)
|
58
|
+
# Whether to automatically delete old backups.
|
59
|
+
# If nil, do not delete, otherwise keep to the specified number of backups.
|
60
|
+
# Default: nil
|
61
|
+
keep_max_backup_count: 10
|
56
62
|
)
|
57
63
|
```
|
58
64
|
|
@@ -68,188 +74,9 @@ Finally, run `rake -T` in the `$HOME/dotfiles` and make sure that the output is
|
|
68
74
|
$ rake -T
|
69
75
|
rake clear_backups
|
70
76
|
|
71
|
-
##
|
72
|
-
|
73
|
-
This example is my actual dotfile environment.
|
74
|
-
|
75
|
-
I have two working environments, macOS and ubuntu. The dotfiles in these environments are slightly different, so each dotfile is separated.
|
76
|
-
|
77
|
-
### Directory Structure
|
78
|
-
|
79
|
-
```
|
80
|
-
$HOME/dotfiles
|
81
|
-
├── common
|
82
|
-
│ ├── bin
|
83
|
-
│ │ ├── git-delete-other-branches
|
84
|
-
│ │ └── git-reset-and-clean
|
85
|
-
│ ├── git
|
86
|
-
│ │ └── ignore
|
87
|
-
│ ├── rubygems
|
88
|
-
│ │ └── .gemrc
|
89
|
-
│ └── vim
|
90
|
-
│ └── .vimrc
|
91
|
-
├── macOS
|
92
|
-
│ ├── bash
|
93
|
-
│ │ ├── .bash_profile
|
94
|
-
│ │ └── .bashrc
|
95
|
-
│ ├── git
|
96
|
-
│ │ └── .gitconfig
|
97
|
-
│ ├── karabiner
|
98
|
-
│ │ └── tab-emulation.json
|
99
|
-
│ └── vscode
|
100
|
-
│ ├── keybindings.json
|
101
|
-
│ └── settings.json
|
102
|
-
├── ubuntu
|
103
|
-
│ ├── bash
|
104
|
-
│ │ └── .bashrc
|
105
|
-
│ ├── bin
|
106
|
-
│ │ ├── upgrade-ghcli
|
107
|
-
│ │ ├── utils
|
108
|
-
│ │ ├── x-copy
|
109
|
-
│ │ └── x-open
|
110
|
-
│ ├── git
|
111
|
-
│ │ └── .gitconfig
|
112
|
-
│ ├── vscode
|
113
|
-
│ │ ├── keybindings.json
|
114
|
-
│ │ └── settings.json
|
115
|
-
│ └── xkeysnail
|
116
|
-
│ ├── config.py
|
117
|
-
│ ├── debug.sh
|
118
|
-
│ ├── restart.sh
|
119
|
-
│ ├── start.sh
|
120
|
-
│ └── stop.sh
|
121
|
-
├── macOS.yml
|
122
|
-
├── ubuntu.yml
|
123
|
-
└── Rakefile
|
124
|
-
```
|
125
|
-
|
126
|
-
### Rakefile
|
127
|
-
|
128
|
-
```ruby
|
129
|
-
require 'flexdot'
|
130
|
-
|
131
|
-
Flexdot.setup(
|
132
|
-
home_dir: '..'
|
133
|
-
)
|
134
|
-
|
135
|
-
# You can execute `install:macOS` when you run `rake` command
|
136
|
-
# with no arguments by defining it as follows:
|
137
|
-
task default: 'install:macOS'
|
138
|
-
```
|
139
|
-
|
140
|
-
### Available Commands
|
141
|
-
|
142
|
-
When you run the `rake -T` command in that directory structure, you should have two installation commands available:
|
143
|
-
|
144
|
-
$ rake -T
|
145
|
-
rake clear_backups # Clear all backups
|
146
|
-
rake install:macOS # Install dotfiles for macOS
|
147
|
-
rake install:ubuntu # Install dotfiles for ubuntu
|
148
|
-
|
149
|
-
### Dotfile Index File
|
150
|
-
|
151
|
-
`macOS.yml` and `ubuntu.yml` are for setting the link destination of dotfile. dotfile will be installed according to its setting.
|
152
|
-
|
153
|
-
#### macOS.yml
|
154
|
-
|
155
|
-
For example, `common -> bin -> git-delete-other-branchs` is `$HOME/dotfiles/common/bin/git-delete-other-branches`.
|
156
|
-
And the value `bin` means `$HOME/bin` directory.
|
157
|
-
|
158
|
-
So this defines linking `$HOME/dotfiles/common/bin/git-delete-other-branches` to `$HOME/bin/git-delete-other-branches`.
|
159
|
-
|
160
|
-
|
161
|
-
```yml
|
162
|
-
common:
|
163
|
-
bin:
|
164
|
-
git-delete-other-branches: bin
|
165
|
-
git-reset-and-clean: bin
|
166
|
-
git:
|
167
|
-
ignore: .config/git
|
168
|
-
rubygems:
|
169
|
-
.gemrc: .
|
170
|
-
vim:
|
171
|
-
.vimrc: .
|
172
|
-
|
173
|
-
macOS:
|
174
|
-
bash:
|
175
|
-
.bash_profile: .
|
176
|
-
.bashrc: .
|
177
|
-
git:
|
178
|
-
.gitconfig: .
|
179
|
-
karabiner:
|
180
|
-
tab-emulation.json: .config/karabiner/assets/complex_modifications
|
181
|
-
vscode:
|
182
|
-
keybindings.json: Library/Application Support/Code/User
|
183
|
-
settings.json: Library/Application Support/Code/User
|
184
|
-
```
|
185
|
-
|
186
|
-
#### ubuntu.yml
|
187
|
-
|
188
|
-
```yml
|
189
|
-
common:
|
190
|
-
bin:
|
191
|
-
git-delete-other-branchs: bin
|
192
|
-
git-reset-and-clean: bin
|
193
|
-
git:
|
194
|
-
ignore: .config/git
|
195
|
-
rubygems:
|
196
|
-
.gemrc: .
|
197
|
-
vim:
|
198
|
-
.vimrc: .
|
199
|
-
|
200
|
-
ubuntu:
|
201
|
-
bash:
|
202
|
-
.bashrc: .
|
203
|
-
bin:
|
204
|
-
upgrade-ghcli: bin
|
205
|
-
utils: bin
|
206
|
-
x-copy: bin
|
207
|
-
x-open: bin
|
208
|
-
git:
|
209
|
-
.gitconfig: .
|
210
|
-
vscode:
|
211
|
-
keybindings.json: .config/Code/User
|
212
|
-
settings.json: .config/Code/User
|
213
|
-
xkeysnail:
|
214
|
-
config.py: .xkeysnail
|
215
|
-
debug.sh: .xkeysnail
|
216
|
-
restart.sh: .xkeysnail
|
217
|
-
start.sh: .xkeysnail
|
218
|
-
stop.sh: .xkeysnail
|
219
|
-
```
|
220
|
-
|
221
|
-
### Installing dotfiles for macOS
|
222
|
-
|
223
|
-
$ rake
|
224
|
-
|
225
|
-
Or,
|
226
|
-
|
227
|
-
$ rake install:macOS
|
228
|
-
|
229
|
-
The following is the output result:
|
230
|
-
|
231
|
-
```
|
232
|
-
already linked: bin/git-delete-other-branches
|
233
|
-
already linked: bin/git-reset-and-clean
|
234
|
-
already linked: .config/git/ignore
|
235
|
-
already linked: .gemrc
|
236
|
-
already linked: .vimrc
|
237
|
-
link created: .bash_profile (backup)
|
238
|
-
link created: .bashrc (backup)
|
239
|
-
link created: .gitconfig (backup)
|
240
|
-
link created: .config/karabiner/assets/complex_modifications/tab-emulation.json (backup)
|
241
|
-
link created: Library/Application Support/Code/User/keybindings.json (backup)
|
242
|
-
link created: Library/Application Support/Code/User/settings.json (backup)
|
243
|
-
```
|
244
|
-
|
245
|
-
`already_linked` means skipped because `bin/git-delete-other-branches` is already linked. `link_created` means the link was created.
|
246
|
-
Also, `(backup)` means that a file exists in the link path and that file was backed up to `$HOME/dotfiles/backup/YYYYMMDDHHIISS/filename`.
|
247
|
-
|
248
|
-
### Misc
|
249
|
-
|
250
|
-
You can clear all backups in `$HOME/dotfiles/backup/YYYYMMDDHHIISS` to run `rake clear_backups`.
|
77
|
+
## Usage
|
251
78
|
|
252
|
-
|
79
|
+
See [doc/example.md](doc/example.md)
|
253
80
|
|
254
81
|
## License
|
255
82
|
|
data/doc/example.md
ADDED
@@ -0,0 +1,182 @@
|
|
1
|
+
# Example
|
2
|
+
|
3
|
+
This example is my actual dotfile environment.
|
4
|
+
|
5
|
+
I have two working environments, macOS and ubuntu. The dotfiles in these environments are slightly different, so each dotfile is separated.
|
6
|
+
|
7
|
+
## Directory Structure
|
8
|
+
|
9
|
+
```
|
10
|
+
$HOME/dotfiles
|
11
|
+
├── common
|
12
|
+
│ ├── bin
|
13
|
+
│ │ ├── git-delete-other-branches
|
14
|
+
│ │ └── git-reset-and-clean
|
15
|
+
│ ├── git
|
16
|
+
│ │ └── ignore
|
17
|
+
│ ├── rubygems
|
18
|
+
│ │ └── .gemrc
|
19
|
+
│ └── vim
|
20
|
+
│ └── .vimrc
|
21
|
+
├── macOS
|
22
|
+
│ ├── bash
|
23
|
+
│ │ ├── .bash_profile
|
24
|
+
│ │ └── .bashrc
|
25
|
+
│ ├── git
|
26
|
+
│ │ └── .gitconfig
|
27
|
+
│ ├── karabiner
|
28
|
+
│ │ └── tab-emulation.json
|
29
|
+
│ └── vscode
|
30
|
+
│ ├── keybindings.json
|
31
|
+
│ └── settings.json
|
32
|
+
├── ubuntu
|
33
|
+
│ ├── bash
|
34
|
+
│ │ └── .bashrc
|
35
|
+
│ ├── bin
|
36
|
+
│ │ ├── upgrade-ghcli
|
37
|
+
│ │ ├── utils
|
38
|
+
│ │ ├── x-copy
|
39
|
+
│ │ └── x-open
|
40
|
+
│ ├── git
|
41
|
+
│ │ └── .gitconfig
|
42
|
+
│ ├── vscode
|
43
|
+
│ │ ├── keybindings.json
|
44
|
+
│ │ └── settings.json
|
45
|
+
│ └── xkeysnail
|
46
|
+
│ ├── config.py
|
47
|
+
│ ├── debug.sh
|
48
|
+
│ ├── restart.sh
|
49
|
+
│ ├── start.sh
|
50
|
+
│ └── stop.sh
|
51
|
+
├── macOS.yml
|
52
|
+
├── ubuntu.yml
|
53
|
+
└── Rakefile
|
54
|
+
```
|
55
|
+
|
56
|
+
## Rakefile
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
require 'flexdot'
|
60
|
+
|
61
|
+
Flexdot.setup(
|
62
|
+
home_dir: '..'
|
63
|
+
)
|
64
|
+
|
65
|
+
# You can execute `install:macOS` when you run `rake` command
|
66
|
+
# with no arguments by defining it as follows:
|
67
|
+
task default: 'install:macOS'
|
68
|
+
```
|
69
|
+
|
70
|
+
## Available Commands
|
71
|
+
|
72
|
+
When you run the `rake -T` command in that directory structure, you should have two installation commands available:
|
73
|
+
|
74
|
+
$ rake -T
|
75
|
+
rake clear_backups # Clear all backups
|
76
|
+
rake install:macOS # Install dotfiles for macOS
|
77
|
+
rake install:ubuntu # Install dotfiles for ubuntu
|
78
|
+
|
79
|
+
## Dotfile Index File
|
80
|
+
|
81
|
+
`macOS.yml` and `ubuntu.yml` are for setting the link destination of dotfile. dotfile will be installed according to its setting.
|
82
|
+
|
83
|
+
### macOS.yml
|
84
|
+
|
85
|
+
For example, `common -> bin -> git-delete-other-branchs` is `$HOME/dotfiles/common/bin/git-delete-other-branches`.
|
86
|
+
And the value `bin` means `$HOME/bin` directory.
|
87
|
+
|
88
|
+
So this defines linking `$HOME/dotfiles/common/bin/git-delete-other-branches` to `$HOME/bin/git-delete-other-branches`.
|
89
|
+
|
90
|
+
|
91
|
+
```yml
|
92
|
+
common:
|
93
|
+
bin:
|
94
|
+
git-delete-other-branches: bin
|
95
|
+
git-reset-and-clean: bin
|
96
|
+
git:
|
97
|
+
ignore: .config/git
|
98
|
+
rubygems:
|
99
|
+
.gemrc: .
|
100
|
+
vim:
|
101
|
+
.vimrc: .
|
102
|
+
|
103
|
+
macOS:
|
104
|
+
bash:
|
105
|
+
.bash_profile: .
|
106
|
+
.bashrc: .
|
107
|
+
git:
|
108
|
+
.gitconfig: .
|
109
|
+
karabiner:
|
110
|
+
tab-emulation.json: .config/karabiner/assets/complex_modifications
|
111
|
+
vscode:
|
112
|
+
keybindings.json: Library/Application Support/Code/User
|
113
|
+
settings.json: Library/Application Support/Code/User
|
114
|
+
```
|
115
|
+
|
116
|
+
### ubuntu.yml
|
117
|
+
|
118
|
+
```yml
|
119
|
+
common:
|
120
|
+
bin:
|
121
|
+
git-delete-other-branchs: bin
|
122
|
+
git-reset-and-clean: bin
|
123
|
+
git:
|
124
|
+
ignore: .config/git
|
125
|
+
rubygems:
|
126
|
+
.gemrc: .
|
127
|
+
vim:
|
128
|
+
.vimrc: .
|
129
|
+
|
130
|
+
ubuntu:
|
131
|
+
bash:
|
132
|
+
.bashrc: .
|
133
|
+
bin:
|
134
|
+
upgrade-ghcli: bin
|
135
|
+
utils: bin
|
136
|
+
x-copy: bin
|
137
|
+
x-open: bin
|
138
|
+
git:
|
139
|
+
.gitconfig: .
|
140
|
+
vscode:
|
141
|
+
keybindings.json: .config/Code/User
|
142
|
+
settings.json: .config/Code/User
|
143
|
+
xkeysnail:
|
144
|
+
config.py: .xkeysnail
|
145
|
+
debug.sh: .xkeysnail
|
146
|
+
restart.sh: .xkeysnail
|
147
|
+
start.sh: .xkeysnail
|
148
|
+
stop.sh: .xkeysnail
|
149
|
+
```
|
150
|
+
|
151
|
+
## Installing dotfiles for macOS
|
152
|
+
|
153
|
+
$ rake
|
154
|
+
|
155
|
+
Or,
|
156
|
+
|
157
|
+
$ rake install:macOS
|
158
|
+
|
159
|
+
The following is the output result:
|
160
|
+
|
161
|
+
```
|
162
|
+
already linked: bin/git-delete-other-branches
|
163
|
+
already linked: bin/git-reset-and-clean
|
164
|
+
already linked: .config/git/ignore
|
165
|
+
already linked: .gemrc
|
166
|
+
already linked: .vimrc
|
167
|
+
link created: .bash_profile (backup)
|
168
|
+
link created: .bashrc (backup)
|
169
|
+
link created: .gitconfig (backup)
|
170
|
+
link created: .config/karabiner/assets/complex_modifications/tab-emulation.json (backup)
|
171
|
+
link created: Library/Application Support/Code/User/keybindings.json (backup)
|
172
|
+
link created: Library/Application Support/Code/User/settings.json (backup)
|
173
|
+
```
|
174
|
+
|
175
|
+
`already_linked` means skipped because `bin/git-delete-other-branches` is already linked. `link_created` means the link was created.
|
176
|
+
Also, `(backup)` means that a file exists in the link path and that file was backed up to `$HOME/dotfiles/backup/YYYYMMDDHHIISS/filename`.
|
177
|
+
|
178
|
+
## Misc
|
179
|
+
|
180
|
+
You can clear all backups in `$HOME/dotfiles/backup/YYYYMMDDHHIISS` to run `rake clear_backups`.
|
181
|
+
|
182
|
+
$ rake clear_backups
|
data/flexdot.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.description = 'Flexdot is a Flexible and Rake based dotfile manager'
|
11
11
|
spec.homepage = 'https://github.com/hidakatsuya/flexdot'
|
12
12
|
spec.license = 'MIT'
|
13
|
-
spec.required_ruby_version = Gem::Requirement.new('>=
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 3.0.0')
|
14
14
|
|
15
15
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
16
16
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test)/}) }
|
data/lib/flexdot/backup.rb
CHANGED
@@ -19,8 +19,9 @@ module Flexdot
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
def initialize
|
22
|
+
def initialize(keep_max_count)
|
23
23
|
backup_dir.mkpath unless backup_dir.exist?
|
24
|
+
@keep_max_count = keep_max_count
|
24
25
|
@finished = false
|
25
26
|
end
|
26
27
|
|
@@ -34,6 +35,16 @@ module Flexdot
|
|
34
35
|
@finished = true
|
35
36
|
end
|
36
37
|
|
38
|
+
def remove_outdated!
|
39
|
+
return if @keep_max_count.nil?
|
40
|
+
|
41
|
+
backups = self.class.base_dir.glob('*/').select { |dir| dir.basename.to_s.match?(/\d{14}/) }
|
42
|
+
backups.sort_by! { |dir| dir.basename.to_s }.reverse!
|
43
|
+
backups.slice!(0, @keep_max_count)
|
44
|
+
|
45
|
+
backups.each(&:rmtree)
|
46
|
+
end
|
47
|
+
|
37
48
|
private
|
38
49
|
|
39
50
|
def backup_dir
|
data/lib/flexdot/installer.rb
CHANGED
@@ -8,12 +8,12 @@ require_relative 'index'
|
|
8
8
|
|
9
9
|
module Flexdot
|
10
10
|
class Installer
|
11
|
-
def initialize(name,
|
11
|
+
def initialize(name, home_dir, dotfiles_dir, options)
|
12
12
|
@name = name
|
13
13
|
@dotfiles_dir = dotfiles_dir
|
14
14
|
@home_dir = home_dir
|
15
|
-
@backup = Backup.new
|
16
|
-
@output = Output.new(@home_dir, colorize: output_colorize)
|
15
|
+
@backup = Backup.new(options.keep_max_backup_count)
|
16
|
+
@output = Output.new(@home_dir, colorize: options.output_colorize)
|
17
17
|
end
|
18
18
|
|
19
19
|
def install(index_file)
|
@@ -23,11 +23,12 @@ module Flexdot
|
|
23
23
|
end
|
24
24
|
|
25
25
|
backup.finish!
|
26
|
+
backup.remove_outdated!
|
26
27
|
end
|
27
28
|
|
28
29
|
private
|
29
30
|
|
30
|
-
attr_reader :name, :
|
31
|
+
attr_reader :name, :home_dir, :dotfiles_dir, :backup, :output
|
31
32
|
|
32
33
|
def install_link(dotfile_path, home_file_path)
|
33
34
|
dotfile = @dotfiles_dir.join(dotfile_path).expand_path
|
data/lib/flexdot/tasks.rb
CHANGED
@@ -10,10 +10,10 @@ module Flexdot
|
|
10
10
|
|
11
11
|
Index = Struct.new(:filename, :name, keyword_init: true)
|
12
12
|
|
13
|
-
def initialize(
|
14
|
-
@dotfiles_dir = Pathname.new(dotfiles_dir).expand_path
|
13
|
+
def initialize(home_dir, options)
|
15
14
|
@home_dir = Pathname.new(home_dir).expand_path
|
16
|
-
@
|
15
|
+
@dotfiles_dir = Pathname.new(options.dotfiles_dir).expand_path
|
16
|
+
@options = options
|
17
17
|
end
|
18
18
|
|
19
19
|
def install
|
@@ -28,9 +28,9 @@ module Flexdot
|
|
28
28
|
task index.name do
|
29
29
|
installer = Installer.new(
|
30
30
|
index.name,
|
31
|
-
dotfiles_dir,
|
32
31
|
home_dir,
|
33
|
-
|
32
|
+
dotfiles_dir,
|
33
|
+
options
|
34
34
|
)
|
35
35
|
installer.install(index.filename)
|
36
36
|
end
|
@@ -40,7 +40,7 @@ module Flexdot
|
|
40
40
|
|
41
41
|
private
|
42
42
|
|
43
|
-
attr_reader :
|
43
|
+
attr_reader :home_dir, :dotfiles_dir, :options
|
44
44
|
|
45
45
|
def indexes
|
46
46
|
@indexes ||= Pathname.new(dotfiles_dir).glob('*.yml').map do |index_file|
|
data/lib/flexdot/version.rb
CHANGED
data/lib/flexdot.rb
CHANGED
@@ -6,7 +6,31 @@ require_relative 'flexdot/version'
|
|
6
6
|
require_relative 'flexdot/tasks'
|
7
7
|
|
8
8
|
module Flexdot
|
9
|
-
|
10
|
-
|
9
|
+
Options = Struct.new(
|
10
|
+
# The dotfile directory path.
|
11
|
+
# Default: '.'.
|
12
|
+
:dotfiles_dir,
|
13
|
+
|
14
|
+
# Whether or not to colorize the output
|
15
|
+
# Default: true
|
16
|
+
:output_colorize,
|
17
|
+
|
18
|
+
# Whether to automatically delete old backups.
|
19
|
+
# If nil, do not delete, otherwise keep to the specified number of backups.
|
20
|
+
# Default: nil
|
21
|
+
:keep_max_backup_count,
|
22
|
+
|
23
|
+
keyword_init: true
|
24
|
+
)
|
25
|
+
|
26
|
+
DEFAULT_OPTIONS = {
|
27
|
+
dotfiles_dir: '.',
|
28
|
+
output_colorize: true,
|
29
|
+
keep_max_backup_count: nil
|
30
|
+
}
|
31
|
+
|
32
|
+
def self.setup(home_dir:, **options)
|
33
|
+
opts = Options.new(DEFAULT_OPTIONS.merge(options))
|
34
|
+
Tasks.new(home_dir, opts).install
|
11
35
|
end
|
12
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flexdot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katsuya Hidaka
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -48,12 +48,12 @@ files:
|
|
48
48
|
- ".github/dependabot.yml"
|
49
49
|
- ".github/workflows/test.yml"
|
50
50
|
- ".gitignore"
|
51
|
-
- CHANGELOG.md
|
52
51
|
- CODE_OF_CONDUCT.md
|
53
52
|
- Gemfile
|
54
53
|
- LICENSE.txt
|
55
54
|
- README.md
|
56
55
|
- Rakefile
|
56
|
+
- doc/example.md
|
57
57
|
- flexdot.gemspec
|
58
58
|
- lib/flexdot.rb
|
59
59
|
- lib/flexdot/backup.rb
|
@@ -66,7 +66,7 @@ homepage: https://github.com/hidakatsuya/flexdot
|
|
66
66
|
licenses:
|
67
67
|
- MIT
|
68
68
|
metadata: {}
|
69
|
-
post_install_message:
|
69
|
+
post_install_message:
|
70
70
|
rdoc_options: []
|
71
71
|
require_paths:
|
72
72
|
- lib
|
@@ -74,15 +74,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
74
|
requirements:
|
75
75
|
- - ">="
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: 3.0.0
|
78
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
|
-
rubygems_version: 3.
|
85
|
-
signing_key:
|
84
|
+
rubygems_version: 3.4.6
|
85
|
+
signing_key:
|
86
86
|
specification_version: 4
|
87
87
|
summary: A Flexible and Rake based dotfile manager
|
88
88
|
test_files: []
|
data/CHANGELOG.md
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Please see [the release page](https://github.com/hidakatsuya/flexdot/releases).
|