string_color 0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 13d4bf10fec902737fc76853776eece295ec38b1
4
+ data.tar.gz: ae9183b8b58f1f68e028147e07f12f53aee9369f
5
+ SHA512:
6
+ metadata.gz: 8971a39db7c975a88e9b479cfafecf9eaf5d0dfa494a4a8dc553ab99b18f3d2f0b204d1ba35a289628a8cf1696810a3db322a94088b41b059f555b6773a0acfb
7
+ data.tar.gz: b166560d9ad5928613a8e4cb8e0393ebcc800a343040aac26b88615848ad71a7f11a3074f20fc8bfa66da7ea6dbc32ac324f765e83914715102486f3015e401a
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.idea/
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+ *.bundle
12
+ *.so
13
+ *.o
14
+ *.a
15
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 POS_troi
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # StringColor
2
+
3
+ Output color text in console
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'string_color'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install string_color
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+ puts "This is red text".red
25
+ ```
26
+
27
+ ## Available color
28
+
29
+ * White - white
30
+ * Red - red
31
+ * Light red - light_red
32
+ * Green - green
33
+ * Light green - light_green
34
+ * Yellow - yellow
35
+ * Blue - blue
36
+ * Light blue - light_blue
37
+ * Purple - purple
38
+ * Light purple - light_purple
39
+ * Brown - brown
40
+ * Cyan - cyan
41
+ * Light cyan - light_cyan
42
+ * Light gray - light_gray
43
+ * Dark gray - dark_gray
44
+
45
+ ## Contributing
46
+
47
+ 1. Fork it ( https://github.com/POStroi/ruby_string_color/fork )
48
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
49
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
50
+ 4. Push to the branch (`git push origin my-new-feature`)
51
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << 'test'
6
+ end
7
+
8
+ desc "Run tests"
9
+ task :default => :test
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+ require 'string_color/version'
3
+ ###################################################################
4
+ # #
5
+ # Text coloring #
6
+ # #
7
+ # ██████╗ ██████╗ ███████╗ ████████╗██████╗ ██████╗ ██╗ #
8
+ # ██╔══██╗██╔═══██╗██╔════╝ ╚══██╔══╝██╔══██╗██╔═══██╗██║ #
9
+ # ██████╔╝██║ ██║███████╗ ██║ ██████╔╝██║ ██║██║ #
10
+ # ██╔═══╝ ██║ ██║╚════██║ ██║ ██╔══██╗██║ ██║██║ #
11
+ # ██║ ╚██████╔╝███████║███████╗██║ ██║ ██║╚██████╔╝██║ #
12
+ # ╚═╝ ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ #
13
+ # #
14
+ ###################################################################
15
+
16
+
17
+ class String
18
+ # Return White
19
+ def white; colorize(self, "\e[1;37m"); end
20
+ # Return red
21
+ def red; colorize(self, "\e[31m"); end
22
+ # Return Light Red
23
+ def light_red; colorize(self, "\e[1;31m"); end
24
+ # Return Green
25
+ def green; colorize(self, "\e[32m"); end
26
+ # Return Light Green
27
+ def light_green; colorize(self, "\e[1;32m"); end
28
+ # Return Yellow
29
+ def yellow; colorize(self, "\e[1;33m"); end
30
+ # Return Blue
31
+ def blue; colorize(self, "\e[34m"); end
32
+ # Return Light Blue
33
+ def light_blue; colorize(self, "\e[1;34m"); end
34
+ # Return Purple
35
+ def purple; colorize(self, "\e[35m"); end
36
+ # Return Light Purple
37
+ def light_purple; colorize(self, "\e[1;35m"); end
38
+ # Return Brown
39
+ def brown; colorize(self, "\e[33m"); end
40
+ # Return Cyan
41
+ def cyan; colorize(self, "\e[36m"); end
42
+ # Return Light Cyan
43
+ def light_cyan; colorize(self, "\e[1;36m"); end
44
+ # Return Light Gray
45
+ def light_gray; colorize(self, "\e[37m"); end
46
+ # Return Dark Gray
47
+ def dark_gray; colorize(self, "\e[1;30m"); end
48
+ # Colored text
49
+ def colorize(text, color_code) "#{color_code}#{text}\e[0m" end
50
+ end
51
+
@@ -0,0 +1,3 @@
1
+ module StringColor
2
+ VERSION = "0.1"
3
+ end
@@ -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 'string_color/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "string_color"
8
+ spec.version = StringColor::VERSION
9
+ spec.authors = ["POS_troi"]
10
+ spec.email = ["root@sysalex.com"]
11
+ spec.summary = %q{Colorize strings for terminal output}
12
+ spec.description = %q{Colorize strings for terminal output}
13
+ spec.homepage = "https://github.com/POStroi/ruby_string_color.git"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake", '~> 0'
23
+ end
@@ -0,0 +1,26 @@
1
+ require 'minitest/autorun'
2
+ require 'string_color'
3
+
4
+ class StringColorTest < Minitest::Test
5
+ def test_color_output
6
+ puts 'White color'.white
7
+ puts 'Red color'.red
8
+ puts 'Light red color'.light_red
9
+ puts 'Green color'.green
10
+ puts 'Light green color'.light_green
11
+ puts 'Yellow color'.yellow
12
+ puts 'Blue color'.blue
13
+ puts 'Light blue color'.light_blue
14
+ puts 'Purple color'.purple
15
+ puts 'Light purple color'.light_purple
16
+ puts 'Brown color'.brown
17
+ puts 'Cyan color'.cyan
18
+ puts 'Light cyan color'.light_cyan
19
+ puts 'Light gray color'.light_gray
20
+ puts 'Dark gray color'.dark_gray
21
+ end
22
+
23
+ def test_equal
24
+ assert_equal "\e[31mRed\e[0m", "Red".red
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: string_color
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - POS_troi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-05 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.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Colorize strings for terminal output
42
+ email:
43
+ - root@sysalex.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - lib/string_color.rb
54
+ - lib/string_color/version.rb
55
+ - string_color.gemspec
56
+ - test/test_string_color.rb
57
+ homepage: https://github.com/POStroi/ruby_string_color.git
58
+ licenses:
59
+ - MIT
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.4.5
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: Colorize strings for terminal output
81
+ test_files:
82
+ - test/test_string_color.rb