ln4sudo 0.1.1 → 0.1.2

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: 8caa637bb6869c0e0903fe649bd48d35737a79a4818b790ea3d17f7a73055f0c
4
- data.tar.gz: 6642cd624d5ea0c101528416313d86eae0d030a6934631bad5e599519972c0b3
3
+ metadata.gz: d81611791367f47f236e6af564a8f2bc0e6ed08bd1d7d6b2dbb77061f7c5829e
4
+ data.tar.gz: 221b67e8fe6074d69ff0c8293e65efcb2a36e530eb4332eb5fd50064478a28e3
5
5
  SHA512:
6
- metadata.gz: 32a6e8fd01e55eebbf53873cb2cdca5463f0090196275d455ea74a9eb30a6804265e30d1d7568b18a80f3720ca21b2c8eb63f092fab29b7ab4c6116cd39cad91
7
- data.tar.gz: a5252f11082a43b3571016cf184e6ce42e2b57030cab825afe05b8d3a4d729d0f17cd0a19fd7a086703d91b4d7df1cc43bd3d0327a548f9d15e5607e8d98ecd2
6
+ metadata.gz: 8e9a15b0f6e4537346cac59420ef88f72799b853aadb4a000fbca467ab7556ea45fbc642834bbf9acc9e20b2a0d8422ba18ee135fbb270c86731698d2d634170
7
+ data.tar.gz: ccb53d57317388f7f98f9b1137347623ca264d8378e6f0b2bc27caa131bbc8d4b996ed476a6887ff74a3147528832dede01329e5252ef4c1ece1089b02e6695c
data/README.md CHANGED
@@ -10,6 +10,10 @@ ln4sudo - create a symbolic link in /sbin for easy sudo.
10
10
  ## Usage
11
11
 
12
12
  ```
13
+ ln4sudo [-f] command...
14
+
15
+ -f remove existing destination files
16
+
13
17
  $ which gem
14
18
  /usr/local/ruby2.5.1/bin/gem
15
19
 
@@ -28,7 +32,7 @@ change target directory to /usr/local/sbin
28
32
 
29
33
  ## Contributing
30
34
 
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ln4sudo.
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/s3fxn/ln4sudo.
32
36
 
33
37
  ## License
34
38
 
data/exe/ln4sudo CHANGED
@@ -11,7 +11,9 @@ if ARGV == []
11
11
  puts
12
12
  puts 'ln4sudo - create a symbolic link in /sbin for easy sudo.'
13
13
  puts
14
- puts 'Usage: ln4sudo command...'
14
+ puts 'Usage: ln4sudo [-f] command...'
15
+ puts
16
+ puts '-f remove existing destination files'
15
17
  puts
16
18
  puts 'examples:'
17
19
  puts '$ which gem'
@@ -39,6 +41,13 @@ if ARGV[0] == 'init' and FileTest.directory?(ARGV[1] || '')
39
41
  exit
40
42
  end
41
43
 
44
+ if ARGV.include?('-f')
45
+ force = 'f'
46
+ ARGV.delete('-f')
47
+ else
48
+ force = ''
49
+ end
50
+
42
51
  dir = open(config).read.strip if FileTest.exists?(config)
43
52
  dir = '/sbin' if dir == nil or dir == ''
44
53
  ARGV.each {|cmd|
@@ -47,7 +56,8 @@ ARGV.each {|cmd|
47
56
  puts "#{cmd} not found."
48
57
  next
49
58
  end
50
- sudo_cmd = "sudo ln -s #{fullpath} #{dir}"
59
+ fullpath = File.readlink(fullpath) if FileTest.symlink?(fullpath)
60
+ sudo_cmd = "sudo ln -s#{force} #{fullpath} #{dir}"
51
61
  puts sudo_cmd
52
62
  print `#{sudo_cmd}`
53
63
  }
@@ -1,3 +1,3 @@
1
1
  module Ln4sudo
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ln4sudo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - s3fxn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-09 00:00:00.000000000 Z
11
+ date: 2018-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler