colourer 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +16 -0
- data/Gemfile +4 -0
- data/Guardfile +24 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/colourer.gemspec +25 -0
- data/lib/colourer.rb +32 -0
- data/lib/colourer/version.rb +3 -0
- data/spec/colourer_spec.rb +24 -0
- data/spec/fixtures/approvals/string/colours.approved.txt +16 -0
- data/spec/fixtures/approvals/string/rainbows.approved.txt +16 -0
- data/spec/spec_helper.rb +6 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e169e0753e7577554b8a4a0ece51fe92d924d64f
|
4
|
+
data.tar.gz: 1220f5b41876f6e94d4df99472e3efc5c8302cc7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ac2eb3d7cc717d911e31495dd7b0fe2df5e35511b2ca366614968821b91879a007045743658011a89f1726fdde84332426de0c5fe4786db80be197600986c116
|
7
|
+
data.tar.gz: d5c6865c2404fb09708fa9a9a3d7358ac616cbaa7bd955cd3a031fb4db9065c202acd821353dad8bbc5b21412348314147776f89485235c2317c0afb8599d670
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard :rspec do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
|
9
|
+
# Rails example
|
10
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
11
|
+
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
12
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
13
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
14
|
+
watch('config/routes.rb') { "spec/routing" }
|
15
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
16
|
+
|
17
|
+
# Capybara features specs
|
18
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
19
|
+
|
20
|
+
# Turnip features and steps
|
21
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
22
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
23
|
+
end
|
24
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Roman V. Babenko
|
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,29 @@
|
|
1
|
+
# Colourer
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'colourer'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install colourer
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/colourer.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'colourer/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'colourer'
|
8
|
+
spec.version = Colourer::VERSION
|
9
|
+
spec.authors = ['Roman V. Babenko']
|
10
|
+
spec.email = ['romanvbabenko@gmail.com']
|
11
|
+
spec.description = %q{Just another Ruby String class extension. Adds methods to set text color}
|
12
|
+
spec.summary = %q{Add color methods to String class}
|
13
|
+
spec.homepage = ''
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
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.3'
|
22
|
+
spec.add_development_dependency 'rspec', '~> 2.14.0'
|
23
|
+
spec.add_development_dependency 'guard-rspec'
|
24
|
+
spec.add_development_dependency 'approvals'
|
25
|
+
end
|
data/lib/colourer.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require "colourer/version"
|
2
|
+
|
3
|
+
class String
|
4
|
+
|
5
|
+
class << self
|
6
|
+
|
7
|
+
def colours
|
8
|
+
palette.keys
|
9
|
+
end
|
10
|
+
|
11
|
+
def palette
|
12
|
+
{ :black => '0;30', :blue => '0;34', :green => '0;32', :cyan => '0;36', :red => '0;31', :purple => '0;35', :brown => '0;33', :light_gray => '0;37',
|
13
|
+
:dark_gray => '1;30', :light_blue => '1;34', :light_green => '1;32', :light_cyan => '1;36', :light_red => '1;31', :light_purple => '1;35',
|
14
|
+
:yellow => '1;33', :white => '1;37' }
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
String.palette.each do |colour, code|
|
20
|
+
define_method colour do
|
21
|
+
"\e[#{code}m#{self}\e[0m"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def magenta; purple; end
|
26
|
+
def light_magenta; light_purple; end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
module Colourer
|
31
|
+
# Your code goes here...
|
32
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
# http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
|
4
|
+
|
5
|
+
describe String do
|
6
|
+
|
7
|
+
specify 'colours' do
|
8
|
+
verify do
|
9
|
+
String.colours
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
specify 'rainbows' do
|
14
|
+
verify do
|
15
|
+
String.colours.map { |colour| colour.to_s.send(colour) }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
specify 'colorize gem compatibility' do
|
20
|
+
String.new.purple.should == String.new.magenta
|
21
|
+
String.new.light_purple == String.new.light_magenta
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
[0] :black
|
2
|
+
[1] :blue
|
3
|
+
[2] :green
|
4
|
+
[3] :cyan
|
5
|
+
[4] :red
|
6
|
+
[5] :purple
|
7
|
+
[6] :brown
|
8
|
+
[7] :light_gray
|
9
|
+
[8] :dark_gray
|
10
|
+
[9] :light_blue
|
11
|
+
[10] :light_green
|
12
|
+
[11] :light_cyan
|
13
|
+
[12] :light_red
|
14
|
+
[13] :light_purple
|
15
|
+
[14] :yellow
|
16
|
+
[15] :white
|
@@ -0,0 +1,16 @@
|
|
1
|
+
[0] "\e[0;30mblack\e[0m"
|
2
|
+
[1] "\e[0;34mblue\e[0m"
|
3
|
+
[2] "\e[0;32mgreen\e[0m"
|
4
|
+
[3] "\e[0;36mcyan\e[0m"
|
5
|
+
[4] "\e[0;31mred\e[0m"
|
6
|
+
[5] "\e[0;35mpurple\e[0m"
|
7
|
+
[6] "\e[0;33mbrown\e[0m"
|
8
|
+
[7] "\e[0;37mlight_gray\e[0m"
|
9
|
+
[8] "\e[1;30mdark_gray\e[0m"
|
10
|
+
[9] "\e[1;34mlight_blue\e[0m"
|
11
|
+
[10] "\e[1;32mlight_green\e[0m"
|
12
|
+
[11] "\e[1;36mlight_cyan\e[0m"
|
13
|
+
[12] "\e[1;31mlight_red\e[0m"
|
14
|
+
[13] "\e[1;35mlight_purple\e[0m"
|
15
|
+
[14] "\e[1;33myellow\e[0m"
|
16
|
+
[15] "\e[1;37mwhite\e[0m"
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: colourer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Roman V. Babenko
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-01 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.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.14.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.14.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: guard-rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: approvals
|
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: Just another Ruby String class extension. Adds methods to set text color
|
70
|
+
email:
|
71
|
+
- romanvbabenko@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- Gemfile
|
78
|
+
- Guardfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- colourer.gemspec
|
83
|
+
- lib/colourer.rb
|
84
|
+
- lib/colourer/version.rb
|
85
|
+
- spec/colourer_spec.rb
|
86
|
+
- spec/fixtures/approvals/string/colours.approved.txt
|
87
|
+
- spec/fixtures/approvals/string/rainbows.approved.txt
|
88
|
+
- spec/spec_helper.rb
|
89
|
+
homepage: ''
|
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: '0'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.1.7
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Add color methods to String class
|
113
|
+
test_files:
|
114
|
+
- spec/colourer_spec.rb
|
115
|
+
- spec/fixtures/approvals/string/colours.approved.txt
|
116
|
+
- spec/fixtures/approvals/string/rainbows.approved.txt
|
117
|
+
- spec/spec_helper.rb
|