commit-meat 0.0.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.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/CHANGELOG.md ADDED
@@ -0,0 +1,2 @@
1
+ __0.0.1__
2
+ First version - stops you from committing messages with only 1 word.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 IIC Ninjas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ 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, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,23 @@
1
+ commit-meat
2
+ ===========
3
+
4
+ ![](http://i.imgur.com/ouptGNQ.png?1?7479)
5
+
6
+ A gem forcing you to write better commit messages.
7
+
8
+ ## Installation
9
+
10
+ Simply __install__ the gem once by:
11
+
12
+ `gem install commit-meat`
13
+
14
+ and __install__ Commit-Meat in any Git repository you want it to work by:
15
+
16
+ `commit-meat --install`
17
+
18
+ To __remove__ Commit-Meat run:
19
+
20
+ `commit-meat --uninstall`
21
+
22
+ ---
23
+ Copyright (c) 2012-2014 Shay Davidson (@ShayHDavidson), released under the MIT license.
data/bin/commit-meat ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require 'commit-meat'
5
+ rescue LoadError
6
+ require 'rubygems'
7
+ require 'commit-meat'
8
+ end
9
+
10
+ include CommitMeat
11
+
12
+ Choice.options do
13
+
14
+ header "Installs a pre-commit hook that tells you when your commit messages are too short or uninformative."
15
+
16
+ option :install do
17
+ short '-i'
18
+ long '--install'
19
+ desc "Install Commit-Meat for this Git repository."
20
+ action { CommitMeat::Installation::install }
21
+ end
22
+
23
+ option :uninstall do
24
+ short '-u'
25
+ long '--uninstall'
26
+ desc "Uninstall Commit-Meat for this git repository."
27
+ action { CommitMeat::Installation::uninstall }
28
+ end
29
+
30
+ option :run do
31
+ short '-r'
32
+ long '--run'
33
+ desc "Run Commit-Meat"
34
+ action { CommitMeat::run() }
35
+ end
36
+
37
+ option :version do
38
+ short '-v'
39
+ long '--version'
40
+ desc "Print Commit-Meat's version"
41
+ action { puts["Version: #{CommitMeat::VERSION.to_s.green}"] }
42
+ end
43
+
44
+ end
45
+
46
+ Choice.help if Choice.choices.empty?
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "commit-meat/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'commit-meat'
7
+ s.version = CommitMeat::VERSION
8
+ s.summary = %q{Tells you when your commit are bad.}
9
+ s.description = %q{Installs a pre-commit hook that tells you when your commit messages are too short or uninformative.}
10
+ s.authors = ['Shay Davidson']
11
+ s.email = ['shay.h.davidson@gmail.com']
12
+ s.files = ['lib/commit-meat.rb']
13
+ s.homepage = 'https://github.com/iic-ninjas/commit-meat'
14
+ s.license = 'MIT'
15
+
16
+ s.files = `git ls-files`.split("\n") - ["Gemfile.lock"]
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ['lib']
19
+
20
+ s.add_runtime_dependency 'colored'
21
+ s.add_runtime_dependency 'choice'
22
+ end
data/gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "http://rubygems.org"
2
+ gemspec
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require 'commit-meat'
5
+ rescue LoadError
6
+ require 'rubygems'
7
+ require 'commit-meat'
8
+ end
9
+
10
+ def assert_with_message(condition, msg)
11
+ unless condition
12
+ puts "There's NO MEAT - did not commit.".red
13
+ puts msg.yellow
14
+ exit 1
15
+ end
16
+ end
17
+
18
+ message_file = ARGV[0]
19
+ message = File.read(message_file).strip
20
+
21
+ assert_with_message(message.split.size > 1, 'Single word commitd messages are not allowed.')
@@ -0,0 +1,39 @@
1
+ module CommitMeat
2
+ module Installation
3
+
4
+ HOOK_PATH = File.join '.git', 'hooks', 'commit-msg'
5
+ HOOK_DIR = File.join '.git', 'hooks'
6
+ HOOK_CONTENT = File.open('lib/commit-meat/hook.rb').read
7
+
8
+ def self.install
9
+ if not File.directory?('.git')
10
+ puts "You don't appear to be in the base directory of a git project.".red
11
+ exit 1
12
+ end
13
+
14
+ Dir.mkdir(HOOK_DIR) unless File.directory?(HOOK_DIR)
15
+
16
+ if File.exists? HOOK_PATH
17
+ puts "A pre-commit hook already exists for this project.".red
18
+ exit 1
19
+ end
20
+
21
+ File.open(HOOK_PATH, 'w') {|f| f.write(HOOK_CONTENT) }
22
+ FileUtils.chmod 0755, HOOK_PATH
23
+ puts "Installed Commit-Meat hook as:".green
24
+ puts " -> #{File.expand_path(HOOK_PATH)}".green
25
+ puts "(To remove later run: `commit-meat --uninstall`)."
26
+ end
27
+
28
+ def self.uninstall
29
+ if File.exists? HOOK_PATH
30
+ FileUtils.rm HOOK_PATH
31
+ puts "Uninstalled Commit-Meat for this Git repository.".green
32
+ else
33
+ puts "Commit-Meat is not enabled for this directory, nothing was uninstalled.".yellow
34
+ end
35
+ end
36
+
37
+
38
+ end
39
+ end
@@ -0,0 +1,5 @@
1
+ module CommitMeat
2
+
3
+ VERSION = '0.0.1'
4
+
5
+ end
@@ -0,0 +1,7 @@
1
+ require 'commit-meat/installation'
2
+ require 'commit-meat/version'
3
+ require 'choice'
4
+ require 'colored'
5
+
6
+ module CommitMeat
7
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: commit-meat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Shay Davidson
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-11-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: colored
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: choice
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: Installs a pre-commit hook that tells you when your commit messages are
47
+ too short or uninformative.
48
+ email:
49
+ - shay.h.davidson@gmail.com
50
+ executables:
51
+ - commit-meat
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - .gitignore
56
+ - CHANGELOG.md
57
+ - LICENSE
58
+ - README.md
59
+ - bin/commit-meat
60
+ - commit-meat.gemspec
61
+ - gemfile
62
+ - lib/commit-meat.rb
63
+ - lib/commit-meat/hook.rb
64
+ - lib/commit-meat/installation.rb
65
+ - lib/commit-meat/version.rb
66
+ homepage: https://github.com/iic-ninjas/commit-meat
67
+ licenses:
68
+ - MIT
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 1.8.24
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: Tells you when your commit are bad.
91
+ test_files: []