byepry 0.0.0 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/byepry +6 -0
- data/lib/byepry.rb +20 -26
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b5d097323681ad650646d2f2e8e83d73a08fef6
|
4
|
+
data.tar.gz: a489b43b3d3708774911709ce0b91f64c01b5563
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2247f38fb46c606403fc5a6045ccf9fb747d92c2e7305d004950d1f2b33ea9a5d152b7c6d1672025939db328dbba0ef81c0b734ef91041672c58a8b30d5bde3b
|
7
|
+
data.tar.gz: 38e4c00d4736593e05f01a249d34a0754d73e8161657251c1cfe8b11920719ade4c6d376c934d109e722632e7769de09321ab1efaa70f19736d3d80e519670f4
|
data/bin/byepry
ADDED
data/lib/byepry.rb
CHANGED
@@ -2,37 +2,31 @@ require 'find'
|
|
2
2
|
require 'fileutils'
|
3
3
|
require 'tempfile'
|
4
4
|
require 'colorize'
|
5
|
-
# require 'rubygems/command_manager'
|
6
5
|
|
7
6
|
class Byepry
|
8
|
-
def
|
9
|
-
Find.find(
|
10
|
-
|
11
|
-
|
7
|
+
def self.go
|
8
|
+
Find.find('.') do |path|
|
9
|
+
next unless path =~ /.*\.rb$/
|
10
|
+
file = File.open(path, 'r+')
|
11
|
+
# Open a temporary file
|
12
|
+
tmp = Tempfile.new('extract')
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
line_number
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
if l.include? 'binding.pry'
|
22
|
-
changed_file = true
|
23
|
-
puts "Removed pry from File: #{path} Line: #{line_number}".green
|
24
|
-
end
|
25
|
-
tmp << l unless l.include? 'binding.pry'
|
26
|
-
end
|
27
|
-
|
28
|
-
# Close tmp, or troubles ahead
|
29
|
-
tmp.close
|
30
|
-
|
31
|
-
# Move temp file to origin
|
32
|
-
if changed_file
|
33
|
-
FileUtils.mv(tmp.path, path)
|
14
|
+
changed_file = false
|
15
|
+
line_number = 0
|
16
|
+
# Write good lines to temporary file
|
17
|
+
open(path, 'r').each do |l|
|
18
|
+
line_number += 1
|
19
|
+
if l.include? 'binding.pry'
|
20
|
+
changed_file = true
|
21
|
+
puts "Removed pry from File: #{path} Line: #{line_number}".green
|
34
22
|
end
|
23
|
+
tmp << l unless l.include? 'binding.pry'
|
35
24
|
end
|
25
|
+
|
26
|
+
# Close tmp
|
27
|
+
tmp.close
|
28
|
+
# Move temp file to origin if file changed
|
29
|
+
FileUtils.mv(tmp.path, path) if changed_file
|
36
30
|
end
|
37
31
|
end
|
38
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: byepry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Othmane EL KESRI
|
@@ -12,10 +12,12 @@ date: 2018-05-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
13
13
|
description: A simple gem that removes the 'binding.pry' lines
|
14
14
|
email: elkesri.othmane@gmail.com
|
15
|
-
executables:
|
15
|
+
executables:
|
16
|
+
- byepry
|
16
17
|
extensions: []
|
17
18
|
extra_rdoc_files: []
|
18
19
|
files:
|
20
|
+
- bin/byepry
|
19
21
|
- lib/byepry.rb
|
20
22
|
homepage: http://rubygems.org/gems/byepry
|
21
23
|
licenses:
|
@@ -37,7 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
37
39
|
version: '0'
|
38
40
|
requirements: []
|
39
41
|
rubyforge_project:
|
40
|
-
rubygems_version: 2.6.
|
42
|
+
rubygems_version: 2.6.11
|
41
43
|
signing_key:
|
42
44
|
specification_version: 4
|
43
45
|
summary: ByePry!
|