tagrity 0.2.16 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 021e64164031ab6fa1be2a1080f679730fba4f89c5c7d8de3e71a119d0984519
4
- data.tar.gz: 3d70b525056a82b6b6586a3125dc84729e0aa1a48495a08be1bffa0f1e76cc18
3
+ metadata.gz: 13500a07d1e3b5d4252c672f4f834ce6fa1c4469b3a85c6c25aea178c63aa711
4
+ data.tar.gz: 3872291c8b4bd1fca09bafc0f66f813f197dbc02ae13a0b381496a0f1e1eccda
5
5
  SHA512:
6
- metadata.gz: 0cc1385017a29cea175198b53075b3fe98fea195424422714d91eaa18bef7b082209bbf456e34b9728e6b22a82f782880bcbf6f8124df32ba3e980e8348698b4
7
- data.tar.gz: a2b24b69c5493d0fd7f80e6c5ef37c7433dc9b0d21bcfee1896574225a8a49fe18b5eca96c538c639946fffa4fc5ef7f2f16d7a44e543c5b7e0b568a4b4a3ae9
6
+ metadata.gz: 3656fff98985bb4a27b8194f6318461be7ff4ca6ad4b840b658e5d1de9cddc69b3e329018d8dcdc97bdd018654f77d15c942c80d257aa88c38b13c871563a61b
7
+ data.tar.gz: f804edab3d0b1ef85af2f0debf2cdce7a5c07314366d0b595cac4b7fb8a0dfb59fa81198b618ee76a63b6dc1d6cd54e8468706996c1fcdf0cc61867312b80b62
@@ -3,9 +3,9 @@ sudo: false
3
3
  language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
- - 2.6.3
6
+ - 2.7.1
7
7
  before_install:
8
- - gem install bundler -v 2.0.2
8
+ - gem install bundler -v 2.1.4
9
9
  - gem install ripper-tags -v 0.8.1
10
10
  - brew unlink python@2
11
11
  - brew install --HEAD universal-ctags/universal-ctags/universal-ctags
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tagrity (0.2.16)
4
+ tagrity (0.3.0)
5
5
  cli-ui (~> 1.3.0)
6
6
  listen (~> 3.2.1)
7
7
  pry (~> 0.9.9)
data/README.md CHANGED
@@ -32,19 +32,19 @@ tagrity status
32
32
 
33
33
  ## Configuration
34
34
 
35
- Configuration can be done through use of a `tagrity_config.yml` file that looks like the following:
35
+ Configuration can be done through use of a local `.tagrity_config.yml` file that looks like the following:
36
36
 
37
- **NOTE:** Tagrity will look for a global config file at `$XDG_CONFIG_HOME/tagrity/tagrity_config.yml` (usually this will be `~/.config/tagrity/tagrity_config.yml`). This can be overridden by a local config in the current directory under the name `.tagrity_config.yml`.
37
+ **NOTE:** Tagrity will also look for a global config file at `$XDG_CONFIG_HOME/tagrity/tagrity_config.yml` (usually this will be `~/.config/tagrity/tagrity_config.yml`). This will be overriden by a local config file.
38
38
 
39
39
  **NOTE:** Tagrity needs to be restarted for configuration changes to take effect.
40
40
 
