terminal-emojify 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/.gitignore +15 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +56 -0
- data/Rakefile +2 -0
- data/bin/emojify +9 -0
- data/lib/terminal/emojify.rb +14 -0
- data/lib/terminal/emojify/maybe.rb +38 -0
- data/lib/terminal/emojify/version.rb +5 -0
- data/script/bootstrap +1 -0
- data/terminal-emojify.gemspec +23 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 09d44e9ab5a638d6e333d6d2976c206a31b4e7af
|
4
|
+
data.tar.gz: 0328e9319134624366e7b4d19dca6aa5351be4ce
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bfb9706f9dbf40ea1e3a716b5f376f9656e537fecbd64d65d39b9e403b618477768915166f62def660794780372f2bd3c27a2fee34c6fd89d065fc08def58d64
|
7
|
+
data.tar.gz: 451c6f3476ab27a43143dcc31940d59e5c7a41c6b4fe03fe584ed0cfba20559f9aa549da05e99d02a1d52dcad3bde442b76975b24a0fd20faaede1ad7e38cb09
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Antonio Scandurra
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# Terminal Emojify
|
2
|
+
|
3
|
+
Outputs emoji aliases as raw characters.
|
4
|
+
|
5
|
+
## Why?
|
6
|
+
|
7
|
+
Nowadays [many
|
8
|
+
projects](https://github.com/atom/atom/tree/master/CONTRIBUTING.md) use emojis
|
9
|
+
as part of their contribution workflow. Commit messages are, therefore, full of
|
10
|
+
these wonderful icons which, unfortunately, are not accessible in our terminal.
|
11
|
+
|
12
|
+
Terminal Emojify is here to change that.
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
```bash
|
17
|
+
$ gem install terminal-emojify
|
18
|
+
```
|
19
|
+
|
20
|
+
## Example Usages
|
21
|
+
|
22
|
+
### Beautiful git history
|
23
|
+
|
24
|
+
Edit your .gitconfig and define this alias:
|
25
|
+
|
26
|
+
```
|
27
|
+
[alias]
|
28
|
+
elog = --no-pager log | emojify | less
|
29
|
+
```
|
30
|
+
|
31
|
+
Then run the command below on your repo:
|
32
|
+
|
33
|
+
```bash
|
34
|
+
$ git elog
|
35
|
+
```
|
36
|
+
|
37
|
+
### Psycho
|
38
|
+
|
39
|
+
(courtesy of http://emojisaurus.com/phrases/402-psycho)
|
40
|
+
|
41
|
+
```
|
42
|
+
$ echo ":hocho: :scream: :shower:" | emojify
|
43
|
+
```
|
44
|
+
|
45
|
+
### Many others
|
46
|
+
|
47
|
+
What about you? How do you use it? Please, open an issue so that I can include
|
48
|
+
other creative usages of this utility :bow:.
|
49
|
+
|
50
|
+
## Contributing
|
51
|
+
|
52
|
+
1. Fork it ( https://github.com/as-cii/terminal-emojify/fork )
|
53
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
54
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
55
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
56
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/emojify
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "terminal/emojify/version"
|
2
|
+
require "terminal/emojify/maybe"
|
3
|
+
require "gemoji"
|
4
|
+
|
5
|
+
module Terminal
|
6
|
+
module Emojify
|
7
|
+
def self.call(text)
|
8
|
+
text.gsub(/:([\w+-]+):/) do |match|
|
9
|
+
emoji = Maybe.wrap Emoji.find_by_alias($1)
|
10
|
+
(emoji.raw + " ").value || match
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class Maybe
|
2
|
+
def self.wrap(object)
|
3
|
+
if object
|
4
|
+
Some.new(object)
|
5
|
+
else
|
6
|
+
None.new
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def respond_to?(method_name, include_private = false)
|
11
|
+
super || @object.respond_to?(method_name, include_private)
|
12
|
+
end
|
13
|
+
|
14
|
+
def method_missing(method_name, *arguments, &block)
|
15
|
+
value = nil
|
16
|
+
if @object.respond_to?(method_name)
|
17
|
+
value = @object.send(method_name, *arguments, &block)
|
18
|
+
end
|
19
|
+
|
20
|
+
self.class.wrap(value)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
class None < Maybe
|
25
|
+
def value
|
26
|
+
nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class Some < Maybe
|
31
|
+
def initialize(object)
|
32
|
+
@object = object
|
33
|
+
end
|
34
|
+
|
35
|
+
def value
|
36
|
+
@object
|
37
|
+
end
|
38
|
+
end
|
data/script/bootstrap
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
bundle install --path=vendor/gems
|
@@ -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 'terminal/emojify/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "terminal-emojify"
|
8
|
+
spec.version = Terminal::Emojify::VERSION
|
9
|
+
spec.authors = ["Antonio Scandurra"]
|
10
|
+
spec.email = ["me@as-cii.com"]
|
11
|
+
spec.summary = %q{Outputs emoji aliases as raw characters.}
|
12
|
+
spec.homepage = ""
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
21
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
22
|
+
spec.add_dependency "gemoji", "~> 2.1.0"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: terminal-emojify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Antonio Scandurra
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-17 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
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: gemoji
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.1.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.1.0
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- me@as-cii.com
|
58
|
+
executables:
|
59
|
+
- emojify
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/emojify
|
69
|
+
- lib/terminal/emojify.rb
|
70
|
+
- lib/terminal/emojify/maybe.rb
|
71
|
+
- lib/terminal/emojify/version.rb
|
72
|
+
- script/bootstrap
|
73
|
+
- terminal-emojify.gemspec
|
74
|
+
homepage: ''
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.4.5
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: Outputs emoji aliases as raw characters.
|
98
|
+
test_files: []
|
99
|
+
has_rdoc:
|