git-rainbow 1.0.0
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 +9 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/README.md +31 -0
- data/bin/git-rainbow +5 -0
- data/git-rainbow.gemspec +23 -0
- data/lib/git-rainbow.rb +3 -0
- data/lib/git_rainbow.rb +6 -0
- data/lib/git_rainbow/exploder.rb +33 -0
- data/lib/git_rainbow/painter.rb +31 -0
- data/lib/git_rainbow/version.rb +3 -0
- data/screen.png +0 -0
- metadata +84 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 3524f03b12dcc8ffb35e1fbd1af0336ea12bb3f0
|
|
4
|
+
data.tar.gz: 34b74556fdb18d59e042fb6d2907899f2273f305
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: d330fe8b5a92ecab8e11522620d3b6f9072f7cece4e72341253bb1d7601358e9d107a95b2362983ba15ac44fc56d425af70df9d8d04b65de58eda322a6ce7f7e
|
|
7
|
+
data.tar.gz: 5c5178b2eb1bbfceeee7a2cb2526a71c460411a16e55690140196032e2ff0220491d0975533cc3346598c4e23171f9402dcbda7ff6c174ff9e1bfc098678f16f
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Git::Rainbow
|
|
2
|
+
|
|
3
|
+
According to our own research, every year there are millions
|
|
4
|
+
of programmers suffer from the lack of rainbows in their git commits.
|
|
5
|
+
It is a serious issue, which escalates with age due to the ever
|
|
6
|
+
reducing number of dopamine receptors in the brain.
|
|
7
|
+
|
|
8
|
+
Lets leave those inhumane working conditions in the past! Introducing
|
|
9
|
+
`git rainbow`!
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
gem install git-rainbow
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Once you have that, go into your project and type:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
git-rainbow -m 'Adding more rainbows to the project!'
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
It works just like a normal `git commit`, but produces the a rainbowy
|
|
22
|
+
commit text. If you've done everything right it should look kind of like
|
|
23
|
+
this:
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
|
|
27
|
+
## Copyright & License
|
|
28
|
+
|
|
29
|
+
Mate, you can't patent rainbows!
|
|
30
|
+
|
|
31
|
+
-- Nikolay
|
data/bin/git-rainbow
ADDED
data/git-rainbow.gemspec
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'git_rainbow/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "git-rainbow"
|
|
8
|
+
spec.version = GitRainbow::VERSION
|
|
9
|
+
spec.authors = ["Nikolay Nemshilov"]
|
|
10
|
+
spec.email = ["nemshilov@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = "A git extension that makes rainbows"
|
|
13
|
+
spec.description = "A git extension that makes rainbows. Like totally!"
|
|
14
|
+
spec.homepage = "https://github.com/MadRabbit/git-rainbow"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
17
|
+
spec.bindir = "bin"
|
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_dependency "tco", "~> 0.1.8"
|
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
|
23
|
+
end
|
data/lib/git-rainbow.rb
ADDED
data/lib/git_rainbow.rb
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module GitRainbow
|
|
2
|
+
extend self
|
|
3
|
+
|
|
4
|
+
def explode!
|
|
5
|
+
if message
|
|
6
|
+
exec command
|
|
7
|
+
else
|
|
8
|
+
puts usage!
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def usage!
|
|
13
|
+
'USAGE: git rainbow -m "Your message here!"'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def command
|
|
17
|
+
%Q{ git commit #{ammend? ? '--amend' : ''} -m "#{Painter.paint(message)}" }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def message
|
|
21
|
+
ARGV.each_with_index do |arg, i|
|
|
22
|
+
if arg == "-m" || arg == "--message"
|
|
23
|
+
return ARGV[i+1]
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
nil
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def ammend?
|
|
31
|
+
ARGV.include?("--amend")
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require "tco"
|
|
2
|
+
|
|
3
|
+
module GitRainbow::Painter
|
|
4
|
+
extend self
|
|
5
|
+
|
|
6
|
+
def paint(message)
|
|
7
|
+
palette = build_palette(message.size)
|
|
8
|
+
message.chars.map { |ch| colorize(ch, palette.shift) }.join("")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def colorize(char, color)
|
|
12
|
+
Tco.fg(color, char)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def build_palette(size)
|
|
16
|
+
size.times.map do |i|
|
|
17
|
+
# we're basically generating a bunch of sine wave sequences
|
|
18
|
+
# with a PI/2 phase shift between them to represent RGB colors
|
|
19
|
+
red = wave_value_at(i, size: size, phase: Math::PI/2 - 1)
|
|
20
|
+
green = wave_value_at(i, size: size, phase: 0 - 1)
|
|
21
|
+
blue = wave_value_at(i, size: size, phase: -Math::PI/2 - 1)
|
|
22
|
+
"##{red}#{green}#{blue}"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def wave_value_at(i, size: 1, phase: 0)
|
|
27
|
+
sin = Math.sin(Math::PI / size * 4 * i + phase) # pure sin -1..+1 value
|
|
28
|
+
int = sin * 127 + 128 # 0..255 value
|
|
29
|
+
"%02x" % int # 2 symbols hex
|
|
30
|
+
end
|
|
31
|
+
end
|
data/screen.png
ADDED
|
Binary file
|
metadata
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: git-rainbow
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Nikolay Nemshilov
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-10-24 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: tco
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 0.1.8
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 0.1.8
|
|
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.9'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '1.9'
|
|
41
|
+
description: A git extension that makes rainbows. Like totally!
|
|
42
|
+
email:
|
|
43
|
+
- nemshilov@gmail.com
|
|
44
|
+
executables:
|
|
45
|
+
- git-rainbow
|
|
46
|
+
extensions: []
|
|
47
|
+
extra_rdoc_files: []
|
|
48
|
+
files:
|
|
49
|
+
- ".gitignore"
|
|
50
|
+
- ".travis.yml"
|
|
51
|
+
- Gemfile
|
|
52
|
+
- README.md
|
|
53
|
+
- bin/git-rainbow
|
|
54
|
+
- git-rainbow.gemspec
|
|
55
|
+
- lib/git-rainbow.rb
|
|
56
|
+
- lib/git_rainbow.rb
|
|
57
|
+
- lib/git_rainbow/exploder.rb
|
|
58
|
+
- lib/git_rainbow/painter.rb
|
|
59
|
+
- lib/git_rainbow/version.rb
|
|
60
|
+
- screen.png
|
|
61
|
+
homepage: https://github.com/MadRabbit/git-rainbow
|
|
62
|
+
licenses: []
|
|
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.5
|
|
81
|
+
signing_key:
|
|
82
|
+
specification_version: 4
|
|
83
|
+
summary: A git extension that makes rainbows
|
|
84
|
+
test_files: []
|