commit-meat 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,8 @@
1
+ _0.0.3_
2
+ * Fixed typos.
3
+
1
4
  __0.0.2__
2
- Fixed an issue with hook path.
5
+ * Fixed an issue with hook path.
3
6
 
4
7
  __0.0.1__
5
- First version - stops you from committing messages with only 1 word.
8
+ * First version - stops you from committing messages with only 1 word.
data/README.md CHANGED
@@ -9,15 +9,15 @@ A gem forcing you to write better commit messages.
9
9
 
10
10
  Simply __install__ the gem once by:
11
11
 
12
- `gem install commit-meat`
12
+ gem install commit-meat
13
13
 
14
14
  and __install__ Commit-Meat in any Git repository you want it to work by:
15
15
 
16
- `commit-meat --install`
16
+ commit-meat --install
17
17
 
18
18
  To __remove__ Commit-Meat run:
19
19
 
20
- `commit-meat --uninstall`
20
+ commit-meat --uninstall
21
21
 
22
22
  ---
23
- Copyright (c) 2012-2014 Shay Davidson (@ShayHDavidson), released under the MIT license.
23
+ Copyright (c) 2012-2014 Shay Davidson (@ShayHDavidson), released under the MIT license.
@@ -27,13 +27,6 @@ Choice.options do
27
27
  action { CommitMeat::Installation::uninstall }
28
28
  end
29
29
 
30
- option :run do
31
- short '-r'
32
- long '--run'
33
- desc "Run Commit-Meat"
34
- action { CommitMeat::run() }
35
- end
36
-
37
30
  option :version do
38
31
  short '-v'
39
32
  long '--version'
@@ -1,7 +1,30 @@
1
1
  require 'commit-meat/installation'
2
2
  require 'commit-meat/version'
3
+ require 'commit-meat/tester'
3
4
  require 'choice'
4
5
  require 'colored'
6
+ require 'yaml'
5
7
 
6
8
  module CommitMeat
9
+
10
+ def self.run
11
+ message_file = ARGV[0]
12
+ message = File.read(message_file).strip
13
+
14
+ tester = Tester.new(message)
15
+
16
+ tester.test
17
+ if tester.failed?
18
+ fail_with_message(tester.failure_messages)
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def self.fail_with_message(messages)
25
+ puts "There's NO MEAT - did not commit.".red
26
+ messages.each { |message| puts message.yellow }
27
+ exit 1
28
+ end
29
+
7
30
  end
@@ -0,0 +1,119 @@
1
+ ---
2
+ - ahole
3
+ - anus
4
+ - arschloch
5
+ - arse
6
+ - ashole
7
+ - asshole
8
+ - ass
9
+ - bastard
10
+ - bitch
11
+ - blowjob
12
+ - boobs
13
+ - breasts
14
+ - butt
15
+ - carpetmuncher
16
+ - cawk
17
+ - cazzo
18
+ - chink
19
+ - cipa
20
+ - clit
21
+ - cock
22
+ - crap
23
+ - cum
24
+ - cunt
25
+ - dego
26
+ - dick
27
+ - dildo
28
+ - darn
29
+ - damn
30
+ - dominatrics
31
+ - douche
32
+ - dyke
33
+ - enema
34
+ - kusemek
35
+ - fag
36
+ - fart
37
+ - fatass
38
+ - fuck
39
+ - fudgepacker
40
+ - gay
41
+ - gook
42
+ - hell
43
+ - hui
44
+ - jackoff
45
+ - jap
46
+ - jerkoff
47
+ - jisim
48
+ - jizm
49
+ - jizz
50
+ - kike
51
+ - kaki
52
+ - klootzak
53
+ - knob
54
+ - knulle
55
+ - kraut
56
+ - kuk
57
+ - kus
58
+ - kurwa
59
+ - lesbian
60
+ - lesbo
61
+ - masochist
62
+ - masturbate
63
+ - merd
64
+ - muie
65
+ - mulkku
66
+ - muschi
67
+ - nazi
68
+ - niger
69
+ - nigger
70
+ - nutsack
71
+ - orgasm
72
+ - packy
73
+ - pee
74
+ - penis
75
+ - pimp
76
+ - piss
77
+ - pizda
78
+ - polack
79
+ - poop
80
+ - porn
81
+ - puke
82
+ - pule
83
+ - pussy
84
+ - puta
85
+ - puto
86
+ - queer
87
+ - rectum
88
+ - retard
89
+ - retarded
90
+ - s.o.b
91
+ - sadist
92
+ - scank
93
+ - schlong
94
+ - schmuck
95
+ - screw
96
+ - scrotum
97
+ - semen
98
+ - sharmute
99
+ - shemale
100
+ - shit
101
+ - shize
102
+ - skank
103
+ - suck
104
+ - slut
105
+ - spit
106
+ - stupid
107
+ - suka
108
+ - testicle
109
+ - tit
110
+ - twat
111
+ - vagina
112
+ - vittu
113
+ - vulva
114
+ - wank
115
+ - whore
116
+ - wichser
117
+ - wop
118
+ - xrated
119
+ - xxx
@@ -3,7 +3,17 @@ module CommitMeat
3
3
 
