renuo-bin-check 1.0.0.beta1 → 1.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49b29562f89e957c52c206a952c8f84b3856915d
4
- data.tar.gz: 0d97bdbf04362dce1aac65134a65b42cecbcb30a
3
+ metadata.gz: 48fab45d683bbc1e9cd8333ff87c35425389711a
4
+ data.tar.gz: 5384edf0fdd441236be7eb1da70f1556e098f4fd
5
5
  SHA512:
6
- metadata.gz: d61ab0b4118331bfa28413ec370a9d4f2d9bb5af2cf17bae2f3cef757613a8ff9d153beeb027ab92c5635ac339486c7fde0bbe351bcb9ca86a3d2fe842c48c09
7
- data.tar.gz: d6982dd518a622bd5c55a4e2ac73ce95c63553e21395a4fc7c34982e147a1f316343cfbe0bf9c6a0d62f52be1c052fdea4a29a0462a95632808082b217b0ec80
6
+ metadata.gz: 1f0b98a715b68b7d732e6923a2a2f8575e3f40bf40fdd69916927bf01c4a048fa803e459110ceb795b1fb89a2d9098c4cf3ce0434c0e1d7800f22f53131a724c
7
+ data.tar.gz: d9b52541149d25add4e55ec50ff6dc01afe9d0e16863354b019803e2309e79526a7626faeb74b2c60d4aeee9d3bda1f0a35a03864ed3906cbb9de45fe404d232
@@ -10,9 +10,19 @@ Style/Documentation:
10
10
  Style/NonNilCheck:
11
11
  IncludeSemanticChanges: true
12
12
 
13
+ Style/FileName:
14
+ Exclude:
15
+ - 'Gemfile.local.rb'
16
+ - 'Gemfile.local.example.rb'
17
+
13
18
  Style/FrozenStringLiteralComment:
14
19
  Enabled: false
15
20
 
21
+ Metrics/BlockLength:
22
+ Enabled: true
23
+ Exclude:
24
+ - spec/**/*
25
+
16
26
  AllCops:
17
27
  TargetRubyVersion: 2.3
18
28
  Include:
@@ -53,3 +53,10 @@ This release introduces a new fancy DSL (yeyy) which is easier to use and brings
53
53
  * Defaults are available and can be used
54
54
 
55
55
  * Possibility to exclude specific checks of a default
56
+
57
+ ## Version 1.0.0.beta2
58
+
59
+ Fix mistakes in Default Scripts:
60
+ * Rubocop autocorrect fails if any issues are found, even if they can be autocorrected.
61
+ * Rspec wont use the cache, if the Gemfile.lock has changed.
62
+ * Rubocop wont use the cache, if any file from `config/**/*.rb` has changed.
data/README.md CHANGED
@@ -14,7 +14,7 @@ Add renuo-bin-check to your Gemfile:
14
14
  gem 'renuo-bin-check', group: :bin_check
15
15
  ```
16
16
 
17
- Create a file at any place you want. Usually it would be called `bin/check though.
17
+ Create a file at any place you want. Usually it would be called `bin/check` though.
18
18
  You can now configure your checks like that:
19
19
 
20
20
  ```rb
@@ -25,7 +25,7 @@ Bundler.require(:bin_check)
25
25
  # run bin-check with rails-defaults
26
26
  BinCheck.run do
27
27
  #add a new check
28
- <name-of-check> do
28
+ <name_of_check> do
29
29
  command "<a one line command or a path to a script>"
30
30
  files ['<path-to-file-1>', '<path-to-file-2>']
31
31
  reversed_exit <true or false>
@@ -45,13 +45,13 @@ It is also possible to have common configurations and to not run the rails-defau
45
45
  #run bin without defaults
46
46
  BinCheck.run :no_defaults do
47
47
  # define common settings for all checks in the block
48
- <name of your common configuration> do
48
+ <name_of_your_common_configuration> do
49
49
  reversed_exit <true or false>
50
50
  success_message '<output to display if script succeeds>'
51
51
  error_message '<output to display if script fails>'
52
52
 
53
53
  # add check
54
- <name-of-check> do
54
+ <name_of_check> do
55
55
  # add specific settings for this check
56
56
  command "<a one line command or a path to a script>"
57
57
  files ['<path-to-file-1>', '<path-to-file-2>']
@@ -62,20 +62,6 @@ BinCheck.run :no_defaults do
62
62
  end
63
63
  ```
64
64
 
