very_safe_rm 0.2.8 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/Rakefile +3 -3
- data/bin/console +3 -3
- data/exe/very_safe_rm +14 -3
- data/lib/very_safe_rm/.rubocop.yml +2 -0
- data/lib/very_safe_rm/rm_one.rb +2 -8
- data/lib/very_safe_rm/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d1b3771e78710b5a1471586198014d0d6eb5009
|
4
|
+
data.tar.gz: adc2fc7accabcf74571dd320bd6c34f1e02016db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32fb7d1a66881f161f9cf388c5c8d5d5b1f6faf2ea23c92bc4aef21c53c98855412507af4a00c3f42f17935bd49ad44b5ae4f85c14c534683230d267b0315835
|
7
|
+
data.tar.gz: 22947038c9ad18a895f9fc55a1b74b8eebf324e00d2aaed9928d9efbb8b5cabf48cfd321a3a331d818cf83e67a8adbd8f71153abcd760a3fec13fcfc9ec280af
|
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
3
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in very_safe_rm.gemspec
|
6
6
|
gemspec
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'very_safe_rm'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,5 @@ require "very_safe_rm"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start(__FILE__)
|
data/exe/very_safe_rm
CHANGED
@@ -8,19 +8,30 @@ if args.include? '--version'
|
|
8
8
|
print 'very_safe_rm '
|
9
9
|
puts VerySafeRm::VERSION
|
10
10
|
puts
|
11
|
-
system 'rm --version'
|
11
|
+
system '/bin/rm --version'
|
12
|
+
exit
|
13
|
+
end
|
14
|
+
|
15
|
+
if args.include? '--help'
|
16
|
+
system ['/bin/rm', $PROGRAM_NAME], '--help'
|
12
17
|
exit
|
13
18
|
end
|
14
19
|
|
15
20
|
if file.empty?
|
16
|
-
system 'rm'
|
21
|
+
system ['/bin/rm', $PROGRAM_NAME]
|
17
22
|
exit 1
|
18
23
|
end
|
19
24
|
|
20
25
|
if args.include?('-r') || args.include?('-R') || args.include?('--recursive')
|
21
26
|
STDERR.print 'Did you really want to delete directory? [y/N] '
|
22
27
|
exit unless STDIN.gets.chomp =~ /^y(es)?$/i
|
23
|
-
|
28
|
+
end
|
29
|
+
|
30
|
+
if args.include?('-f') || args.include?('--force')
|
31
|
+
STDERR.print 'Did you really want to delete? [y/N] '
|
32
|
+
exit unless STDIN.gets.chomp =~ /^y(es)?$/i
|
33
|
+
STDERR.print 'Alright, I will wait you for 5 second'
|
34
|
+
sleep 5
|
24
35
|
end
|
25
36
|
|
26
37
|
VerySafeRm.run file, args
|
data/lib/very_safe_rm/rm_one.rb
CHANGED
@@ -1,14 +1,8 @@
|
|
1
1
|
module VerySafeRm
|
2
|
-
# TODO
|
3
2
|
module RM
|
4
3
|
def self.rm(file, args)
|
5
|
-
system %(rm #{args.join ' '} -- "#{file}")
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.do_rm(file, args)
|
9
4
|
return if RM.check_bang file
|
10
|
-
|
11
|
-
RM.rm file, args
|
5
|
+
system %(/bin/rm #{args.join ' '} -- "#{file}")
|
12
6
|
end
|
13
7
|
|
14
8
|
def self.rm_one(file, args)
|
@@ -18,7 +12,7 @@ module VerySafeRm
|
|
18
12
|
elsif Dir.empty? file then RM.rm file, ['-r', '-f', '-v']
|
19
13
|
elsif File.empty? file then RM.rm file, ['-f', '-v']
|
20
14
|
elsif RM.check_force_rm? file then RM.rm file, ['-v', *args]
|
21
|
-
else RM.
|
15
|
+
else RM.rm file, ['-i', '-v', *args]
|
22
16
|
end
|
23
17
|
end
|
24
18
|
|
data/lib/very_safe_rm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: very_safe_rm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 71e6fd52
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- bin/setup
|
73
73
|
- exe/very_safe_rm
|
74
74
|
- lib/very_safe_rm.rb
|
75
|
+
- lib/very_safe_rm/.rubocop.yml
|
75
76
|
- lib/very_safe_rm/args.rb
|
76
77
|
- lib/very_safe_rm/rm_one.rb
|
77
78
|
- lib/very_safe_rm/version.rb
|