byepry 0.0.0 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/byepry +6 -0
  3. data/lib/byepry.rb +20 -26
  4. metadata +5 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50dee77ea3e062215e07ce22c6bbc87477a23457
4
- data.tar.gz: 4f6051e0e41014c5e0c5eb0ca1ec5f27826821c1
3
+ metadata.gz: 2b5d097323681ad650646d2f2e8e83d73a08fef6
4
+ data.tar.gz: a489b43b3d3708774911709ce0b91f64c01b5563
5
5
  SHA512:
6
- metadata.gz: 68cfd2ef5d6fa992be4bdd3ee1f6e23447ec1406449fc787f1c5f7816d6b52f934e5a45cf8d5e8150fe1091d33348183fb6d28ac2c0177edec81d5ae591af0b7
7
- data.tar.gz: 859e18b46809235750b5cb264a779e1b68fb5754956c5af644dca3a690cef8e7e3abb5087c1c2d6c693cab477de7e050d3d3aae6bfbf059c67d56811d0c8d735
6
+ metadata.gz: 2247f38fb46c606403fc5a6045ccf9fb747d92c2e7305d004950d1f2b33ea9a5d152b7c6d1672025939db328dbba0ef81c0b734ef91041672c58a8b30d5bde3b
7
+ data.tar.gz: 38e4c00d4736593e05f01a249d34a0754d73e8161657251c1cfe8b11920719ade4c6d376c934d109e722632e7769de09321ab1efaa70f19736d3d80e519670f4
data/bin/byepry ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+ require 'tempfile'
5
+ require 'byepry'
6
+ Byepry.go
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 execute
9
- Find.find(ARGV.first) do |path|
10
- if path =~ /.*\.rb$/
11
- file = File.open(path, 'r+')
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
- # 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)
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.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.14
42
+ rubygems_version: 2.6.11
41
43
  signing_key:
42
44
  specification_version: 4
43
45
  summary: ByePry!