tagrity 0.1.2 → 0.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38dc3f96b14b1ef629c339a71faf41d448b7ca5281dd9d4e69ea4a2dcf167662
4
- data.tar.gz: 731c6fb5f54d8c9ca850f2ee6a38018f6a1765b1663334b52ba2ad0f9929c686
3
+ metadata.gz: 65a563d8eee08ae53bc757695cd9e307668a5222e3b841c6b1b6be7bb19043be
4
+ data.tar.gz: 0ba21cf9f1a2936140e8e26ec31b7b7a6cfcbca92789bafa9c2b75b2aa6944f8
5
5
  SHA512:
6
- metadata.gz: e228435fd32b23cb6d36b184889a82a170abc8422870d4321d36d5e2a17e89a108804ca4f83613ae41ad2e71091dae20a3e59652af5d715fa1f761055f6e1f6b
7
- data.tar.gz: db4f8487a44f71e366bfa83e6308ab712236ea038348a08ca6302904ab6d8cf1b09b61eb0dcc96aa233b8f964f07b41985af27043756d2001e3d697b19dfdbb6
6
+ metadata.gz: 0cc9e3b3babbdf5d048f913bbe05a85d866fe03a5f00a664aa0426f747ad15f3004fe9e674dad81ecc51e16945b8fd78a3bf93bff126927c515bf6ce881f9a0a
7
+ data.tar.gz: 02d9d817b50f25d6864f602fd22af3437458e458e534edfa5a26f4991bfeed5b8c976fb7ae43e608f05b148453538c026985cf155c666dfbe2440ccb198ee16a
@@ -0,0 +1,4 @@
1
+ continue
2
+ n
3
+ next
4
+ ls
@@ -1,18 +1,25 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tagrity (0.1.2)
4
+ tagrity (0.1.6)
5
5
  listen (~> 3.0)
6
+ pry (~> 0.9.9)
6
7
  thor (~> 0.20)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
10
11
  specs:
12
+ coderay (1.1.2)
11
13
  diff-lcs (1.3)
12
14
  ffi (1.11.3)
13
- listen (3.2.0)
15
+ listen (3.2.1)
14
16
  rb-fsevent (~> 0.10, >= 0.10.3)
15
17
  rb-inotify (~> 0.9, >= 0.9.10)
18
+ method_source (0.9.2)
19
+ pry (0.9.12.6)
20
+ coderay (~> 1.0)
21
+ method_source (~> 0.8)
22
+ slop (~> 3.4)
16
23
  rake (10.5.0)
17
24
  rb-fsevent (0.10.3)
18
25
  rb-inotify (0.10.0)
@@ -31,6 +38,7 @@ GEM
31
38
  diff-lcs (>= 1.2.0, < 2.0)
32
39
  rspec-support (~> 3.9.0)
33
40
  rspec-support (3.9.0)
41
+ slop (3.6.0)
34
42
  thor (0.20.3)
35
43
 
36
44
  PLATFORMS
data/README.md CHANGED
@@ -4,19 +4,17 @@ Automatically regenerate tags on file changes.
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'tagrity'
7
+ ```sh
8
+ $ gem install tagrity
11
9
  ```
12
10
 
13
- And then execute:
14
-
15
- $ bundle
11
+ ## Quick Start
16
12
 
17
- Or install it yourself as:
13
+ ```sh
14
+ tagrity start
15
+ ```
18
16
 
19
- $ gem install tagrity
17
+ That's it! By default, tagrity will only index files tracked by git. You may wish to al
20
18
 
21
19
  ## Usage
22
20
 
@@ -84,3 +82,12 @@ The gem is available as open source under the terms of the [MIT License](https:/
84
82
  ## Code of Conduct
85
83
 
86
84
  Everyone interacting in the Tagrity project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/tagrity/blob/master/CODE_OF_CONDUCT.md).
85
+
86
+
87
+
88
+
89
+ tagrity config to use (default to ~/.config/tagrity/config.yml if available).
90
+ A config file is a yaml file with the following possible values.
91
+ Some of these can be overridden with options, however the configfile
92
+ provided via --configfile will override the global config file in
93
+ ~/.config/tagrity/config.yml
@@ -6,16 +6,19 @@ require 'tagrity/commands/status'
6
6
  module Tagrity
