clipboard_formatter 1.0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8b55cec134ee2e7bae28f294d61cf1054d28b315
4
+ data.tar.gz: 07d923dd8824b41cedb29c5972adf1baf7bdffe5
5
+ SHA512:
6
+ metadata.gz: 232141684b757559098bda0b58055797f3229fa78ba3c18d6e391d42818749031e104d3f2af5e3c6308f3594379917b9f27d7ae9432a582f9e343f2aafa9abc5
7
+ data.tar.gz: 1b972c583f3024c949fdf8bdbe63038124fbd52bb563cb4fcc0e42a2c22a64858212721883be78e77e00c143206e650b9a652592b6de989a21eb8110c6ad7529
@@ -0,0 +1 @@
1
+ Gemfile.lock
@@ -0,0 +1,6 @@
1
+ ## CHANGELOG
2
+
3
+ ### 1.0.0
4
+
5
+ * Inital release
6
+
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2015 Jan Lelis, mail@janlelis.de
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,30 @@
1
+ # RSpec Clipboard Formatter [![[version]](https://badge.fury.io/rb/clipboard_formatter.svg)](http://badge.fury.io/rb/clipboard_formatter)
2
+
3
+ Copies the list of failed examples to your clipboard so that you can restart them easily.
4
+
5
+
6
+ ## Setup
7
+
8
+ Add the gem to your `Gemfile`:
9
+
10
+ ```ruby
11
+ gem 'rspec-clipboard'
12
+ ```
13
+
14
+ Add the formatter to your rspec options, e.g. in a `.rspec` file. You probably want to set it as an additional one, instead of the only one:
15
+
16
+ ```
17
+ --format documentation
18
+ --require clipboard_formatter --format ClipboardFormatter
19
+ ```
20
+
21
+
22
+ ## Usage
23
+
24
+ Run your RSpec suite, but let some tests fail. Then use your clipboard.
25
+
26
+
27
+ ## MIT License
28
+
29
+ Copyright (C) 2015 Jan Lelis <http://janlelis.com>. Released under the MIT license.
30
+
@@ -0,0 +1,30 @@
1
+ # # #
2
+ # Get gemspec info
3
+
4
+ gemspec_file = Dir['*.gemspec'].first
5
+ gemspec = eval File.read(gemspec_file), binding, gemspec_file
6
+ info = "#{gemspec.name} | #{gemspec.version} | " \
7
+ "#{gemspec.runtime_dependencies.size} dependencies | " \
8
+ "#{gemspec.files.size} files"
9
+
10
+
11
+ # # #
12
+ # Gem build and install task
13
+
14
+ desc info
15
+ task :gem do
16
+ puts info + "\n\n"
17
+ print " "; sh "gem build #{gemspec_file}"
18
+ FileUtils.mkdir_p 'pkg'
19
+ FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", 'pkg'
20
+ puts; sh %{gem install --no-document pkg/#{gemspec.name}-#{gemspec.version}.gem}
21
+ end
22
+
23
+
24
+ # # #
25
+ # Start an IRB session with the gem loaded
26
+
27
+ desc "#{gemspec.name} | IRB"
28
+ task :irb do
29
+ sh "irb -I ./lib -r #{gemspec.name.gsub '-','/'}"
30
+ end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require File.dirname(__FILE__) + "/lib/clipboard_formatter/version"
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "clipboard_formatter"
7
+ gem.version = ClipboardFormatter::VERSION
8
+ gem.summary = "A clipboard formatter for RSpec."
9
+ gem.description = "Copies the list of failed examples to your clipboard so that you can restart them easily."
10
+ gem.authors = ["Jan Lelis"]
11
+ gem.email = "mail@janlelis.de"
12
+ gem.homepage = "https://github.com/janlelis/clipboard_formatter"
13
+ gem.license = "MIT"
14
+
15
+ gem.files = Dir["{**/}{.*,*}"].select{ |path| File.file?(path) && path !~ /^pkg/ }
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.required_ruby_version = "~> 2.0"
21
+ gem.add_dependency 'rspec', '~> 3.0'
22
+ gem.add_dependency 'clipboard', '~> 1.0'
23
+ end
@@ -0,0 +1,26 @@
1
+ require_relative "clipboard_formatter/version"
2
+
3
+ require 'rspec/core/formatters'
4
+ require 'clipboard'
5
+
6
+ class ClipboardFormatter
7
+ RSpec::Core::Formatters.register self, :dump_summary
8
+
9
+ def initialize(*)
10
+ end
11
+
12
+ def dump_summary(notification)
13
+ if notification.failed_examples.present?
14
+ locations = Hash.new{ |h,k| h[k] = [] }
15
+
16
+ notification.failed_examples.each{ |fe|
17
+ locations[fe.metadata[:file_path]] << fe.metadata[:line_number]
18
+ }
19
+
20
+ Clipboard.copy "rspec " + locations.map{ |file_path, line_numbers|
21
+ [file_path, *line_numbers]*":"
22
+ }*" "
23
+ end
24
+ end
25
+ end
26
+
@@ -0,0 +1,4 @@
1
+ class ClipboardFormatter
2
+ VERSION = "1.0.0".freeze
3
+ end
4
+
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: clipboard_formatter
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jan Lelis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-06 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.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.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: clipboard
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ description: Copies the list of failed examples to your clipboard so that you can
42
+ restart them easily.
43
+ email: mail@janlelis.de
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - CHANGELOG.md
50
+ - MIT-LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - clipboard_formatter.gemspec
54
+ - lib/clipboard_formatter.rb
55
+ - lib/clipboard_formatter/version.rb
56
+ homepage: https://github.com/janlelis/clipboard_formatter
57
+ licenses:
58
+ - MIT
59
+ metadata: {}
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 2.4.6
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: A clipboard formatter for RSpec.
80
+ test_files: []
81
+ has_rdoc: