fast_ignore 0.12.0 → 0.12.1
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/.simplecov +2 -0
- data/CHANGELOG.md +3 -0
- data/lib/fast_ignore/rule_set_builder.rb +24 -9
- data/lib/fast_ignore/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e68a04cc6c34d7f72a6049beb86c9808c43bae4e712a1e9e8462e8e18f331bf0
|
4
|
+
data.tar.gz: 3c015e68f03e9d387064a68d42fe6f367e60894e1a20f02945af2c6669ddcebb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 047ec0c2f7fe90a3bf9a23b01ec3aa054bd7770e2f3b9d38dae8e77704ef8dd7d8d1449633faa3c7aae9ecc7b4d236f8b3442e5b3dcf489cf825da85efce19e5
|
7
|
+
data.tar.gz: d9fa32ba54a4268ce530556767972fd60dbf04a24ec8a890110fd084675611721244cbdf1f1722bfc70fe41794458a7fe6a0ecbde388149308ff710e76610a43
|
data/.simplecov
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class FastIgnore
|
4
|
-
module RuleSetBuilder
|
4
|
+
module RuleSetBuilder # rubocop:disable Metrics/ModuleLength
|
5
5
|
class << self
|
6
6
|
# :nocov:
|
7
7
|
using ::FastIgnore::Backports::DeletePrefixSuffix if defined?(::FastIgnore::Backports::DeletePrefixSuffix)
|
@@ -70,30 +70,45 @@ class FastIgnore
|
|
70
70
|
return unless gitignore
|
71
71
|
|
72
72
|
gi = ::FastIgnore::RuleSet.new([], false, true)
|
73
|
-
gi <<
|
74
|
-
gi <<
|
75
|
-
gi <<
|
73
|
+
gi << from_root_gitignore_file(global_gitignore_path(root: project_root))
|
74
|
+
gi << from_root_gitignore_file(::File.join(project_root, '.git/info/exclude'))
|
75
|
+
gi << from_root_gitignore_file(::File.join(project_root, '.gitignore'), soft: gitignore == :auto)
|
76
76
|
gi
|
77
77
|
end
|
78
78
|
|
79
|
-
def
|
79
|
+
def from_root_gitignore_file(path, soft: true)
|
80
80
|
return if soft && !::File.exist?(path)
|
81
81
|
|
82
82
|
build_rule_set(::File.readlines(path), false, file_root: '', gitignore: true)
|
83
83
|
end
|
84
84
|
|
85
|
-
def
|
86
|
-
|
85
|
+
def global_gitignore_path(root:)
|
86
|
+
gitconfig_gitignore_path(::File.expand_path('.git/config', root)) ||
|
87
|
+
gitconfig_gitignore_path(::File.expand_path('~/.gitconfig')) ||
|
88
|
+
gitconfig_gitignore_path(xdg_config_path) ||
|
89
|
+
gitconfig_gitignore_path('/etc/gitconfig') ||
|
90
|
+
default_global_gitignore_path
|
91
|
+
end
|
92
|
+
|
93
|
+
def gitconfig_gitignore_path(config_path)
|
94
|
+
return unless config_path
|
87
95
|
return unless ::File.exist?(config_path)
|
88
96
|
|
89
|
-
ignore_path = ::File.readlines(config_path).find { |l| l.
|
97
|
+
ignore_path = ::File.readlines(config_path).find { |l| l.sub!(/\A\s*excludesfile\s*=/, '') }
|
90
98
|
return unless ignore_path
|
91
99
|
|
92
|
-
ignore_path.delete_prefix!("\texcludesfile = ")
|
93
100
|
ignore_path.strip!
|
101
|
+
return ignore_path if ignore_path.empty? # don't expand path in this case
|
102
|
+
|
94
103
|
::File.expand_path(ignore_path)
|
95
104
|
end
|
96
105
|
|
106
|
+
def xdg_config_path
|
107
|
+
return unless ENV['XDG_CONFIG_HOME'] && !ENV['XDG_CONFIG_HOME'].empty?
|
108
|
+
|
109
|
+
::File.expand_path('git/config', ENV['XDG_CONFIG_HOME'])
|
110
|
+
end
|
111
|
+
|
97
112
|
def default_global_gitignore_path
|
98
113
|
if ENV['XDG_CONFIG_HOME'] && !ENV['XDG_CONFIG_HOME'].empty?
|
99
114
|
::File.expand_path('git/ignore', ENV['XDG_CONFIG_HOME'])
|
data/lib/fast_ignore/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_ignore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dana Sherson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|