completely 0.6.0 → 0.6.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: b40f2059243b2820d2ce140394be5551e5ddb131351adb35d26343841f8a54c7
4
- data.tar.gz: 71e01f5c44395f97023afff5a1822c5fa651efb98155a3b8dd05f750a19a5419
3
+ metadata.gz: 96373b5a76365d9d8dd59e017dec1c32159520ac92f4d2abaed7dd807843a847
4
+ data.tar.gz: fea9ce43a598c7f52ddb59971f895ebdb8eb9bb4f9a1d6918e5c15c52eb583e9
5
5
  SHA512:
6
- metadata.gz: 71d90d706eb26933817483395670eb5d5ed516b606b62c1f4b9408afdec92b977142e4b2501ff12b75bb47fa971e558696ef5294a3c569f3856da8cb9904254f
7
- data.tar.gz: df1e950e2f839a977181521bb09fb917e6d47046f4f6b80d7a8dfc557b2c5d67ee66f962b7a23fd2456137a283bae6ffc9fe38e9ad97355c53c82a1ec84cff7a
6
+ metadata.gz: c2b06ef048b16ddc565534b7934c421bc9dde18bf7706071972f64d406563be6044308cd4a38497f96f78208ba5916bc29d5aa4c1228f30fdfb0e6cad638f61b
7
+ data.tar.gz: ae92c96a9d51cf4574868257432f348494e16c8bbcfa10a3a6703ae6ca3de110a008c443bc1da25807a815792e7e9d7e3cc6df5530a32ee21c5653524662b93d
@@ -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.command_string
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.command_string}`" unless success
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
@@ -15,13 +15,22 @@ module Completely
15
15
  ]
16
16
  end
17
17
 
18
- def command
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 command_string
24
- command.join ' '
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(*command)
53
+ system(*install_command)
54
+ end
55
+
56
+ def uninstall
57
+ system(*uninstall_command)
45
58
  end
46
59
 
47
60
  private
@@ -1,3 +1,3 @@
1
1
  module Completely
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.1'
3
3
  end
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.0
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