byebyebug 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/byebyebug +11 -0
  3. data/lib/byebyebug.rb +45 -0
  4. metadata +74 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 63e6a653639f45ea9b68b2e1f2b9c96b2b45d3ef
4
+ data.tar.gz: 95dd7d2f70aa8d8b37849a0525c0c44a47a3ad94
5
+ SHA512:
6
+ metadata.gz: 41ed05c9cdc6c98912a5002a8c2d48892da085937e43e2da627d4706c69f849f35d397261484278ff3a64eda2d615348932b3914f6349df8351001241e9ccc8b
7
+ data.tar.gz: a164b3a2278342129e978daa8c3ae58b72a71a793103645093c70587c3721826c84374f98370963872cc883370842148585bbc56d10bf68f0bc637365a3c9ed7
data/bin/byebyebug ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/byebyebug'
4
+
5
+ glob = ARGV[1] || './**/*.rb'
6
+
7
+ checker = ByeByeBug::Checker.new
8
+ checker.check
9
+ checker.report
10
+
11
+ exit(1) if checker.error
data/lib/byebyebug.rb ADDED
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env ruby
2
+ # Search for byebug|debug|binding.pry on files
3
+
4
+ require 'byebug'
5
+
6
+ module ByeByeBug
7
+ class Checker
8
+ COMMENT_REGEX = /^#.*/
9
+ BYEBUG_REGEX = /.*(byebug|binding.pry|debug)\s+.*/
10
+
11
+ attr_reader :glob, :bad_files
12
+
13
+ def initialize(glob = "./**/*.rb")
14
+ @glob = glob
15
+ @bad_files = {} # 'path' => [list of numbers in file]
16
+ end
17
+
18
+ def check
19
+ Dir[glob].each do |path|
20
+ File.open(path, 'r').each_line.with_index do |line, line_number|
21
+ next if line =~ COMMENT_REGEX # ignore if its a comment
22
+
23
+ # match
24
+ if line =~ BYEBUG_REGEX
25
+ @bad_files[path] ||= []
26
+ @bad_files[path] << line_number + 1 # starts at 0
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ def report
33
+ puts 'Everthing is fine' && return unless error
34
+
35
+ puts 'Bad files:'
36
+ bad_files.each do |path, line_numbers|
37
+ puts "#{path} on number(s): #{line_numbers.join(',')}"
38
+ end
39
+ end
40
+
41
+ def error
42
+ @bad_files.count > 0
43
+ end
44
+ end
45
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: byebyebug
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Oscar Moreno Garza
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-02-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: byebug
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description:
42
+ email: oscarmg99@gmail.com
43
+ executables:
44
+ - byebyebug
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - bin/byebyebug
49
+ - lib/byebyebug.rb
50
+ homepage: https://gitlab.com/ozkar99/byebyebug
51
+ licenses:
52
+ - BSD-2-Clause
53
+ metadata: {}
54
+ post_install_message:
55
+ rdoc_options: []
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '2.3'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubyforge_project:
70
+ rubygems_version: 2.5.2
71
+ signing_key:
72
+ specification_version: 4
73
+ summary: A gem/script that displays files with stranded byebug|debug|binding.pry directives
74
+ test_files: []