putsplus 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/README.md +10 -7
- data/lib/putsplus/footer.rb +31 -0
- data/lib/putsplus/version.rb +1 -1
- data/lib/putsplus.rb +15 -1
- data/putsplus.gemspec +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1e8414b9cdf3872b9612de4b7a2c3a5c120ef23
|
4
|
+
data.tar.gz: c5c8afecb838efacb0adaefcb2066a812d0203f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eabeb3ac743ccb4f3ac2b1491b8a38dc6318f36695d0aee034bec64aa7760f554f9d30fad52f0cd4dabeb5cce682658a5665b8789e1801c1b71a7bc26d582fb8
|
7
|
+
data.tar.gz: 74855200776bd1de705e5a4d86327fde0552182a6114b83fabb124eab36f6fc475c91a515b76949f98824638587105e582a1a9e0c376798e5080eebac2a4a027
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
# Putsplus
|
1
|
+
# Putsplus ![Build Status](https://travis-ci.org/bjubes/putsplus.svg?branch=master)
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Builds upon the default `puts` command to create more attractive and programmer friendly user interfaces for command line applications.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -20,10 +18,15 @@ Or install it yourself as:
|
|
20
18
|
|
21
19
|
$ gem install putsplus
|
22
20
|
|
23
|
-
|
21
|
+
then require and include it in your scripts
|
22
|
+
```ruby
|
23
|
+
require 'putsplus'
|
24
|
+
include Putsplus
|
25
|
+
```
|
24
26
|
|
25
|
-
|
27
|
+
## Usage
|
26
28
|
|
29
|
+
Refer to the documentation on [rubygems.org](http://www.rubydoc.info/gems/putsplus/Putsplus)
|
27
30
|
## Development
|
28
31
|
|
29
32
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -32,7 +35,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
35
|
|
33
36
|
## Contributing
|
34
37
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
38
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/bjubes/putsplus. Please ensure all PRs are your original work.
|
36
39
|
|
37
40
|
|
38
41
|
## License
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Putsplus
|
2
|
+
#
|
3
|
+
# Sticks text to last line in console
|
4
|
+
#
|
5
|
+
class Footer
|
6
|
+
attr_reader :thread
|
7
|
+
attr_accessor :text
|
8
|
+
|
9
|
+
def initialize(text = "")
|
10
|
+
@text = text
|
11
|
+
@thread = Thread.new {
|
12
|
+
while true do
|
13
|
+
sticky_footer @text
|
14
|
+
end
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
def kill
|
19
|
+
Thread.kill(@thread)
|
20
|
+
end
|
21
|
+
|
22
|
+
def sticky_footer text
|
23
|
+
print text.to_s + "\r"
|
24
|
+
$stdout.flush
|
25
|
+
end
|
26
|
+
|
27
|
+
def alive?
|
28
|
+
@thread.alive?
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/putsplus/version.rb
CHANGED
data/lib/putsplus.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require "putsplus/version"
|
2
|
+
require_relative "putsplus/footer.rb"
|
2
3
|
|
3
4
|
module Putsplus
|
5
|
+
|
4
6
|
#
|
5
7
|
#Puts only if obj is not null
|
6
8
|
#
|
@@ -37,7 +39,18 @@ module Putsplus
|
|
37
39
|
raise Exeception, "num must be an Integer" unless is_int?(num)
|
38
40
|
raise Exeception, "char must be an Character or String" unless (is_string? char)
|
39
41
|
|
40
|
-
puts char * num
|
42
|
+
puts char.to_s * num.to_i
|
43
|
+
end
|
44
|
+
|
45
|
+
#
|
46
|
+
#puts a full line break using the character provided
|
47
|
+
#
|
48
|
+
#Arguments:
|
49
|
+
# char: the character to use. Defaults to '-'.
|
50
|
+
#
|
51
|
+
def full_linebr char = '-'
|
52
|
+
raise Exeception, "char must be one character only" unless char.to_s.length == 1
|
53
|
+
linebr `tput cols`, char
|
41
54
|
end
|
42
55
|
|
43
56
|
#
|
@@ -50,6 +63,7 @@ module Putsplus
|
|
50
63
|
puts string
|
51
64
|
linebr string.length, char
|
52
65
|
end
|
66
|
+
|
53
67
|
|
54
68
|
#PRIVATE VARS
|
55
69
|
private
|
data/putsplus.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Brian Jubelirer"]
|
10
10
|
spec.email = ["brian2386@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = "Builds upon puts to
|
12
|
+
spec.summary = "Builds upon the default puts command to create more attractive and programmer friendly user interfaces for command line applications."
|
13
13
|
spec.homepage = "http://rubygems.org/gems/putsplus"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: putsplus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Jubelirer
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- bin/console
|
69
69
|
- bin/setup
|
70
70
|
- lib/putsplus.rb
|
71
|
+
- lib/putsplus/footer.rb
|
71
72
|
- lib/putsplus/version.rb
|
72
73
|
- putsplus.gemspec
|
73
74
|
homepage: http://rubygems.org/gems/putsplus
|
@@ -93,5 +94,6 @@ rubyforge_project:
|
|
93
94
|
rubygems_version: 2.6.8
|
94
95
|
signing_key:
|
95
96
|
specification_version: 4
|
96
|
-
summary: Builds upon puts to
|
97
|
+
summary: Builds upon the default puts command to create more attractive and programmer
|
98
|
+
friendly user interfaces for command line applications.
|
97
99
|
test_files: []
|