rash-command-shell 0.1.1 → 0.1.3
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/bin/rash +6 -3
- data/lib/rash.rb +8 -2
- data/lib/rash/ext/filesystem.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 925fc43795fdb6dedccf7680890bad76aa0f4e2294bf4db6eef10bfb67e6cdc4
|
4
|
+
data.tar.gz: 4f57d6387ecfdf2261e491edce9c8f38b2bccc3de23eb16096df0d8312acb444
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2f3aae4dbd89d00963b235a28f6901fdfc7f4aa4dbe1ec592656f1c9acddc48dfd874a77395fd1a4d2e81e2c8c08f1c700f76ae76049d265f148f5985cb294d
|
7
|
+
data.tar.gz: 69a3a6d0623f316ba75c8a14a3eefde9f2e81214656b9f86836ade185dc83f300be0b97d5df90f383cd106ee71a000ce20ec02bbe2de63aa2d8ceb97cb06560b
|
data/bin/rash
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
if ARGV.
|
4
|
-
exec("irb", "-r", "rash")
|
5
|
-
|
3
|
+
if ARGV.empty?
|
4
|
+
exec("irb", "-r", "rash", *ARGV)
|
5
|
+
elsif File.exists?(ARGV[0]) && !File.directory?(ARGV[0])
|
6
6
|
require "rash"
|
7
7
|
file = ARGV.shift
|
8
8
|
load file
|
9
|
+
else
|
10
|
+
$stderr.puts "#{File.basename($0)}: #{ARGV[0]}: No such file or directory"
|
11
|
+
exit 1
|
9
12
|
end
|
data/lib/rash.rb
CHANGED
@@ -65,7 +65,12 @@ $env = Environment.new
|
|
65
65
|
# note for later documentation: any aliases of cd must be functions, not
|
66
66
|
# environmental aliases. Limitation of implementation.
|
67
67
|
def cd(dir = nil)
|
68
|
-
|
68
|
+
d = dir
|
69
|
+
case d
|
70
|
+
when File, Dir
|
71
|
+
d = d.path if File.directory?(d.path)
|
72
|
+
end
|
73
|
+
$env.chdir(d)
|
69
74
|
end
|
70
75
|
|
71
76
|
|
@@ -78,6 +83,7 @@ def run(file, *args)
|
|
78
83
|
system(exe, *args.flatten.map{|a| a.to_s}, {out: $stdout, err: $stderr, in: $stdin})
|
79
84
|
end
|
80
85
|
|
86
|
+
alias cmd __send__
|
81
87
|
|
82
88
|
# Defines `bash` psuedo-compatibility. Filesystem effects happen like normal
|
83
89
|
# and environmental variable changes are copied
|
@@ -116,7 +122,7 @@ def self.method_missing(m, *args, &block)
|
|
116
122
|
exe = which(m.to_s)
|
117
123
|
if exe || ($env.alias?(m) && !$env.aliasing_disabled)
|
118
124
|
if $env.superuser_mode
|
119
|
-
system("sudo", *$env.resolve_alias(m), *args.flatten.map{|a| a.to_s}, {out: $stdout, err: $stderr, in: $stdin})
|
125
|
+
system("sudo", *$env.resolve_alias(m), *args.flatten.map{|a| a.to_s}, {out: $stdout, err: $stderr, in: $stdin, exception: true})
|
120
126
|
else
|
121
127
|
system(*$env.resolve_alias(m), *args.flatten.map{|a| a.to_s}, {out: $stdout, err: $stderr, in: $stdin})
|
122
128
|
end
|
data/lib/rash/ext/filesystem.rb
CHANGED
@@ -39,8 +39,8 @@ class Environment
|
|
39
39
|
def traverse_filetree(from, to)
|
40
40
|
abs_from = File.expand_path(from)
|
41
41
|
abs_to = File.expand_path(to)
|
42
|
-
raise SystemCallError(from, Errno::ENOENT::Errno) unless Dir.exists?(abs_from)
|
43
|
-
raise SystemCallError(to, Errno::ENOENT::Errno) unless Dir.exists?(abs_to)
|
42
|
+
raise SystemCallError.new(from, Errno::ENOENT::Errno) unless Dir.exists?(abs_from)
|
43
|
+
raise SystemCallError.new(to, Errno::ENOENT::Errno) unless Dir.exists?(abs_to)
|
44
44
|
|
45
45
|
from_parts = (abs_from == "/" ? [""] : abs_from.split(File::SEPARATOR))
|
46
46
|
to_parts = (abs_to == "/" ? [""] : abs_to.split(File::SEPARATOR))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rash-command-shell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kellen Watt
|
@@ -50,7 +50,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '2.5'
|
54
54
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
56
|
- - ">="
|