checker 0.0.4 → 0.0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/checker.gemspec +1 -1
- data/lib/checker.rb +1 -1
- data/lib/checker/cli.rb +49 -4
- data/lib/checker/core_ext.rb +0 -2
- data/lib/checker/modules/base.rb +124 -0
- data/lib/checker/modules/coffeescript.rb +7 -26
- data/lib/checker/modules/haml.rb +5 -17
- data/lib/checker/modules/pry.rb +9 -15
- data/lib/checker/modules/ruby.rb +5 -17
- data/lib/checker/modules/sass.rb +7 -28
- metadata +52 -36
- data/lib/checker/cli/execute.rb +0 -42
- data/lib/checker/modules/all.rb +0 -16
- data/lib/checker/utils.rb +0 -83
data/checker.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'checker'
|
3
|
-
s.version = '0.0.4'
|
3
|
+
s.version = '0.0.4.1'
|
4
4
|
s.date = '2012-07-09'
|
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."
|
data/lib/checker.rb
CHANGED
data/lib/checker/cli.rb
CHANGED
@@ -1,11 +1,56 @@
|
|
1
1
|
require 'checker'
|
2
|
-
require 'checker/cli/execute'
|
3
2
|
|
4
3
|
module Checker
|
5
|
-
module Modules; end
|
6
|
-
|
7
4
|
class CLI
|
5
|
+
class << self
|
6
|
+
def execute
|
7
|
+
if ARGV.size == 0
|
8
|
+
modules = get_modules_to_check
|
9
|
+
else
|
10
|
+
modules = ARGV.map(&:downcase)
|
11
|
+
end
|
12
|
+
|
13
|
+
if modules.empty? || modules.include?('all')
|
14
|
+
modules = available_modules
|
15
|
+
end
|
16
|
+
|
17
|
+
check_module_availability(modules) do |result|
|
18
|
+
puts "Modules not available: #{result.join(", ")}.\n"
|
19
|
+
puts "Available: all, #{available_modules.join(", ")}\n"
|
20
|
+
puts "Check your git config checker.check\n"
|
21
|
+
exit 1
|
22
|
+
end
|
23
|
+
|
24
|
+
checked = []
|
25
|
+
files = modified_files
|
26
|
+
modules.each do |mod|
|
27
|
+
klass = "Checker::Modules::#{mod.downcase.capitalize}".constantize
|
28
|
+
checked << klass.new(files.dup).check
|
29
|
+
end
|
30
|
+
exit (checked.all_true? ? 0 : 1)
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
def available_modules
|
35
|
+
Checker::Modules.constants.map(&:to_s).map(&:downcase) - ['base']
|
36
|
+
end
|
37
|
+
|
38
|
+
def check_module_availability(modules)
|
39
|
+
result = modules - available_modules
|
40
|
+
unless result.empty?
|
41
|
+
if block_given?
|
42
|
+
yield(result)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def get_modules_to_check
|
48
|
+
`git config checker.check`.chomp.split(",").map(&:strip)
|
49
|
+
end
|
8
50
|
|
9
|
-
|
51
|
+
def modified_files
|
52
|
+
@modified_files ||= `git status --porcelain | egrep "^(A |M |R ).*" | awk ' { if ($3 == "->") print $4; else print $2 } '`.split
|
53
|
+
end
|
54
|
+
end
|
10
55
|
end
|
11
56
|
end
|
data/lib/checker/core_ext.rb
CHANGED
@@ -0,0 +1,124 @@
|
|
1
|
+
module Checker
|
2
|
+
module Modules
|
3
|
+
class Base < Struct.new(:files)
|
4
|
+
def check
|
5
|
+
print_module_header
|
6
|
+
prepare_check
|
7
|
+
check_executable or return true
|
8
|
+
select_proper_files
|
9
|
+
check_all_files
|
10
|
+
valid?
|
11
|
+
end
|
12
|
+
|
13
|
+
def valid?
|
14
|
+
@results.all_true?
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def print_module_header
|
20
|
+
color "[ #{name} ]\n", :light_blue
|
21
|
+
end
|
22
|
+
|
23
|
+
def prepare_check
|
24
|
+
@files_to_check = []
|
25
|
+
@results = []
|
26
|
+
end
|
27
|
+
|
28
|
+
def check_executable
|
29
|
+
if check_for_executable
|
30
|
+
true
|
31
|
+
else
|
32
|
+
color "executable not found, skipping...\n", :magenta
|
33
|
+
false
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def check_for_executable
|
38
|
+
true
|
39
|
+
end
|
40
|
+
|
41
|
+
def select_proper_files
|
42
|
+
@files_to_check = self.files.select { |f|
|
43
|
+
self.class.extensions.map { |ex| f.ends_with?(ex) }.any?
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
def check_all_files
|
48
|
+
@results = @files_to_check.map do |file|
|
49
|
+
color "Checking #{file}...", :yellow
|
50
|
+
check_one(file)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.extensions *args
|
55
|
+
@extensions ||= []
|
56
|
+
if args.empty?
|
57
|
+
@extensions
|
58
|
+
else
|
59
|
+
@extensions += args
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def plain_command(cmd, options = {})
|
64
|
+
exitstatus = system(cmd)
|
65
|
+
show_output(exitstatus, options)
|
66
|
+
exitstatus
|
67
|
+
end
|
68
|
+
|
69
|
+
def command(cmd, options = {})
|
70
|
+
if options[:use_bundler] == true
|
71
|
+
if use_bundler?
|
72
|
+
cmd = "bundle exec #{cmd}"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
cmd = rvm_command(cmd) if use_rvm?
|
77
|
+
cmd << " #{options[:append]}" if options[:append]
|
78
|
+
exitstatus = execute(cmd)
|
79
|
+
show_output(exitstatus, options)
|
80
|
+
exitstatus
|
81
|
+
end
|
82
|
+
|
83
|
+
def show_output(exitstatus, options)
|
84
|
+
unless options[:show_output] == false
|
85
|
+
if exitstatus
|
86
|
+
puts " [OK]".green
|
87
|
+
else
|
88
|
+
puts " [FAIL]".red
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
def execute(cmd)
|
95
|
+
system(cmd)
|
96
|
+
end
|
97
|
+
|
98
|
+
def color(str, color)
|
99
|
+
print str.colorize(color)
|
100
|
+
end
|
101
|
+
|
102
|
+
def name
|
103
|
+
self.class.to_s.split('::').last.upcase
|
104
|
+
end
|
105
|
+
|
106
|
+
def use_bundler?
|
107
|
+
File.exists?("Gemfile.lock")
|
108
|
+
end
|
109
|
+
|
110
|
+
def use_rvm?
|
111
|
+
File.exists?(".rvmrc") && File.exists?(rvm_shell)
|
112
|
+
end
|
113
|
+
|
114
|
+
def rvm_shell
|
115
|
+
File.join(ENV.fetch('rvm_path', ''), 'bin/rvm-shell')
|
116
|
+
end
|
117
|
+
|
118
|
+
def rvm_command(command)
|
119
|
+
rvm_version = `echo $rvm_ruby_string`.chomp
|
120
|
+
"#{rvm_shell} '#{rvm_version}' -c '#{command}'"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -1,33 +1,14 @@
|
|
1
1
|
module Checker
|
2
2
|
module Modules
|
3
|
-
class Coffeescript
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
Utils.color("coffee executable NOT FOUND, OMITTING...\n", :yellow)
|
9
|
-
return true
|
10
|
-
end
|
11
|
-
|
12
|
-
files = Utils.files_modified
|
13
|
-
files.delete_if {|f| !f.ends_with?(".coffee")}
|
14
|
-
|
15
|
-
files.map! do |f|
|
16
|
-
Utils.color("Checking #{f}...", :yellow)
|
17
|
-
Coffeescript.check_one(f)
|
18
|
-
end
|
19
|
-
|
20
|
-
files.all_true?
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.check_one(file)
|
24
|
-
Utils.plain_command("cat #{file} | egrep -v '^//=' | coffee -sc > /dev/null")
|
3
|
+
class Coffeescript < Base
|
4
|
+
extensions 'coffee'
|
5
|
+
private
|
6
|
+
def check_one(file)
|
7
|
+
plain_command("cat #{file} | egrep -v '^//=' | coffee -sc > /dev/null")
|
25
8
|
end
|
26
9
|
|
27
|
-
def
|
28
|
-
|
29
|
-
system(cmd)
|
30
|
-
$?.exitstatus == 0
|
10
|
+
def check_for_executable
|
11
|
+
command('coffee -v', :show_output => false, :append => ">> /dev/null 2>&1")
|
31
12
|
end
|
32
13
|
end
|
33
14
|
end
|
data/lib/checker/modules/haml.rb
CHANGED
@@ -1,22 +1,10 @@
|
|
1
1
|
module Checker
|
2
2
|
module Modules
|
3
|
-
class Haml
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
files.delete_if {|f| !f.ends_with?(".haml")}
|
9
|
-
|
10
|
-
files.map! do |f|
|
11
|
-
Utils.color("Checking #{f}...", :yellow)
|
12
|
-
Haml.check_one(f)
|
13
|
-
end
|
14
|
-
|
15
|
-
files.all_true?
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.check_one(file)
|
19
|
-
Utils.plain_command("haml #{file} > /dev/null")
|
3
|
+
class Haml < Base
|
4
|
+
extensions 'haml'
|
5
|
+
private
|
6
|
+
def check_one(file)
|
7
|
+
plain_command("haml --check #{file} >> /dev/null")
|
20
8
|
end
|
21
9
|
end
|
22
10
|
end
|
data/lib/checker/modules/pry.rb
CHANGED
@@ -1,21 +1,15 @@
|
|
1
1
|
module Checker
|
2
2
|
module Modules
|
3
|
-
class Pry
|
4
|
-
|
5
|
-
Utils.color("> binding.pry occurence <\n", :light_blue)
|
3
|
+
class Pry < Base
|
4
|
+
extensions 'rb'
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
Utils.color("Checking #{f}...", :yellow)
|
11
|
-
[Pry.check_for_binding_pry(f), Pry.check_for_binding_remote_pry(f)].all_true?
|
12
|
-
end
|
13
|
-
|
14
|
-
files.all_true?
|
6
|
+
private
|
7
|
+
def check_one file
|
8
|
+
[check_for_binding_pry(file), check_for_binding_remote_pry(file)].all_true?
|
15
9
|
end
|
16
10
|
|
17
|
-
def
|
18
|
-
result = `grep -n "binding
|
11
|
+
def check_for_binding_pry(file)
|
12
|
+
result = `grep -n "binding\\.pry" #{file}`.chomp
|
19
13
|
|
20
14
|
unless result.empty?
|
21
15
|
puts " pry -> FAIL, ".red
|
@@ -27,8 +21,8 @@ module Checker
|
|
27
21
|
result.empty?
|
28
22
|
end
|
29
23
|
|
30
|
-
def
|
31
|
-
result = `grep -n "binding
|
24
|
+
def check_for_binding_remote_pry(file)
|
25
|
+
result = `grep -n "binding\\.remote_pry" #{file}`.chomp
|
32
26
|
|
33
27
|
unless result.empty?
|
34
28
|
puts " remote_pry -> FAIL".red
|
data/lib/checker/modules/ruby.rb
CHANGED
@@ -1,22 +1,10 @@
|
|
1
1
|
module Checker
|
2
2
|
module Modules
|
3
|
-
class Ruby
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
files.delete_if {|f| !f.ends_with?(".rb")}
|
9
|
-
|
10
|
-
files.map! do |f|
|
11
|
-
Utils.color("Checking #{f}...", :yellow)
|
12
|
-
Ruby.check_one(f)
|
13
|
-
end
|
14
|
-
|
15
|
-
files.all_true?
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.check_one(file)
|
19
|
-
Utils.command("ruby -c #{file}", :append => ">> /dev/null")
|
3
|
+
class Ruby < Base
|
4
|
+
extensions 'rb'
|
5
|
+
private
|
6
|
+
def check_one(file)
|
7
|
+
command("ruby -c #{file}", :append => ">> /dev/null")
|
20
8
|
end
|
21
9
|
end
|
22
10
|
end
|
data/lib/checker/modules/sass.rb
CHANGED
@@ -1,35 +1,14 @@
|
|
1
1
|
module Checker
|
2
2
|
module Modules
|
3
|
-
class Sass
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
Utils.color("sass executable NOT FOUND, OMITTING...\n", :magenta)
|
9
|
-
return true
|
10
|
-
end
|
11
|
-
|
12
|
-
files = Utils.files_modified
|
13
|
-
files.delete_if {|f| !f.ends_with?(".scss") and !f.ends_with?(".sass")}
|
14
|
-
|
15
|
-
files.map! do |f|
|
16
|
-
Utils.color("Checking #{f}...", :yellow)
|
17
|
-
Sass.check_one(f)
|
18
|
-
end
|
19
|
-
|
20
|
-
files.all_true?
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.check_one(file)
|
24
|
-
cmd = "sass #{file}"
|
25
|
-
Utils.command(cmd, :use_bundler => true, :append => ">> /dev/null")
|
3
|
+
class Sass < Base
|
4
|
+
extensions 'scss', 'sass'
|
5
|
+
private
|
6
|
+
def check_one(file)
|
7
|
+
command("sass #{file}", :use_bundler => true, :append => ">> /dev/null")
|
26
8
|
end
|
27
9
|
|
28
|
-
def
|
29
|
-
|
30
|
-
cmd = "sass -v"
|
31
|
-
Utils.command(cmd, :use_bundler => true, :show_output => false, :append => ">> /dev/null")
|
32
|
-
@exitstatus = ($?.exitstatus == 0)
|
10
|
+
def check_for_executable
|
11
|
+
command("sass -v", :use_bundler => true, :show_output => false, :append => ">> /dev/null 2>&1")
|
33
12
|
end
|
34
13
|
end
|
35
14
|
end
|
metadata
CHANGED
@@ -1,35 +1,46 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: checker
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 4
|
9
|
+
- 1
|
10
|
+
version: 0.0.4.1
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Jacek Jakubik
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-07-09 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
15
22
|
name: colorize
|
16
|
-
|
17
|
-
|
18
|
-
requirements:
|
19
|
-
- - =
|
20
|
-
- !ruby/object:Gem::Version
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
- 5
|
31
|
+
- 8
|
21
32
|
version: 0.5.8
|
22
33
|
type: :runtime
|
23
|
-
|
24
|
-
|
25
|
-
description: A collection of modules which every is designed to check syntax for specific
|
26
|
-
files.
|
34
|
+
version_requirements: *id001
|
35
|
+
description: A collection of modules which every is designed to check syntax for specific files.
|
27
36
|
email: jacek.jakubik@netguru.pl
|
28
|
-
executables:
|
37
|
+
executables:
|
29
38
|
- checker
|
30
39
|
extensions: []
|
40
|
+
|
31
41
|
extra_rdoc_files: []
|
32
|
-
|
42
|
+
|
43
|
+
files:
|
33
44
|
- .gitignore
|
34
45
|
- CHANGELOG
|
35
46
|
- README.md
|
@@ -37,37 +48,42 @@ files:
|
|
37
48
|
- checker.gemspec
|
38
49
|
- lib/checker.rb
|
39
50
|
- lib/checker/cli.rb
|
40
|
-
- lib/checker/cli/execute.rb
|
41
51
|
- lib/checker/core_ext.rb
|
42
|
-
- lib/checker/modules/
|
52
|
+
- lib/checker/modules/base.rb
|
43
53
|
- lib/checker/modules/coffeescript.rb
|
44
54
|
- lib/checker/modules/haml.rb
|
45
55
|
- lib/checker/modules/pry.rb
|
46
56
|
- lib/checker/modules/ruby.rb
|
47
57
|
- lib/checker/modules/sass.rb
|
48
|
-
|
58
|
+
has_rdoc: true
|
49
59
|
homepage: http://github.com/netguru/checker
|
50
60
|
licenses: []
|
61
|
+
|
51
62
|
post_install_message:
|
52
63
|
rdoc_options: []
|
53
|
-
|
64
|
+
|
65
|
+
require_paths:
|
54
66
|
- lib
|
55
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
requirements:
|
64
|
-
- -
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
segments:
|
79
|
+
- 0
|
80
|
+
version: "0"
|
67
81
|
requirements: []
|
82
|
+
|
68
83
|
rubyforge_project:
|
69
|
-
rubygems_version: 1.
|
84
|
+
rubygems_version: 1.3.6
|
70
85
|
signing_key:
|
71
86
|
specification_version: 3
|
72
87
|
summary: Syntax checker for various files
|
73
88
|
test_files: []
|
89
|
+
|
data/lib/checker/cli/execute.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
module Checker
|
2
|
-
class CLI
|
3
|
-
module Execute
|
4
|
-
def self.included(base)
|
5
|
-
base.extend(ClassMethods)
|
6
|
-
end
|
7
|
-
|
8
|
-
module ClassMethods
|
9
|
-
def execute
|
10
|
-
if ARGV.size == 0
|
11
|
-
modules = Utils.get_modules_to_check
|
12
|
-
else
|
13
|
-
modules = ARGV.map(&:downcase)
|
14
|
-
end
|
15
|
-
## by default lets check all
|
16
|
-
if modules.empty?
|
17
|
-
modules = ["all"]
|
18
|
-
end
|
19
|
-
|
20
|
-
## check all the modules
|
21
|
-
if modules.include?("all")
|
22
|
-
exit (Checker::Modules::All.check ? 0 : 1)
|
23
|
-
else
|
24
|
-
Utils.check_module_availability(modules) do |result|
|
25
|
-
puts "Modules not available: #{result.join(", ")}.\n"
|
26
|
-
puts "Available: #{Utils.available_modules.join(", ")}\n"
|
27
|
-
puts "Check your git config checker.check\n"
|
28
|
-
exit 1
|
29
|
-
end
|
30
|
-
|
31
|
-
checked = []
|
32
|
-
modules.each do |mod|
|
33
|
-
klass = "Checker::Modules::#{mod.downcase.capitalize}".constantize
|
34
|
-
checked << klass.check
|
35
|
-
end
|
36
|
-
exit (checked.all_true? ? 0 : 1)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
data/lib/checker/modules/all.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
module Checker
|
2
|
-
module Modules
|
3
|
-
## simple wrapper, to call every module
|
4
|
-
class All
|
5
|
-
def self.check
|
6
|
-
checked = []
|
7
|
-
constants = Utils.available_modules - ["all"]
|
8
|
-
constants.each do |const|
|
9
|
-
klass = "Checker::Modules::#{const.capitalize}".constantize
|
10
|
-
checked << klass.check
|
11
|
-
end
|
12
|
-
checked.all_true?
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
data/lib/checker/utils.rb
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
class Utils
|
2
|
-
def self.files_modified
|
3
|
-
@files_modified ||= `git status --porcelain | egrep "^(A |M |R ).*" | awk ' { if ($3 == "->") print $4; else print $2 } '`.split
|
4
|
-
@files_modified.dup
|
5
|
-
end
|
6
|
-
|
7
|
-
def self.use_bundler?
|
8
|
-
File.exists?("Gemfile.lock")
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.use_rvm?
|
12
|
-
File.exists?(".rvmrc") && File.exists?(rvm_shell)
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.rvm_command(command)
|
16
|
-
rvm_version = `echo $rvm_ruby_string`.chomp
|
17
|
-
# puts "Using '#{rvm_version}' version"
|
18
|
-
cmd = "#{rvm_shell} '#{rvm_version}' -c '#{command}'"
|
19
|
-
cmd
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.rvm_shell
|
23
|
-
File.join(ENV.fetch('rvm_path', ''), 'bin/rvm-shell')
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.show_output(exitstatus, options)
|
27
|
-
unless options[:show_output] == false
|
28
|
-
if exitstatus
|
29
|
-
puts " [OK]".green
|
30
|
-
else
|
31
|
-
puts " [FAIL]".red
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.plain_command(cmd, options = {})
|
37
|
-
exitstatus = system(cmd)
|
38
|
-
Utils.show_output(exitstatus, options)
|
39
|
-
exitstatus
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.command(cmd, options = {})
|
43
|
-
if options[:use_bundler] == true
|
44
|
-
if Utils.use_bundler?
|
45
|
-
cmd = "bundle exec #{cmd}"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
cmd = Utils.rvm_command(cmd) if Utils.use_rvm?
|
50
|
-
cmd << " #{options[:append]}" if options[:append]
|
51
|
-
exitstatus = Utils.execute(cmd)
|
52
|
-
Utils.show_output(exitstatus, options)
|
53
|
-
exitstatus
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.execute(cmd)
|
57
|
-
# system("echo #{cmd}")
|
58
|
-
system(cmd)
|
59
|
-
end
|
60
|
-
|
61
|
-
def self.available_modules
|
62
|
-
Checker::Modules.constants.map(&:to_s).map(&:downcase)
|
63
|
-
end
|
64
|
-
|
65
|
-
def self.check_module_availability(modules)
|
66
|
-
constants = self.available_modules
|
67
|
-
result = modules - (constants & modules)
|
68
|
-
unless result.empty?
|
69
|
-
if block_given?
|
70
|
-
yield(result)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def self.get_modules_to_check
|
76
|
-
`git config checker.check`.chomp.split(",").map(&:strip)
|
77
|
-
end
|
78
|
-
|
79
|
-
def self.color(str, color)
|
80
|
-
print str.colorize(color)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|