tol 0.0.3 → 0.0.4

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.
data/README.md CHANGED
@@ -22,6 +22,7 @@ Or install it yourself as:
22
22
  Take Off Labs :: A collection of useful tools for Rails development
23
23
 
24
24
  tol db # Copies the latest version of the database from Heroku to the local development system.
25
+ tol codecheck # Checks the code for left over binding.pry or console.log.
25
26
  tol help # Displays this help message.
26
27
  ```
27
28
 
@@ -1,4 +1,5 @@
1
1
  require 'tol/database'
2
+ require 'tol/codecheck'
2
3
 
3
4
  module Tol
4
5
  class CLI
@@ -11,6 +12,8 @@ class CLI
11
12
  case ARGV.first
12
13
  when "db"
13
14
  Tol::Database.new.run
15
+ when "codecheck"
16
+ Tol::Codecheck.new.run
14
17
  else
15
18
  help
16
19
  end
@@ -22,6 +25,7 @@ class CLI
22
25
  "#{"A collection of useful tools for Rails development".underline}\n\n"
23
26
 
24
27
  database_help
28
+ codecheck_help
25
29
  help_help
26
30
  end
27
31
 
@@ -29,6 +33,10 @@ class CLI
29
33
  puts " #{"tol db".foreground(:red)} \# Copies the latest version of the database from Heroku to the local development system."
30
34
  end
31
35
 
36
+ def codecheck_help
37
+ puts " #{"tol codecheck".foreground(:red)} \# Checks the code for left over binding.pry or console.log."
38
+ end
39
+
32
40
  def help_help
33
41
  puts " #{"tol help".foreground(:red)} \# Displays this help message."
34
42
  end
@@ -0,0 +1,47 @@
1
+ require 'tol/heroku'
2
+ require 'tol/rails_app'
3
+
4
+ module Tol
5
+ class Codecheck
6
+ require 'rainbow'
7
+ require 'highline/import'
8
+
9
+ attr_accessor :terminal_columns
10
+
11
+ def run
12
+ size = HighLine::SystemExtensions.terminal_size
13
+ self.terminal_columns = size[0]
14
+
15
+ check_for_binding_pry
16
+ check_for_console_log
17
+ end
18
+
19
+ def check_for_binding_pry
20
+ puts "Checking for binding.pry".foreground(:yellow)
21
+ result = `find . -name "*.rb" -exec grep -H "binding.pry" {} \\\;`
22
+ if result.length > 0
23
+ puts "The following binding.pry's have been found".foreground(:red)
24
+ result.split("\n").each do |res|
25
+ puts res[0..self.terminal_columns - 2]
26
+ end
27
+ puts "Please fix".foreground(:red)
28
+ else
29
+ puts "No binding.pry's found".foreground(:green)
30
+ end
31
+ end
32
+
33
+ def check_for_console_log
34
+ puts "Checking for console.log".foreground(:yellow)
35
+ result = `find . -name "*.js*" -exec grep -H "console.log" {} \\\;`
36
+ if result.length > 0
37
+ puts "The following console.log's have been found".foreground(:red)
38
+ result.split("\n").each do |res|
39
+ puts res[0..self.terminal_columns - 2]
40
+ end
41
+ puts "Please fix!".foreground(:red)
42
+ else
43
+ puts "No console.log's found".foreground(:green)
44
+ end
45
+ end
46
+ end
47
+ end
@@ -1,3 +1,3 @@
1
1
  module Tol
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tol
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-29 00:00:00.000000000 Z
12
+ date: 2013-06-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pry
@@ -76,6 +76,7 @@ files:
76
76
  - dev-notes
77
77
  - lib/tol.rb
78
78
  - lib/tol/cli.rb
79
+ - lib/tol/codecheck.rb
79
80
  - lib/tol/database.rb
80
81
  - lib/tol/heroku.rb
81
82
  - lib/tol/rails_app.rb