7
7
  class CLI < Thor
8
8
  desc "start", "Start watching a directory (default to pwd)"
9
- option :dir
10
- option :fg, type: :boolean
11
- option :configfile
12
- option :tagf
13
- option :default_cmd
14
- option :excluded_exts, type: :array
15
- option :excluded_paths, type: :array
9
+ option :dir, desc: "directory to watch (omit to use pwd)"
10
+ option :tagf, desc: "filename (relative) to generate tags into (default: 'tags')."
11
+ option :fg, type: :boolean, desc: "keep the tagrity process running in the foreground"
12
+ option :fresh, type: :boolean, default: false, desc: "index the whole codebase before watching the file system. This will be slow if the codebase is large."
13
+ option :git, type: :boolean, default: true, desc: "only index files which are being tracked by git"
14
+ option :configfile, desc: "See README for more info."
15
+ option :ext_cmds, type: :hash, desc: "which <command> to use to generate tags based on the file extension. <command> must support -f and --append"
16
+ option :default_cmd, desc: "the default <command> to be used to generate tags (default: 'ctags'). <command> must support -f and --append"
17
+ option :excluded_exts, type: :array, desc: "which file extensions to not generate tags for."
18
+ option :excluded_paths, type: :array, desc: "which paths to ignore. Usually better to ignore this since by default only file tracked by git are indexed."
16
19
  def start()
17
20
  setup_config
18
- Command::Start::call(dir, fg?)
21
+ Command::Start::call(dir, fg?, fresh?)
19
22
  end
20
23
 
21
24
  desc "stop", "Stop watching a directory (default to pwd)"
@@ -41,13 +44,19 @@ module Tagrity
41
44
  options[:fg]
42
45
  end
43
46
 
47
+ def fresh?
48
+ options[:fresh]
49
+ end
50
+
44
51
  def setup_config
45
52
  ConfigFile.instance.init(
46
53
  configfile: options[:configfile],
47
54
  default_cmd: options[:default_cmd],
48
55
  tagf: options[:tagf],
56
+ ext_cmds: options[:ext_cmds],
49
57
  excluded_exts: options[:excluded_exts],
50
- excluded_paths: options[:excluded_paths]
58
+ excluded_paths: options[:excluded_paths],
59
+ git: options[:git]
51
60
  )
52
61
  end
53
62
  end
@@ -1,6 +1,6 @@
1
1
  require 'listen'
2
2
  require 'tagrity/pid_file'
3
- require 'tagrity/process_helper'
3
+ require 'tagrity/helper'
4
4
  require 'tagrity/file_callbacks'
5
5
  require 'tagrity/provider'
6
6
 
@@ -10,7 +10,7 @@ module Tagrity
10
10
  class ErrorProcessAlreadyRunning < StandardError; end
11
11
 
12
12
  class << self
13
- def call(dir, fg)
13
+ def call(dir, fg, fresh)
14
14
  assert_not_running(dir)
15
15
 
16
16
  Process.daemon(nochdir: true) unless fg
@@ -18,11 +18,15 @@ module Tagrity
18
18
  callbacks = Provider.provide(:file_callbacks)
19
19
  PidFile.write(PidFile.new(dir, Process.pid))
20
20
 
21
+ callbacks.on_fresh if fresh
22
+
21
23
  listener = Listen.to(
22
24
  dir,
23
- ignore: [/^\.?tags$/],
24
25
  relative: true,
25
26
  ) do |modified, added, removed|
27
+ puts "modified absolute path: #{modified}"
28
+ puts "added absolute path: #{added}"
29
+ puts "removed absolute path: #{removed}"
26
30
  callbacks.on_files_modified(modified)
27
31
  callbacks.on_files_added(added)
28
32
  callbacks.on_files_removed(removed)
@@ -1,32 +1,36 @@
1
1
  require 'yaml'
2
2
  require 'singleton'
