dbcommit 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +6 -0
- data/LICENSE +22 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +2 -0
- data/bin/dbcommit +27 -0
- data/dbcommit.gemspec +26 -0
- data/ext/dbcommit/extconf.rb +0 -0
- data/lib/dbcommit/version.rb +3 -0
- data/lib/dbcommit.rb +109 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 026e1025ce52cd10a968f8f70aaff581736d41a9
|
4
|
+
data.tar.gz: eccbc1eeb11c65aac4caf226ebf395788d3ad895
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3889523bb0ca9b9c1c281a6246df128454cb3c4dea5a8cbc1c0547b15524e5010054c111891df96f9090a7a872447043492f3012e3db9dcd16b2b853759d6777
|
7
|
+
data.tar.gz: e29eef93d860c86ece2926ae2581df28139419627109436168f01edd9c19bc65832321c9e56c145e317a07a9b3cdcb3539764898fbbc733508149c17acc6f11f
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Dylan Shine
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Dylan Shine
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Dbcommit
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'dbcommit'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install dbcommit
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: Write usage instructions here
|
24
|
+
|
25
|
+
## Contributing
|
26
|
+
|
27
|
+
1. Fork it ( https://github.com/[my-github-username]/dbcommit/fork )
|
28
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
29
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
30
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
31
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/dbcommit
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'Dbcommit'
|
3
|
+
include Term::ANSIColor
|
4
|
+
|
5
|
+
puts "Please enter your commit message:"
|
6
|
+
message = gets.chomp
|
7
|
+
|
8
|
+
commit = `git commit -m "#{message}"`
|
9
|
+
|
10
|
+
files = commit.scan(/\d/)[-3].to_i
|
11
|
+
changes = commit.scan(/\d/)[-2].to_i + commit.scan(/\d/)[-1].to_i
|
12
|
+
|
13
|
+
if files != 0
|
14
|
+
print green("Commit Successful."), "\n"
|
15
|
+
puts commit
|
16
|
+
Dbcommit::check_length_of_message(message)
|
17
|
+
Dbcommit::check_tense_of_message(message)
|
18
|
+
Dbcommit::check_conjunctions_in_message(message)
|
19
|
+
Dbcommit::check_cursing_in_message(message)
|
20
|
+
Dbcommit::check_if_message_ends_with_period(message)
|
21
|
+
Dbcommit::check_number_of_files(files)
|
22
|
+
Dbcommit::check_number_of_changes(changes)
|
23
|
+
Dbcommit::check_capitalized_first_word(message)
|
24
|
+
Dbcommit::check_spelling_of_each_word(message)
|
25
|
+
else
|
26
|
+
print red("Commit Failed."), "\n"
|
27
|
+
end
|
data/dbcommit.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'dbcommit/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "dbcommit"
|
8
|
+
spec.version = Dbcommit::VERSION
|
9
|
+
spec.authors = ["Dylan Shine"]
|
10
|
+
spec.email = ["dylanshinenyc@gmail.com"]
|
11
|
+
spec.summary = "test"
|
12
|
+
spec.description = ""
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = ["dbcommit"]
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
end
|
File without changes
|
data/lib/dbcommit.rb
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
require "dbcommit/version"
|
2
|
+
require 'term/ansicolor'
|
3
|
+
require 'ffi/aspell'
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
module Dbcommit
|
8
|
+
speller = FFI::Aspell::Speller.new('en_US')
|
9
|
+
|
10
|
+
IMPERATIVE = ["add", "reformat", "style", "create", "delete", "change", "modify", "update", "replace", "minimize", "make", "implement", "compare", "test", "refresh", "clean", "get", "post", "compute", "describe", "document", "comment", "improve", "check", "close", "include", "provide", "insert", "read", "switch", "swap", "fix", "import", "export", "present", "set", "do", "undo", "schedule", "filter", "run", "prevent", "note", "transpose", "give", "open", "destroy", "require", "develop", "raise", "split", "join", "load", "unload", "review", "view", "control", "model", "mix", "submit", "code", "clear", "structure", "refactor", "count", "validate", "install", "clone", "lock", "store", "convert", "write", "find", "pull", "push", "request", "authenticate", "show", "prove", "migrate", "route", "define", "print", "hit", "save", "advance", "start", "begin", "end", "finish", "format", "send", "receive", "kill", "generate", "correct", "rename", "log", "map", "inspect", "associate", "search", "collect", "select", "reject", "merge", "combine", "compact", "concat", "cycle", "drop", "truncate", "fetch", "fill", "flatten", "freeze", "initialize", "copy", "pack", "permute", "pop", "repeat", "reverse", "rotate", "sample", "sort", "order", "shift", "shuffle", "slice", "take", "execute", "randomize", "detect", "group", "reduce", "inject", "zip", "sum", "divide", "multiply", "use", "restore", "subtract", "exponentiate", "return", "iterate", "recurse", "exit", "commit", "message", "punctuate", "hold", "uninstall", "accept", "contribute", "command", "try", "move", "base", "rebase", "enter", "leave", "finalize", "penalize", "unify", "pass", "allow", "let", "disable", "enable", "ignore", "target", "skip", "perform", "build", "scaffold", "reassign", "bring", "preserve", "assert", "name", "redefine", "deprecate", "introduce", "go", "expand", "mutate", "rely", "duplicate", "extract", "render", "assign", "rewrite", "call", "bind", "unbind", "affect", "escape", "calculate", "bundle", "eliminate", "specify", "guide", "stop", "digest", "relax", "readd", "disallow", "regenerate", "fork", "persist", "rollback", "reset", "simplify", "prefer", "demonstrate", "better", "avoid", "consider", "throw", "loosen", "support", "cleanup", "revert", "integrate", "verify", "share", "ensure", "condense", "rephrase", "un-inline", "adjust", "inform", "fall", "fallback", "cast", "reuse", "propagate", "dump", "list", "clarify", "warn"]
|
11
|
+
|
12
|
+
CURSES = ["arse", "ass", "asshole", "bastard", "bitch", "bollocks", "bloody", "child-fucker", "cunt", "damn", "fuck", "goddamn", "godsdamn", "hell", "holy shit", "motherfucker", "shit", "shite", "shitass", "son of a bitch", "son of a whore", "twat", "fucker", "cock", "dick", "fucking"]
|
13
|
+
|
14
|
+
PUNCTUATION = [".", ",", "!", "?"]
|
15
|
+
|
16
|
+
private
|
17
|
+
def self.check_length_of_message(message)
|
18
|
+
case message.length
|
19
|
+
when 0..10
|
20
|
+
print "* Commit message size: Too short: #{message.length} characters.".yellow, "\n"
|
21
|
+
when 11..51
|
22
|
+
print "* Commit message size: Perfect: #{message.length} characters.".green, "\n"
|
23
|
+
when 51..100
|
24
|
+
print "* Commit message size: Too long: #{message.length} characters.".red, "\n"
|
25
|
+
else
|
26
|
+
print "* Commit message size: Gingantic: #{message.length} characters.".red, "\n"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.check_spelling_of_each_word(message)
|
31
|
+
words = []
|
32
|
+
message.split.each do |word|
|
33
|
+
if speller.correct?(word) == false
|
34
|
+
words << word
|
35
|
+
end
|
36
|
+
end
|
37
|
+
print "* Misspelled words in your commit message: #{words.join(,)}".red, "\n"
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.check_capitalized_first_word(message)
|
41
|
+
if message[0] != message[0].upcase
|
42
|
+
print "* Always begin your commit message with a capital letter of.".red, "\n"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.check_tense_of_message(message)
|
47
|
+
if !IMPERATIVE.include?(message.split[0].downcase)
|
48
|
+
print "* Commit message was not written in the correct gramatical mood: #{message.split[0]}".red, "\n"
|
49
|
+
print '* Your commit messages should be in the "Imperative" mood.'.blue, "\n"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.check_conjunctions_in_message(message)
|
54
|
+
message.split.each do |word|
|
55
|
+
if word.downcase == "and"
|
56
|
+
print '* Never use "and" in your commit message simply make a separate commit."'.red, "\n"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.check_if_message_ends_with_period(message)
|
62
|
+
if PUNCTUATION.include?(message[-1])
|
63
|
+
print "* First line of commit message should never include ending punctuation.".red, "\n"
|
64
|
+
print "* You ended your message with a #{message[-1]}".red, "\n"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.check_cursing_in_message(message)
|
69
|
+
message.split.each do |word|
|
70
|
+
if CURSES.include?(word.downcase)
|
71
|
+
print "* Your should never swear in your commit messages!".red, "\n"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.check_number_of_files(files)
|
77
|
+
case files
|
78
|
+
when 1
|
79
|
+
print "* Number of files changed: Perfect: #{files} file(s)".green, "\n"
|
80
|
+
when 2
|
81
|
+
print "* Number of files changed: Good: #{files} file(s)".blue, "\n"
|
82
|
+
when 3
|
83
|
+
print "* Number of files changed: Okay: #{files} file(s)".yellow, "\n"
|
84
|
+
when 4
|
85
|
+
print "* Number of files changed: Marginal: #{files} file(s)".orange, "\n"
|
86
|
+
when 5
|
87
|
+
print "* Number of files changed: Bad: #{files} file(s)".red, "\n"
|
88
|
+
else
|
89
|
+
print "* Number of files changed: Terrble: #{files} file(s)".red, "\n"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def self.check_number_of_changes(changes)
|
94
|
+
case changes
|
95
|
+
when 1..11
|
96
|
+
print "* Number of changes: Perfect: #{changes} change(s)".green, "\n"
|
97
|
+
when 12..30
|
98
|
+
print "* Number of changes: Okay: #{changes} change(s)".yellow, "\n"
|
99
|
+
when 31..60
|
100
|
+
print "* Number of changes: Too many: #{changes} change(s)".orange, "\n"
|
101
|
+
else
|
102
|
+
print "* Number of changes: Way too many: #{changes} change(s)".red, "\n"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
class String
|
108
|
+
include Term::ANSIColor
|
109
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dbcommit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dylan Shine
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: ''
|
42
|
+
email:
|
43
|
+
- dylanshinenyc@gmail.com
|
44
|
+
executables:
|
45
|
+
- dbcommit
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- ".gitignore"
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- bin/dbcommit
|
56
|
+
- dbcommit.gemspec
|
57
|
+
- ext/dbcommit/extconf.rb
|
58
|
+
- lib/dbcommit.rb
|
59
|
+
- lib/dbcommit/version.rb
|
60
|
+
homepage: ''
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
metadata: {}
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 2.4.4
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: test
|
84
|
+
test_files: []
|