tagrity 0.2.19 → 0.3.4

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: 436d0d9af10e33b0f6b4ec2b2ce17588d63186816531374b3d2dec409404b9a4
4
- data.tar.gz: 5c8c7b93a1b0331018e71926052348f2341f4d947609176aeea39818938a6dfe
3
+ metadata.gz: 7490444ad7659b555e29f61c09d8bee1536a608345113245ea54f1f85fcb5002
4
+ data.tar.gz: e28e9d0d61c936ae89379913bd6b64d2e177431e985371c81b27bb2b77f287d4
5
5
  SHA512:
6
- metadata.gz: 70d5afd1da1dab096030fbd7de53f41327eaac0a220a9f7abf9920f5a69388ff37fdd4e546f2877a391662350675339ae340681d08ff898d95e07855ceec14b8
7
- data.tar.gz: a5054c37893487fbb09809b4587b5b3b7f5e1b7e3a69d2144df2d882ef8edd2307203766c6a5bf4910f3bc0dfa592a7a9b4b1d7cdf791527eb9d444e00b251a7
6
+ metadata.gz: fdd57aeb20e34e8f224d07fb893fe44ebc3bd02364dcf79c12bb404ac293e11333b7941967356ac4999b8105f22c5f7541df519265d3cced834cc4b71f6dea67
7
+ data.tar.gz: 80ac84ad3477f8d03275e2e814c36c668ab237cfa1bb9fb95628b0a60cc32eef554a49117871368fae9a2d5eee37ff9dbd6ab94176b89d263eaa413e3191f094
@@ -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.18)
4
+ tagrity (0.3.2)
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,5 @@
1
+ # TODO
2
+
3
+ * Better error handling
4
+ * Restart process which were terminated due to a system shutdown
5
+ * Will have to add `tagrity stop <pid>` instead of forcing users to use `kill <pid>`
@@ -0,0 +1,3 @@
1
+ #! /bin/sh
2
+
3
+ echo "Hello, World!"
@@ -3,6 +3,7 @@ require 'tagrity/commands/start'
3
3
  require 'tagrity/commands/stop'
4
4
  require 'tagrity/commands/status'
5
5
  require 'tagrity/commands/logs'
6
+ require 'tagrity/commands/revive'
6
7
  require 'tagrity/version'
7
8
 
8
9
  module Tagrity
@@ -35,5 +36,10 @@ module Tagrity
35
36
  def logs
36
37
  Command::Logs::call(options['n'], options['debug'])
37
38
  end
39
+
40
+ desc "revive", "Restart any tagrity processes that died"
41
+ def revive
42
+ Command::Revive::call
43
+ end
38
44
  end
39
45
  end
@@ -0,0 +1,11 @@
1
+ module Tagrity
2
+ module Command
3
+ class Revive
4
+ class << self
5
+ def call
6
+ PidFile.revive_dead_pids
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -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}")
@@ -36,6 +36,20 @@ module Tagrity
36
36
  end
37
37
  end
38
38
 
39
+ def revive_dead_pids
40
+ Dir.glob("#{Helper.run_dir}/*").reduce([]) do |pid_files, path|
41
+ pid = pid_from_path(path)
42
+ dir = File.read(path)
43
+
44
+ if not Helper.alive?(pid)
45
+ File.delete(path)
46
+ Dir.chdir(File.realdirpath(dir)) do
47
+ Process.spawn('tagrity start')
48
+ end
49
+ end
50
+ end
51
+ end
52
+
39
53
  private
40
54
 
41
55
  def same_dirs?(dir1, dir2)
@@ -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 (#{$?.exitstatus}) to generate tags for #{fnames} into #{tagf}")
55
+ @logger.error("{#{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.19"
2
+ VERSION = "0.3.4"
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.19
4
+ version: 0.3.4
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-19 00:00:00.000000000 Z
11
+ date: 2020-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -128,6 +128,7 @@ email:
128
128
  - rethy.spud@gmail.com
129
129
  executables:
130
130
  - tagrity
131
+ - tagrity_revive
131
132
  extensions: []
132
133
  extra_rdoc_files: []
133
134
  files:
@@ -141,12 +142,15 @@ files:
141
142
  - LICENSE.txt
142
143
  - README.md
143
144
  - Rakefile
145
+ - TODO.md
144
146
  - bin/console
145
147
  - bin/setup
146
148
  - exe/tagrity
149
+ - exe/tagrity_revive
147
150
  - lib/tagrity.rb
148
151
  - lib/tagrity/cli.rb
149
152
  - lib/tagrity/commands/logs.rb
153
+ - lib/tagrity/commands/revive.rb
150
154
  - lib/tagrity/commands/start.rb
151
155
  - lib/tagrity/commands/status.rb
152
156
  - lib/tagrity/commands/stop.rb