luks 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +28 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/luks.rb +36 -0
- data/lib/luks/color_puts.rb +15 -0
- data/lib/luks/version.rb +3 -0
- data/luks.gemspec +28 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e9400b41b773be464be7193e0cc22ca1837004e5
|
4
|
+
data.tar.gz: e69451bfa48a588d259ace421785a8181b677077
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 568568e3b7ee0da1304dc0d0d666fb3bbde0255c6195be462034209e11c21b680db8da26817361a3837fcf219c603aed491dfda6eea1072423ca11b1516c64fd
|
7
|
+
data.tar.gz: 3162d02b38ec23a8fcde790fb1288e288c9cf77d658da05c6dfb9a7e4b905fbef6c77a0812803792831fa0a7824cacffb1175b20375e31ef0731a310faf54b9e
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Epigene
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Luks
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
Add this line to your application's Gemfile:
|
5
|
+
|
6
|
+
```ruby
|
7
|
+
gem 'luks' # and bundle
|
8
|
+
```
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
```rb
|
13
|
+
# Anywhere in code
|
14
|
+
red "This thing failed!"
|
15
|
+
green "Hooray, something was successful"
|
16
|
+
```
|
17
|
+
|
18
|
+
Discover all implemented color methods by running
|
19
|
+
|
20
|
+
```rb
|
21
|
+
Luks.colors
|
22
|
+
```
|
23
|
+
|
24
|
+
## Disclaimer
|
25
|
+
Shamelessly stolen from [Rainbow](https://github.com/sickill/rainbow).
|
26
|
+
|
27
|
+
## License
|
28
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "luks"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/luks.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require "luks/version"
|
2
|
+
|
3
|
+
class Luks
|
4
|
+
# See http://pueblo.sourceforge.net/doc/manual/ansi_color_codes.html
|
5
|
+
COLOR_CODES = {
|
6
|
+
reset: "[0m", # this is not a color, but the code that resets previous changes
|
7
|
+
red: "[31m",
|
8
|
+
green: "[32m",
|
9
|
+
yellow: "[33m",
|
10
|
+
blue: "[34m",
|
11
|
+
magenta: "[35m",
|
12
|
+
cyan: "[36m"
|
13
|
+
}.freeze
|
14
|
+
|
15
|
+
def self.colors
|
16
|
+
color_symbols.each do |color_symbol|
|
17
|
+
Kernel.send(color_symbol, "#{color_symbol}!")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
def self.color_symbols
|
23
|
+
return %i|red green blue yellow magenta cyan|
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.apply_escape_sequences(color_symbol, text)
|
27
|
+
raise "The argument for :#{color_symbol} does not implement :to_s" unless text.respond_to?(:to_s)
|
28
|
+
escape = "\e#{Luks::COLOR_CODES[color_symbol]}".freeze
|
29
|
+
reset = "\e#{Luks::COLOR_CODES[:reset]}".freeze
|
30
|
+
|
31
|
+
return puts("#{escape}#{text}#{reset}")
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'luks/color_puts'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Kernel
|
2
|
+
|
3
|
+
# def red
|
4
|
+
# def ...
|
5
|
+
Luks.send(:color_symbols).each do |color_symbol|
|
6
|
+
define_method(color_symbol) do |*args|
|
7
|
+
args.each do |arg_item|
|
8
|
+
Luks.send(:apply_escape_sequences, __method__, arg_item)
|
9
|
+
end
|
10
|
+
|
11
|
+
return nil
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
data/lib/luks/version.rb
ADDED
data/luks.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'luks/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.required_ruby_version = '>= 2'
|
8
|
+
spec.date = Date.today.to_s
|
9
|
+
spec.name = "luks"
|
10
|
+
spec.version = Luks::VERSION
|
11
|
+
spec.authors = ["Epigene"]
|
12
|
+
spec.email = ["augusts.bautra@gmail.com"]
|
13
|
+
|
14
|
+
spec.summary = %q{Use colorful puts alternatives!}
|
15
|
+
spec.description = %q{A zero-dependency gem for colorful futs variants.}
|
16
|
+
spec.homepage = "https://github.com/Epigene/luks"
|
17
|
+
spec.license = "MIT"
|
18
|
+
|
19
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
+
spec.add_development_dependency "pry"
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: luks
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0.beta1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Epigene
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-08-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.12'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.12'
|
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: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: A zero-dependency gem for colorful futs variants.
|
70
|
+
email:
|
71
|
+
- augusts.bautra@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bin/console
|
84
|
+
- bin/setup
|
85
|
+
- lib/luks.rb
|
86
|
+
- lib/luks/color_puts.rb
|
87
|
+
- lib/luks/version.rb
|
88
|
+
- luks.gemspec
|
89
|
+
homepage: https://github.com/Epigene/luks
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '2'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">"
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 1.3.1
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.4.8
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Use colorful puts alternatives!
|
113
|
+
test_files: []
|