tidy-file-organizer 1.0.1 → 1.0.3
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/.rubocop.yml +1 -1
- data/CHANGELOG.md +30 -0
- data/CLAUDE.md +43 -10
- data/Gemfile.lock +7 -7
- data/LICENSE +30 -0
- data/README.ja.md +2 -0
- data/README.md +2 -0
- data/config/default.ja.yml +112 -0
- data/config/default.yml +112 -0
- data/lib/tidy_file_organizer/config.rb +1 -1
- data/lib/tidy_file_organizer/organizer.rb +25 -2
- data/lib/tidy_file_organizer/setup_prompt.rb +32 -8
- data/lib/tidy_file_organizer/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7bf457323c6a4508bbc12d36e8257feb4ce5299c117025463c85e44b25ec84e4
|
|
4
|
+
data.tar.gz: b439bba97f524a343597bdb6edb49e7d9ad00552b756bc60604633011e104faf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 448ec9a7765b482a5e3af0f676ebf8ac92589459ac276068a0036b0363eac977c7cdad0dc984a848332462a2d66393135a3ccb9b82781644b61c78fe9079bb7d
|
|
7
|
+
data.tar.gz: 0d5b50de6315cf1ebb5b7903a939f63f07d8189f4fbbaa75e69e3167917457903dbea0464699ebf39ecfee51db5a1fe77919c78a78c57e9712fe6553710e5d3a
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.0.3] - 2026-01-15
|
|
4
|
+
|
|
5
|
+
### Documentation
|
|
6
|
+
- Add LICENSE file with MIT License and CC BY 3.0 exception for RuboCop config
|
|
7
|
+
- Clarify license scope in README files (English and Japanese)
|
|
8
|
+
- Explicitly document that `.rubocop.cookpad-styleguide.yml` is not covered by MIT License
|
|
9
|
+
|
|
10
|
+
## [1.0.2] - 2026-01-15
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Downgrade Bundler version to 2.5.23 for CI compatibility
|
|
14
|
+
|
|
15
|
+
### Tests
|
|
16
|
+
- Rewrite RSpec tests in English
|
|
17
|
+
- Expand test data for Phase 1 and pattern matching
|
|
18
|
+
- Add comprehensive tests for Phase 1 and pattern matching
|
|
19
|
+
|
|
20
|
+
### Documentation
|
|
21
|
+
- Update architecture documentation and RuboCop configuration
|
|
22
|
+
|
|
23
|
+
## [1.0.1] - (Previous Release)
|
|
24
|
+
|
|
25
|
+
Initial release features:
|
|
26
|
+
- File organization based on extensions, keywords, and regex patterns
|
|
27
|
+
- Date-based file organization
|
|
28
|
+
- Duplicate file detection and removal
|
|
29
|
+
- Internationalization support (English/Japanese)
|
|
30
|
+
- Per-directory configuration management using MD5 hashes
|
data/CLAUDE.md
CHANGED
|
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|
|
4
4
|
|
|
5
5
|
## Project Overview
|
|
6
6
|
|
|
7
|
-
A Ruby CLI tool that organizes files based on extensions, keywords, and dates. The tool supports internationalization (English/Japanese) based on the `LANG` environment variable and stores per-directory configurations using MD5 hashes.
|
|
7
|
+
A Ruby CLI tool that organizes files based on extensions, keywords, regex patterns, and dates. The tool supports internationalization (English/Japanese) based on the `LANG` environment variable and stores per-directory configurations using MD5 hashes.
|
|
8
8
|
|
|
9
9
|
## Development Commands
|
|
10
10
|
|
|
@@ -60,9 +60,10 @@ ruby -I lib ./exe/tidyify run spec/data/ja --recursive
|
|
|
60
60
|
- `organize-by-date`, `find-duplicates`, `remove-duplicates`: Directory is required
|
|
61
61
|
- Options are parsed by checking for flags like `--dry-run`, `--recursive`/`-r`, `--pattern=<value>`, `--no-confirm`
|
|
62
62
|
|
|
63
|
-
- **Organizer** (`lib/tidy_file_organizer/organizer.rb`): Main orchestrator for file organization. Implements
|
|
64
|
-
1.
|
|
65
|
-
2.
|
|
63
|
+
- **Organizer** (`lib/tidy_file_organizer/organizer.rb`): Main orchestrator for file organization. Implements three-level priority system:
|
|
64
|
+
1. Pattern matching (highest priority) - matches regex patterns in filename
|
|
65
|
+
2. Keyword matching (high priority) - matches keywords anywhere in filename
|
|
66
|
+
3. Extension matching (normal priority) - matches file extensions
|
|
66
67
|
|
|
67
68
|
- **Config** (`lib/tidy_file_organizer/config.rb`): Manages per-directory configuration using MD5 hash of directory path. Stores configs in `~/.config/tidy-file-organizer/[MD5hash].yml`. Supports default config references to avoid duplication.
|
|
68
69
|
|
|
@@ -95,11 +96,30 @@ Default configurations are sourced from `config/default.yml` and `config/default
|
|
|
95
96
|
```yaml
|
|
96
97
|
language: en # or 'ja'
|
|
97
98
|
extensions:
|
|
98
|
-
Images: [jpg, jpeg, png, gif, bmp, svg, webp]
|
|
99
|
+
Images: [jpg, jpeg, png, gif, bmp, svg, webp, heic, heif, tiff, avif, ico, raw]
|
|
99
100
|
Documents: [pdf, doc, docx, txt, md]
|
|
101
|
+
Databases: [db, sqlite, sqlite3, sql]
|
|
102
|
+
Fonts: [ttf, otf, woff, woff2]
|
|
103
|
+
eBooks: [epub, mobi, azw]
|
|
104
|
+
Logs: [log, out, err]
|
|
105
|
+
Data: [csv, tsv, parquet]
|
|
100
106
|
keywords:
|
|
101
107
|
Screenshots: [screenshot, スクリーンショット, スクショ]
|
|
102
108
|
Invoices: [invoice, 請求書]
|
|
109
|
+
Receipts: [receipt, 領収書, レシート]
|
|
110
|
+
Reports: [report, 報告書, レポート]
|
|
111
|
+
Templates: [template, テンプレート, sample]
|
|
112
|
+
patterns:
|
|
113
|
+
ByDate:
|
|
114
|
+
- pattern: '\d{4}-\d{2}-\d{2}'
|
|
115
|
+
description: 'Date format: 2024-01-15'
|
|
116
|
+
- pattern: '\d{8}'
|
|
117
|
+
description: 'Date format: 20240115'
|
|
118
|
+
Versions:
|
|
119
|
+
- pattern: 'v\d+\.\d+\.\d+'
|
|
120
|
+
description: 'Semantic version: v1.0.0'
|
|
121
|
+
- pattern: '_v\d+'
|
|
122
|
+
description: 'Version suffix: file_v2'
|
|
103
123
|
```
|
|
104
124
|
|
|
105
125
|
**Interactive Setup Input Format**: `extensions,list:directory keyword,list:directory`
|
|
@@ -117,17 +137,30 @@ keywords:
|
|
|
117
137
|
### File Organization Priority
|
|
118
138
|
|
|
119
139
|
When running `tidyify run`:
|
|
120
|
-
1. **
|
|
121
|
-
2. **
|
|
122
|
-
3.
|
|
123
|
-
4.
|
|
140
|
+
1. **Pattern matching** is checked first (regex patterns in filename) - highest priority
|
|
141
|
+
2. **Keyword matching** is checked second (entire filename) - high priority
|
|
142
|
+
3. **Extension matching** is checked third (file extension only) - normal priority
|
|
143
|
+
4. Files matching none of the above are skipped
|
|
144
|
+
5. Organized directories are excluded from processing to prevent reorganizing already-organized files
|
|
145
|
+
|
|
146
|
+
**Priority Example**:
|
|
147
|
+
- File: `invoice_2024-01-15.pdf`
|
|
148
|
+
- Pattern match: `\d{4}-\d{2}-\d{2}` → Goes to `ByDate/` folder
|
|
149
|
+
- Even though "invoice" keyword exists, pattern takes precedence
|
|
124
150
|
|
|
125
151
|
**Exclusion Mechanism**:
|
|
126
|
-
- `Organizer#extract_organized_dirs` collects all directory names from config (
|
|
152
|
+
- `Organizer#extract_organized_dirs` collects all directory names from config (extensions, keywords, and patterns)
|
|
127
153
|
- In recursive mode, `FileHelper#excluded_path?` checks if any part of the file's relative path matches an organized directory name
|
|
128
154
|
- This prevents files like `images/photo.jpg` from being re-organized into `images/images/photo.jpg`
|
|
129
155
|
- Empty directories are automatically cleaned up after recursive organization (excluding the target directory and organized directories)
|
|
130
156
|
|
|
157
|
+
**Pattern Matching Details**:
|
|
158
|
+
- Patterns are defined as Ruby regular expressions in the config file
|
|
159
|
+
- Each pattern category can have multiple regex patterns
|
|
160
|
+
- Patterns are matched against the full filename (including extension)
|
|
161
|
+
- Invalid regex patterns are skipped with a warning message
|
|
162
|
+
- Pattern matching supports both string keys ('pattern') and symbol keys (:pattern) for flexibility
|
|
163
|
+
|
|
131
164
|
## Code Style
|
|
132
165
|
|
|
133
166
|
This project follows [Cookpad's Ruby Style Guide](https://github.com/cookpad/styleguide) via `.rubocop.cookpad-styleguide.yml` with project-specific overrides in `.rubocop.yml`.
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
tidy-file-organizer (1.0.
|
|
4
|
+
tidy-file-organizer (1.0.2)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
@@ -65,10 +65,10 @@ PLATFORMS
|
|
|
65
65
|
|
|
66
66
|
DEPENDENCIES
|
|
67
67
|
rake (~> 13.0)
|
|
68
|
-
rspec
|
|
69
|
-
rubocop
|
|
70
|
-
rubocop-performance
|
|
71
|
-
rubocop-rspec
|
|
68
|
+
rspec
|
|
69
|
+
rubocop
|
|
70
|
+
rubocop-performance
|
|
71
|
+
rubocop-rspec
|
|
72
72
|
tidy-file-organizer!
|
|
73
73
|
|
|
74
74
|
CHECKSUMS
|
|
@@ -94,9 +94,9 @@ CHECKSUMS
|
|
|
94
94
|
rubocop-performance (1.26.1) sha256=cd19b936ff196df85829d264b522fd4f98b6c89ad271fa52744a8c11b8f71834
|
|
95
95
|
rubocop-rspec (3.9.0) sha256=8fa70a3619408237d789aeecfb9beef40576acc855173e60939d63332fdb55e2
|
|
96
96
|
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
|
|
97
|
-
tidy-file-organizer (1.0.
|
|
97
|
+
tidy-file-organizer (1.0.2)
|
|
98
98
|
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
|
|
99
99
|
unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
|
|
100
100
|
|
|
101
101
|
BUNDLED WITH
|
|
102
|
-
|
|
102
|
+
2.5.23
|
data/LICENSE
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 sachin21
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
EXCEPTION:
|
|
26
|
+
|
|
27
|
+
The file `.rubocop.cookpad-styleguide.yml` is NOT covered by the above MIT License.
|
|
28
|
+
This file is part of Cookpad's Ruby Style Guide (https://github.com/cookpad/styleguide)
|
|
29
|
+
and is licensed under Creative Commons Attribution 3.0 Unported (CC BY 3.0).
|
|
30
|
+
See: https://creativecommons.org/licenses/by/3.0/
|
data/README.ja.md
CHANGED
|
@@ -213,6 +213,8 @@ ruby -I lib ./exe/tidyify run spec/data/ja --recursive
|
|
|
213
213
|
|
|
214
214
|
MIT License
|
|
215
215
|
|
|
216
|
+
**注意**: `.rubocop.cookpad-styleguide.yml`ファイルはMITライセンスの対象外です。このファイルは[Style guides in COOKPAD](https://github.com/cookpad/styleguide)の一部であり、[CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)ライセンスの下で提供されています。
|
|
217
|
+
|
|
216
218
|
## 謝辞
|
|
217
219
|
|
|
218
220
|
本プロジェクトのRuboCop設定には、[Style guides in COOKPAD](https://github.com/cookpad/styleguide)を使用しています。このスタイルガイドは[CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)ライセンスの下で提供されています。
|
data/README.md
CHANGED
|
@@ -213,6 +213,8 @@ ruby -I lib ./exe/tidyify run spec/data/ja --recursive
|
|
|
213
213
|
|
|
214
214
|
MIT License
|
|
215
215
|
|
|
216
|
+
**Note**: The file `.rubocop.cookpad-styleguide.yml` is not covered by the MIT License. It is part of [Cookpad's Ruby Style Guide](https://github.com/cookpad/styleguide) and is licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/).
|
|
217
|
+
|
|
216
218
|
## Acknowledgments
|
|
217
219
|
|
|
218
220
|
This project uses [Cookpad's Ruby Style Guide](https://github.com/cookpad/styleguide) for RuboCop configuration, which is licensed under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/).
|
data/config/default.ja.yml
CHANGED
|
@@ -15,6 +15,15 @@
|
|
|
15
15
|
- bmp
|
|
16
16
|
- svg
|
|
17
17
|
- webp
|
|
18
|
+
- heic
|
|
19
|
+
- heif
|
|
20
|
+
- tiff
|
|
21
|
+
- tif
|
|
22
|
+
- avif
|
|
23
|
+
- ico
|
|
24
|
+
- raw
|
|
25
|
+
- cr2
|
|
26
|
+
- nef
|
|
18
27
|
動画:
|
|
19
28
|
- mp4
|
|
20
29
|
- mov
|
|
@@ -22,12 +31,21 @@
|
|
|
22
31
|
- mkv
|
|
23
32
|
- flv
|
|
24
33
|
- wmv
|
|
34
|
+
- webm
|
|
35
|
+
- m4v
|
|
36
|
+
- 3gp
|
|
37
|
+
- ogv
|
|
25
38
|
音声:
|
|
26
39
|
- mp3
|
|
27
40
|
- wav
|
|
28
41
|
- flac
|
|
29
42
|
- aac
|
|
30
43
|
- m4a
|
|
44
|
+
- ogg
|
|
45
|
+
- opus
|
|
46
|
+
- wma
|
|
47
|
+
- midi
|
|
48
|
+
- mid
|
|
31
49
|
書類:
|
|
32
50
|
- pdf
|
|
33
51
|
- doc
|
|
@@ -48,6 +66,17 @@
|
|
|
48
66
|
- c
|
|
49
67
|
- go
|
|
50
68
|
- rs
|
|
69
|
+
- sh
|
|
70
|
+
- bash
|
|
71
|
+
- zsh
|
|
72
|
+
- fish
|
|
73
|
+
- ps1
|
|
74
|
+
- r
|
|
75
|
+
- swift
|
|
76
|
+
- kt
|
|
77
|
+
- scala
|
|
78
|
+
- clj
|
|
79
|
+
- lua
|
|
51
80
|
ウェブ:
|
|
52
81
|
- html
|
|
53
82
|
- css
|
|
@@ -69,6 +98,34 @@
|
|
|
69
98
|
- toml
|
|
70
99
|
- xml
|
|
71
100
|
- ini
|
|
101
|
+
データベース:
|
|
102
|
+
- db
|
|
103
|
+
- sqlite
|
|
104
|
+
- sqlite3
|
|
105
|
+
- sql
|
|
106
|
+
- mdb
|
|
107
|
+
- accdb
|
|
108
|
+
フォント:
|
|
109
|
+
- ttf
|
|
110
|
+
- otf
|
|
111
|
+
- woff
|
|
112
|
+
- woff2
|
|
113
|
+
- eot
|
|
114
|
+
電子書籍:
|
|
115
|
+
- epub
|
|
116
|
+
- mobi
|
|
117
|
+
- azw
|
|
118
|
+
- azw3
|
|
119
|
+
- fb2
|
|
120
|
+
ログ:
|
|
121
|
+
- log
|
|
122
|
+
- out
|
|
123
|
+
- err
|
|
124
|
+
データ:
|
|
125
|
+
- csv
|
|
126
|
+
- tsv
|
|
127
|
+
- parquet
|
|
128
|
+
- arrow
|
|
72
129
|
:keywords:
|
|
73
130
|
スクリーンショット:
|
|
74
131
|
- screenshot
|
|
@@ -90,3 +147,58 @@
|
|
|
90
147
|
- backup
|
|
91
148
|
- バックアップ
|
|
92
149
|
- bak
|
|
150
|
+
領収書:
|
|
151
|
+
- receipt
|
|
152
|
+
- 領収書
|
|
153
|
+
- レシート
|
|
154
|
+
報告書:
|
|
155
|
+
- report
|
|
156
|
+
- 報告書
|
|
157
|
+
- レポート
|
|
158
|
+
- 報告
|
|
159
|
+
提案書:
|
|
160
|
+
- proposal
|
|
161
|
+
- 提案書
|
|
162
|
+
- 提案
|
|
163
|
+
- 企画書
|
|
164
|
+
プレゼン資料:
|
|
165
|
+
- presentation
|
|
166
|
+
- slide
|
|
167
|
+
- deck
|
|
168
|
+
- プレゼン
|
|
169
|
+
- 資料
|
|
170
|
+
- スライド
|
|
171
|
+
テンプレート:
|
|
172
|
+
- template
|
|
173
|
+
- テンプレート
|
|
174
|
+
- sample
|
|
175
|
+
- サンプル
|
|
176
|
+
- boilerplate
|
|
177
|
+
下書き:
|
|
178
|
+
- draft
|
|
179
|
+
- 草案
|
|
180
|
+
- 下書き
|
|
181
|
+
- wip
|
|
182
|
+
- temp
|
|
183
|
+
- tmp
|
|
184
|
+
メモ:
|
|
185
|
+
- note
|
|
186
|
+
- memo
|
|
187
|
+
- メモ
|
|
188
|
+
- ノート
|
|
189
|
+
- 覚書
|
|
190
|
+
:patterns:
|
|
191
|
+
日付:
|
|
192
|
+
- pattern: '\d{4}-\d{2}-\d{2}'
|
|
193
|
+
description: '日付形式: 2024-01-15'
|
|
194
|
+
- pattern: '\d{4}_\d{2}_\d{2}'
|
|
195
|
+
description: '日付形式: 2024_01_15'
|
|
196
|
+
- pattern: '\d{8}'
|
|
197
|
+
description: '日付形式: 20240115'
|
|
198
|
+
バージョン:
|
|
199
|
+
- pattern: 'v\d+\.\d+\.\d+'
|
|
200
|
+
description: 'セマンティックバージョン: v1.0.0'
|
|
201
|
+
- pattern: '_v\d+'
|
|
202
|
+
description: 'バージョン接尾辞: file_v2'
|
|
203
|
+
- pattern: '_(final|rev\d+)'
|
|
204
|
+
description: '最終版または改訂版: file_final, file_rev3'
|
data/config/default.yml
CHANGED
|
@@ -15,6 +15,15 @@
|
|
|
15
15
|
- bmp
|
|
16
16
|
- svg
|
|
17
17
|
- webp
|
|
18
|
+
- heic
|
|
19
|
+
- heif
|
|
20
|
+
- tiff
|
|
21
|
+
- tif
|
|
22
|
+
- avif
|
|
23
|
+
- ico
|
|
24
|
+
- raw
|
|
25
|
+
- cr2
|
|
26
|
+
- nef
|
|
18
27
|
Videos:
|
|
19
28
|
- mp4
|
|
20
29
|
- mov
|
|
@@ -22,12 +31,21 @@
|
|
|
22
31
|
- mkv
|
|
23
32
|
- flv
|
|
24
33
|
- wmv
|
|
34
|
+
- webm
|
|
35
|
+
- m4v
|
|
36
|
+
- 3gp
|
|
37
|
+
- ogv
|
|
25
38
|
Audio:
|
|
26
39
|
- mp3
|
|
27
40
|
- wav
|
|
28
41
|
- flac
|
|
29
42
|
- aac
|
|
30
43
|
- m4a
|
|
44
|
+
- ogg
|
|
45
|
+
- opus
|
|
46
|
+
- wma
|
|
47
|
+
- midi
|
|
48
|
+
- mid
|
|
31
49
|
Documents:
|
|
32
50
|
- pdf
|
|
33
51
|
- doc
|
|
@@ -48,6 +66,17 @@
|
|
|
48
66
|
- c
|
|
49
67
|
- go
|
|
50
68
|
- rs
|
|
69
|
+
- sh
|
|
70
|
+
- bash
|
|
71
|
+
- zsh
|
|
72
|
+
- fish
|
|
73
|
+
- ps1
|
|
74
|
+
- r
|
|
75
|
+
- swift
|
|
76
|
+
- kt
|
|
77
|
+
- scala
|
|
78
|
+
- clj
|
|
79
|
+
- lua
|
|
51
80
|
Web:
|
|
52
81
|
- html
|
|
53
82
|
- css
|
|
@@ -69,6 +98,34 @@
|
|
|
69
98
|
- toml
|
|
70
99
|
- xml
|
|
71
100
|
- ini
|
|
101
|
+
Databases:
|
|
102
|
+
- db
|
|
103
|
+
- sqlite
|
|
104
|
+
- sqlite3
|
|
105
|
+
- sql
|
|
106
|
+
- mdb
|
|
107
|
+
- accdb
|
|
108
|
+
Fonts:
|
|
109
|
+
- ttf
|
|
110
|
+
- otf
|
|
111
|
+
- woff
|
|
112
|
+
- woff2
|
|
113
|
+
- eot
|
|
114
|
+
eBooks:
|
|
115
|
+
- epub
|
|
116
|
+
- mobi
|
|
117
|
+
- azw
|
|
118
|
+
- azw3
|
|
119
|
+
- fb2
|
|
120
|
+
Logs:
|
|
121
|
+
- log
|
|
122
|
+
- out
|
|
123
|
+
- err
|
|
124
|
+
Data:
|
|
125
|
+
- csv
|
|
126
|
+
- tsv
|
|
127
|
+
- parquet
|
|
128
|
+
- arrow
|
|
72
129
|
:keywords:
|
|
73
130
|
Screenshots:
|
|
74
131
|
- screenshot
|
|
@@ -90,3 +147,58 @@
|
|
|
90
147
|
- backup
|
|
91
148
|
- バックアップ
|
|
92
149
|
- bak
|
|
150
|
+
Receipts:
|
|
151
|
+
- receipt
|
|
152
|
+
- 領収書
|
|
153
|
+
- レシート
|
|
154
|
+
Reports:
|
|
155
|
+
- report
|
|
156
|
+
- 報告書
|
|
157
|
+
- レポート
|
|
158
|
+
- 報告
|
|
159
|
+
Proposals:
|
|
160
|
+
- proposal
|
|
161
|
+
- 提案書
|
|
162
|
+
- 提案
|
|
163
|
+
- 企画書
|
|
164
|
+
Presentations:
|
|
165
|
+
- presentation
|
|
166
|
+
- slide
|
|
167
|
+
- deck
|
|
168
|
+
- プレゼン
|
|
169
|
+
- 資料
|
|
170
|
+
- スライド
|
|
171
|
+
Templates:
|
|
172
|
+
- template
|
|
173
|
+
- テンプレート
|
|
174
|
+
- sample
|
|
175
|
+
- サンプル
|
|
176
|
+
- boilerplate
|
|
177
|
+
Drafts:
|
|
178
|
+
- draft
|
|
179
|
+
- 草案
|
|
180
|
+
- 下書き
|
|
181
|
+
- wip
|
|
182
|
+
- temp
|
|
183
|
+
- tmp
|
|
184
|
+
Notes:
|
|
185
|
+
- note
|
|
186
|
+
- memo
|
|
187
|
+
- メモ
|
|
188
|
+
- ノート
|
|
189
|
+
- 覚書
|
|
190
|
+
:patterns:
|
|
191
|
+
ByDate:
|
|
192
|
+
- pattern: '\d{4}-\d{2}-\d{2}'
|
|
193
|
+
description: 'Date format: 2024-01-15'
|
|
194
|
+
- pattern: '\d{4}_\d{2}_\d{2}'
|
|
195
|
+
description: 'Date format: 2024_01_15'
|
|
196
|
+
- pattern: '\d{8}'
|
|
197
|
+
description: 'Date format: 20240115'
|
|
198
|
+
Versions:
|
|
199
|
+
- pattern: 'v\d+\.\d+\.\d+'
|
|
200
|
+
description: 'Semantic version: v1.0.0'
|
|
201
|
+
- pattern: '_v\d+'
|
|
202
|
+
description: 'Version suffix: file_v2'
|
|
203
|
+
- pattern: '_(final|rev\d+)'
|
|
204
|
+
description: 'Final or revision: file_final, file_rev3'
|
|
@@ -47,7 +47,9 @@ module TidyFileOrganizer
|
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
def extract_organized_dirs(config)
|
|
50
|
-
|
|
50
|
+
dirs = config[:extensions].keys + config[:keywords].keys
|
|
51
|
+
dirs += config[:patterns].keys if config[:patterns]
|
|
52
|
+
dirs.uniq
|
|
51
53
|
end
|
|
52
54
|
|
|
53
55
|
def handle_empty_files
|
|
@@ -71,7 +73,8 @@ module TidyFileOrganizer
|
|
|
71
73
|
filename = File.basename(file_path)
|
|
72
74
|
extension = extract_extension(file_path)
|
|
73
75
|
|
|
74
|
-
|
|
76
|
+
find_by_pattern(filename, config[:patterns]) ||
|
|
77
|
+
find_by_keyword(filename, config[:keywords]) ||
|
|
75
78
|
find_by_extension(extension, config[:extensions])
|
|
76
79
|
end
|
|
77
80
|
|
|
@@ -79,6 +82,26 @@ module TidyFileOrganizer
|
|
|
79
82
|
File.extname(file_path).delete('.').downcase
|
|
80
83
|
end
|
|
81
84
|
|
|
85
|
+
def find_by_pattern(filename, patterns_config)
|
|
86
|
+
return nil unless patterns_config
|
|
87
|
+
|
|
88
|
+
patterns_config.each do |dir, patterns|
|
|
89
|
+
patterns.each do |pattern_info|
|
|
90
|
+
pattern = pattern_info['pattern'] || pattern_info[:pattern]
|
|
91
|
+
next unless pattern
|
|
92
|
+
|
|
93
|
+
begin
|
|
94
|
+
regex = Regexp.new(pattern)
|
|
95
|
+
return dir if filename.match?(regex)
|
|
96
|
+
rescue RegexpError => e
|
|
97
|
+
# Skip invalid regex patterns
|
|
98
|
+
warn "Invalid regex pattern '#{pattern}': #{e.message}"
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
nil
|
|
103
|
+
end
|
|
104
|
+
|
|
82
105
|
def find_by_keyword(filename, keywords_config)
|
|
83
106
|
keywords_config.each do |dir, keywords|
|
|
84
107
|
return dir if keywords.any? { |kw| filename.include?(kw) }
|
|
@@ -109,25 +109,35 @@ module TidyFileOrganizer
|
|
|
109
109
|
def default_extensions
|
|
110
110
|
if @language == 'en'
|
|
111
111
|
{
|
|
112
|
-
'Images' => %w[jpg jpeg png gif bmp svg webp],
|
|
113
|
-
'Videos' => %w[mp4 mov avi mkv flv wmv],
|
|
114
|
-
'Audio' => %w[mp3 wav flac aac m4a],
|
|
112
|
+
'Images' => %w[jpg jpeg png gif bmp svg webp heic heif tiff tif avif ico raw cr2 nef],
|
|
113
|
+
'Videos' => %w[mp4 mov avi mkv flv wmv webm m4v 3gp ogv],
|
|
114
|
+
'Audio' => %w[mp3 wav flac aac m4a ogg opus wma midi mid],
|
|
115
115
|
'Documents' => %w[pdf doc docx xls xlsx ppt pptx txt md],
|
|
116
|
-
'Scripts' => %w[rb py js ts java cpp c go rs],
|
|
116
|
+
'Scripts' => %w[rb py js ts java cpp c go rs sh bash zsh fish ps1 r swift kt scala clj lua],
|
|
117
117
|
'Web' => %w[html css scss jsx tsx vue],
|
|
118
118
|
'Archives' => %w[zip tar gz rar 7z bz2],
|
|
119
119
|
'Configs' => %w[json yml yaml toml xml ini],
|
|
120
|
+
'Databases' => %w[db sqlite sqlite3 sql mdb accdb],
|
|
121
|
+
'Fonts' => %w[ttf otf woff woff2 eot],
|
|
122
|
+
'eBooks' => %w[epub mobi azw azw3 fb2],
|
|
123
|
+
'Logs' => %w[log out err],
|
|
124
|
+
'Data' => %w[csv tsv parquet arrow],
|
|
120
125
|
}
|
|
121
126
|
else
|
|
122
127
|
{
|
|
123
|
-
'画像' => %w[jpg jpeg png gif bmp svg webp],
|
|
124
|
-
'動画' => %w[mp4 mov avi mkv flv wmv],
|
|
125
|
-
'音声' => %w[mp3 wav flac aac m4a],
|
|
128
|
+
'画像' => %w[jpg jpeg png gif bmp svg webp heic heif tiff tif avif ico raw cr2 nef],
|
|
129
|
+
'動画' => %w[mp4 mov avi mkv flv wmv webm m4v 3gp ogv],
|
|
130
|
+
'音声' => %w[mp3 wav flac aac m4a ogg opus wma midi mid],
|
|
126
131
|
'書類' => %w[pdf doc docx xls xlsx ppt pptx txt md],
|
|
127
|
-
'スクリプト' => %w[rb py js ts java cpp c go rs],
|
|
132
|
+
'スクリプト' => %w[rb py js ts java cpp c go rs sh bash zsh fish ps1 r swift kt scala clj lua],
|
|
128
133
|
'ウェブ' => %w[html css scss jsx tsx vue],
|
|
129
134
|
'アーカイブ' => %w[zip tar gz rar 7z bz2],
|
|
130
135
|
'設定' => %w[json yml yaml toml xml ini],
|
|
136
|
+
'データベース' => %w[db sqlite sqlite3 sql mdb accdb],
|
|
137
|
+
'フォント' => %w[ttf otf woff woff2 eot],
|
|
138
|
+
'電子書籍' => %w[epub mobi azw azw3 fb2],
|
|
139
|
+
'ログ' => %w[log out err],
|
|
140
|
+
'データ' => %w[csv tsv parquet arrow],
|
|
131
141
|
}
|
|
132
142
|
end
|
|
133
143
|
end
|
|
@@ -140,6 +150,13 @@ module TidyFileOrganizer
|
|
|
140
150
|
'Minutes' => %w[議事録 minutes meeting],
|
|
141
151
|
'Contracts' => %w[契約 contract 同意書],
|
|
142
152
|
'Backups' => %w[backup バックアップ bak],
|
|
153
|
+
'Receipts' => %w[receipt 領収書 レシート],
|
|
154
|
+
'Reports' => %w[report 報告書 レポート 報告],
|
|
155
|
+
'Proposals' => %w[proposal 提案書 提案 企画書],
|
|
156
|
+
'Presentations' => %w[presentation slide deck プレゼン 資料 スライド],
|
|
157
|
+
'Templates' => %w[template テンプレート sample サンプル boilerplate],
|
|
158
|
+
'Drafts' => %w[draft 草案 下書き wip temp tmp],
|
|
159
|
+
'Notes' => %w[note memo メモ ノート 覚書],
|
|
143
160
|
}
|
|
144
161
|
else
|
|
145
162
|
{
|
|
@@ -148,6 +165,13 @@ module TidyFileOrganizer
|
|
|
148
165
|
'議事録' => %w[議事録 minutes meeting],
|
|
149
166
|
'契約書' => %w[契約 contract 同意書],
|
|
150
167
|
'バックアップ' => %w[backup バックアップ bak],
|
|
168
|
+
'領収書' => %w[receipt 領収書 レシート],
|
|
169
|
+
'報告書' => %w[report 報告書 レポート 報告],
|
|
170
|
+
'提案書' => %w[proposal 提案書 提案 企画書],
|
|
171
|
+
'プレゼン資料' => %w[presentation slide deck プレゼン 資料 スライド],
|
|
172
|
+
'テンプレート' => %w[template テンプレート sample サンプル boilerplate],
|
|
173
|
+
'下書き' => %w[draft 草案 下書き wip temp tmp],
|
|
174
|
+
'メモ' => %w[note memo メモ ノート 覚書],
|
|
151
175
|
}
|
|
152
176
|
end
|
|
153
177
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tidy-file-organizer
|
|
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
|
- sachin21
|
|
@@ -92,9 +92,11 @@ files:
|
|
|
92
92
|
- ".rspec"
|
|
93
93
|
- ".rubocop.cookpad-styleguide.yml"
|
|
94
94
|
- ".rubocop.yml"
|
|
95
|
+
- CHANGELOG.md
|
|
95
96
|
- CLAUDE.md
|
|
96
97
|
- Gemfile
|
|
97
98
|
- Gemfile.lock
|
|
99
|
+
- LICENSE
|
|
98
100
|
- README.ja.md
|
|
99
101
|
- README.md
|
|
100
102
|
- config/default.ja.yml
|
|
@@ -140,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
140
142
|
- !ruby/object:Gem::Version
|
|
141
143
|
version: '0'
|
|
142
144
|
requirements: []
|
|
143
|
-
rubygems_version:
|
|
145
|
+
rubygems_version: 4.0.4
|
|
144
146
|
specification_version: 4
|
|
145
147
|
summary: File organizer based on extensions, names, and keywords.
|
|
146
148
|
test_files: []
|