completely 0.6.0 → 0.6.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/lib/completely/cli.rb +3 -1
- data/lib/completely/commands/install.rb +2 -2
- data/lib/completely/commands/uninstall.rb +39 -0
- data/lib/completely/installer.rb +17 -4
- data/lib/completely/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96373b5a76365d9d8dd59e017dec1c32159520ac92f4d2abaed7dd807843a847
|
4
|
+
data.tar.gz: fea9ce43a598c7f52ddb59971f895ebdb8eb9bb4f9a1d6918e5c15c52eb583e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2b06ef048b16ddc565534b7934c421bc9dde18bf7706071972f64d406563be6044308cd4a38497f96f78208ba5916bc29d5aa4c1228f30fdfb0e6cad638f61b
|
7
|
+
data.tar.gz: ae92c96a9d51cf4574868257432f348494e16c8bbcfa10a3a6703ae6ca3de110a008c443bc1da25807a815792e7e9d7e3cc6df5530a32ee21c5653524662b93d
|
data/lib/completely/cli.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
require 'mister_bin'
|
2
|
-
require 'completely/version'
|
3
2
|
require 'completely/commands/generate'
|
4
3
|
require 'completely/commands/init'
|
5
4
|
require 'completely/commands/install'
|
6
5
|
require 'completely/commands/preview'
|
7
6
|
require 'completely/commands/test'
|
7
|
+
require 'completely/commands/uninstall'
|
8
|
+
require 'completely/version'
|
8
9
|
|
9
10
|
module Completely
|
10
11
|
class CLI
|
@@ -18,6 +19,7 @@ module Completely
|
|
18
19
|
runner.route 'generate', to: Commands::Generate
|
19
20
|
runner.route 'test', to: Commands::Test
|
20
21
|
runner.route 'install', to: Commands::Install
|
22
|
+
runner.route 'uninstall', to: Commands::Uninstall
|
21
23
|
|
22
24
|
runner
|
23
25
|
end
|
@@ -21,12 +21,12 @@ module Completely
|
|
21
21
|
|
22
22
|
def run
|
23
23
|
if args['--dry']
|
24
|
-
puts installer.
|
24
|
+
puts installer.install_command_string
|
25
25
|
return
|
26
26
|
end
|
27
27
|
|
28
28
|
success = installer.install force: args['--force']
|
29
|
-
raise InstallError, "Failed running command:\nnb`#{installer.
|
29
|
+
raise InstallError, "Failed running command:\nnb`#{installer.install_command_string}`" unless success
|
30
30
|
|
31
31
|
say "Saved m`#{installer.target_path}`"
|
32
32
|
say 'You may need to restart your session to test it'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'completely/commands/base'
|
2
|
+
|
3
|
+
module Completely
|
4
|
+
module Commands
|
5
|
+
class Uninstall < Base
|
6
|
+
summary 'Uninstall a bash completion script'
|
7
|
+
|
8
|
+
help <<~HELP
|
9
|
+
This command will remove the completion script for the specified program from all the bash completion directories.
|
10
|
+
HELP
|
11
|
+
|
12
|
+
usage 'completely uninstall PROGRAM [--dry]'
|
13
|
+
usage 'completely uninstall (-h|--help)'
|
14
|
+
|
15
|
+
option '-d --dry', 'Show the uninstallation command but do not run it'
|
16
|
+
|
17
|
+
param 'PROGRAM', 'Name of the program the completions are for.'
|
18
|
+
|
19
|
+
def run
|
20
|
+
if args['--dry']
|
21
|
+
puts installer.uninstall_command_string
|
22
|
+
return
|
23
|
+
end
|
24
|
+
|
25
|
+
success = installer.uninstall
|
26
|
+
raise InstallError, "Failed running command:\nnb`#{installer.uninstall_command_string}`" unless success
|
27
|
+
|
28
|
+
say 'Done'
|
29
|
+
say 'You may need to restart your session to test it'
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def installer
|
35
|
+
Installer.new program: args['PROGRAM']
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/completely/installer.rb
CHANGED
@@ -15,13 +15,22 @@ module Completely
|
|
15
15
|
]
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def install_command
|
19
19
|
result = root_user? ? [] : %w[sudo]
|
20
20
|
result + %W[cp #{script_path} #{target_path}]
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
24
|
-
|
23
|
+
def install_command_string
|
24
|
+
install_command.join ' '
|
25
|
+
end
|
26
|
+
|
27
|
+
def uninstall_command
|
28
|
+
result = root_user? ? [] : %w[sudo]
|
29
|
+
result + %w[rm -f] + target_directories.map { |dir| "#{dir}/#{program}" }
|
30
|
+
end
|
31
|
+
|
32
|
+
def uninstall_command_string
|
33
|
+
uninstall_command.join ' '
|
25
34
|
end
|
26
35
|
|
27
36
|
def target_path
|
@@ -41,7 +50,11 @@ module Completely
|
|
41
50
|
raise InstallError, "File exists: m`#{target_path}`"
|
42
51
|
end
|
43
52
|
|
44
|
-
system(*
|
53
|
+
system(*install_command)
|
54
|
+
end
|
55
|
+
|
56
|
+
def uninstall
|
57
|
+
system(*uninstall_command)
|
45
58
|
end
|
46
59
|
|
47
60
|
private
|
data/lib/completely/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: completely
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- lib/completely/commands/install.rb
|
62
62
|
- lib/completely/commands/preview.rb
|
63
63
|
- lib/completely/commands/test.rb
|
64
|
+
- lib/completely/commands/uninstall.rb
|
64
65
|
- lib/completely/completions.rb
|
65
66
|
- lib/completely/exceptions.rb
|
66
67
|
- lib/completely/installer.rb
|