3
- require 'tagrity/executable_helper'
3
+ require 'tagrity/helper'
4
4
 
5
5
  module Tagrity
6
6
  class ConfigFile
7
7
  include Singleton
8
8
 
9
9
  class ErrorTagFileNotWritable < StandardError; end
10
+ class ErrorGitNotExecutable < StandardError; end
10
11
 
11
12
  def init(
12
13
  configfile:,
13
14
  default_cmd:,
14
15
  tagf:,
16
+ ext_cmds:,
15
17
  excluded_exts:,
16
- excluded_paths:
18
+ excluded_paths:,
19
+ git:
17
20
  )
18
21
  fname = config_file_name(configfile)
19
22
  @config = if fname.nil? then {} else YAML.load_file(fname) end
20
- ensure_ext_cmds
23
+ ensure_ext_cmds(ext_cmds)
21
24
  ensure_default_cmd(default_cmd)
22
25
  ensure_tagf(tagf)
23
26
  ensure_excluded_exts(excluded_exts)
24
27
  ensure_excluded_paths(excluded_paths)
28
+ ensure_git(git)
25
29
  end
26
30
 
27
31
  def ft_to_cmd(ext)
28
32
  ft_cmd = @config['ext_cmds'][ext]
29
- return @config['default_cmd'] if ft_cmd.nil? || !ExecutableHelper.is_executable(ft_cmd)
33
+ return @config['default_cmd'] if ft_cmd.nil? || !Helper.is_executable?(ft_cmd)
30
34
  ft_cmd
31
35
  end
32
36
 
@@ -42,14 +46,18 @@ module Tagrity
42
46
  @config['tagf']
43
47
  end
44
48
 
49
+ def respect_git?
50
+ @config['git']
51
+ end
52
+
45
53
  def to_s
46
54
  @config.to_s
47
55
  end
48
56
 
49
57
  private
50
58
 
51
- def ensure_ext_cmds
52
- set_option('ext_cmds', nil, {})
59
+ def ensure_ext_cmds(ext_cmds)
60
+ set_option('ext_cmds', ext_cmds, {})
53
61
  end
54
62
 
55
63
  def ensure_default_cmd(default_cmd)
@@ -66,11 +74,18 @@ module Tagrity
66
74
 
67
75
  def ensure_tagf(tagf)
68
76
  set_option('tagf', tagf, 'tags')
69
- unless File.writable?(@config['tagf'])
77
+ if File.exists?(@config['tagf']) && !File.writable?(@config['tagf'])
70
78
  raise ErrorTagFileNotWritable, "#{@config['tagf']} must be writable to be used as the tag file."
71
79
  end
72
80
  end
73
81
 
82
+ def ensure_git(git)
83
+ set_option('git', git, true)
84
+ if @config['git'] && !Helper.is_executable?('git')
85
+ raise ErrorGitNotExecutable, "'git' must be executable to use the --git option."
86
+ end
87
+ end
88
+
74
89
  def set_option(key, local_val, default)
75
90
  unless local_val.nil?
76
91
  @config[key] = local_val
@@ -7,6 +7,10 @@ module Tagrity
7
7
  @tag_generator = tag_generator
8
8
  end
9
9
 
10
+ def on_fresh
11
+ @tag_generator.generate_all
12
+ end
13
+
10
14
  def on_files_modified(files)
11
15
  @tag_generator.generate(files)
12
16
  end
