bare_minimum_checks 0.1.1
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 +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +37 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/bare_minimum_checks.gemspec +41 -0
- data/bin/bare_minimum_checks +8 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/bare_minimum_checks/file_name_style.rb +36 -0
- data/lib/bare_minimum_checks/project.rb +34 -0
- data/lib/bare_minimum_checks/version.rb +3 -0
- data/lib/bare_minimum_checks.rb +13 -0
- metadata +118 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d894c8d982f9aa9cbe75b1a5727a5c7d30135f733240a4cea77b91dc0a942495
|
4
|
+
data.tar.gz: a90e834041b6659172cba159816c6be4144b0dfd50d8f5c553d6072dc2fd4049
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 18d198c1143098396505d08f3ffe9312ec84effa2f77c929a9fd8e7d97c58df4de9734e7072b0f681a0434a03278c8958fa378b1454aa01bf0a26e20f4f75012
|
7
|
+
data.tar.gz: 8735130c6243c69f680ef52ab7e904a3336dcd3d4dca2fc068c162120bb8c9d3448ce008e0ed1d036074f2e3222a52ad5db77e02cce1dad6e67fda1b2db138b3
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
bare_minimum_checks (0.1.1)
|
5
|
+
git (= 1.5.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.3)
|
11
|
+
git (1.5.0)
|
12
|
+
rake (10.4.2)
|
13
|
+
rspec (3.7.0)
|
14
|
+
rspec-core (~> 3.7.0)
|
15
|
+
rspec-expectations (~> 3.7.0)
|
16
|
+
rspec-mocks (~> 3.7.0)
|
17
|
+
rspec-core (3.7.1)
|
18
|
+
rspec-support (~> 3.7.0)
|
19
|
+
rspec-expectations (3.7.0)
|
20
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
21
|
+
rspec-support (~> 3.7.0)
|
22
|
+
rspec-mocks (3.7.0)
|
23
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
24
|
+
rspec-support (~> 3.7.0)
|
25
|
+
rspec-support (3.7.1)
|
26
|
+
|
27
|
+
PLATFORMS
|
28
|
+
ruby
|
29
|
+
|
30
|
+
DEPENDENCIES
|
31
|
+
bare_minimum_checks!
|
32
|
+
bundler (~> 1.17)
|
33
|
+
rake (~> 10.0)
|
34
|
+
rspec (~> 3.0)
|
35
|
+
|
36
|
+
BUNDLED WITH
|
37
|
+
1.17.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Pavithra Krishnan
|
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,39 @@
|
|
1
|
+
# BareMinimumChecks
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bare_minimum_checks`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'bare_minimum_checks'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install bare_minimum_checks
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
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.
|
30
|
+
|
31
|
+
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).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bare_minimum_checks.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
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,41 @@
|
|
1
|
+
#
|
2
|
+
# lib = File.expand_path("../lib", __FILE__)
|
3
|
+
# $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
# $LOAD_PATH.unshift("/Users/pavithra/.rvm/gems/ruby-2.3.8/gems")
|
5
|
+
# puts $LOAD_PATH
|
6
|
+
require "bare_minimum_checks/version"
|
7
|
+
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = "bare_minimum_checks"
|
10
|
+
spec.version = BareMinimumChecks::VERSION
|
11
|
+
spec.authors = ["Pavithra Krishnan"]
|
12
|
+
spec.email = ["pavikrish2988@gmail.com"]
|
13
|
+
|
14
|
+
spec.summary = "Run tests for files modified"
|
15
|
+
spec.description = "Provides a cli to run tests for the files that have been modified"
|
16
|
+
spec.license = "MIT"
|
17
|
+
spec.add_dependency "git", "1.5.0"
|
18
|
+
|
19
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
20
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
21
|
+
if spec.respond_to?(:metadata)
|
22
|
+
spec.metadata["source_code_uri"] = "https://github.com/Pavithrak/bare_minimum_checks"
|
23
|
+
spec.metadata["changelog_uri"] = "https://github.com/Pavithrak/bare_minimum_checks"
|
24
|
+
else
|
25
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
26
|
+
"public gem pushes."
|
27
|
+
end
|
28
|
+
|
29
|
+
# Specify which files should be added to the gem when it is released.
|
30
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
31
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
32
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
33
|
+
end
|
34
|
+
spec.bindir = "bin"
|
35
|
+
spec.executables = ["bare_minimum_checks"]
|
36
|
+
spec.require_paths = ["lib"]
|
37
|
+
|
38
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
39
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
40
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
41
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "bare_minimum_checks"
|
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__)
|
15
|
+
|
data/bin/setup
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
module BareMinimumChecks
|
2
|
+
class FileNameStyle
|
3
|
+
def get_test_file_name(file_path)
|
4
|
+
file = get_name(file_path)
|
5
|
+
if @style.match(file)
|
6
|
+
file_name_split = file.split('.')
|
7
|
+
@test_file_names.reduce([]) do |arr, name|
|
8
|
+
file_name_split[0] = file_name_split[0] + name
|
9
|
+
dir_glob = Dir.glob("./**/#{file_name_split.join('.')}")
|
10
|
+
arr.concat dir_glob
|
11
|
+
end
|
12
|
+
else
|
13
|
+
[]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.camel_case
|
18
|
+
FileNameStyle.new(/^([A-Z][a-z0-9]+)+\.([a-z]+)/, %w[Spec Test])
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.snake_case
|
22
|
+
FileNameStyle.new(/^[A-Za-z]+[_A-Za-z]+\.[a-z]+/, %w[_spec _test])
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def initialize(style, test_file_names)
|
28
|
+
@style = style
|
29
|
+
@test_file_names = test_file_names
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_name(file_path)
|
33
|
+
file_path.split('/')[-1]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'git'
|
2
|
+
require_relative 'file_name_style'
|
3
|
+
|
4
|
+
module BareMinimumChecks
|
5
|
+
class Project
|
6
|
+
def run_specs
|
7
|
+
specs = local_changes.reduce([]) do |specs, file_path|
|
8
|
+
arr = specs.concat FileNameStyle.camel_case.get_test_file_name(file_path)
|
9
|
+
arr.concat FileNameStyle.snake_case.get_test_file_name(file_path)
|
10
|
+
end
|
11
|
+
specs.each do |spec_file|
|
12
|
+
puts "Running #{spec_file}"
|
13
|
+
system("rspec #{spec_file}")
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def local_changes
|
21
|
+
g = Git.open('.')
|
22
|
+
local_changes = g.diff.map(&:path)
|
23
|
+
current_branch_name = g.current_branch
|
24
|
+
branch_name = is_local_branch?(current_branch_name) ? 'origin/master' : "origin/#{current_branch_name}"
|
25
|
+
local_changes.concat g.diff(branch_name, 'HEAD').map(&:path)
|
26
|
+
local_changes.uniq
|
27
|
+
end
|
28
|
+
|
29
|
+
def is_local_branch?(branch_name)
|
30
|
+
count = `git remote show origin | grep #{branch_name} | wc -l`
|
31
|
+
count.to_i == 0
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bare_minimum_checks
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Pavithra Krishnan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-02-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: git
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.5.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.5.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.17'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.17'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
description: Provides a cli to run tests for the files that have been modified
|
70
|
+
email:
|
71
|
+
- pavikrish2988@gmail.com
|
72
|
+
executables:
|
73
|
+
- bare_minimum_checks
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- Gemfile
|
80
|
+
- Gemfile.lock
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bare_minimum_checks.gemspec
|
85
|
+
- bin/bare_minimum_checks
|
86
|
+
- bin/console
|
87
|
+
- bin/setup
|
88
|
+
- lib/bare_minimum_checks.rb
|
89
|
+
- lib/bare_minimum_checks/file_name_style.rb
|
90
|
+
- lib/bare_minimum_checks/project.rb
|
91
|
+
- lib/bare_minimum_checks/version.rb
|
92
|
+
homepage:
|
93
|
+
licenses:
|
94
|
+
- MIT
|
95
|
+
metadata:
|
96
|
+
source_code_uri: https://github.com/Pavithrak/bare_minimum_checks
|
97
|
+
changelog_uri: https://github.com/Pavithrak/bare_minimum_checks
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 2.7.8
|
115
|
+
signing_key:
|
116
|
+
specification_version: 4
|
117
|
+
summary: Run tests for files modified
|
118
|
+
test_files: []
|