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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e836b7c699760ca19208699ef38c2e038cf252cf
4
- data.tar.gz: 6ddcab54fb6b54b934f12dfcfd84e43854b154e5
3
+ metadata.gz: 6d1b3771e78710b5a1471586198014d0d6eb5009
4
+ data.tar.gz: adc2fc7accabcf74571dd320bd6c34f1e02016db
5
5
  SHA512:
6
- metadata.gz: 7ff23445bda8df8858892f655e5de3d38f6b7bcc115f37cec207fe243608e5e649fccc1e4399891aacb761875d53138464db5039afc23307889c9d4469a4a6af
7
- data.tar.gz: d145c7af47a56a6c5515b41a09a4aaf2a4c90a707e05e18f61aebfff7110e8b5492b5c23374d5ad761fb47cb1ba2a67f758d1ffb86684fdbcc569c7ebd35af43
6
+ metadata.gz: 32fb7d1a66881f161f9cf388c5c8d5d5b1f6faf2ea23c92bc4aef21c53c98855412507af4a00c3f42f17935bd49ad44b5ae4f85c14c534683230d267b0315835
7
+ data.tar.gz: 22947038c9ad18a895f9fc55a1b74b8eebf324e00d2aaed9928d9efbb8b5cabf48cfd321a3a331d818cf83e67a8adbd8f71153abcd760a3fec13fcfc9ec280af
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- source "https://rubygems.org"
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
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "very_safe_rm"
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 "irb"
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
- args << '-f'
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
@@ -0,0 +1,2 @@
1
+ Documentation:
2
+ Enabled: false
@@ -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
- sleep 3 if args.include?('-f') || args.include?('--force')
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.do_rm file, ['-i', '-v', *args]
15
+ else RM.rm file, ['-i', '-v', *args]
22
16
  end
23
17
  end
24
18
 
@@ -1,3 +1,3 @@
1
1
  module VerySafeRm
2
- VERSION = "0.2.8"
2
+ VERSION = '0.3.0'.freeze
3
3
  end
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.2.8
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-10-15 00:00:00.000000000 Z
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