gspec 0.1.3

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b45345dbb96d43f21a405cd074166e71fd9ee69193b017f29a45edb8a9ef9986
4
+ data.tar.gz: 7d1b2488b0de4f5c19b5f7914846cd97e1de8b9b9920867dc2294a7f7bb9fb7a
5
+ SHA512:
6
+ metadata.gz: aec59cb2c87a0850b69f2f50b038da6bb3ab8ccc7fda37e645e3bb1925791475e1c822f5570d55c83161c5935b0889d6460079ce41e26a046ab760886043e699
7
+ data.tar.gz: 390113de700c7b167cd8a6cf1a53e95e94a5aa1e8cddf354ecad776a4e3a3b3323fa7aacf41782c6828df9be7e35aa65053d104e1563e2d8b36166cb363bb5a6
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.0
6
+ before_install: gem install bundler -v 2.1.2
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in gspec.gemspec
4
+ gemspec
5
+
6
+ gem "rake", "~> 12.0"
7
+ gem "rspec", "~> 3.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,34 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gspec (0.1.3)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.3)
10
+ rake (12.3.3)
11
+ rspec (3.9.0)
12
+ rspec-core (~> 3.9.0)
13
+ rspec-expectations (~> 3.9.0)
14
+ rspec-mocks (~> 3.9.0)
15
+ rspec-core (3.9.1)
16
+ rspec-support (~> 3.9.1)
17
+ rspec-expectations (3.9.1)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.9.0)
20
+ rspec-mocks (3.9.1)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.9.0)
23
+ rspec-support (3.9.2)
24
+
25
+ PLATFORMS
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ gspec!
30
+ rake (~> 12.0)
31
+ rspec (~> 3.0)
32
+
33
+ BUNDLED WITH
34
+ 2.1.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Micah Shute
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,48 @@
1
+ # Gspec
2
+
3
+ `bundle add gspec`
4
+
5
+ go into your Rakefile and paste the following code:
6
+
7
+ ```ruby
8
+ pec = Gem::Specification.find_by_name 'gspec'
9
+ load "#{spec.gem_dir}/lib/gspec/tasks/generator.rake"
10
+ ```
11
+ create a test file with:
12
+
13
+ `rake spec:create_for[Your::Class:Name::Here]`
14
+
15
+ ## Installation
16
+
17
+ Add this line to your application's Gemfile:
18
+
19
+ ```ruby
20
+ gem 'gspec'
21
+ ```
22
+
23
+ And then execute:
24
+
25
+ $ bundle install
26
+
27
+ Or install it yourself as:
28
+
29
+ $ gem install gspec
30
+
31
+ ## Usage
32
+
33
+ TODO: Write usage instructions here
34
+
35
+ ## Development
36
+
37
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
38
+
39
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
40
+
41
+ ## Contributing
42
+
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gspec.
44
+
45
+
46
+ ## License
47
+
48
+ 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,9 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ import './lib/gspec/tasks/generator.rake'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task :default => :spec
9
+
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "gspec"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/gspec.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ require_relative 'lib/gspec/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "gspec"
5
+ spec.version = Gspec::VERSION
6
+ spec.authors = ["Micah Shute"]
7
+ spec.email = ["micah.shute@gmail.com"]
8
+
9
+ spec.summary = %q{Add a rake task to quickly generate rspec files}
10
+ spec.homepage = "https://github.com/micahshute/gspec"
11
+ spec.license = "MIT"
12
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
13
+
14
+
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = "https://github.com/micahshute/gspec"
18
+ spec.metadata["changelog_uri"] = "https://github.com/micahshute/gspec"
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ end
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+ end
data/lib/gspec.rb ADDED
@@ -0,0 +1,6 @@
1
+ require "gspec/version"
2
+
3
+ module Gspec
4
+ class Error < StandardError; end
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,49 @@
1
+ task :file_utils do
2
+ require 'fileutils'
3
+ end
4
+
5
+ namespace :spec do
6
+
7
+ desc "Create test file for a class"
8
+ task :create_for, [:name] => :file_utils do |task, args|
9
+ file = Dir.pwd
10
+ Dir.mkdir(file + '/spec') unless Dir.exist?(file + "/spec")
11
+
12
+ starting_file = file + "/spec"
13
+ klass = args[:name]
14
+ proj_name = file.split('/').last.downcase
15
+ path_components = klass.split('::')
16
+ namespace = path_components.shift if path_components.first.downcase == proj_name
17
+ dirs = path_components[0...-1].map{|d| d.gsub(/(\w)([A-Z])/, '\1_\2').downcase}
18
+ filename = path_components.last.gsub(/(\w)([A-Z])/, '\1_\2').downcase
19
+ dirs.each.with_index do |d, i|
20
+ prev_dirs = dirs[0...i].join("/")
21
+ curr_dir = "/#{prev_dirs}/#{d}"
22
+ Dir.mkdir(starting_file+ curr_dir) unless Dir.exist?(starting_file + curr_dir)
23
+ end
24
+ relpath = dirs.length > 0 ? "/#{dirs.join('/')}/#{filename}_spec.rb" : "/#{filename}_spec.rb"
25
+
26
+ begin
27
+ raise Errno::EEXIST if File.file?(starting_file + relpath)
28
+ file = File.open(starting_file + relpath, 'w')
29
+ boilerplate = <<-TEST
30
+ RSpec.describe #{klass} do
31
+
32
+ it "does something useful" do
33
+ expect(false).to eq(true)
34
+ end
35
+
36
+ end
37
+
38
+ TEST
39
+
40
+ file.write(boilerplate)
41
+ file.close
42
+ rescue Errno::EEXIST => e
43
+ puts "The test for #{klass} has already been created"
44
+
45
+ end
46
+
47
+ end
48
+
49
+ end
@@ -0,0 +1,3 @@
1
+ module Gspec
2
+ VERSION = "0.1.3"
3
+ end
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gspec
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
+ platform: ruby
6
+ authors:
7
+ - Micah Shute
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-04-28 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - micah.shute@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - ".rspec"
22
+ - ".travis.yml"
23
+ - Gemfile
24
+ - Gemfile.lock
25
+ - LICENSE.txt
26
+ - README.md
27
+ - Rakefile
28
+ - bin/console
29
+ - bin/setup
30
+ - gspec.gemspec
31
+ - lib/gspec.rb
32
+ - lib/gspec/tasks/generator.rake
33
+ - lib/gspec/version.rb
34
+ homepage: https://github.com/micahshute/gspec
35
+ licenses:
36
+ - MIT
37
+ metadata:
38
+ homepage_uri: https://github.com/micahshute/gspec
39
+ source_code_uri: https://github.com/micahshute/gspec
40
+ changelog_uri: https://github.com/micahshute/gspec
41
+ post_install_message:
42
+ rdoc_options: []
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 2.3.0
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ requirements: []
56
+ rubygems_version: 3.1.2
57
+ signing_key:
58
+ specification_version: 4
59
+ summary: Add a rake task to quickly generate rspec files
60
+ test_files: []