checker 0.0.1 → 0.0.2
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 +6 -0
- data/checker.gemspec +2 -2
- data/lib/checker.rb +1 -1
- data/lib/checker/modules/pry.rb +40 -0
- data/lib/checker/modules/ruby.rb +1 -1
- data/lib/checker/utils.rb +4 -12
- metadata +3 -2
data/README
CHANGED
data/checker.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'checker'
|
3
|
-
s.version = '0.0.
|
4
|
-
s.date = '2012-04-
|
3
|
+
s.version = '0.0.2'
|
4
|
+
s.date = '2012-04-20'
|
5
5
|
s.summary = "Syntax checker for various files"
|
6
6
|
s.description = "A collection of modules which every is designed to check syntax for specific files."
|
7
7
|
s.authors = ["Jacek Jakubik"]
|
data/lib/checker.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
module Checker
|
2
|
+
module Modules
|
3
|
+
class Pry
|
4
|
+
def self.check
|
5
|
+
puts ">> PRY <<"
|
6
|
+
|
7
|
+
files = Utils.files_modified
|
8
|
+
|
9
|
+
files.map! do |f|
|
10
|
+
print "Checking #{f} -> "
|
11
|
+
[Pry.check_for_binding_pry(f), Pry.check_for_binding_remote_pry(f)].all_true?
|
12
|
+
end
|
13
|
+
|
14
|
+
files.all_true?
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.check_for_binding_pry(file)
|
18
|
+
result = `grep -n "binding.pry" #{file}`.chomp
|
19
|
+
|
20
|
+
unless result.empty?
|
21
|
+
puts "FAIL #{file} found occurence of 'binding.pry'"
|
22
|
+
puts result
|
23
|
+
end
|
24
|
+
|
25
|
+
result.empty?
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.check_for_binding_remote_pry(file)
|
29
|
+
result = `grep -n "binding.remote_pry" #{file}`.chomp
|
30
|
+
|
31
|
+
unless result.empty?
|
32
|
+
puts "FAIL #{file} -> found occurence of 'binding.remote_pry'"
|
33
|
+
puts result
|
34
|
+
end
|
35
|
+
|
36
|
+
result.empty?
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/checker/modules/ruby.rb
CHANGED
data/lib/checker/utils.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
class Utils
|
2
2
|
def self.files_modified
|
3
|
-
`git status --porcelain | egrep "^(A |M |R ).*" | awk ' { if ($3 == "->") print $4; else print $2 } '`.split
|
3
|
+
@files_modified ||= `git status --porcelain | egrep "^(A |M |R ).*" | awk ' { if ($3 == "->") print $4; else print $2 } '`.split
|
4
|
+
@files_modified.dup
|
4
5
|
end
|
5
6
|
|
6
7
|
def self.use_rvm?
|
@@ -8,17 +9,8 @@ class Utils
|
|
8
9
|
end
|
9
10
|
|
10
11
|
def self.rvm_command(command)
|
11
|
-
|
12
|
-
rvm_version
|
13
|
-
if f.match(/rvm( use|) ([^ ]+)$/)
|
14
|
-
rvm_version = $2
|
15
|
-
end
|
16
|
-
if rvm_version.nil?
|
17
|
-
puts "Cannot determine rvm version"
|
18
|
-
exit 1
|
19
|
-
else
|
20
|
-
puts "Using '#{rvm_version}' version"
|
21
|
-
end
|
12
|
+
rvm_version = `echo $rvm_ruby_string`.chomp
|
13
|
+
puts "Using '#{rvm_version}' version"
|
22
14
|
cmd = "$rvm_path/bin/rvm-shell '#{rvm_version}' -c '#{command}'"
|
23
15
|
Utils.command cmd
|
24
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: checker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
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: 2012-04-
|
12
|
+
date: 2012-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A collection of modules which every is designed to check syntax for specific
|
15
15
|
files.
|
@@ -28,6 +28,7 @@ files:
|
|
28
28
|
- lib/checker/core_ext.rb
|
29
29
|
- lib/checker/modules/all.rb
|
30
30
|
- lib/checker/modules/haml.rb
|
31
|
+
- lib/checker/modules/pry.rb
|
31
32
|
- lib/checker/modules/ruby.rb
|
32
33
|
- lib/checker/utils.rb
|
33
34
|
homepage: http://github.com/netguru/checker
|