41
- [`tagrity_config.yml`](https://github.com/RRethy/tagrity/blob/master/sample_config.yml)
41
+ [Sample `tagrity_config.yml`](https://github.com/RRethy/tagrity/blob/master/sample_config.yml)
42
42
 
43
43
  ```yaml
44
44
  # which command to use to generate tags for a specific file extension
45
45
  # overrides default_command
46
46
  # tag generation commands must support --append, -f, -L
47
- # NOTE: Exuberant-ctags does NOT satisfy this, instead use Universal-ctags
47
+ # NOTE: Exuberant-ctags does NOT satisfy this requirement, instead use Universal-ctags
48
48
  #
49
49
  # Default: empty
50
50
  extension_commands:
@@ -75,15 +75,6 @@ extensions_whitelist: [rb, c, h, js]
75
75
  # Default: []
76
76
  extensions_blacklist: [erb, html, txt]
77
77
 
78
- # how to integrate with git
79
- # git_strategy: TRACKED | IGNORED | NA
80
- # TRACKED: only index files tracked by git
81
- # IGNORED: only index files which are not ignored by git
82
- # NA: don't use git, index all files under pwd
83
- #
84
- # Default: NA
85
- git_strategy: IGNORED
86
-
87
78
  # which paths (relative to pwd) to ignore
88
79
  # It's usually better to avoid this since tagrity integrates with git by
89
80
  # default using the strategy specified by git_strategy
data/TODO.md ADDED
@@ -0,0 +1,8 @@
1
+ # TODO
2
+
3
+ * Better error handling
4
+ * Delete old tags before doing --append (similar to ripper-tags funtionality, but do it for all ctags-alikes)
5
+ * Restart process which were terminated due to a system shutdown
6
+ * Will have to add `tagrity stop <pid>` instead of forcing users to use `kill <pid>`
7
+ * Watch local and global config for changes and reload automatically
8
+ * Better --fresh for git repos
@@ -9,7 +9,7 @@ module Tagrity
9
9
  class CLI < Thor
10
10
  desc "version", "print tagrity version"
11
11
  def version()
12
- puts VERSION
12
+ puts Tagrity::VERSION
13
13
  end
14
14
 
15
15
  desc "start", "Start watching pwd"
@@ -15,7 +15,7 @@ module Tagrity
15
15
  dir = Dir.pwd
16
16
  assert_not_running(dir)
17
17
 
18
- Process.daemon(:nochdir => true) unless fg
18
+ Process.daemon(true) unless fg
19
19
  logger.fg = fg
20
20
 
21
21
  tag_generator = Provider.provide(:tag_generator)
@@ -34,11 +34,11 @@ module Tagrity
34
34
  ) do |modified, added, removed|
35
35
  unless modified.empty?
36
36
  logger.info("modified absolute path: #{modified}")
37
- tag_generator.generate(modified)
37
+ tag_generator.generate(modified, true)
38
38
  end
39
39
  unless added.empty?
40
40
  logger.info("added absolute path: #{added}")
41
- tag_generator.generate(added)
41
+ tag_generator.generate(added, true)
42
42
  end
43
43
  unless removed.empty?
44
44
  logger.info("removed absolute path: #{removed}")
@@ -14,26 +14,36 @@ module Tagrity
14
14
  end
15
15
 
16
16
  def generate_all
17
- if File.exists?(tagf)
18
- File.delete(tagf)
19
- end
20
- cmd = if check_git?
21
- 'git ls-files 2> /dev/null'
17
+ files = []
18
+ if Helper.git_dir?
19
+ untracked_files = `git ls-files --others --exclude-standard 2> /dev/null`.split("\n")
20
+ if $?.exitstatus != 0
21
+ @logger.error("Failed to get a listing of all untracked files under pwd for use with --fresh.")
22
+ untracked_files = []
23
+ end
24
+ tracked_files = `git ls-files 2> /dev/null`.split("\n")
25
+ if $?.exitstatus != 0
26
+ @logger.error("Failed to get a listing of all tracked files under pwd for use with --fresh.")
27
+ tracked_files = []
28
+ end
29
+ files = tracked_files.concat untracked_files
22
30
  else
23
- 'find * -type f 2> /dev/null'
31
+ files = `find * -type f 2> /dev/null`.split("\n")
24
32
  end
25
- files = `#{cmd}`.split("\n")
26
- if $?.exitstatus == 0
27
- generate(files)
28
- else
29
- @logger.error("Failed to get a listing of all files under pwd for use with --fresh. Used #{cmd}.")
33
+ if not files.empty? and File.exists?(tagf)
34
+ File.delete(tagf)
30
35
  end
36
+
37
+ generate(files, false)
31
38
  end
32
39
 
33
- def generate(files)
40
+ def generate(files, check_git)
34
41
  return if files.empty?
42
+ if not Helper.git_dir?
43
+ check_git = false
44
+ end
35
45
  files
36
- .select { |file| generate_tags?(file)}
46
+ .select { |file| generate_tags?(file, check_git) }
37
47
  .group_by { |file| @config.command_for_extension(file.split('.').last) }
38
48
  .each do |cmd, fnames|
39
49
  Tempfile.create do |tmpf|
@@ -42,7 +52,7 @@ module Tagrity
42
52
  if $?.exitstatus == 0
43
53
  @logger.info("{#{cmd}} generated tags for #{fnames} into #{tagf}")
44
54
  else
45
- @logger.info("{#{cmd}} failed to generate tags for #{fnames} into #{tagf}")
55
+ @logger.info("{#{cmd}} failed (#{$?.exitstatus}) to generate tags for #{fnames} into #{tagf}")
46
56
  end
47
57
  end
48
58
  end
@@ -66,8 +76,8 @@ module Tagrity
66
76
 
67
77
  private
68
78
 
69
- def generate_tags?(file)
70
- copacetic_with_git?(file) && indexable?(file)
79
+ def generate_tags?(file, check_git)
80
+ return (!check_git || !Helper.file_ignored?(file)) && indexable?(file)
71
81
  end
72
82
 
73
83
  def indexable?(file)
@@ -1,3 +1,3 @@
1
1
  module Tagrity
2
- VERSION = "0.2.16"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  # which command to use to generate tags for a specific file extension
2
2
  # overrides default_command
3
3
  # tag generation commands must support --append, -f, -L
4
- # NOTE: Exuberant-ctags does NOT satisfy this, instead use Universal-ctags
4
+ # NOTE: Exuberant-ctags does NOT satisfy this requirement, instead use Universal-ctags
5
5
  #
6
6
  # Default: empty
7
7
  extension_commands:
@@ -32,15 +32,6 @@ extensions_whitelist: [rb, c, h, js]
32
32
  # Default: []
33
33
  extensions_blacklist: [erb, html, txt]
34
34
 
35
- # how to integrate with git
36
- # git_strategy: TRACKED | IGNORED | NA
37
- # TRACKED: only index files tracked by git
38
- # IGNORED: only index files which are not ignored by git
39
- # NA: don't use git, index all files under pwd
40
- #
41
- # Default: NA
42
- git_strategy: IGNORED
43
-
44
35
  # which paths (relative to pwd) to ignore
45
36
  # It's usually better to avoid this since tagrity integrates with git by
46
37
  # default using the strategy specified by git_strategy
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tagrity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.16
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam P. Regasz-Rethy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-18 00:00:00.000000000 Z
11
+ date: 2020-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -141,6 +141,7 @@ files:
141
141
  - LICENSE.txt
142
142
  - README.md
143
143
  - Rakefile
144
+ - TODO.md
144
145
  - bin/console
145
146
  - bin/setup
146
147
  - exe/tagrity