Skip to content

Commit 4e34111

Browse files
Add rails-diff dotfiles command
Co-authored-by: Steve Redka <[email protected]>
1 parent 5574a47 commit 4e34111

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## [Unreleased]
22

33
- Add `--only` option to only include specific files or directories in the diff.
4+
- Add `rails-diff dotfiles` to compare dotfiles (configuration files) in the repository.
45
- [BUGFIX] --fail-on-diff wasn't aborting with errors on diff.
56

67
## [0.5.0] - 2025-03-10

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,14 @@ rails-diff generated scaffold Post --fail-on-diff
6767
rails-diff generated authentication --commit 7df1b8
6868
```
6969

70-
### Options
70+
### Compare dotfiles (configuration files)
71+
72+
```bash
73+
# Compare configuration files like .gitignore, .rspec, .rubocop.yml
74+
rails-diff dotfiles
75+
```
76+
77+
### Global Options
7178

7279
#### --fail-on-diff
7380

lib/rails/diff/cli.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ def file(*files)
2626

2727
options[:fail_on_diff] ? abort(diff) : puts(diff)
2828
end
29+
30+
desc "dotfiles", "Compare dotfiles in your repository with the ones generated by Rails"
31+
def dotfiles
32+
dotfiles = `git ls-files --cached --others --exclude-standard -- '.*'`.split("\n")
33+
34+
file(*dotfiles)
2935
end
3036

3137
desc "generated GENERATOR [args]", "Compare files that would be created by a Rails generator"

0 commit comments

Comments
 (0)