4
4
  HOOK_PATH = File.join '.git', 'hooks', 'commit-msg'
5
5
  HOOK_DIR = File.join '.git', 'hooks'
6
- HOOK_CONTENT = File.open(File.join(File.dirname(File.expand_path(__FILE__)), 'hook.rb')).read
6
+ HOOK_CONTENT = <<END
7
+ #!/usr/bin/env ruby
8
+ begin
9
+ require 'commit-meat'
10
+ rescue LoadError
11
+ require 'rubygems'
12
+ require 'commit-meat'
13
+ end
14
+
15
+ CommitMeat::run()
16
+ END
7
17
 
8
18
  def self.install
9
19
  if not File.directory?('.git')
@@ -0,0 +1,49 @@
1
+ module CommitMeat
2
+
3
+ class Tester
4
+
5
+ extend Tests
6
+
7
+ attr_reader :failure_messages
8
+
9
+ def initialize(message)
10
+ @message = message
11
+ @failure_messages = []
12
+ end
13
+
14
+ def failed?
15
+ @failure_messages.any?
16
+ end
17
+
18
+ def test
19
+ check_if :has_only_one_word, "Single word commit messages are not allowed."
20
+ check_if :includes_bad_words, "Bad words are not allowed in commit messages."
21
+ end
22
+
23
+ def check_if(bad_commit_test, failure_message)
24
+ unless send(bad_commit_test)
25
+ @failure_messages << failure_message
26
+ end
27
+ end
28
+
29
+ end
30
+
31
+ module Tests
32
+
33
+ def has_only_one_word
34
+ @message.split.size > 1
35
+ end
36
+
37
+ def includes_bad_words
38
+ bad_words = YAML::load_file(File.join(File.dirname(File.expand_path(__FILE__)), 'config/bad_words.yml'))
39
+ bad_words_found = []
40
+
41
+ bad_words.each do |word|
42
+ bad_words_found << word if @message.include?(word)
43
+ end
44
+
45
+ bad_words_found.any?
46
+ end
47
+
48
+ end
49
+ end
@@ -1,5 +1,5 @@
1
1
  module CommitMeat
2
2
 
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commit-meat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-06 00:00:00.000000000 Z
12
+ date: 2013-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colored
@@ -60,8 +60,9 @@ files:
60
60
  - commit-meat.gemspec
61
61
  - gemfile
62
62
  - lib/commit-meat.rb
63
- - lib/commit-meat/hook.rb
63
+ - lib/commit-meat/config/bad_words.yml
64
64
  - lib/commit-meat/installation.rb
65
+ - lib/commit-meat/tester.rb
65
66
  - lib/commit-meat/version.rb
66
67
  homepage: https://github.com/iic-ninjas/commit-meat
67
68
  licenses:
@@ -1,21 +0,0 @@
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.')