colsole 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +9 -4
- data/lib/colsole.rb +7 -3
- data/lib/colsole/version.rb +1 -1
- metadata +4 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b58eedbdc35ce21578e093774b1110c2633cc1271a33e6bbce21bcb148003e20
|
4
|
+
data.tar.gz: 2d6c1526571488460603ff69aabcfc86a93eb836e2901ffd4345ce81d1e0fe79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f15d7093fcf1b9835e01b51f8a442ee5dee4194e0b8f03226602bb9a782b764dc74230fa3d9f0b1e86188532641a0ae998126ad0c3ef823a31c37edee15ab87
|
7
|
+
data.tar.gz: 1c391bc4f87e5b8c22165ecfeec4e64efb21a817282ccb070b121ec4cae63f4f5ca07fc4f8b86dd2e10cbc81c5a25c3451c584d6b4513ec78e475564b534e415
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
Colsole
|
2
2
|
==================================================
|
3
3
|
|
4
|
-
[![Gem](https://
|
5
|
-
[![
|
6
|
-
[![
|
7
|
-
[![
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/colsole.svg)](https://badge.fury.io/rb/colsole)
|
5
|
+
[![Build Status](https://travis-ci.com/DannyBen/colsole.svg?branch=master)](https://travis-ci.com/DannyBen/colsole)
|
6
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/0556015f7cd2080531a1/maintainability)](https://codeclimate.com/github/DannyBen/colsole/maintainability)
|
7
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/0556015f7cd2080531a1/test_coverage)](https://codeclimate.com/github/DannyBen/colsole/test_coverage)
|
8
8
|
|
9
9
|
---
|
10
10
|
|
@@ -129,6 +129,11 @@ Checks if the provided string is a command in the path.
|
|
129
129
|
Returns an array `[width, height]` of the terminal, or the supplied
|
130
130
|
`fallback_value` if it is unable to detect.
|
131
131
|
|
132
|
+
### `terminal_width`
|
133
|
+
|
134
|
+
Returns only the terminal width. This is a shortcut to
|
135
|
+
`detect_terminal_size[0]`.
|
136
|
+
|
132
137
|
|
133
138
|
Color Codes
|
134
139
|
--------------------------------------------------
|
data/lib/colsole.rb
CHANGED
@@ -12,6 +12,7 @@ require "colsole/version"
|
|
12
12
|
# - #say_status symbol, string [, color] - print a message with status
|
13
13
|
# - #word_wrap string - wrap a string and maintain indentation
|
14
14
|
# - #detect_terminal_size
|
15
|
+
# - #terminal_width
|
15
16
|
#
|
16
17
|
# Credits:
|
17
18
|
# terminal width detection by Gabrial Horner https://github.com/cldwalker
|
@@ -101,7 +102,12 @@ module Colsole
|
|
101
102
|
text.strip!
|
102
103
|
length -= lead.length
|
103
104
|
text.split("\n").collect! do |line|
|
104
|
-
line.length > length
|
105
|
+
if line.length > length
|
106
|
+
line.gsub!(/([^\s]{#{length}})([^\s$])/, "\\1 \\2")
|
107
|
+
line.gsub(/(.{1,#{length}})(\s+|$)/, "#{lead}\\1\n").rstrip
|
108
|
+
else
|
109
|
+
"#{lead}#{line}"
|
110
|
+
end
|
105
111
|
end * "\n"
|
106
112
|
end
|
107
113
|
|
@@ -169,5 +175,3 @@ module Colsole
|
|
169
175
|
end
|
170
176
|
|
171
177
|
end
|
172
|
-
|
173
|
-
self.extend Colsole
|
data/lib/colsole/version.rb
CHANGED
metadata
CHANGED
@@ -1,71 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: colsole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: runfile
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0.9'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0.9'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: runfile-tasks
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0.4'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0.4'
|
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.6'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.6'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: simplecov
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0.14'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0.14'
|
11
|
+
date: 2018-12-07 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
69
13
|
description: Utility functions for making colorful console applications
|
70
14
|
email: db@dannyben.com
|
71
15
|
executables: []
|
@@ -95,7 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
39
|
version: '0'
|
96
40
|
requirements: []
|
97
41
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.6
|
42
|
+
rubygems_version: 2.7.6
|
99
43
|
signing_key:
|
100
44
|
specification_version: 4
|
101
45
|
summary: Colorful Console Applications
|