65
- ## Setup
66
-
67
- git clone git@github.com:renuo/renuo-bin-check.git
68
- cd renuo-bin-check
69
- bin/setup
70
-
71
-
72
- ## Run Tests
73
-
74
- The following script will run *rspec*, *rubocop*, *reek*, scanner for debugging outputs and a scanner for TODOs
75
-
76
- bin/check
77
-
78
-
79
65
  ### Options for Configuration
80
66
 
81
67
  #### command
@@ -178,7 +164,7 @@ The configuration options can be called in any order.
178
164
 
179
165
  ```rb
180
166
  BinCheck do
181
- todo-grepper do
167
+ todo_grepper do
182
168
  command "grep --exclude-dir='app/assets/typings/**' -i -r 'TODO'"\
183
169
  "app spec config db Rakefile README.md Gemfile"
184
170
  files ['app/**/*', 'spec/**/*', 'config/**/*', 'db/**/*', 'Rakefile', 'README.md', 'Gemfile']
@@ -194,6 +180,20 @@ end
194
180
  * scss-lint doesnt work yet with renuo-bin-check
195
181
  * reek doesnt work yet with renuo-bin-check
196
182
 
183
+ ## Setup
184
+
185
+ git clone git@github.com:renuo/renuo-bin-check.git
186
+ cd renuo-bin-check
187
+ bin/setup
188
+
189
+
190
+ ## Run Tests
191
+
192
+ The following script will run *rspec*, *rubocop*, *reek*, scanner for debugging outputs and a scanner for TODOs
193
+
194
+ bin/check
195
+
196
+
197
197
  ## Contribute
198
198
 
199
199
  If you would like to contribute, you're very welcome to.
@@ -10,10 +10,8 @@ class BinCheck
10
10
  end
11
11
  end
12
12
 
13
- def respond_to_missing?
14
- #:nocov:
13
+ def self.respond_to_missing?(_name, *_params)
15
14
  true
16
- #:nocov:
17
15
  end
18
16
 
19
17
  def self.run(default = :rails_defaults, &check)
@@ -108,7 +108,7 @@ module RenuoBinCheck
108
108
  def tslint(bin_check)
109
109
  bin_check.check do |config|
110
110
  config.command 'tslint -c tslint.json app/assets/javascripts/**/*.ts'
111
- config.files ['app/assets/javascripts/**/*.ts']
111
+ config.files ['app/**/*.ts']
112
112
  end
113
113
  end
114
114
 
@@ -128,14 +128,16 @@ module RenuoBinCheck
128
128
  def reek(bin_check)
129
129
  bin_check.check do |config|
130
130
  config.command 'bundle exec reek'
131
- config.files ['app/**/*.rb']
131
+ config.files ['app/**/*.rb', 'spec/**/*.rb', 'config/**/*', 'db/**/*.rb', 'lib/**/*.rb', 'lib/**/*.rake',
132
+ 'lib/**/*.rake', 'Gemfile*', '.reek']
132
133
  end
133
134
  end
134
135
 
135
136
  def rspec(bin_check)
136
137
  bin_check.check do |config|
137
138
  config.command 'bundle exec rspec'
138
- config.files ['app/**/*.rb', 'spec/**/*.rb']
139
+ config.files ['app/**/*.rb', 'spec/**/*.rb', 'config/**/*', 'db/**/*.rb', 'lib/**/*.rb', 'lib/**/*.rake',
140
+ 'lib/**/*.rake', 'Gemfile', 'Gemfile.lock', '.rspec']
139
141
  end
140
142
  end
141
143
 
@@ -47,6 +47,7 @@ class DefaultScripts
47
47
  rspec
48
48
  @default_scripts
49
49
  end
50
+
50
51
  # rubocop:enable Metrics/MethodLength
51
52
 
52
53
  def todo
@@ -105,8 +106,8 @@ class DefaultScripts
105
106
 
106
107
  def rubocop_autocorrect
107
108
  @default_scripts << DSLConfig.new('rubocop_autocorrect') do
108
- command 'bundle exec rubocop -a -D -c .rubocop.yml'
109
- files ['app/**/*.rb', 'spec/**/*.rb']
109
+ command File.join(File.dirname(__FILE__), 'rubocop-autocorrect.sh')
110
+ files ['app/**/*.rb', 'spec/**/*.rb', 'config/**/*.rb']
110
111
  end
111
112
  end
112
113
 
@@ -161,7 +162,8 @@ class DefaultScripts
161
162
  def rspec
162
163
  @default_scripts << DSLConfig.new('rspec') do
163
164
  command 'bundle exec rspec'
164
- files ['app/**/*.rb', 'spec/**/*.rb']
165
+ files ['app/**/*.rb', 'spec/**/*.rb', 'config/**/*', 'db/**/*.rb', 'lib/**/*.rb', 'lib/**/*.rake',
166
+ 'lib/**/*.rake', 'Gemfile', 'Gemfile.lock', '.rspec']
165
167
  end
166
168
  end
167
169
  end
@@ -0,0 +1,11 @@
1
+ #!/bin/zsh
2
+
3
+ source ~/.zshrc
4
+
5
+ bundle exec rubocop -D -c .rubocop.yml --fail-fast
6
+ if [ ! $? -eq 0 ]; then
7
+ echo 'rubocop detected issues!'
8
+ bundle exec rubocop -a -D -c .rubocop.yml
9
+ echo 'Tried to auto correct the issues, but must be reviewed manually, commit aborted'
10
+ exit 1
11
+ fi
@@ -4,6 +4,11 @@ module RenuoBinCheck
4
4
  attr_accessor :script_command, :script_files, :script_name, :script_reversed_exit, :script_standard_output,
5
5
  :script_error_output, :appended_standard_output, :appended_error_output
6
6
 
7
+ def initialize
8
+ @script_command = nil
9
+ @script_reversed_exit = nil
10
+ end
11
+
7
12
  def command(command)
8
13
  @script_command = command
9
14
  end
@@ -53,9 +58,15 @@ module RenuoBinCheck
53
58
  end
54
59
 
55
60
  def script_command
56
- raise 'There must be a command set for each script you want to run. Find further instruction on how to use this' \
57
- ' Gem here in the Readme: https://github.com/renuo/renuo-bin-check' unless @script_command
61
+ raise_script_command_not_set unless @script_command
58
62
  @script_command
59
63
  end
64
+
65
+ private
66
+
67
+ def raise_script_command_not_set
68
+ raise 'There must be a command set for each script you want to run. Find further instruction on how to use' \
69
+ ' this Gem here in the Readme: https://github.com/renuo/renuo-bin-check'
70
+ end
60
71
  end
61
72
  end
@@ -8,6 +8,7 @@ module RenuoBinCheck
8
8
  @script_config = script_config
9
9
  script_files = @script_config.script_files
10
10
  @cacher = Cacher.new(@script_config.script_name, script_files) if script_files
11
+ @result = nil
11
12
  end
12
13
 
13
14
  def run
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module RenuoBinCheck
3
- VERSION = '1.0.0.beta1'
3
+ VERSION = '1.0.0.beta2'
4
4
  end
@@ -112,12 +112,10 @@ RSpec.describe DefaultScripts do
112
112
  end
113
113
 
114
114
  it '#rubocop_autocorrect' do
115
- expect(default_scripts.rubocop_autocorrect.last.configs)
116
- .to eq(
117
- name: 'rubocop_autocorrect',
118
- command: 'bundle exec rubocop -a -D -c .rubocop.yml',
119
- files: ['app/**/*.rb', 'spec/**/*.rb']
120
- )
115
+ configs = default_scripts.rubocop_autocorrect.last.configs
116
+ expect(configs[:name]).to eq('rubocop_autocorrect')
117
+ expect(configs[:command]).to end_with('lib/renuo_bin_check/default_scripts/rubocop-autocorrect.sh')
118
+ expect(configs[:files]).to eq(['app/**/*.rb', 'spec/**/*.rb', 'config/**/*.rb'])
121
119
  end
122
120
 
123
121
  it '#slim_lint' do
@@ -185,7 +183,8 @@ RSpec.describe DefaultScripts do
185
183
  .to eq(
186
184
  name: 'rspec',
187
185
  command: 'bundle exec rspec',
188
- files: ['app/**/*.rb', 'spec/**/*.rb']
186
+ files: ['app/**/*.rb', 'spec/**/*.rb', 'config/**/*', 'db/**/*.rb', 'lib/**/*.rb', 'lib/**/*.rake',
187
+ 'lib/**/*.rake', 'Gemfile', 'Gemfile.lock', '.rspec']
189
188
  )
190
189
  end
191
190
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renuo-bin-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta1
4
+ version: 1.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zora Fuchs
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-12 00:00:00.000000000 Z
11
+ date: 2017-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -209,6 +209,7 @@ files:
209
209
  - lib/renuo_bin_check/cacher.rb
210
210
  - lib/renuo_bin_check/default_scripts/default_rails.rb
211
211
  - lib/renuo_bin_check/default_scripts/default_scripts.rb
212
+ - lib/renuo_bin_check/default_scripts/rubocop-autocorrect.sh
212
213
  - lib/renuo_bin_check/dsl_config.rb
213
214
  - lib/renuo_bin_check/initializer.rb
214
215
  - lib/renuo_bin_check/master_thread.rb