rush2 0.9.0 → 0.10.0
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/Gemfile.lock +47 -40
- data/Rakefile +1 -2
- data/VERSION +1 -1
- data/lib/rush/array_ext.rb +1 -4
- data/lib/rush/commands.rb +2 -1
- data/lib/rush/entry.rb +11 -0
- data/lib/rush/file.rb +6 -0
- data/lib/rush/local.rb +23 -0
- data/lib/rush/shell.rb +2 -4
- data/spec/entry_spec.rb +29 -0
- data/spec/file_spec.rb +12 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c106f0808d50d33412e8d98bea9b0d7b30b07ef3
|
4
|
+
data.tar.gz: b0d4c9a54c1fec4704d0c1ff5d52955f7cd17fd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee1353477b176cf8a8ca79df7c8e849bb4621705b45d7981384633d48a414bfa53e135e90f1eef029cc2c415e7708f322870d6295fd74bd013f7f4a5e76f82a2
|
7
|
+
data.tar.gz: 83faa49ab8d8caa9c13c07d85675f5ee43883426e69e382099e845660cfe1f64243c8cf6f0e9a6a7eba652cf1081f5bc4c3753494ea34347c02eb0bb5a626c72
|
data/Gemfile.lock
CHANGED
@@ -1,74 +1,78 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
addressable (2.
|
5
|
-
builder (3.2.
|
6
|
-
coderay (1.1.
|
4
|
+
addressable (2.4.0)
|
5
|
+
builder (3.2.3)
|
6
|
+
coderay (1.1.1)
|
7
7
|
coolline (0.5.0)
|
8
8
|
unicode_utils (~> 1.4)
|
9
9
|
descendants_tracker (0.0.4)
|
10
10
|
thread_safe (~> 0.3, >= 0.3.1)
|
11
|
-
diff-lcs (1.
|
11
|
+
diff-lcs (1.3)
|
12
12
|
faraday (0.9.2)
|
13
13
|
multipart-post (>= 1.2, < 3)
|
14
|
-
git (1.
|
15
|
-
github_api (0.
|
16
|
-
addressable (~> 2.
|
14
|
+
git (1.3.0)
|
15
|
+
github_api (0.16.0)
|
16
|
+
addressable (~> 2.4.0)
|
17
17
|
descendants_tracker (~> 0.0.4)
|
18
18
|
faraday (~> 0.8, < 0.10)
|
19
19
|
hashie (>= 3.4)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
hashie (3.4.2)
|
20
|
+
mime-types (>= 1.16, < 3.0)
|
21
|
+
oauth2 (~> 1.0)
|
22
|
+
hashie (3.5.5)
|
24
23
|
highline (1.7.8)
|
25
|
-
jeweler (2.
|
24
|
+
jeweler (2.3.7)
|
26
25
|
builder
|
27
|
-
bundler (>= 1
|
26
|
+
bundler (>= 1)
|
28
27
|
git (>= 1.2.5)
|
29
|
-
github_api
|
28
|
+
github_api (~> 0.16.0)
|
30
29
|
highline (>= 1.6.15)
|
31
30
|
nokogiri (>= 1.5.10)
|
31
|
+
psych (~> 2.2)
|
32
32
|
rake
|
33
33
|
rdoc
|
34
|
-
|
34
|
+
semver2
|
35
|
+
jwt (1.5.6)
|
35
36
|
method_source (0.8.2)
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
mime-types (2.99.3)
|
38
|
+
mini_portile2 (2.2.0)
|
39
|
+
multi_json (1.12.1)
|
40
|
+
multi_xml (0.6.0)
|
39
41
|
multipart-post (2.0.0)
|
40
|
-
net-ssh (
|
41
|
-
nokogiri (1.
|
42
|
-
|
43
|
-
oauth2 (1.
|
44
|
-
faraday (>= 0.8, < 0.
|
42
|
+
net-ssh (4.1.0)
|
43
|
+
nokogiri (1.8.0)
|
44
|
+
mini_portile2 (~> 2.2.0)
|
45
|
+
oauth2 (1.4.0)
|
46
|
+
faraday (>= 0.8, < 0.13)
|
45
47
|
jwt (~> 1.0)
|
46
48
|
multi_json (~> 1.3)
|
47
49
|
multi_xml (~> 0.5)
|
48
|
-
rack (
|
49
|
-
pry (0.10.
|
50
|
+
rack (>= 1.2, < 3)
|
51
|
+
pry (0.10.4)
|
50
52
|
coderay (~> 1.1.0)
|
51
53
|
method_source (~> 0.8.1)
|
52
54
|
slop (~> 3.4)
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
rspec-
|
59
|
-
rspec-
|
60
|
-
|
61
|
-
|
62
|
-
|
55
|
+
psych (2.2.4)
|
56
|
+
rack (2.0.3)
|
57
|
+
rake (12.0.0)
|
58
|
+
rdoc (5.1.0)
|
59
|
+
rspec (3.6.0)
|
60
|
+
rspec-core (~> 3.6.0)
|
61
|
+
rspec-expectations (~> 3.6.0)
|
62
|
+
rspec-mocks (~> 3.6.0)
|
63
|
+
rspec-core (3.6.0)
|
64
|
+
rspec-support (~> 3.6.0)
|
65
|
+
rspec-expectations (3.6.0)
|
63
66
|
diff-lcs (>= 1.2.0, < 2.0)
|
64
|
-
rspec-support (~> 3.
|
65
|
-
rspec-mocks (3.
|
67
|
+
rspec-support (~> 3.6.0)
|
68
|
+
rspec-mocks (3.6.0)
|
66
69
|
diff-lcs (>= 1.2.0, < 2.0)
|
67
|
-
rspec-support (~> 3.
|
68
|
-
rspec-support (3.
|
70
|
+
rspec-support (~> 3.6.0)
|
71
|
+
rspec-support (3.6.0)
|
72
|
+
semver2 (3.4.2)
|
69
73
|
session (3.2.0)
|
70
74
|
slop (3.6.0)
|
71
|
-
thread_safe (0.3.
|
75
|
+
thread_safe (0.3.6)
|
72
76
|
unicode_utils (1.4.0)
|
73
77
|
|
74
78
|
PLATFORMS
|
@@ -83,3 +87,6 @@ DEPENDENCIES
|
|
83
87
|
rake
|
84
88
|
rspec
|
85
89
|
session
|
90
|
+
|
91
|
+
BUNDLED WITH
|
92
|
+
1.14.5
|
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ Jeweler::Tasks.new do |s|
|
|
5
5
|
s.name = "rush2"
|
6
6
|
s.summary = "A Ruby replacement for bash+ssh."
|
7
7
|
s.description = "A Ruby replacement for bash+ssh, providing both an interactive shell and a library. Manage both local and remote unix systems from a single client."
|
8
|
-
s.author = "
|
8
|
+
s.author = "Sergei Smagin"
|
9
9
|
s.email = "smaginsergey1310@gmail.com"
|
10
10
|
s.homepage = "https://github.com/s-mage/rush"
|
11
11
|
s.licenses = ['MIT']
|
@@ -54,4 +54,3 @@ Rake::RDocTask.new do |t|
|
|
54
54
|
t.rdoc_files.include('lib/rush.rb')
|
55
55
|
t.rdoc_files.include('lib/rush/*.rb')
|
56
56
|
end
|
57
|
-
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.10.0
|
data/lib/rush/array_ext.rb
CHANGED
data/lib/rush/commands.rb
CHANGED
@@ -51,7 +51,8 @@ module Rush::Commands
|
|
51
51
|
# Usage:
|
52
52
|
# home.locate('mai_failz').open
|
53
53
|
def open(*args)
|
54
|
-
|
54
|
+
cmd = RUBY_PLATFORM.match(/darwin/) ? 'open' : 'xdg-open'
|
55
|
+
open_with(cmd, *args)
|
55
56
|
end
|
56
57
|
|
57
58
|
# Open file with any application you like.
|
data/lib/rush/entry.rb
CHANGED
@@ -132,6 +132,17 @@ class Rush::Entry
|
|
132
132
|
mimic(moved)
|
133
133
|
end
|
134
134
|
|
135
|
+
# Symlink the file (see File.ln for options)
|
136
|
+
def symlink(dst, options = {})
|
137
|
+
connection.ln_s(full_path, dst, options)
|
138
|
+
self.class.new(dst, box)
|
139
|
+
end
|
140
|
+
|
141
|
+
# Return true if the entry is a symlink.
|
142
|
+
def symlink?
|
143
|
+
connection.symlink? full_path
|
144
|
+
end
|
145
|
+
|
135
146
|
def mimic(from) # :nodoc:
|
136
147
|
@box = from.box
|
137
148
|
@path = from.path
|
data/lib/rush/file.rb
CHANGED
@@ -16,6 +16,12 @@ class Rush::File < Rush::Entry
|
|
16
16
|
end
|
17
17
|
alias_method :touch, :create
|
18
18
|
|
19
|
+
# Hardlink the file (see File.ln for options)
|
20
|
+
def link(dst, options = {})
|
21
|
+
connection.ln(full_path, dst, options)
|
22
|
+
self.class.new(dst, box)
|
23
|
+
end
|
24
|
+
|
19
25
|
# Size in bytes on disk.
|
20
26
|
def size
|
21
27
|
stat[:size]
|
data/lib/rush/local.rb
CHANGED
@@ -76,6 +76,27 @@ class Rush::Connection::Local
|
|
76
76
|
true
|
77
77
|
end
|
78
78
|
|
79
|
+
# Create a hard link to another file
|
80
|
+
def ln(src, dst, options = {})
|
81
|
+
raise(Rush::DoesNotExist, src) unless File.exists?(src)
|
82
|
+
raise(Rush::DoesNotExist, File.dirname(dst)) unless File.exists?(File.dirname(dst))
|
83
|
+
FileUtils.ln(src, dst, options)
|
84
|
+
true
|
85
|
+
end
|
86
|
+
|
87
|
+
# Create a symbolic link to another file
|
88
|
+
def ln_s(src, dst, options = {})
|
89
|
+
raise(Rush::DoesNotExist, src) unless File.exists?(src)
|
90
|
+
raise(Rush::DoesNotExist, File.dirname(dst)) unless File.exists?(File.dirname(dst))
|
91
|
+
FileUtils.ln_s(src, dst, options)
|
92
|
+
true
|
93
|
+
end
|
94
|
+
|
95
|
+
# Is this path a symlink?
|
96
|
+
def symlink?(path)
|
97
|
+
File.symlink? path
|
98
|
+
end
|
99
|
+
|
79
100
|
# Create an in-memory archive (tgz) of a file or dir, which can be
|
80
101
|
# transmitted to another server for a copy or move. Note that archive
|
81
102
|
# operations have the dir name implicit in the archive.
|
@@ -354,6 +375,8 @@ class Rush::Connection::Local
|
|
354
375
|
when 'create_dir' then create_dir(params[:full_path])
|
355
376
|
when 'rename' then rename(params[:path], params[:name], params[:new_name])
|
356
377
|
when 'copy' then copy(params[:src], params[:dst])
|
378
|
+
when 'ln' then ln(params[:src], params[:dst], params[:options])
|
379
|
+
when 'ln_s' then ln_s(params[:src], params[:dst], params[:options])
|
357
380
|
when 'read_archive' then read_archive(params[:full_path])
|
358
381
|
when 'write_archive' then write_archive(params[:payload], params[:dir])
|
359
382
|
when 'index' then index(params[:base_path], params[:glob]).join("\n") + "\n"
|
data/lib/rush/shell.rb
CHANGED
@@ -24,7 +24,7 @@ module Rush
|
|
24
24
|
$last_res = nil
|
25
25
|
load_custom_commands
|
26
26
|
set_readline
|
27
|
-
@multiline_cmd
|
27
|
+
@multiline_cmd = '' # Multiline commands should be stored somewhere
|
28
28
|
$last_backtrace = '' # Backtrace should too.
|
29
29
|
end
|
30
30
|
|
@@ -41,9 +41,7 @@ module Rush
|
|
41
41
|
def load_custom_commands
|
42
42
|
eval config.load_env, @pure_binding
|
43
43
|
commands = config.load_commands
|
44
|
-
Rush::Dir.class_eval commands
|
45
|
-
Rush::File.class_eval commands
|
46
|
-
Array.class_eval commands
|
44
|
+
[Rush::Dir, Rush::File, Array].each { |x| x.class_eval commands }
|
47
45
|
end
|
48
46
|
|
49
47
|
# Run the interactive shell using coolline.
|
data/spec/entry_spec.rb
CHANGED
@@ -99,6 +99,35 @@ describe Rush::Entry do
|
|
99
99
|
expect(@copied_dir.full_path).to eq "#{@sandbox_dir}newdir/#{@entry.name}"
|
100
100
|
end
|
101
101
|
|
102
|
+
it 'can symlink itself as file' do
|
103
|
+
newdir = "#{@sandbox_dir}newdir"
|
104
|
+
system "mkdir -p #{newdir}"
|
105
|
+
|
106
|
+
dst = newdir + "/link"
|
107
|
+
link = @entry.symlink(dst)
|
108
|
+
|
109
|
+
expect(File.exist?(dst)).to eq true
|
110
|
+
expect(File.symlink?(dst)).to eq true
|
111
|
+
expect(link.symlink?).to eq true
|
112
|
+
|
113
|
+
expect(link.full_path).to eq dst
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'can symlink itself as directory' do
|
117
|
+
newdir = "#{@sandbox_dir}newdir"
|
118
|
+
system "mkdir -p #{newdir}"
|
119
|
+
dir = Rush::Dir.new( newdir + "/direct/")
|
120
|
+
dir.create
|
121
|
+
|
122
|
+
dst = newdir + "/linked"
|
123
|
+
link = dir.symlink(dst)
|
124
|
+
|
125
|
+
expect(Dir.exist?(dst)).to eq true
|
126
|
+
expect(File.symlink?(dst)).to eq true
|
127
|
+
|
128
|
+
expect(link.full_path).to eq dst + '/'
|
129
|
+
end
|
130
|
+
|
102
131
|
it 'considers dotfiles to be hidden' do
|
103
132
|
expect(Rush::Entry.new("#{@sandbox_dir}/show")).to_not be_hidden
|
104
133
|
expect(Rush::Entry.new("#{@sandbox_dir}/.dont_show")).to be_hidden
|
data/spec/file_spec.rb
CHANGED
@@ -31,6 +31,18 @@ describe Rush::File do
|
|
31
31
|
expect(File.exist?("#{@sandbox_dir}/create_me")).to eq true
|
32
32
|
end
|
33
33
|
|
34
|
+
it 'can hardlink itself' do
|
35
|
+
newdir = "#{@sandbox_dir}newdir"
|
36
|
+
system "mkdir -p #{newdir}"
|
37
|
+
|
38
|
+
dst = newdir + "/link"
|
39
|
+
link = @file.link(dst)
|
40
|
+
|
41
|
+
expect(File.exist?(dst)).to eq true
|
42
|
+
|
43
|
+
expect(link.full_path).to eq dst
|
44
|
+
end
|
45
|
+
|
34
46
|
it 'knows its size in bytes' do
|
35
47
|
expect(@file.size).to eq @contents.length
|
36
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rush2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Sergei Smagin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: session
|
@@ -202,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
202
|
version: '0'
|
203
203
|
requirements: []
|
204
204
|
rubyforge_project:
|
205
|
-
rubygems_version: 2.5.
|
205
|
+
rubygems_version: 2.5.1
|
206
206
|
signing_key:
|
207
207
|
specification_version: 4
|
208
208
|
summary: A Ruby replacement for bash+ssh.
|