m-spec 0.1.6 → 0.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6420629e2b27b246efaca92e6ad572603eaaf05bfaf716b0d386cadebafab8f9
4
- data.tar.gz: 33e8d052ef1d6513a06e9048ac12ce95c51b1597c3ef7246b4d360619b304cab
3
+ metadata.gz: 1dcf77e4015cb8bb7c3a1e9c0bdba696607e9b5e1c194498cb260373e7038921
4
+ data.tar.gz: 81821b568580532c5b5c4cf18b457f947185a83932d4b9359b57b3e85c211502
5
5
  SHA512:
6
- metadata.gz: f9484c58fa989d6dea4c2a94abed38d2d769b04c663c3206588961d41858f3ae1c2afda4cfac94b515c9364191131b96913d335d1379765f8af495ec6da9ddba
7
- data.tar.gz: 21ba3b262a018015878cac2b140acbde0e46ad6e916cb17de44e1a25ea4861d49478d67cd05050d354c96ac180647110b3a9937e452c86319cc3098c5ab24255
6
+ metadata.gz: 4638a25c2f039e6bbb4a550db34a1b228414e30037209b50ea273e7173717eed1e931f5bc58bffd888041e0f6a84b54d46fc770bcd970f8ca98c9a150f7af72b
7
+ data.tar.gz: f1ede96eae952c17fb581b02741cadf44ea619bb0dade5a69f0b27133f482a1642cf8c3e22fee17c2ff8fac7cc7b4aa3172e8b3d0060d6ab3e036d3eefd9012f
@@ -0,0 +1,12 @@
1
+ # _____ ____ ____ __ _ __
2
+ # / ___/ _____ ____ _ / __// __/____ / / (_)____ / /_
3
+ # \__ \ / ___// __ `// /_ / /_ / __ \ / / / // __ \ / __/
4
+ # ___/ // /__ / /_/ // __// __// /_/ // /___ / // / / // /_
5
+ # /____/ \___/ \__,_//_/ /_/ 1 \____//_____//_//_/ /_/ \__/
6
+ #
7
+ # The linter file that doesn't lead junior developers to bad habits.
8
+ # https://github.com/makersacademy/scaffolint
9
+ #
10
+ # Configure Rubocop to use the config file in the Scaffolint GitHub repo
11
+ inherit_from:
12
+ - https://raw.githubusercontent.com/makersacademy/scaffolint/v1.1.0/.rubocop.yml
data/README.md CHANGED
@@ -73,6 +73,17 @@ It's got simple one-level indentation, simple colour coding for test passes and
73
73
 
74
74
  Remember - you'll have to manage yourself: test setup and teardown, keeping test code dry, each test running in isolation, and loading source code properly.
75
75
 
76
+ ## Rubocop
77
+
78
+ M-spec comes with rubocop by default, using this [set of rules](https://github.com/makersacademy/scaffolint). To configure your test suite to disable rubocop or to only run rubcop, add an optional configuration file named `.m-spec` to your project root where you run your specs from. You don't need the configuration file - by default your specs will run first, followed by rubocop.
79
+
80
+ You can add either of two options
81
+ - `--no-rubocop` which will ignore running rubocop
82
+ - `--only-rubocop` which will ignore running your tests
83
+
84
+ See [rubocop documentation](https://docs.rubocop.org/rubocop/index.html) for more info - you might be interested in reading about rubocop's autocorrect command.
85
+
86
+
76
87
  ## Extending
77
88
 
78
89
  After checking out the repo
data/exe/m-spec CHANGED
@@ -1,5 +1,29 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'm-spec'
3
3
 
4
- spec_file = ARGV[0]
5
- require spec_file
4
+ def run_rubocop!
5
+ config = "$GEM_HOME/gems/m-spec-#{Mspec::VERSION}/.rubocop.yml"
6
+ system("bundle exec rubocop --config #{config}")
7
+ end
8
+
9
+ def run_specs!
10
+ spec_file = ARGV[0]
11
+ require spec_file
12
+ end
13
+
14
+ if File.exists?('./.m-spec')
15
+ File.open('./.m-spec', 'r') do |file|
16
+ options = file.read.split
17
+ if options.include?('--only-rubocop')
18
+ run_rubocop!
19
+ elsif options.include?('--no-rubocop')
20
+ run_specs!
21
+ else
22
+ run_specs!
23
+ run_rubocop!
24
+ end
25
+ end
26
+ else
27
+ run_specs!
28
+ run_rubocop!
29
+ end
@@ -1,3 +1,3 @@
1
1
  module Mspec
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -22,6 +22,8 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
+ spec.add_dependency "rubocop", "~> 0.79.0"
26
+
25
27
  spec.add_development_dependency "bundler", "~> 2.1"
26
28
  spec.add_development_dependency "rake", ">= 12.3.3"
27
29
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: m-spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edward Withers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-29 00:00:00.000000000 Z
11
+ date: 2020-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubocop
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.79.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.79.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -48,6 +62,7 @@ extensions: []
48
62
  extra_rdoc_files: []
49
63
  files:
50
64
  - ".gitignore"
65
+ - ".rubocop.yml"
51
66
  - CODE_OF_CONDUCT.md
52
67
  - Gemfile
53
68
  - LICENSE.txt