quickfix_formatter 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a464000edd8b10c8a089604971668774b2291e56817e274ce8e24675ee5201db
4
+ data.tar.gz: 9ff5e11cf4d342e2614543408a95e3dcd3582fcbaf94100318dcdcd3076bffc0
5
+ SHA512:
6
+ metadata.gz: 768cae8e6dae2a10c733b8b39ae2cf3d0d33ca920736af5ee1543e9b6dd2e120c2f79a8ee8c42f0dc670ec3daeefbfed4260fa7b5e428b20ecb84cb397ed58ef
7
+ data.tar.gz: a64dcba120202c3570ad0c0a7bc0a766984f98217cfc39828faca73a45a927fcb7e35fd4f4d682a952c2d6de207d17ba748ca9abfa32b174f60be878a7f2b3c4
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.0.0
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in quickfix_formatter.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rubocop", "~> 1.21"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Cameron
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # QuickfixFormatter
2
+
3
+ Easily integrate the vim quickfix list with your failing rspec tests. Just add this gem, set it as one of your
4
+ formatters (`--format QuickfixFormatter`)
5
+
6
+ ## Installation
7
+
8
+ Install the gem and add to the application's Gemfile by executing:
9
+
10
+ $ bundle add quickfix_formatter
11
+
12
+ If bundler is not being used to manage dependencies, install the gem by executing:
13
+
14
+ $ gem install quickfix_formatter
15
+
16
+ ## Usage
17
+
18
+ Add `--format QuickfixFormatter` to `.rspec` or in the command line. There are two configurable settings, shown below
19
+ with their default values.
20
+
21
+ `quickfix_output_file` is a string that represents the location the quickfix file is written to.
22
+ `quickfix_silence`, when set to `true`, will supress the text that prints after writing the file.
23
+
24
+ ```ruby
25
+ # spec/spec_helper.rb
26
+
27
+ RSpec.configure do |config|
28
+ config.quickfix_output_file = "tmp/quickfix.out"
29
+ config.quickfix_silence = false
30
+ end
31
+ ```
32
+
33
+ Once `rspec` has written the output file, you can load it with `:cfile <path to file>`.
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ckolkey/quickfix_formatter.
38
+
39
+ ## License
40
+
41
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rubocop/rake_task"
5
+
6
+ RuboCop::RakeTask.new
7
+
8
+ task default: :rubocop
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rspec/core"
4
+ require "rspec/core/formatters/base_formatter"
5
+
6
+ ::RSpec.configuration.add_setting :quickfix_output_file, default: "tmp/quickfix.out"
7
+ ::RSpec.configuration.add_setting :quickfix_silence, default: false
8
+
9
+ # Writes the failures in a format consumable by the vim quickfix list
10
+ class QuickfixFormatter < RSpec::Core::Formatters::BaseFormatter
11
+ ::RSpec::Core::Formatters.register self, :dump_failures
12
+
13
+ def dump_failures(notification)
14
+ File.write(
15
+ config.quickfix_output_file,
16
+ notification.failed_examples.map(&method(:line_output)).join
17
+ )
18
+
19
+ puts(text_output) unless config.quickfix_silence
20
+ end
21
+
22
+ private
23
+
24
+ def line_output(example)
25
+ filepath = example.metadata[:absolute_file_path]
26
+ line_number = example.metadata[:line_number]
27
+ group_description = example.example_group.description
28
+
29
+ "#{filepath}:#{line_number}: #{group_description}: #{example.description}\n"
30
+ end
31
+
32
+ def text_output
33
+ ::RSpec::Core::Formatters::ConsoleCodes.wrap("\nQuickfix written to: '#{config.quickfix_output_file}'", :blue)
34
+ end
35
+
36
+ def config
37
+ ::RSpec.configuration
38
+ end
39
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "quickfix_formatter"
5
+ spec.version = "0.1.0"
6
+ spec.authors = ["Cameron"]
7
+ spec.email = ["cameron.kolkey@gmail.com"]
8
+ spec.summary = "Format rspec output for vim quickfix consumption"
9
+ spec.homepage = "https://www.github.com/ckolkey/quickfix_formatter"
10
+ spec.license = "MIT"
11
+ spec.required_ruby_version = ">= 3.0.0"
12
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
13
+ spec.metadata["homepage_uri"] = spec.homepage
14
+ spec.metadata["source_code_uri"] = spec.homepage
15
+ spec.metadata["changelog_uri"] = spec.homepage
16
+ spec.require_paths = ["lib"]
17
+
18
+ # Specify which files should be added to the gem when it is released.
19
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
+ spec.files = Dir.chdir(__dir__) do
21
+ `git ls-files -z`.split("\x0").reject do |f|
22
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
23
+ end
24
+ end
25
+
26
+ spec.add_dependency "rspec", ">= 3.12.0"
27
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: quickfix_formatter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Cameron
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-01-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.12.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.12.0
27
+ description:
28
+ email:
29
+ - cameron.kolkey@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".rubocop.yml"
35
+ - Gemfile
36
+ - LICENSE.txt
37
+ - README.md
38
+ - Rakefile
39
+ - lib/quickfix_formatter.rb
40
+ - quickfix_formatter.gemspec
41
+ homepage: https://www.github.com/ckolkey/quickfix_formatter
42
+ licenses:
43
+ - MIT
44
+ metadata:
45
+ allowed_push_host: https://rubygems.org
46
+ homepage_uri: https://www.github.com/ckolkey/quickfix_formatter
47
+ source_code_uri: https://www.github.com/ckolkey/quickfix_formatter
48
+ changelog_uri: https://www.github.com/ckolkey/quickfix_formatter
49
+ post_install_message:
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: 3.0.0
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ requirements: []
64
+ rubygems_version: 3.4.1
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: Format rspec output for vim quickfix consumption
68
+ test_files: []