mate 2.1.1 → 2.2.0
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/LICENSE.txt +1 -1
- data/README.markdown +1 -1
- data/bin/tm2 +1 -1
- data/lib/mate/git.rb +32 -0
- data/lib/mate/tm_properties.rb +21 -8
- data/lib/mate/tm_properties/ignores.rb +24 -10
- data/lib/mate/tmproj/ignores.rb +4 -2
- data/mate.gemspec +2 -2
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48e7e1cb9ee23a719cdc6b634dc2639e5afa0cfc1d622354bd602c741a1c3f92
|
4
|
+
data.tar.gz: 32d0efa02bb8d71116c59f900244bbaedd8fd0c334ca9c8099feb69d28fab3a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9ebac2d8bd91e393a61201c8697837aff27bfde035272b60ddb4c41ae45a9a2bcade929ad54ff8524b0752442a65bc1582c78f861b9c35da3deeefa6b061aa3
|
7
|
+
data.tar.gz: 8d837dfb721952669be640fb453d9c45ee115de7ca6ee68398277524cf4002fe0e0f03a7e7547aa2af8e5e9275dd2ad7f99d1f28b46d79ac8a2ab08ed7d3e49a
|
data/LICENSE.txt
CHANGED
data/README.markdown
CHANGED
data/bin/tm2
CHANGED
data/lib/mate/git.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
module Mate
|
2
|
+
module Git
|
3
|
+
class << self
|
4
|
+
def excludesfile(workind_dir)
|
5
|
+
expand_path IO.popen(%W[git -C #{workind_dir} config --get core.excludesfile], &:read)
|
6
|
+
end
|
7
|
+
|
8
|
+
def global_tmignore
|
9
|
+
expand_path '~/.tmignore'
|
10
|
+
end
|
11
|
+
|
12
|
+
def toplevel(workind_dir)
|
13
|
+
expand_path IO.popen(%W[git -C #{workind_dir} rev-parse --show-toplevel], err: '/dev/null', &:read)
|
14
|
+
end
|
15
|
+
|
16
|
+
def git_dir(workind_dir)
|
17
|
+
expand_path IO.popen(%W[git -C #{workind_dir} rev-parse --absolute-git-dir], err: '/dev/null', &:read)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def expand_path(path)
|
23
|
+
return unless path
|
24
|
+
|
25
|
+
path = path.strip
|
26
|
+
return if path == ''
|
27
|
+
|
28
|
+
Pathname(path).expand_path
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/mate/tm_properties.rb
CHANGED
@@ -1,26 +1,39 @@
|
|
1
1
|
require 'pathname'
|
2
|
+
require 'mate/git'
|
2
3
|
|
3
4
|
module Mate
|
4
5
|
class TmProperties
|
5
|
-
|
6
|
+
def self.create(dir)
|
7
|
+
new(Git.toplevel(dir) || dir).save
|
8
|
+
end
|
9
|
+
|
6
10
|
def initialize(dir)
|
7
11
|
@dir = Pathname(dir).expand_path
|
8
12
|
@file = @dir + '.tm_properties'
|
13
|
+
@lines = @file.exist? ? @file.read.split("\n") : []
|
14
|
+
@other_lines = @lines.reject{ |line| line =~ Ignores::GENERATED_R }
|
9
15
|
end
|
10
16
|
|
11
17
|
def save
|
12
|
-
ignores = Ignores.new(dir)
|
18
|
+
ignores = Ignores.new(@dir)
|
19
|
+
|
20
|
+
write(ignores.lines + @other_lines)
|
21
|
+
end
|
13
22
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
23
|
+
def cleanup
|
24
|
+
if @other_lines.empty?
|
25
|
+
@file.unlink if @file.exist?
|
18
26
|
else
|
19
|
-
|
27
|
+
write(@other_lines)
|
20
28
|
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def write(lines)
|
34
|
+
return if lines == @lines
|
21
35
|
|
22
36
|
@file.open('w') do |f|
|
23
|
-
f.puts ignores.lines
|
24
37
|
f.puts lines
|
25
38
|
end
|
26
39
|
end
|
@@ -1,6 +1,8 @@
|
|
1
|
+
require 'mate/git'
|
2
|
+
|
1
3
|
module Mate
|
2
4
|
class TmProperties::Ignores
|
3
|
-
GENERATED_SUFFIX =
|
5
|
+
GENERATED_SUFFIX = '## GENERATED ##'
|
4
6
|
GENERATED_R = /^exclude(?:Directories)? = .* #{Regexp.escape(GENERATED_SUFFIX)}$/
|
5
7
|
|
6
8
|
attr_reader :dir
|
@@ -9,17 +11,29 @@ module Mate
|
|
9
11
|
@exclude = ['**/.git']
|
10
12
|
@exclude_directories = []
|
11
13
|
|
12
|
-
process(
|
13
|
-
process(
|
14
|
+
process('.', Git.excludesfile(dir))
|
15
|
+
process('.', Git.global_tmignore)
|
16
|
+
if (git_dir = Git.git_dir(dir))
|
17
|
+
process('.', git_dir + 'info/exclude')
|
18
|
+
end
|
14
19
|
|
15
20
|
dir.find do |path|
|
16
|
-
|
21
|
+
next unless path.lstat.directory?
|
22
|
+
|
23
|
+
toplevel = dir == path
|
24
|
+
|
25
|
+
if !toplevel && (path + '.git').exist?
|
26
|
+
TmProperties.new(path).save
|
27
|
+
Find.prune
|
28
|
+
else
|
17
29
|
relative_path = path.relative_path_from(dir).to_s
|
18
30
|
Find.prune if ignore_dir?(relative_path)
|
19
|
-
%w[.gitignore .tmignore
|
20
|
-
|
21
|
-
|
22
|
-
|
31
|
+
%w[.gitignore .tmignore].each do |ignore_file_name|
|
32
|
+
process(relative_path, path + ignore_file_name)
|
33
|
+
end
|
34
|
+
|
35
|
+
if !toplevel && (path + '.tm_properties').exist?
|
36
|
+
TmProperties.new(path).cleanup
|
23
37
|
end
|
24
38
|
end
|
25
39
|
end
|
@@ -43,8 +57,8 @@ module Mate
|
|
43
57
|
end
|
44
58
|
end
|
45
59
|
|
46
|
-
def process(
|
47
|
-
return unless ignore_file.exist?
|
60
|
+
def process(subdirectory, ignore_file)
|
61
|
+
return unless ignore_file && ignore_file.exist?
|
48
62
|
|
49
63
|
prefix = subdirectory == '.' ? '' : glob_escape("#{subdirectory}/")
|
50
64
|
|
data/lib/mate/tmproj/ignores.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'mate/git'
|
2
|
+
|
1
3
|
module Mate
|
2
4
|
class Tmproj::Ignores
|
3
5
|
BINARY_EXTENSIONS = [
|
@@ -14,8 +16,8 @@ module Mate
|
|
14
16
|
@file_pattern = ["#{DOUBLE_ASTERISK_R}.+\\.(?:#{BINARY_EXTENSIONS.flatten.join('|')})"]
|
15
17
|
@folder_pattern = ["#{DOUBLE_ASTERISK_R}.git"]
|
16
18
|
|
17
|
-
process(dir,
|
18
|
-
process(dir,
|
19
|
+
process(dir, Git.excludesfile(dir))
|
20
|
+
process(dir, Git.global_tmignore)
|
19
21
|
|
20
22
|
dir.find do |path|
|
21
23
|
Find.prune if ignore?(path)
|
data/mate.gemspec
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'mate'
|
5
|
-
s.version = '2.
|
5
|
+
s.version = '2.2.0'
|
6
6
|
s.summary = %q{TextMate project builder and TextMate 2 properties builder using git ignores for exclusions}
|
7
|
-
s.homepage = "
|
7
|
+
s.homepage = "https://github.com/toy/#{s.name}"
|
8
8
|
s.authors = ['Ivan Kuchin']
|
9
9
|
s.license = 'MIT'
|
10
10
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Kuchin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plist
|
@@ -38,17 +38,18 @@ files:
|
|
38
38
|
- bin/tm
|
39
39
|
- bin/tm2
|
40
40
|
- lib/mate/bin.rb
|
41
|
+
- lib/mate/git.rb
|
41
42
|
- lib/mate/tm_properties.rb
|
42
43
|
- lib/mate/tm_properties/ignores.rb
|
43
44
|
- lib/mate/tmproj.rb
|
44
45
|
- lib/mate/tmproj/ignores.rb
|
45
46
|
- mate.gemspec
|
46
|
-
homepage:
|
47
|
+
homepage: https://github.com/toy/mate
|
47
48
|
licenses:
|
48
49
|
- MIT
|
49
50
|
metadata:
|
50
51
|
bug_tracker_uri: https://github.com/toy/mate/issues
|
51
|
-
documentation_uri: https://www.rubydoc.info/gems/mate/2.
|
52
|
+
documentation_uri: https://www.rubydoc.info/gems/mate/2.2.0
|
52
53
|
source_code_uri: https://github.com/toy/mate
|
53
54
|
post_install_message:
|
54
55
|
rdoc_options: []
|
@@ -65,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
66
|
- !ruby/object:Gem::Version
|
66
67
|
version: '0'
|
67
68
|
requirements: []
|
68
|
-
rubygems_version: 3.
|
69
|
+
rubygems_version: 3.1.2
|
69
70
|
signing_key:
|
70
71
|
specification_version: 4
|
71
72
|
summary: TextMate project builder and TextMate 2 properties builder using git ignores
|