bath 0.2.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.
- data/bin/bath +63 -0
- metadata +46 -0
data/bin/bath
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
if ARGV[1].to_s.empty?
|
4
|
+
puts "try: bath link <file>"
|
5
|
+
exit 0
|
6
|
+
end
|
7
|
+
|
8
|
+
bin = "/usr/local/bin/"
|
9
|
+
|
10
|
+
case ARGV.first when 'link', 'add'
|
11
|
+
file = ARGV[1]
|
12
|
+
|
13
|
+
if !File.exist?(file)
|
14
|
+
puts "Unfortunately, #{file} was not found."
|
15
|
+
exit 0
|
16
|
+
end
|
17
|
+
|
18
|
+
if !File.directory?(bin)
|
19
|
+
puts "#{bin} does not exist!"
|
20
|
+
puts "creating #{bin}..."
|
21
|
+
system "mkdir -p #{bin}"
|
22
|
+
end
|
23
|
+
|
24
|
+
if File.extname(file).empty?
|
25
|
+
if File.symlink?(bin + file)
|
26
|
+
puts "Unfortunately, #{bin + file} already exists."
|
27
|
+
exit 0
|
28
|
+
end
|
29
|
+
|
30
|
+
name = bin + file
|
31
|
+
|
32
|
+
puts "Symlinking #{file} to #{name}..."
|
33
|
+
File.symlink(File.expand_path(file), name)
|
34
|
+
system "chmod +x #{name}"
|
35
|
+
else
|
36
|
+
name = file.split(File.extname(file))
|
37
|
+
name = bin + name.first
|
38
|
+
|
39
|
+
if File.symlink?(name)
|
40
|
+
puts "Unfortunately, #{name} already exists."
|
41
|
+
exit 0
|
42
|
+
end
|
43
|
+
|
44
|
+
puts "Symlinking #{file} to #{name}..."
|
45
|
+
File.symlink(File.expand_path(file), name)
|
46
|
+
system "chmod +x #{name}"
|
47
|
+
end
|
48
|
+
|
49
|
+
warn "/usr/local/bin is not in your PATH." unless ENV['PATH'].split(':').include? '/usr/local/bin'
|
50
|
+
when 'ulink', 'unlink', 'rm', 'remove'
|
51
|
+
file = ARGV[1]
|
52
|
+
|
53
|
+
if !File.exist?(bin + file)
|
54
|
+
puts "Unfortunately, #{bin + file} was not found."
|
55
|
+
exit 0
|
56
|
+
end
|
57
|
+
|
58
|
+
puts "Removing #{file} from #{bin}"
|
59
|
+
system "rm #{bin + file}"
|
60
|
+
|
61
|
+
else
|
62
|
+
puts "try: bath link <file>"
|
63
|
+
end
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bath
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- dejay
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-29 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: A command-line utility to help you symlink to your path with ease
|
15
|
+
email:
|
16
|
+
executables:
|
17
|
+
- bath
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- bin/bath
|
22
|
+
homepage: https://github.com/dejay/bath
|
23
|
+
licenses: []
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
none: false
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 1.8.24
|
43
|
+
signing_key:
|
44
|
+
specification_version: 3
|
45
|
+
summary: Symlink to your path with ease
|
46
|
+
test_files: []
|