byepry 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/byepry.rb +38 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 50dee77ea3e062215e07ce22c6bbc87477a23457
4
+ data.tar.gz: 4f6051e0e41014c5e0c5eb0ca1ec5f27826821c1
5
+ SHA512:
6
+ metadata.gz: 68cfd2ef5d6fa992be4bdd3ee1f6e23447ec1406449fc787f1c5f7816d6b52f934e5a45cf8d5e8150fe1091d33348183fb6d28ac2c0177edec81d5ae591af0b7
7
+ data.tar.gz: 859e18b46809235750b5cb264a779e1b68fb5754956c5af644dca3a690cef8e7e3abb5087c1c2d6c693cab477de7e050d3d3aae6bfbf059c67d56811d0c8d735
data/lib/byepry.rb ADDED
@@ -0,0 +1,38 @@
1
+ require 'find'
2
+ require 'fileutils'
3
+ require 'tempfile'
4
+ require 'colorize'
5
+ # require 'rubygems/command_manager'
6
+
7
+ class Byepry
8
+ def execute
9
+ Find.find(ARGV.first) do |path|
10
+ if path =~ /.*\.rb$/
11
+ file = File.open(path, 'r+')
12
+
13
+ # Open temporary file
14
+ tmp = Tempfile.new("extract")
15
+
16
+ changed_file = false
17
+ line_number = 0
18
+ # Write good lines to temporary file
19
+ open(path, 'r').each do |l|
20
+ line_number += 1
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)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: byepry
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Othmane EL KESRI
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-05-11 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple gem that removes the 'binding.pry' lines
14
+ email: elkesri.othmane@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/byepry.rb
20
+ homepage: http://rubygems.org/gems/byepry
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.6.14
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: ByePry!
44
+ test_files: []