Class: RoCommands::Misc
Instance Method Summary
collapse
Methods inherited from Base
describe, inherited, method_added, meths, start, usage
Methods included from Bash
#_bash, #add_time, #bash, #bash_capture, #bash_capture_array, #bash_lines, #bash_per, #bash_system, #bundle_exec, #err, err, #handle_path, #kernel_system, out, #out, #status, status
Instance Method Details
#move_zip_to(target_dir, keyword = ".*", src = '.') ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/ro_commands/misc.rb', line 22
def move_zip_to(target_dir, keyword=".*", src='.')
filter = %r{#{keyword}}
Find.find(src) do |file|
if is_zip?(file) or is_rar?(file) and file.match filter
FileUtils.mv file, target_dir
end
unzip_r(target_dir)
end
end
|
#railscasts_find(keyword) ⇒ Object
15
16
17
18
|
# File 'lib/ro_commands/misc.rb', line 15
def railscasts_find(keyword)
bash "find /media/zxr/New-Volume/TDDOWNLOAD/railscasts/ -iname '*#{keyword}*'"
end
|
#root_find(keyword) ⇒ Object
9
10
11
|
# File 'lib/ro_commands/misc.rb', line 9
def root_find(keyword)
bash "find / -iname '*#{keyword}*'"
end
|
#unzip(from, to = Dir.pwd) ⇒ Object
36
37
38
39
|
# File 'lib/ro_commands/misc.rb', line 36
def unzip(from, to=Dir.pwd)
FileUtils.mkpath to
bash "unzip -n #{from} -d #{to}"
end
|
#unzip_r(dir = ".") ⇒ Object
43
44
45
46
47
48
49
50
|
# File 'lib/ro_commands/misc.rb', line 43
def unzip_r(dir=".")
Dir.chdir dir
Find.find(Dir.pwd) do |file|
if test(?f, file)
try_zip(file)
end
end
end
|