@@ -0,0 +1,57 @@
1
+ module Tagrity
2
+ class Helper
3
+ root = ENV['TEST'] ? __dir__ : "#{ENV['HOME']}/.tagrity/"
4
+ RUN_DIR = File.join(root, 'var/run').freeze
5
+ LOG_DIR = File.join(root, 'var/log').freeze
6
+
7
+ class << self
8
+ def run_dir
9
+ ensure_data_dirs
10
+ RUN_DIR
11
+ end
12
+
13
+ def is_executable?(cmd)
14
+ !%x{command -v #{cmd}}.empty?
15
+ end
16
+
17
+ def kill(pid)
18
+ Process.kill('HUP', pid)
19
+ end
20
+
21
+ def alive?(pid)
22
+ Process.kill(0, pid) # signal 0 checks if pid is alive
23
+ true
24
+ rescue Errno::ESRCH
25
+ false
26
+ rescue Errno::EPERM
27
+ true
28
+ end
29
+
30
+ def is_git_dir?
31
+ return @is_git_dir unless @is_git_dir.nil?
32
+ `git rev-parse --git-dir &> /dev/null`
33
+ if $?.exitstatus == 0
34
+ @is_git_dir = true
35
+ else
36
+ @is_git_dir = false
37
+ end
38
+ end
39
+
40
+ def is_file_ignored?(file)
41
+ `git check-ignore -q #{file} &> /dev/null`
42
+ $?.exitstatus == 0
43
+ end
44
+
45
+ def is_file_tracked?(file)
46
+ `git ls-files --error-unmatch #{file} &> /dev/null`
47
+ $?.exitstatus == 0
48
+ end
49
+
50
+ private
51
+
52
+ def ensure_data_dirs
53
+ FileUtils.mkdir_p(RUN_DIR)
54
+ end
55
+ end
56
+ end
57
+ end
@@ -1,31 +1,31 @@
1
+ require 'tagrity/helper'
2
+
1
3
  module Tagrity
2
4
  class PidFile
3
- RUN_DIR = "#{__dir__}/../../var/run"
4
-
5
5
  class << self
6
6
  def write(pid_file)
7
- File.write("#{run_dir}/#{pid_file.name}", pid_file.dir)
7
+ File.write("#{Helper.run_dir}/#{pid_file.name}", pid_file.dir)
8
8
  end
9
9
 
10
10
  def delete(dir)
11
- pid_file_paths = Dir.glob("#{run_dir}/#{dir.split('/').last}.*.pid").select do |path|
11
+ pid_file_paths = Dir.glob("#{Helper.run_dir}/#{dir.split('/').last}.*.pid").select do |path|
12
12
  full_dir = File.read(path)
13
13
  File.realdirpath(full_dir) == File.realdirpath(dir)
14
14
  end
15
15
 
16
16
  pid_file_paths.each do |path|
17
17
  File.delete(path)
18
- ProcessHelper.kill(pid_from_path(path))
18
+ Helper.kill(pid_from_path(path))
19
19
  end
20
20
  end
21
21
 
22
22
  def alive_pid_files(dir: nil)
23
- Dir.glob("#{run_dir}/*").reduce([]) do |pid_files, path|
23
+ Dir.glob("#{Helper.run_dir}/*").reduce([]) do |pid_files, path|
24
24
  pid = pid_from_path(path)
25
25
  pid_file_dir = File.read(path)
26
26
 
27
27
  if dir.nil? || is_same_dirs(pid_file_dir, dir)
28
- if ProcessHelper.alive?(pid)
28
+ if Helper.alive?(pid)
29
29
  pid_files << PidFile.new(pid_file_dir, pid)
30
30
  else
31
31
  File.delete(path)
@@ -36,23 +36,12 @@ module Tagrity
36
36
  end
37
37
  end
38
38
 
39
- def run_dir
40
- ensure_dirs
41
- RUN_DIR
42
- end
43
-
44
39
  private
45
40
 
46
41
  def is_same_dirs(dir1, dir2)
47
42
  File.realdirpath(dir1) == File.realdirpath(dir2)
48
43
  end
49
44
 
50
- def ensure_dirs
51
- return if @ensure_dirs_done
52
- FileUtils.mkdir_p(RUN_DIR)
53
- @ensure_dirs_done = true
54
- end
55
-
56
45
  def pid_from_path(pid_file_name)
57
46
  pid_file_name.split('.')[-2].to_i
58
47
  end
@@ -76,13 +65,13 @@ module Tagrity
76
65
 
77
66
  def delete
78
67
  File.delete(pid_file_path)
79
- ProcessHelper.kill(pid.to_i)
68
+ Helper.kill(pid.to_i)
80
69
  end
81
70
 
82
71
  private
83
72
 
84
73
  def pid_file_path
85
- "#{PidFile.run_dir}/#{name}"
74
+ "#{Helper.run_dir}/#{name}"
86
75
  end
87
76
  end
88
77
  end
@@ -1,4 +1,8 @@
1
- require 'tagrity/executable_helper'
1
+ require 'tmpdir'
2
+ require 'tempfile'
3
+ require 'fileutils'
4
+ require 'pry'
5
+ require 'tagrity/helper'
2
6
 
3
7
  module Tagrity
4
8
  class TagGenerator
@@ -9,37 +13,81 @@ module Tagrity
9
13
  @config = ConfigFile.instance
10
14
  end
11
15
 
16
+ def generate_all
17
+ if File.exists?(tagf)
18
+ File.delete(tagf)
19
+ end
20
+ if check_git?
21
+ files = `git ls-files 2> /dev/null`.split
22
+ else
23
+ files = `find * 2> /dev/null`.split
24
+ end
25
+ if $?.exitstatus == 0
26
+ generate(files)
27
+ else
28
+ puts "Failed to get a listing of all files under pwd for use with --fresh."
29
+ end
30
+ end
31
+
12
32
  def generate(files)
13
33
  return if files.empty?
14
34
  files
15
- .select { |file| !dont_index_file(file) && File.readable?(file) }
35
+ .select { |file| generate_tags?(file) }
16
36
  .group_by { |file| @config.ft_to_cmd(file.partition('.').last) }
17
37
  .each do |cmd, fnames|
18
- `#{cmd} -f #{tagf} --append #{fnames.join(' ')}`
19
- if $?.exitstatus != 0
20
- puts "{#{cmd}} failed to generate tags for #{fnames} into #{tagf}"
21
- else
22
- puts "{#{cmd}} generated tags for #{fnames} into #{tagf}"
38
+ Tempfile.create do |tmpf|
39
+ IO::write(tmpf.path, fnames.join("\n"))
40
+ system(cmd, '-f', tagf, '--append', '-L', tmpf.path, out: File::NULL)
41
+ if $?.exitstatus == 0
42
+ puts "{#{cmd}} generated tags for #{fnames} into #{tagf}"
43
+ else
44
+ puts "{#{cmd}} failed to generate tags for #{fnames} into #{tagf}"
45
+ end
23
46
  end
24
47
  end
25
48
  end
26
49
 
27
50
  def delete_files_tags(files)
28
51
  return if files.empty?
29
- `cat #{tagf} | grep -v -F #{files.map { |f| " -e \" #{f} \""}.join(' ')} > .tagrity.tags`
30
- `mv -f .tagrity.tags #{tagf}`
31
- puts "Deleted tags for #{files} from #{tagf}"
52
+ Tempfile.create do |tmpf|
53
+ File.open(tagf) do |f|
54
+ f.each_line do |line|
55
+ unless files.any? { |fname| line.include?("\t#{fname}\t") }
56
+ tmpf.write line
57
+ end
58
+ end
59
+ end
60
+ tmpf.rewind
61
+ FileUtils.mv(tmpf.path, tagf, force: true)
62
+ puts "Deleted tags for #{files} from #{tagf}"
63
+ end
32
64
  end
33
65
 
34
66
  private
35
67
 
36
- def dont_index_file(fname)
68
+ def generate_tags?(file)
69
+ copacetic_with_git?(file) && indexable?(file)
70
+ end
71
+
72
+ def indexable?(file)
73
+ file != tagf && !is_file_excluded(file) && File.readable?(file)
74
+ end
75
+
76
+ def copacetic_with_git?(file)
77
+ !(check_git? && !Helper.is_file_tracked?(file))
78
+ end
79
+
80
+ def check_git?
81
+ @config.respect_git? && Helper.is_git_dir?
82
+ end
83
+
84
+ def is_file_excluded(fname)
37
85
  @config.is_ft_excluded(fname.partition('.').last) || @config.is_path_excluded(fname)
38
86
  end
39
87
 
40
88
  def assert_executables
41
89
  %w(cat grep mv).each do |exe|
42
- if !ExecutableHelper.is_executable(exe)
90
+ if !Helper.is_executable?(exe)
43
91
  raise ExecutableNonExist, "tagrity depends on the executable #{exe}"
44
92
  end
45
93
  end
@@ -1,3 +1,3 @@
1
1
  module Tagrity
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -0,0 +1,31 @@
1
+ # ext_cmds allows different tag generators to be used depending on the file extension.
2
+ # Multiple extensions does not work, *.html.erb files will be picked up as erb.
3
+ # ext_cmds:
4
+ # <file extension>: <command to use to generate tags for this file extension>
5
+ # DEFAULT: empty
6
+ ext_cmds:
7
+ rb: ripper-tags
8
+ c: ctags
9
+ go: gotags
10
+
11
+ # default_cmd specifies the default command to be used to generate tags
12
+ # default_cmd: <command>
13
+ # DEFAULT: ctags
14
+ default_cmd: ctags
15
+
16
+ # tagf is the filename (relative) to generate tags into
17
+ # tagf: <filename>
18
+ # DEFAULT: tags
19
+ tagf: tags
20
+
21
+ # excluded_exts specifies which file extensions to not generate tags for.
22
+ # excluded_exts: [<file extension>, ...]
23
+ # DEFAULT: []
24
+ excluded_exts: [rb, h, js]
25
+
26
+ # excluded_paths specifies which paths to ignore.
27
+ # It's usually better to avoid this since by default tagrity will only look
28
+ # at files which are tracked by git.
29
+ # excluded_paths: [<path>, ...]
30
+ # DEFAULT: []
31
+ excluded_paths: [vendor, node_modules]
@@ -33,4 +33,5 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "rake", "~> 10.0"
34
34
  spec.add_development_dependency "rspec", "~> 3.0"
35
35
  spec.add_development_dependency "ripper-tags", "~> 0.8.0"
36
+ spec.add_dependency "pry", "~> 0.9.9"
36
37
  end
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.1.2
4
+ version: 0.1.7
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: 2019-12-12 00:00:00.000000000 Z
11
+ date: 2019-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.8.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.9.9
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.9.9
97
111
  description: Ditto
98
112
  email:
99
113
  - rethy.spud@gmail.com
@@ -102,6 +116,7 @@ executables:
102
116
  extensions: []
103
117
  extra_rdoc_files: []
104
118
  files:
119
+ - ".byebug_history"
105
120
  - ".gitignore"
106
121
  - ".rspec"
107
122
  - ".travis.yml"
@@ -120,13 +135,13 @@ files:
120
135
  - lib/tagrity/commands/status.rb
121
136
  - lib/tagrity/commands/stop.rb
122
137
  - lib/tagrity/config_file.rb
123
- - lib/tagrity/executable_helper.rb
124
138
  - lib/tagrity/file_callbacks.rb
139
+ - lib/tagrity/helper.rb
125
140
  - lib/tagrity/pid_file.rb
126
- - lib/tagrity/process_helper.rb
127
141
  - lib/tagrity/provider.rb
128
142
  - lib/tagrity/tag_generator.rb
129
143
  - lib/tagrity/version.rb
144
+ - sample_config.yml
130
145
  - tagrity.gemspec
131
146
  homepage: https://github.com/RRethy/tagrity
132
147
  licenses:
@@ -1,9 +0,0 @@
1
- module Tagrity
2
- class ExecutableHelper
3
- class << self
4
- def is_executable(cmd)
5
- !%x{command -v #{cmd}}.empty?
6
- end
7
- end
8
- end
9
- end
@@ -1,18 +0,0 @@
1
- module Tagrity
2
- class ProcessHelper
3
- class << self
4
- def kill(pid)
5
- Process.kill('HUP', pid)
6
- end
7
-
8
- def alive?(pid)
9
- Process.kill(0, pid) # signal 0 checks if pid is alive
10
- true
11
- rescue Errno::ESRCH
12
- false
13
- rescue Errno::EPERM
14
- true
15
- end
16
- end
17
- end
18
- end