ro_thor 4.5.7 → 4.6.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ro_thor.rb +22 -14
- data/lib/ro_thor/array.rb +1 -0
- data/lib/ro_thor/helper.rb +3 -2
- data/lib/ro_thor/http.rb +5 -0
- data/lib/ro_thor/ro_file.rb +7 -1
- data/lib/ro_thor/string.rb +7 -0
- data/spec/lib/ro_thor/ro_file_spec.rb +8 -0
- data/spec/lib/ro_thor_spec.rb +15 -0
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 739ec510fe387cab1f522aa6ce897000ecd62f189b29b1ca947dc94a88664a06
|
4
|
+
data.tar.gz: dde5ecc67ee15a9c6d8f44719149bf53c9880b86920a8d6dec35efb880ed3ca0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31c7c4e83600a3a05864fdc8ade5419b0f79323f82fdeebf1da22f6c5e0eee67099b7d89867837421a11dbbb268060eb20f4ce98a4b6416c2bfe1fee14bc46e5
|
7
|
+
data.tar.gz: 4642ce36d68307d9441dfc9ba4edc317aa86226985d289439b589ee3468dd17a0473ff8c702741c27c61c574ca0d02b502e17c9e6912923d39a3df6bb4015c39
|
data/lib/ro_thor.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
$LOAD_PATH.unshift(Pathname.new(__FILE__).parent.to_s)
|
3
|
+
require 'shellwords'
|
3
4
|
require 'thor'
|
4
5
|
require 'open3'
|
5
6
|
require 'ro_thor/base'
|
6
7
|
require 'ro_thor/sh'
|
7
8
|
require 'ro_thor/ro_file'
|
8
9
|
require 'ro_thor/array'
|
10
|
+
require 'ro_thor/string'
|
9
11
|
require 'ro_thor/helper'
|
10
12
|
require 'ro_thor/ro_err'
|
11
13
|
require 'ro_thor/http'
|
@@ -38,6 +40,14 @@ class RoThor < Thor
|
|
38
40
|
desc(str, "")
|
39
41
|
end
|
40
42
|
|
43
|
+
def st(*args)
|
44
|
+
start(*args)
|
45
|
+
end
|
46
|
+
|
47
|
+
def start(*args)
|
48
|
+
super(args)
|
49
|
+
end
|
50
|
+
|
41
51
|
def create_command(*args, &blk)
|
42
52
|
if @usage.nil?
|
43
53
|
return
|
@@ -45,16 +55,12 @@ class RoThor < Thor
|
|
45
55
|
super
|
46
56
|
end
|
47
57
|
|
48
|
-
def st(*args, &blk)
|
49
|
-
start(args)
|
50
|
-
end
|
51
|
-
|
52
58
|
def lamb(*args, &blk)
|
53
59
|
lambda(*args, &blk)
|
54
60
|
end
|
55
61
|
end
|
56
62
|
|
57
|
-
def open_url(url, user_data_dir=nil, *args, &blk)
|
63
|
+
def open_url(url, user_data_dir = nil, *args, &blk)
|
58
64
|
user_data_dir ||= "#{ENV['HOME']}/.config/google-chrome"
|
59
65
|
sys %Q(google-chrome --user-data-dir=#{user_data_dir.strip} "#{url}")
|
60
66
|
end
|
@@ -63,6 +69,10 @@ class RoThor < Thor
|
|
63
69
|
RoFile.basename(Dir.pwd)
|
64
70
|
end
|
65
71
|
|
72
|
+
def sh_esc(str)
|
73
|
+
Shellwords.escape(str)
|
74
|
+
end
|
75
|
+
|
66
76
|
def cur_pj_name2(*args, &blk)
|
67
77
|
cur_pj_name.gsub(%r{^ro_}, "")
|
68
78
|
end
|
@@ -76,7 +86,6 @@ class RoThor < Thor
|
|
76
86
|
end
|
77
87
|
|
78
88
|
|
79
|
-
|
80
89
|
def down_d(*args, &blk)
|
81
90
|
RoFile.join("/media/roroco/disk750/Downloads", *args, &blk)
|
82
91
|
end
|
@@ -136,17 +145,16 @@ class RoThor < Thor
|
|
136
145
|
|
137
146
|
def toggle_win(win_name)
|
138
147
|
wins = begin
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
148
|
+
shsu("xdotool search --onlyvisible #{win_name}").split("\n")
|
149
|
+
rescue RoThor::Sh::Err => e
|
150
|
+
out(e)
|
151
|
+
out(e.backtrace.join("\n"))
|
152
|
+
sleep(0.5)
|
153
|
+
retry
|
154
|
+
end
|
146
155
|
if wins.size > 0
|
147
156
|
sh "xdotool windowactivate #{wins.first.strip}"
|
148
157
|
end
|
149
158
|
end
|
150
|
-
|
151
159
|
end
|
152
160
|
|
data/lib/ro_thor/array.rb
CHANGED
data/lib/ro_thor/helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative 'base'
|
2
|
+
require_relative 'string'
|
2
3
|
|
3
4
|
class RoThor
|
4
5
|
module Helper
|
@@ -11,8 +12,8 @@ class RoThor
|
|
11
12
|
shsu("xclip -sel clip -o")
|
12
13
|
end
|
13
14
|
|
14
|
-
def to_md5(
|
15
|
-
|
15
|
+
def to_md5(str)
|
16
|
+
str.md5
|
16
17
|
end
|
17
18
|
|
18
19
|
def in_pj(pj_name, *args, &blk)
|
data/lib/ro_thor/http.rb
CHANGED
data/lib/ro_thor/ro_file.rb
CHANGED
@@ -13,6 +13,10 @@ class RoThor
|
|
13
13
|
binwrite(to, binread(from))
|
14
14
|
end
|
15
15
|
|
16
|
+
def ls(path)
|
17
|
+
Dir.glob("#{path}/*")
|
18
|
+
end
|
19
|
+
|
16
20
|
def abs(p, *args, &blk)
|
17
21
|
if p.match(%r{^~})
|
18
22
|
p.gsub(%r{^~}, ENV["HOME"])
|
@@ -42,7 +46,9 @@ class RoThor
|
|
42
46
|
|
43
47
|
def msp(f, *args, &blk)
|
44
48
|
p = parent(f)
|
45
|
-
|
49
|
+
if !test(?d, p)
|
50
|
+
FileUtils.mkpath(p)
|
51
|
+
end
|
46
52
|
end
|
47
53
|
|
48
54
|
def msd(p, *args, &blk)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ro_thor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -110,10 +110,13 @@ files:
|
|
110
110
|
- lib/ro_thor/ro_file.rb
|
111
111
|
- lib/ro_thor/sh.rb
|
112
112
|
- lib/ro_thor/ssh.rb
|
113
|
+
- lib/ro_thor/string.rb
|
113
114
|
- spec/lib/core_ext/array_spec.rb
|
114
115
|
- spec/lib/ro_cmd/thor/dp_spec.rb
|
115
116
|
- spec/lib/ro_thor/ro_err_spec.rb
|
117
|
+
- spec/lib/ro_thor/ro_file_spec.rb
|
116
118
|
- spec/lib/ro_thor/ssh_spec.rb
|
119
|
+
- spec/lib/ro_thor_spec.rb
|
117
120
|
- spec/mysql/my.cnf
|
118
121
|
- spec/rails_helper.rb
|
119
122
|
- spec/spec_helper.rb
|
@@ -140,10 +143,12 @@ signing_key:
|
|
140
143
|
specification_version: 4
|
141
144
|
summary: ''
|
142
145
|
test_files:
|
143
|
-
- spec/
|
146
|
+
- spec/lib/ro_thor_spec.rb
|
144
147
|
- spec/lib/ro_cmd/thor/dp_spec.rb
|
145
|
-
- spec/lib/core_ext/array_spec.rb
|
146
148
|
- spec/lib/ro_thor/ssh_spec.rb
|
149
|
+
- spec/lib/ro_thor/ro_file_spec.rb
|
147
150
|
- spec/lib/ro_thor/ro_err_spec.rb
|
151
|
+
- spec/lib/core_ext/array_spec.rb
|
148
152
|
- spec/rails_helper.rb
|
153
|
+
- spec/spec_helper.rb
|
149
154
|
- spec/mysql/my.cnf
|