nutrun-string 0.1.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.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in nutrun-string.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Achilles Charmpilas, George Malamidis
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.
@@ -0,0 +1,36 @@
1
+ # Nutrun::String
2
+
3
+ nutrun-string allows strings to do cool things on the command line.
4
+ Most of the functionality was originally published by George Malamidis as a gist here: https://gist.github.com/703943.
5
+
6
+ During the last couple of years I've ended up using that little script again and again and again, and every time I thought "I really have to bundle this eventually, instead of pasting it around all the damn time". Well, here it is with a few additions of my own.
7
+
8
+ NOTE: This class will extend Ruby's native String class. Many people don't really like extending base classes, and there are a few long, loooong-winded conversations on the subject on various mailing lists and forums. We don't mind it, and if you don't too, feel free to use this gem.
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ gem 'nutrun-string'
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install nutrun-string
23
+
24
+ ## Usage
25
+ Your console strings can now do boss things such as:
26
+
27
+ "OMG!!1!".blink.red.underline
28
+ Check out the source for a full list of features
29
+
30
+ ## Contributing
31
+
32
+ 1. Fork it
33
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
34
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
35
+ 4. Push to the branch (`git push origin my-new-feature`)
36
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,101 @@
1
+ require "nutrun-string/version"
2
+
3
+ module Nutrun
4
+ module String
5
+ def red
6
+ "\e[31m#{self}\e[0m"
7
+ end
8
+
9
+ def blue
10
+ "\e[34m#{self}\e[0m"
11
+ end
12
+
13
+ def yellow
14
+ "\e[33m#{self}\e[0m"
15
+ end
16
+
17
+ def black
18
+ "\e[30m#{self}\e[0m"
19
+ end
20
+
21
+ def green
22
+ "\e[32m#{self}\e[0m"
23
+ end
24
+
25
+ def magenta
26
+ "\e[35m#{self}\e[0m"
27
+ end
28
+
29
+ def cyan
30
+ "\e[36m#{self}\e[0m"
31
+ end
32
+
33
+ def white
34
+ "\e[37m#{self}\e[0m"
35
+ end
36
+
37
+ def default
38
+ "\e[39m#{self}\e[0m"
39
+ end
40
+
41
+ def bg_black
42
+ "\e[40m#{self}\e[0m"
43
+ end
44
+
45
+ def bg_red
46
+ "\e[41m#{self}\e[0m"
47
+ end
48
+
49
+ def bg_green
50
+ "\e[42m#{self}\e[0m"
51
+ end
52
+
53
+ def bg_yellow
54
+ "\e[43m#{self}\e[0m"
55
+ end
56
+
57
+ def bg_blue
58
+ "\e[44m#{self}\e[0m"
59
+ end
60
+
61
+ def bg_magenta
62
+ "\e[45m#{self}\e[0m"
63
+ end
64
+
65
+ def bg_cyan
66
+ "\e[46m#{self}\e[0m"
67
+ end
68
+
69
+ def bg_white
70
+ "\e[47m#{self}\e[0m"
71
+ end
72
+
73
+ def bg_default
74
+ "\e[49m#{self}\e[0m"
75
+ end
76
+
77
+ def bright
78
+ "\e[1m#{self}\e[0m"
79
+ end
80
+
81
+ def underline
82
+ "\e[4m#{self}\e[0m"
83
+ end
84
+
85
+ def blink
86
+ "\e[5m#{self}\e[0m"
87
+ end
88
+
89
+ def invert
90
+ "\e[7m#{self}\e[0m"
91
+ end
92
+
93
+ def hide
94
+ "\e[8m#{self}\e[0m"
95
+ end
96
+ end
97
+ end
98
+
99
+ class String
100
+ include Nutrun::String
101
+ end
@@ -0,0 +1,5 @@
1
+ module Nutrun
2
+ module String
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'nutrun-string/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "nutrun-string"
8
+ gem.version = Nutrun::String::VERSION
9
+ gem.authors = ["Achilles Charmpilas","George Malamidis"]
10
+ gem.email = ["ac@humbuckercode.co.uk"]
11
+ gem.description = %q{Pimp my console strings}
12
+ gem.summary = %q{Allows strings to do cool things on the command line}
13
+ gem.homepage = "http://humbuckercode.co.uk/licks/gems/nutrunstring/"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ end
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nutrun-string
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Achilles Charmpilas
9
+ - George Malamidis
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-11-19 00:00:00.000000000Z
14
+ dependencies: []
15
+ description: Pimp my console strings
16
+ email:
17
+ - ac@humbuckercode.co.uk
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gitignore
23
+ - Gemfile
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - lib/nutrun-string.rb
28
+ - lib/nutrun-string/version.rb
29
+ - nutrun-string.gemspec
30
+ homepage: http://humbuckercode.co.uk/licks/gems/nutrunstring/
31
+ licenses: []
32
+ post_install_message:
33
+ rdoc_options: []
34
+ require_paths:
35
+ - lib
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubyforge_project:
50
+ rubygems_version: 1.8.10
51
+ signing_key:
52
+ specification_version: 3
53
+ summary: Allows strings to do cool things on the command line
54
+ test_files: []