putsplus 0.0.5 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea8ccee75b8a7cc9add56a2424924e98c35c0fe8
4
- data.tar.gz: 580396c493a3e793255783dd6a746d2824940103
3
+ metadata.gz: c1e8414b9cdf3872b9612de4b7a2c3a5c120ef23
4
+ data.tar.gz: c5c8afecb838efacb0adaefcb2066a812d0203f6
5
5
  SHA512:
6
- metadata.gz: 1283c41956b810ac1bc8c37b4c10f8386c62e5333b06bc95c263064c14e4cc7bde76fe791e5887bc809d5ef235ea26c201aa82b8011db6838823a412e785dd83
7
- data.tar.gz: 3e04a57159267fa53ca885a4bac62a2de94546ae4935e79d32ea37cdf0a70080e68963f871f4de5a472103a1e2f47f988be8762bbed12e51ccd17c975511960a
6
+ metadata.gz: eabeb3ac743ccb4f3ac2b1491b8a38dc6318f36695d0aee034bec64aa7760f554f9d30fad52f0cd4dabeb5cce682658a5665b8789e1801c1b71a7bc26d582fb8
7
+ data.tar.gz: 74855200776bd1de705e5a4d86327fde0552182a6114b83fabb124eab36f6fc475c91a515b76949f98824638587105e582a1a9e0c376798e5080eebac2a4a027
data/.travis.yml CHANGED
@@ -3,3 +3,5 @@ language: ruby
3
3
  rvm:
4
4
  - 2.3.3
5
5
  before_install: gem install bundler -v 1.13.7
6
+ notifications:
7
+ email: false
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
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/putsplus`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- ## Usage
21
+ then require and include it in your scripts
22
+ ```ruby
23
+ require 'putsplus'
24
+ include Putsplus
25
+ ```
24
26
 
25
- TODO: Write usage instructions here
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/[USERNAME]/putsplus.
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
@@ -1,3 +1,3 @@
1
1
  module Putsplus
2
- VERSION = "0.0.5"
2
+ VERSION = "0.1.0"
3
3
  end
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 improve cli UI"
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.5
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 improve cli UI
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: []