polishgeeks-dev-tools 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +27 -30
- data/Rakefile +1 -1
- data/lib/polishgeeks-dev-tools.rb +26 -20
- data/lib/polishgeeks/dev-tools/{command → commands}/allowed_extensions.rb +1 -1
- data/lib/polishgeeks/dev-tools/{command → commands}/base.rb +15 -25
- data/lib/polishgeeks/dev-tools/{command → commands}/brakeman.rb +4 -2
- data/lib/polishgeeks/dev-tools/{command → commands}/empty_method.rb +1 -1
- data/lib/polishgeeks/dev-tools/{command → commands}/empty_method/file_parser.rb +1 -1
- data/lib/polishgeeks/dev-tools/{command → commands}/empty_method/string_refinements.rb +1 -1
- data/lib/polishgeeks/dev-tools/{command → commands}/examples_comparator.rb +1 -1
- data/lib/polishgeeks/dev-tools/{command → commands}/expires_in.rb +1 -1
- data/lib/polishgeeks/dev-tools/{command → commands}/final_blank_line.rb +1 -1
- data/lib/polishgeeks/dev-tools/{command → commands}/haml_lint.rb +1 -1
- data/lib/polishgeeks/dev-tools/{command → commands}/readme.rb +1 -1
- data/lib/polishgeeks/dev-tools/{command → commands}/rspec.rb +1 -1
- data/lib/polishgeeks/dev-tools/{command → commands}/rspec_files_names.rb +1 -1
- data/lib/polishgeeks/dev-tools/{command → commands}/rspec_files_structure.rb +1 -1
- data/lib/polishgeeks/dev-tools/{command → commands}/rubocop.rb +1 -1
- data/lib/polishgeeks/dev-tools/{command → commands}/rubycritic.rb +1 -1
- data/lib/polishgeeks/dev-tools/{command/coverage.rb → commands/simplecov.rb} +22 -9
- data/lib/polishgeeks/dev-tools/{command → commands}/tasks_files_names.rb +1 -1
- data/lib/polishgeeks/dev-tools/{command → commands}/yard.rb +1 -1
- data/lib/polishgeeks/dev-tools/{command → commands}/yml_parser.rb +1 -1
- data/lib/polishgeeks/dev-tools/config.rb +0 -16
- data/lib/polishgeeks/dev-tools/errors.rb +25 -0
- data/lib/polishgeeks/dev-tools/logger.rb +7 -12
- data/lib/polishgeeks/dev-tools/runner.rb +2 -1
- data/lib/polishgeeks/dev-tools/validators/base.rb +26 -0
- data/lib/polishgeeks/dev-tools/validators/rails.rb +12 -0
- data/lib/polishgeeks/dev-tools/validators/simplecov.rb +20 -0
- data/lib/polishgeeks/dev-tools/version.rb +1 -1
- data/polishgeeks_dev_tools.gemspec +1 -1
- data/spec/lib/polishgeeks/dev-tools/{command → commands}/allowed_extensions_spec.rb +1 -1
- data/spec/lib/polishgeeks/dev-tools/commands/base_spec.rb +55 -0
- data/spec/lib/polishgeeks/dev-tools/{command → commands}/brakeman_spec.rb +10 -9
- data/spec/lib/polishgeeks/dev-tools/{command → commands}/empty_method/file_parser_spec.rb +1 -1
- data/spec/lib/polishgeeks/dev-tools/{command → commands}/empty_method/string_refinements_spec.rb +1 -1
- data/spec/lib/polishgeeks/dev-tools/{command → commands}/empty_method_spec.rb +1 -1
- data/spec/lib/polishgeeks/dev-tools/{command → commands}/examples_comparator_spec.rb +1 -1
- data/spec/lib/polishgeeks/dev-tools/{command → commands}/expires_in_spec.rb +1 -1
- data/spec/lib/polishgeeks/dev-tools/{command → commands}/final_blank_line_spec.rb +1 -1
- data/spec/lib/polishgeeks/dev-tools/{command → commands}/haml_lint_spec.rb +1 -1
- data/spec/lib/polishgeeks/dev-tools/{command → commands}/readme_spec.rb +1 -1
- data/spec/lib/polishgeeks/dev-tools/{command → commands}/rspec_files_names_spec.rb +1 -1
- data/spec/lib/polishgeeks/dev-tools/{command → commands}/rspec_files_structure_spec.rb +1 -1
- data/spec/lib/polishgeeks/dev-tools/{command → commands}/rspec_spec.rb +1 -1
- data/spec/lib/polishgeeks/dev-tools/{command → commands}/rubocop_spec.rb +1 -1
- data/spec/lib/polishgeeks/dev-tools/{command → commands}/rubycritic_spec.rb +1 -1
- data/spec/lib/polishgeeks/dev-tools/{command/coverage_spec.rb → commands/simplecov_spec.rb} +28 -15
- data/spec/lib/polishgeeks/dev-tools/{command → commands}/tasks_files_names_spec.rb +1 -1
- data/spec/lib/polishgeeks/dev-tools/{command → commands}/yard_spec.rb +1 -1
- data/spec/lib/polishgeeks/dev-tools/{command → commands}/yml_parser_spec.rb +1 -1
- data/spec/lib/polishgeeks/dev-tools/config_spec.rb +0 -18
- data/spec/lib/polishgeeks/dev-tools/errors_spec.rb +15 -0
- data/spec/lib/polishgeeks/dev-tools/logger_spec.rb +3 -3
- data/spec/lib/polishgeeks/dev-tools/runner_spec.rb +4 -1
- data/spec/lib/polishgeeks/dev-tools/validators/base_spec.rb +34 -0
- data/spec/lib/polishgeeks/dev-tools/validators/rails_spec.rb +21 -0
- data/spec/lib/polishgeeks/dev-tools/validators/simplecov_spec.rb +34 -0
- metadata +78 -69
- data/lib/polishgeeks/dev-tools/command/simplecov.rb +0 -32
- data/spec/lib/polishgeeks/dev-tools/command/base_spec.rb +0 -127
- data/spec/lib/polishgeeks/dev-tools/command/simplecov_spec.rb +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 720e29e14953ef13e7c94a269d5c089ff3783d38
|
4
|
+
data.tar.gz: 56b9bf6b831f5cff118daf838c74a0f311a99977
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73fab8df5c40ec3f30c51a7b29b48c153d9131b559544adbe8cf8d651633bc25d86e9cbf1db09b03ea6a02bbc279e81620d25a827798c5bde288c24ce833bb80
|
7
|
+
data.tar.gz: 50a39d960da6ca93fabf46fe6e443569552fbd04e151d8633e1524db1193b77faa332bb1482382059c990619b3cbb039cff217c6aa135dfd59fab3094ef21501
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
polishgeeks-dev-tools (1.2.
|
4
|
+
polishgeeks-dev-tools (1.2.1)
|
5
5
|
brakeman
|
6
6
|
faker
|
7
7
|
haml-lint
|
@@ -9,7 +9,7 @@ PATH
|
|
9
9
|
pry
|
10
10
|
rspec
|
11
11
|
rubocop
|
12
|
-
rubycritic
|
12
|
+
rubycritic
|
13
13
|
shoulda
|
14
14
|
simplecov
|
15
15
|
timecop
|
@@ -38,7 +38,7 @@ GEM
|
|
38
38
|
descendants_tracker (~> 0.0.4)
|
39
39
|
ice_nine (~> 0.11.0)
|
40
40
|
thread_safe (~> 0.3, >= 0.3.1)
|
41
|
-
brakeman (3.1.
|
41
|
+
brakeman (3.1.2)
|
42
42
|
erubis (~> 2.6)
|
43
43
|
fastercsv (~> 1.5)
|
44
44
|
haml (>= 3.0, < 5.0)
|
@@ -46,10 +46,11 @@ GEM
|
|
46
46
|
multi_json (~> 1.2)
|
47
47
|
ruby2ruby (>= 2.1.1, < 2.3.0)
|
48
48
|
ruby_parser (~> 3.7.0)
|
49
|
+
safe_yaml
|
49
50
|
sass (~> 3.0)
|
50
51
|
slim (>= 1.3.6, < 4.0)
|
51
|
-
terminal-table (~> 1.4
|
52
|
-
bson (3.2.
|
52
|
+
terminal-table (~> 1.4)
|
53
|
+
bson (3.2.6)
|
53
54
|
builder (3.2.2)
|
54
55
|
coderay (1.1.0)
|
55
56
|
coercible (1.0.0)
|
@@ -57,7 +58,6 @@ GEM
|
|
57
58
|
concord (0.1.5)
|
58
59
|
adamantium (~> 0.2.0)
|
59
60
|
equalizer (~> 0.0.9)
|
60
|
-
connection_pool (2.2.0)
|
61
61
|
descendants_tracker (0.0.4)
|
62
62
|
thread_safe (~> 0.3, >= 0.3.1)
|
63
63
|
diff-lcs (1.2.5)
|
@@ -79,41 +79,38 @@ GEM
|
|
79
79
|
haml (~> 4.0)
|
80
80
|
rubocop (>= 0.25.0)
|
81
81
|
sysexits (~> 1.1)
|
82
|
-
highline (1.7.
|
82
|
+
highline (1.7.8)
|
83
83
|
i18n (0.7.0)
|
84
84
|
ice_nine (0.11.1)
|
85
85
|
json (1.8.3)
|
86
86
|
memoizable (0.4.2)
|
87
87
|
thread_safe (~> 0.3, >= 0.3.1)
|
88
88
|
method_source (0.8.2)
|
89
|
-
minitest (5.8.
|
90
|
-
|
89
|
+
minitest (5.8.2)
|
90
|
+
mongo (2.1.2)
|
91
|
+
bson (~> 3.0)
|
92
|
+
mongoid (5.0.1)
|
91
93
|
activemodel (~> 4.0)
|
92
|
-
|
94
|
+
mongo (~> 2.1)
|
93
95
|
origin (~> 2.1)
|
94
96
|
tzinfo (>= 0.3.37)
|
95
|
-
mongoid-rspec (
|
96
|
-
mongoid (~>
|
97
|
+
mongoid-rspec (3.0.0)
|
98
|
+
mongoid (~> 5.0)
|
97
99
|
rake
|
98
|
-
rspec (~> 3.
|
99
|
-
moped (2.0.7)
|
100
|
-
bson (~> 3.0)
|
101
|
-
connection_pool (~> 2.0)
|
102
|
-
optionable (~> 0.2.0)
|
100
|
+
rspec (~> 3.3)
|
103
101
|
multi_json (1.11.2)
|
104
|
-
optionable (0.2.0)
|
105
102
|
origin (2.1.1)
|
106
|
-
parser (2.2.
|
103
|
+
parser (2.2.3.0)
|
107
104
|
ast (>= 1.1, < 3.0)
|
108
105
|
powerpack (0.1.1)
|
109
106
|
procto (0.0.2)
|
110
|
-
pry (0.10.
|
107
|
+
pry (0.10.3)
|
111
108
|
coderay (~> 1.1.0)
|
112
109
|
method_source (~> 0.8.1)
|
113
110
|
slop (~> 3.4)
|
114
111
|
rainbow (2.0.0)
|
115
112
|
rake (10.4.2)
|
116
|
-
reek (1.6.
|
113
|
+
reek (1.6.5)
|
117
114
|
parser (~> 2.2.0.pre.7)
|
118
115
|
rainbow (>= 1.99, < 3.0)
|
119
116
|
unparser (~> 0.2.2)
|
@@ -130,26 +127,26 @@ GEM
|
|
130
127
|
diff-lcs (>= 1.2.0, < 2.0)
|
131
128
|
rspec-support (~> 3.3.0)
|
132
129
|
rspec-support (3.3.0)
|
133
|
-
rubocop (0.
|
130
|
+
rubocop (0.35.0)
|
134
131
|
astrolabe (~> 1.3)
|
135
|
-
parser (>= 2.2.
|
132
|
+
parser (>= 2.2.3.0, < 3.0)
|
136
133
|
powerpack (~> 0.1)
|
137
134
|
rainbow (>= 1.99.1, < 3.0)
|
138
|
-
ruby-progressbar (~> 1.
|
135
|
+
ruby-progressbar (~> 1.7)
|
139
136
|
ruby-progressbar (1.7.5)
|
140
137
|
ruby2ruby (2.2.0)
|
141
138
|
ruby_parser (~> 3.1)
|
142
139
|
sexp_processor (~> 4.0)
|
143
|
-
ruby_parser (3.7.
|
140
|
+
ruby_parser (3.7.2)
|
144
141
|
sexp_processor (~> 4.1)
|
145
|
-
rubycritic (1.
|
142
|
+
rubycritic (1.4.0)
|
146
143
|
flay (= 2.4.0)
|
147
144
|
flog (= 4.2.1)
|
148
145
|
parser (>= 2.2.0, < 3.0)
|
149
|
-
reek (= 1.6.
|
150
|
-
ruby2ruby (>= 2.1.1, < 3.0)
|
146
|
+
reek (= 1.6.5)
|
151
147
|
virtus (~> 1.0)
|
152
|
-
|
148
|
+
safe_yaml (1.0.4)
|
149
|
+
sass (3.4.19)
|
153
150
|
sexp_processor (4.6.0)
|
154
151
|
shoulda (3.5.0)
|
155
152
|
shoulda-context (~> 1.0, >= 1.0.1)
|
@@ -168,7 +165,7 @@ GEM
|
|
168
165
|
slop (3.6.0)
|
169
166
|
sysexits (1.2.0)
|
170
167
|
temple (0.7.6)
|
171
|
-
terminal-table (1.
|
168
|
+
terminal-table (1.5.2)
|
172
169
|
thread_safe (0.3.5)
|
173
170
|
tilt (2.0.1)
|
174
171
|
timecop (0.8.0)
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ task :check do
|
|
8
8
|
config.brakeman = false
|
9
9
|
config.haml_lint = false
|
10
10
|
config.expires_in_files_ignored = %w(
|
11
|
-
lib/polishgeeks/dev-tools/
|
11
|
+
lib/polishgeeks/dev-tools/commands/expires_in.rb
|
12
12
|
)
|
13
13
|
config.empty_method_ignored = %w(
|
14
14
|
empty_method_spec.rb
|
@@ -1,13 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
%w(
|
2
|
+
yaml
|
3
|
+
yard
|
4
|
+
pry
|
5
|
+
fileutils
|
6
|
+
timecop
|
7
|
+
faker
|
8
|
+
ostruct
|
9
|
+
).each { |lib| require lib }
|
10
|
+
|
11
|
+
%w(
|
12
|
+
validators/base
|
13
|
+
commands/base
|
14
|
+
commands/empty_method
|
15
|
+
commands/empty_method/string_refinements
|
16
|
+
).each { |lib| require "polishgeeks/dev-tools/#{lib}" }
|
17
|
+
|
18
|
+
%w(
|
19
|
+
*.rb
|
20
|
+
validators/*.rb
|
21
|
+
commands/*.rb
|
22
|
+
commands/**/*.rb
|
23
|
+
).each do |path|
|
24
|
+
base_path = File.dirname(__FILE__) + "/polishgeeks/dev-tools/#{path}"
|
25
|
+
Dir[base_path].each { |file| require file }
|
26
|
+
end
|
11
27
|
|
12
28
|
module PolishGeeks
|
13
29
|
module DevTools
|
@@ -35,14 +51,4 @@ module PolishGeeks
|
|
35
51
|
end
|
36
52
|
end
|
37
53
|
|
38
|
-
require 'polishgeeks/dev-tools/command/base'
|
39
|
-
require 'polishgeeks/dev-tools/command/empty_method'
|
40
|
-
require 'polishgeeks/dev-tools/command/empty_method/string_refinements'
|
41
|
-
|
42
|
-
commands_path = File.dirname(__FILE__) + '/polishgeeks/dev-tools/command/*.rb'
|
43
|
-
Dir[commands_path].each { |file| require file }
|
44
|
-
|
45
|
-
commands_path = File.dirname(__FILE__) + '/polishgeeks/dev-tools/command/**/*.rb'
|
46
|
-
Dir[commands_path].each { |file| require file }
|
47
|
-
|
48
54
|
load 'polishgeeks/dev-tools/tasks/dev-tools.rake'
|
@@ -1,14 +1,11 @@
|
|
1
1
|
module PolishGeeks
|
2
2
|
module DevTools
|
3
3
|
# Module encapsulating all the commands that we use to check/verify code
|
4
|
-
module
|
4
|
+
module Commands
|
5
5
|
# Base class for all the commands
|
6
6
|
# @abstract Subclass and use
|
7
7
|
class Base
|
8
|
-
#
|
9
|
-
# and it is not present (not detected)
|
10
|
-
class MissingFramework < StandardError; end
|
11
|
-
|
8
|
+
# Output string that we get after executing this command
|
12
9
|
attr_reader :output
|
13
10
|
# stored_output [PolishGeeks::DevTools::OutputStorer] storer with results of previous
|
14
11
|
# commands (they might use output from previous/other commands)
|
@@ -21,7 +18,7 @@ module PolishGeeks
|
|
21
18
|
|
22
19
|
class << self
|
23
20
|
attr_accessor :type
|
24
|
-
attr_accessor :
|
21
|
+
attr_accessor :validators
|
25
22
|
|
26
23
|
TYPES.each do |type|
|
27
24
|
# @return [Boolean] if it is a given type command
|
@@ -31,23 +28,16 @@ module PolishGeeks
|
|
31
28
|
end
|
32
29
|
end
|
33
30
|
|
34
|
-
# When we will try to use a given command, we need to check if it requires
|
35
|
-
# a given framework (Rails, Sinatra), if so, then we need to check if it is
|
36
|
-
# present, because without it a given command cannot run
|
37
|
-
def initialize
|
38
|
-
ensure_framework_if_required
|
39
|
-
end
|
40
|
-
|
41
31
|
# @raise [NotImplementedError] this should be implemented in a subclass
|
42
32
|
def execute
|
43
|
-
fail NotImplementedError
|
33
|
+
fail Errors::NotImplementedError
|
44
34
|
end
|
45
35
|
|
46
36
|
# @raise [NotImplementedError] this should be implemented in a subclass
|
47
37
|
# if it is a validator type (or no implementation required when
|
48
38
|
# it is a validator)
|
49
39
|
def valid?
|
50
|
-
fail NotImplementedError
|
40
|
+
fail Errors::NotImplementedError
|
51
41
|
end
|
52
42
|
|
53
43
|
# @return [String] what message should be printed when error occures
|
@@ -56,16 +46,16 @@ module PolishGeeks
|
|
56
46
|
output
|
57
47
|
end
|
58
48
|
|
59
|
-
|
60
|
-
|
61
|
-
#
|
62
|
-
#
|
63
|
-
# @raise [PolishGeeks::DevTools::
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
49
|
+
# Runs validators if any to check if all requirements of this command
|
50
|
+
# are met in order to execute it properly
|
51
|
+
# @raise [PolishGeeks::DevTools::Errors::InvalidValidatorClassError] when invalid
|
52
|
+
# validator class name is defined
|
53
|
+
# @raise [PolishGeeks::DevTools::Errors::PreCommandValidationError] when validator
|
54
|
+
# conditions are not met
|
55
|
+
def ensure_executable!
|
56
|
+
(self.class.validators || []).each do |validator_class|
|
57
|
+
validator_class.new(stored_output).validate!
|
58
|
+
end
|
69
59
|
end
|
70
60
|
end
|
71
61
|
end
|
@@ -1,11 +1,13 @@
|
|
1
1
|
module PolishGeeks
|
2
2
|
module DevTools
|
3
|
-
module
|
3
|
+
module Commands
|
4
4
|
# A static analysis security vulnerability scanner for Ruby on Rails applications
|
5
5
|
# @see https://github.com/presidentbeef/brakeman
|
6
6
|
class Brakeman < Base
|
7
7
|
self.type = :validator
|
8
|
-
self.
|
8
|
+
self.validators = [
|
9
|
+
Validators::Rails
|
10
|
+
]
|
9
11
|
|
10
12
|
# Regexps to get some stat info from brakeman output
|
11
13
|
REGEXPS = {
|