polishgeeks-dev-tools 1.2.0 → 1.2.1
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/.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
@@ -1,32 +0,0 @@
|
|
1
|
-
module PolishGeeks
|
2
|
-
module DevTools
|
3
|
-
module Command
|
4
|
-
# Command wrapper for Simplecov statistics
|
5
|
-
# It informs us if Simplecov coverage stats were generated
|
6
|
-
class Simplecov < Base
|
7
|
-
self.type = :validator
|
8
|
-
|
9
|
-
# Regexp used to match code coverage from Simplecov generated output
|
10
|
-
MATCH_REGEXP = /\(\d+.\d+\%\) covered/
|
11
|
-
|
12
|
-
# Executes this command
|
13
|
-
# @return [String] command output
|
14
|
-
# @note Since this command wrapper is using external output
|
15
|
-
# information (from Rspec), it doesn't execute any shell tasks
|
16
|
-
def execute
|
17
|
-
@output = stored_output.rspec
|
18
|
-
end
|
19
|
-
|
20
|
-
# @return [Boolean] true if Simplecov coverage was generated
|
21
|
-
def valid?
|
22
|
-
output[MATCH_REGEXP].length > 0
|
23
|
-
end
|
24
|
-
|
25
|
-
# @return [String] default label for this command
|
26
|
-
def label
|
27
|
-
"Simplecov #{output[MATCH_REGEXP]}"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,127 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe PolishGeeks::DevTools::Command::Base do
|
4
|
-
subject { described_class.new }
|
5
|
-
|
6
|
-
describe '#execute' do
|
7
|
-
it { expect { subject.execute }. to raise_error(NotImplementedError) }
|
8
|
-
end
|
9
|
-
|
10
|
-
describe '#valid?' do
|
11
|
-
it { expect { subject.valid? }. to raise_error(NotImplementedError) }
|
12
|
-
end
|
13
|
-
|
14
|
-
describe '#error_message' do
|
15
|
-
let(:output) { rand.to_s }
|
16
|
-
|
17
|
-
before do
|
18
|
-
subject.instance_variable_set('@output', output)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'by default should equal raw output' do
|
22
|
-
expect(subject.error_message).to eq output
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe '#new' do
|
27
|
-
it 'should execute ensure_framework_if_required' do
|
28
|
-
expect_any_instance_of(described_class)
|
29
|
-
.to receive(:ensure_framework_if_required)
|
30
|
-
.once
|
31
|
-
|
32
|
-
described_class.new
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe '#ensure_framework_if_required' do
|
37
|
-
context 'when there is no framework required' do
|
38
|
-
before { described_class.framework = nil }
|
39
|
-
|
40
|
-
it { expect { subject.send(:ensure_framework_if_required) }.to_not raise_error }
|
41
|
-
end
|
42
|
-
|
43
|
-
context 'when there rails is required' do
|
44
|
-
before { described_class.framework = :rails }
|
45
|
-
|
46
|
-
context 'and it is included' do
|
47
|
-
before do
|
48
|
-
expect(PolishGeeks::DevTools)
|
49
|
-
.to receive(:config)
|
50
|
-
.and_return(double(rails?: true))
|
51
|
-
.exactly(2).times
|
52
|
-
end
|
53
|
-
|
54
|
-
it { expect { subject.send(:ensure_framework_if_required) }.to_not raise_error }
|
55
|
-
end
|
56
|
-
|
57
|
-
context 'and it is not included' do
|
58
|
-
before do
|
59
|
-
expect(PolishGeeks::DevTools)
|
60
|
-
.to receive(:config)
|
61
|
-
.and_return(double(rails?: false))
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'should raise exception' do
|
65
|
-
error = described_class::MissingFramework
|
66
|
-
expect { subject.send(:ensure_framework_if_required) }.to raise_error(error, 'rails')
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
context 'when there sinatra is required' do
|
72
|
-
before { described_class.framework = :sinatra }
|
73
|
-
|
74
|
-
context 'and it is included' do
|
75
|
-
before do
|
76
|
-
expect(PolishGeeks::DevTools)
|
77
|
-
.to receive(:config)
|
78
|
-
.and_return(double(sinatra?: true))
|
79
|
-
.exactly(2).times
|
80
|
-
end
|
81
|
-
|
82
|
-
it { expect { subject.send(:ensure_framework_if_required) }.to_not raise_error }
|
83
|
-
end
|
84
|
-
|
85
|
-
context 'and it is not included' do
|
86
|
-
before do
|
87
|
-
expect(PolishGeeks::DevTools)
|
88
|
-
.to receive(:config)
|
89
|
-
.and_return(double(sinatra?: false))
|
90
|
-
end
|
91
|
-
|
92
|
-
it 'should raise exception' do
|
93
|
-
error = described_class::MissingFramework
|
94
|
-
expect { subject.send(:ensure_framework_if_required) }.to raise_error(error, 'sinatra')
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
describe 'class type definer' do
|
101
|
-
subject { described_class.dup }
|
102
|
-
|
103
|
-
context 'when it is generator' do
|
104
|
-
before { subject.type = :generator }
|
105
|
-
|
106
|
-
describe '.generator?' do
|
107
|
-
it { expect(subject.generator?).to eq true }
|
108
|
-
end
|
109
|
-
|
110
|
-
describe '.validator?' do
|
111
|
-
it { expect(subject.validator?).to eq false }
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
context 'when it is validator' do
|
116
|
-
before { subject.type = :validator }
|
117
|
-
|
118
|
-
describe '.generator?' do
|
119
|
-
it { expect(subject.generator?).to eq false }
|
120
|
-
end
|
121
|
-
|
122
|
-
describe '.validator?' do
|
123
|
-
it { expect(subject.validator?).to eq true }
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe PolishGeeks::DevTools::Command::Simplecov do
|
4
|
-
subject { described_class.new }
|
5
|
-
|
6
|
-
let(:label) { '(95.00%) covered' }
|
7
|
-
|
8
|
-
describe '#execute' do
|
9
|
-
context 'when we run simplecov' do
|
10
|
-
let(:output) { OpenStruct.new(rspec: label) }
|
11
|
-
|
12
|
-
before do
|
13
|
-
subject.instance_variable_set(:@stored_output, output)
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'should execute the command' do
|
17
|
-
expect(subject.execute).to eq label
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '#valid?' do
|
23
|
-
context 'when a report was generated' do
|
24
|
-
before do
|
25
|
-
subject.instance_variable_set(:@output, label)
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'should return true' do
|
29
|
-
expect(subject.valid?).to eq true
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe '#label' do
|
35
|
-
context 'when we run simplecov' do
|
36
|
-
before do
|
37
|
-
subject.instance_variable_set(:@output, label)
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'should return the label' do
|
41
|
-
expect(subject.label).to eq 'Simplecov (95.00%) covered'
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe '.generator?' do
|
47
|
-
it { expect(described_class.generator?).to eq false }
|
48
|
-
end
|
49
|
-
|
50
|
-
describe '.validator?' do
|
51
|
-
it { expect(described_class.validator?).to eq true }
|
52
|
-
end
|
53
|
-
end
|