polishgeeks-dev-tools 1.2.1 → 1.3.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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +3 -2
- data/CHANGELOG.md +69 -0
- data/Gemfile.lock +76 -81
- data/README.md +28 -22
- data/Rakefile +4 -3
- data/config/rubocop.yml +16 -16
- data/config/rubocop_todo.yml +14 -0
- data/lib/polish_geeks/dev_tools.rb +26 -0
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/allowed_extensions.rb +4 -4
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/base.rb +18 -3
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/brakeman.rb +5 -2
- data/lib/polish_geeks/dev_tools/commands/bundler_audit.rb +23 -0
- data/lib/{polishgeeks/dev-tools/commands/empty_method.rb → polish_geeks/dev_tools/commands/empty_methods.rb} +3 -13
- data/lib/{polishgeeks/dev-tools/commands/empty_method → polish_geeks/dev_tools/commands/empty_methods}/file_parser.rb +1 -1
- data/lib/{polishgeeks/dev-tools/commands/empty_method → polish_geeks/dev_tools/commands/empty_methods}/string_refinements.rb +2 -2
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/examples_comparator.rb +13 -7
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/expires_in.rb +6 -6
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/final_blank_line.rb +1 -11
- data/lib/polish_geeks/dev_tools/commands/gemfile.rb +39 -0
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/haml_lint.rb +0 -0
- data/lib/polish_geeks/dev_tools/commands/required_files.rb +38 -0
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/rspec.rb +24 -5
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/rspec_files_names.rb +1 -1
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/rspec_files_structure.rb +22 -9
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/rubocop.rb +10 -8
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/rubycritic.rb +0 -0
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/simplecov.rb +0 -0
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/tasks_files_names.rb +0 -0
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/yard.rb +0 -0
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/yml_parser.rb +0 -0
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/config.rb +24 -16
- data/lib/polish_geeks/dev_tools/config_manager.rb +68 -0
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/errors.rb +0 -0
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/hash.rb +0 -0
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/logger.rb +3 -3
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/output_storer.rb +0 -0
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/runner.rb +0 -0
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/shell.rb +0 -0
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/tasks/dev-tools.rake +0 -0
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/validators/base.rb +2 -2
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/validators/rails.rb +0 -0
- data/lib/polish_geeks/dev_tools/validators/rubocop.rb +12 -0
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/validators/simplecov.rb +1 -1
- data/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/version.rb +1 -1
- data/lib/polishgeeks-dev-tools.rb +6 -31
- data/polishgeeks_dev_tools.gemspec +6 -5
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/allowed_extensions_spec.rb +5 -17
- data/spec/lib/polish_geeks/dev_tools/commands/base_spec.rb +90 -0
- data/spec/lib/polish_geeks/dev_tools/commands/brakeman_spec.rb +99 -0
- data/spec/lib/polish_geeks/dev_tools/commands/bundler_audit_spec.rb +52 -0
- data/spec/lib/{polishgeeks/dev-tools/commands/empty_method → polish_geeks/dev_tools/commands/empty_methods}/file_parser_spec.rb +1 -1
- data/spec/lib/{polishgeeks/dev-tools/commands/empty_method → polish_geeks/dev_tools/commands/empty_methods}/string_refinements_spec.rb +1 -1
- data/spec/lib/{polishgeeks/dev-tools/commands/empty_method_spec.rb → polish_geeks/dev_tools/commands/empty_methods_spec.rb} +7 -54
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/examples_comparator_spec.rb +8 -8
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/expires_in_spec.rb +1 -1
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/final_blank_line_spec.rb +2 -45
- data/spec/lib/polish_geeks/dev_tools/commands/gemfile_spec.rb +91 -0
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/haml_lint_spec.rb +13 -21
- data/spec/lib/polish_geeks/dev_tools/commands/required_files_spec.rb +51 -0
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/rspec_files_names_spec.rb +2 -2
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/rspec_files_structure_spec.rb +19 -32
- data/spec/lib/polish_geeks/dev_tools/commands/rspec_spec.rb +106 -0
- data/spec/lib/polish_geeks/dev_tools/commands/rubocop_spec.rb +131 -0
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/rubycritic_spec.rb +5 -3
- data/spec/lib/polish_geeks/dev_tools/commands/simplecov_spec.rb +136 -0
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/tasks_files_names_spec.rb +8 -8
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/yard_spec.rb +10 -10
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/commands/yml_parser_spec.rb +2 -2
- data/spec/lib/polish_geeks/dev_tools/config_manager_spec.rb +124 -0
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/config_spec.rb +3 -3
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/errors_spec.rb +0 -0
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/hash_spec.rb +8 -8
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/logger_spec.rb +9 -9
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/output_storer_spec.rb +1 -1
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/runner_spec.rb +0 -0
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/shell_spec.rb +1 -1
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/validators/base_spec.rb +0 -0
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/validators/rails_spec.rb +0 -0
- data/spec/lib/polish_geeks/dev_tools/validators/rubocop_spec.rb +29 -0
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/validators/simplecov_spec.rb +1 -1
- data/spec/lib/{polishgeeks/dev-tools → polish_geeks/dev_tools}/version_spec.rb +0 -0
- data/spec/lib/{polishgeeks-dev-tools_spec.rb → polish_geeks/dev_tools_spec.rb} +2 -2
- data/spec/spec_helper.rb +1 -1
- metadata +141 -99
- data/lib/polishgeeks/dev-tools/commands/readme.rb +0 -32
- data/spec/lib/polishgeeks/dev-tools/commands/base_spec.rb +0 -55
- data/spec/lib/polishgeeks/dev-tools/commands/brakeman_spec.rb +0 -96
- data/spec/lib/polishgeeks/dev-tools/commands/readme_spec.rb +0 -38
- data/spec/lib/polishgeeks/dev-tools/commands/rspec_spec.rb +0 -63
- data/spec/lib/polishgeeks/dev-tools/commands/rubocop_spec.rb +0 -127
- data/spec/lib/polishgeeks/dev-tools/commands/simplecov_spec.rb +0 -134
|
@@ -21,16 +21,35 @@ module PolishGeeks
|
|
|
21
21
|
|
|
22
22
|
# @return [Boolean] true if there were no Rspec failures, false otherwise
|
|
23
23
|
def valid?
|
|
24
|
-
|
|
24
|
+
failures_count.zero? && disallow_pending_valid?
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
# @return [String] default label for this command
|
|
28
28
|
def label
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
"Rspec (#{examples_count} ex, #{failures_count} fa, #{pending_count} pe)"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
|
|
34
|
+
# @return [Integer] how many examples
|
|
35
|
+
def examples_count
|
|
36
|
+
output.scan(EXAMPLES_REGEXP).flatten.first.to_i
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# @return [Integer] how many failures
|
|
40
|
+
def failures_count
|
|
41
|
+
output.scan(FAILURES_REGEXP).flatten.first.to_i
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# @return [Integer] how many pending
|
|
45
|
+
def pending_count
|
|
46
|
+
output.scan(PENDING_REGEXP).flatten.first.to_i
|
|
47
|
+
end
|
|
32
48
|
|
|
33
|
-
|
|
49
|
+
# @return [Boolean] true if pending specs count is zero or we allow
|
|
50
|
+
# pending tests, false otherwise
|
|
51
|
+
def disallow_pending_valid?
|
|
52
|
+
PolishGeeks::DevTools.config.rspec_disallow_pending? ? pending_count.zero? : true
|
|
34
53
|
end
|
|
35
54
|
end
|
|
36
55
|
end
|
|
@@ -13,7 +13,7 @@ module PolishGeeks
|
|
|
13
13
|
CHECKED_DIRS = %w(
|
|
14
14
|
aggregators controllers helpers lib libs models decorators
|
|
15
15
|
presenters services workers mailers requests polishgeeks*
|
|
16
|
-
)
|
|
16
|
+
).freeze
|
|
17
17
|
|
|
18
18
|
# Regexp used to check names in spec files
|
|
19
19
|
CHECK_REGEXP = /(\_spec\.rb)$/
|
|
@@ -13,20 +13,20 @@ module PolishGeeks
|
|
|
13
13
|
FILES_CHECKED = %w(
|
|
14
14
|
app/**/*.rb
|
|
15
15
|
lib/**/*.rb
|
|
16
|
-
)
|
|
16
|
+
).freeze
|
|
17
17
|
|
|
18
18
|
# From where should we take spec files
|
|
19
19
|
RSPEC_FILES = %w(
|
|
20
20
|
spec/**/*_spec.rb
|
|
21
|
-
)
|
|
21
|
+
).freeze
|
|
22
22
|
|
|
23
23
|
# Executes this command
|
|
24
24
|
# @return [Array<String>] empty array if all the files have corresponding
|
|
25
25
|
# rspec files, otherwise array will contain files that doesn't
|
|
26
26
|
def execute
|
|
27
27
|
@output = {
|
|
28
|
-
app: analyzed_files -
|
|
29
|
-
rspec:
|
|
28
|
+
app: analyzed_files - analyzed_rspec_files,
|
|
29
|
+
rspec: analyzed_rspec_files - analyzed_files
|
|
30
30
|
}
|
|
31
31
|
end
|
|
32
32
|
|
|
@@ -53,9 +53,7 @@ module PolishGeeks
|
|
|
53
53
|
# @return [Array<String>] array with list of files that we want to compare with
|
|
54
54
|
# those from Rspec that should exist
|
|
55
55
|
def analyzed_files
|
|
56
|
-
files =
|
|
57
|
-
Dir[File.join(DevTools.app_root, dir)]
|
|
58
|
-
end
|
|
56
|
+
files = checked_files
|
|
59
57
|
|
|
60
58
|
files.flatten!
|
|
61
59
|
files.uniq!
|
|
@@ -70,8 +68,8 @@ module PolishGeeks
|
|
|
70
68
|
end
|
|
71
69
|
|
|
72
70
|
# @return [Array<String>] rspec files that should correspond with analyzed_files
|
|
73
|
-
def
|
|
74
|
-
files =
|
|
71
|
+
def analyzed_rspec_files
|
|
72
|
+
files = rspec_files
|
|
75
73
|
|
|
76
74
|
files.flatten!
|
|
77
75
|
|
|
@@ -128,6 +126,21 @@ module PolishGeeks
|
|
|
128
126
|
def excludes
|
|
129
127
|
DevTools.config.rspec_files_structure_ignored || []
|
|
130
128
|
end
|
|
129
|
+
|
|
130
|
+
# @return [Array<String>] files that should be analyzed
|
|
131
|
+
def directory_files(dir)
|
|
132
|
+
Dir[File.join(DevTools.app_root, dir)]
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# @return [Array<String>] array with list of files that we want to compare
|
|
136
|
+
def checked_files
|
|
137
|
+
FILES_CHECKED.map { |dir| directory_files(dir) }
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# @return [Array<String>] array with list of files that we want to compare
|
|
141
|
+
def rspec_files
|
|
142
|
+
RSPEC_FILES.map { |dir| directory_files(dir) }
|
|
143
|
+
end
|
|
131
144
|
end
|
|
132
145
|
end
|
|
133
146
|
end
|
|
@@ -4,6 +4,7 @@ module PolishGeeks
|
|
|
4
4
|
# Command wrapper for Rubocop validation
|
|
5
5
|
# It informs us if code is formatted in a proper way
|
|
6
6
|
class Rubocop < Base
|
|
7
|
+
self.config_manager = ConfigManager.new('rubocop.yml')
|
|
7
8
|
self.type = :validator
|
|
8
9
|
|
|
9
10
|
# Regexp used to get number of inspected files
|
|
@@ -14,13 +15,10 @@ module PolishGeeks
|
|
|
14
15
|
# Executes this command
|
|
15
16
|
# @return [String] command output
|
|
16
17
|
def execute
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
cmd = "bundle exec rubocop -c #{config} #{PolishGeeks::DevTools.app_root}"
|
|
22
|
-
|
|
23
|
-
@output = Shell.new.execute(cmd)
|
|
18
|
+
cmd = ["bundle exec rubocop #{PolishGeeks::DevTools.app_root}"]
|
|
19
|
+
cmd << "-c #{self.class.config_manager.path}" if self.class.config_manager.present?
|
|
20
|
+
cmd << '--require rubocop-rspec' if Config.config.rubocop_rspec?
|
|
21
|
+
@output = Shell.new.execute(cmd.join(' '))
|
|
24
22
|
end
|
|
25
23
|
|
|
26
24
|
# @return [Boolean] true if there were no Rubocop offenses detected
|
|
@@ -30,7 +28,11 @@ module PolishGeeks
|
|
|
30
28
|
|
|
31
29
|
# @return [String] default label for this command
|
|
32
30
|
def label
|
|
33
|
-
|
|
31
|
+
msg = []
|
|
32
|
+
msg << 'Rubocop'
|
|
33
|
+
msg << 'with RSpec' if Config.config.rubocop_rspec?
|
|
34
|
+
msg << "(#{files_count} files, #{offenses_count} offenses)"
|
|
35
|
+
msg.join(' ')
|
|
34
36
|
end
|
|
35
37
|
|
|
36
38
|
private
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -20,40 +20,48 @@ module PolishGeeks
|
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
attr_accessor :simplecov_threshold
|
|
24
|
-
|
|
25
23
|
%i(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
required_files_include
|
|
25
|
+
rspec_files_structure_ignored
|
|
26
|
+
expires_in_files_ignored
|
|
27
|
+
final_blank_line_ignored
|
|
28
|
+
empty_methods_ignored
|
|
29
|
+
simplecov_threshold
|
|
30
30
|
).each do |attr|
|
|
31
|
-
attr_accessor
|
|
31
|
+
attr_accessor attr
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
# Available commands
|
|
35
35
|
# All commands will be executed in this order (first rubocop, then rspec, etc)
|
|
36
36
|
COMMANDS = %i(
|
|
37
|
-
|
|
37
|
+
required_files
|
|
38
|
+
gemfile
|
|
38
39
|
expires_in
|
|
40
|
+
examples_comparator
|
|
41
|
+
allowed_extensions
|
|
42
|
+
yml_parser
|
|
43
|
+
final_blank_line
|
|
39
44
|
brakeman
|
|
40
45
|
rubocop
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
bundler_audit
|
|
47
|
+
empty_methods
|
|
43
48
|
haml_lint
|
|
44
|
-
allowed_extensions
|
|
45
|
-
yml_parser
|
|
46
49
|
rspec_files_names
|
|
47
50
|
rspec_files_structure
|
|
48
51
|
tasks_files_names
|
|
49
52
|
rspec
|
|
50
53
|
simplecov
|
|
51
54
|
yard
|
|
52
|
-
examples_comparator
|
|
53
55
|
rubycritic
|
|
54
|
-
)
|
|
56
|
+
).freeze
|
|
57
|
+
|
|
58
|
+
# Additional options for commands
|
|
59
|
+
COMMANDS_OPTIONS = %i(
|
|
60
|
+
rubocop_rspec
|
|
61
|
+
rspec_disallow_pending
|
|
62
|
+
).freeze
|
|
55
63
|
|
|
56
|
-
COMMANDS.each do |attr_name|
|
|
64
|
+
(COMMANDS + COMMANDS_OPTIONS).each do |attr_name|
|
|
57
65
|
attr_accessor attr_name
|
|
58
66
|
|
|
59
67
|
# @return [Boolean] is given command enabled
|
|
@@ -65,7 +73,7 @@ module PolishGeeks
|
|
|
65
73
|
# Initializes configuration and turn on by default
|
|
66
74
|
# all the commands
|
|
67
75
|
def initialize
|
|
68
|
-
COMMANDS.each do |attr_name|
|
|
76
|
+
(COMMANDS + COMMANDS_OPTIONS).each do |attr_name|
|
|
69
77
|
public_send(:"#{attr_name}=", true)
|
|
70
78
|
end
|
|
71
79
|
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
module PolishGeeks
|
|
2
|
+
module DevTools
|
|
3
|
+
# Config manager which is able to check if config file exist either in local
|
|
4
|
+
# or application path
|
|
5
|
+
# @example
|
|
6
|
+
# config_manager = ConfigManager.new('rubocop.yml')
|
|
7
|
+
# config_manager.present? = true
|
|
8
|
+
# config_manager.path = /home/pg/project/.rubocop.yml
|
|
9
|
+
class ConfigManager
|
|
10
|
+
def initialize(file_name)
|
|
11
|
+
@file_name = file_name
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# @return [Boolean] true if there is a local or application config file present
|
|
15
|
+
def present?
|
|
16
|
+
application? || local?
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# If there is an application config file use that, if not
|
|
20
|
+
# check if local config file is available if not return nil
|
|
21
|
+
# @return [String] path to config file or nil
|
|
22
|
+
# @example
|
|
23
|
+
# /home/pg/project/.rubocop.yml
|
|
24
|
+
def path
|
|
25
|
+
application? ? application_path : local_path
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
# @return [Boolean] true if there is a config present locally
|
|
31
|
+
def local?
|
|
32
|
+
!@file_name.nil? && !local_path.nil?
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Provides path to local config file if it exists
|
|
36
|
+
# @return [String] path to local config file
|
|
37
|
+
def local_path
|
|
38
|
+
fetch_path(DevTools.gem_root)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# @return [Boolean] true if there is a config present in the application
|
|
42
|
+
def application?
|
|
43
|
+
!@file_name.nil? && !application_path.nil?
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Provides path to application config file if it exists
|
|
47
|
+
# @return [String] path to application config file
|
|
48
|
+
def application_path
|
|
49
|
+
fetch_path(DevTools.app_root)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Searches for provided file name as well as one with dot in front of it
|
|
53
|
+
# in main directory and config subdirectory
|
|
54
|
+
# @return [String] path to config file if it exists
|
|
55
|
+
# @example
|
|
56
|
+
# /home/pg/project/.rubocop.yml
|
|
57
|
+
def fetch_path(start_path)
|
|
58
|
+
['', 'config'].each do |directory|
|
|
59
|
+
['', '.'].each do |prefix|
|
|
60
|
+
path = File.join(start_path, directory, "#{prefix}#{@file_name}")
|
|
61
|
+
return path if File.exist?(path)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
nil
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
File without changes
|
|
File without changes
|
|
@@ -16,7 +16,7 @@ module PolishGeeks
|
|
|
16
16
|
info(task)
|
|
17
17
|
else
|
|
18
18
|
fatal(task)
|
|
19
|
-
|
|
19
|
+
raise Errors::RequirementsError
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
@@ -31,9 +31,9 @@ module PolishGeeks
|
|
|
31
31
|
msg = 'GENERATED' if task.class.generator?
|
|
32
32
|
msg = 'OK' if task.class.validator?
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
raise Errors::UnknownTaskType unless msg
|
|
35
35
|
|
|
36
|
-
printf('%-
|
|
36
|
+
printf('%-50s %2s', "#{label(task)} ", "\e[32m#{msg}\e[0m\n")
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
# Will print message when task did fail while running
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -12,13 +12,13 @@ module PolishGeeks
|
|
|
12
12
|
# This should be implemented in a subclass
|
|
13
13
|
# @return [Boolean] if validation check is valid or not
|
|
14
14
|
def valid?
|
|
15
|
-
|
|
15
|
+
raise Errors::NotImplementedError
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
# @raise [PreCommandValidationError] when valid? return false
|
|
19
19
|
# @return [Boolean] if validation check is valid or not
|
|
20
20
|
def validate!
|
|
21
|
-
|
|
21
|
+
raise Errors::PreCommandValidationError unless valid?
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
end
|
|
File without changes
|
|
@@ -7,7 +7,7 @@ module PolishGeeks
|
|
|
7
7
|
MATCH_REGEXP = /\(\d+.\d+\%\) covered/
|
|
8
8
|
|
|
9
9
|
def valid?
|
|
10
|
-
Object.const_defined?('SimpleCov') || (!output.nil? && output.
|
|
10
|
+
Object.const_defined?('SimpleCov') || (!output.nil? && !output.empty?)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
# Searches if we have SimpleCov hooked to rspec
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
%w(
|
|
12
12
|
validators/base
|
|
13
13
|
commands/base
|
|
14
|
-
commands/
|
|
15
|
-
commands/
|
|
16
|
-
).each { |lib| require "
|
|
14
|
+
commands/empty_methods
|
|
15
|
+
commands/empty_methods/string_refinements
|
|
16
|
+
).each { |lib| require "polish_geeks/dev_tools/#{lib}" }
|
|
17
17
|
|
|
18
18
|
%w(
|
|
19
19
|
*.rb
|
|
@@ -21,34 +21,9 @@
|
|
|
21
21
|
commands/*.rb
|
|
22
22
|
commands/**/*.rb
|
|
23
23
|
).each do |path|
|
|
24
|
-
base_path = File.dirname(__FILE__) + "/
|
|
24
|
+
base_path = File.dirname(__FILE__) + "/polish_geeks/dev_tools/#{path}"
|
|
25
25
|
Dir[base_path].each { |file| require file }
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# This is just an alias so we can use it from DevTools directly
|
|
31
|
-
# @return [PolishGeeks::DevTools::Config.config]
|
|
32
|
-
def self.config
|
|
33
|
-
Config.config
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# @return [String] root path of this gem
|
|
37
|
-
def self.gem_root
|
|
38
|
-
File.expand_path('../..', __FILE__)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
# @return [String] app root path
|
|
42
|
-
def self.app_root
|
|
43
|
-
File.dirname(ENV['BUNDLE_GEMFILE'])
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
# Sets up the whole configuration
|
|
47
|
-
# @param [Block] block
|
|
48
|
-
def self.setup(&block)
|
|
49
|
-
Config.setup(&block)
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
load 'polishgeeks/dev-tools/tasks/dev-tools.rake'
|
|
28
|
+
require 'polish_geeks/dev_tools'
|
|
29
|
+
load 'polish_geeks/dev_tools/tasks/dev-tools.rake'
|