git_haiku 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.
- checksums.yaml +7 -0
- data/lib/git_haiku.rb +49 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bbb944a57012508ccf9495a5c6592edb84910c4f
|
4
|
+
data.tar.gz: 41290cec7f5ae5a3142d0b79ef619a04587c65c6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 30ce69e8064ffd712b8b231cb93e128e8ff2bf170e15ccdca0ef8307e4ea2a9e64e93c1de170359e600661f45dc5c833cab28a8f1e58bf842771034762cb1e21
|
7
|
+
data.tar.gz: d77fa8e53dc61fa5e154b738f7b80a195e59ced290003f6fcd343f7d5d7c071238b4cbbf89d48f12acb0e1caefa126f17aaefeb716858d2298bf590e9708958d
|
data/lib/git_haiku.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'lingua'
|
3
|
+
require 'colorize'
|
4
|
+
|
5
|
+
class GitHaiku
|
6
|
+
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@dict = []
|
10
|
+
File.open('./dictionary.txt').each {|word| @dict << word}
|
11
|
+
end
|
12
|
+
|
13
|
+
def run
|
14
|
+
haiku_msg = get_n_syllable_word(5).join(" ")
|
15
|
+
haiku_msg.concat("; #{get_n_syllable_word(7).join(" ")}")
|
16
|
+
haiku_msg.concat("; #{get_n_syllable_word(5).join(" ")}")
|
17
|
+
# p haiku_msg
|
18
|
+
git_msg = "git commit -m '#{haiku_msg}'"
|
19
|
+
git_output = "git commit -m"
|
20
|
+
print git_output.concat(" '#{haiku_msg}'".colorize(:red))
|
21
|
+
puts
|
22
|
+
system(git_msg)
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_n_syllable_word(n)
|
27
|
+
n_syl_words = []
|
28
|
+
syllable_count = 0
|
29
|
+
|
30
|
+
|
31
|
+
until syllable_count == n
|
32
|
+
rand_word = @dict.sample
|
33
|
+
this_word_syllables = Lingua::EN::Syllable.syllables(rand_word)
|
34
|
+
|
35
|
+
if (this_word_syllables + syllable_count) <= n
|
36
|
+
n_syl_words << rand_word.strip
|
37
|
+
n_syl_words
|
38
|
+
syllable_count += this_word_syllables
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
n_syl_words
|
43
|
+
end#hey
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
if __FILE__ == $PROGRAM_NAME
|
48
|
+
GitHaiku.new.run
|
49
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: git_haiku
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Aylan Mello
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-06-19 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: aylan.io
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/git_haiku.rb
|
20
|
+
homepage:
|
21
|
+
licenses:
|
22
|
+
- CC-BY-1.0
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.5.1
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Haiku-i-fy your git commits!
|
44
|
+
test_files: []
|