rtui 0.1.8 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,6 @@
1
+ .DS_Store
2
+ doc/*
3
+ rdoc/*
4
+ coverage/*
5
+ spec/debug.log
6
+ pkg/*
@@ -3,6 +3,7 @@
3
3
  | < | | | | |_| |_
4
4
  |___|__| |___| |_______|_______|
5
5
 
6
+
6
7
  This gem goal is to provide TUI eye candy for ruby.
7
8
 
8
9
  For now, we got:
@@ -17,13 +18,13 @@ This fork changes the api and adds some methods.
17
18
 
18
19
  == Examples
19
20
 
20
- pbar = Rtui::Progress.new("test", 100)
21
+ pbar = RTUI::Progress.new("test", 100)
21
22
  100.times {sleep(0.1); pbar.inc}; pbar.finish
22
23
 
23
24
  test: 100% |===============================================| Time: 00:00:10
24
25
 
25
26
 
26
- pbar = Rtui::Progress.new("test", 100, :components => [:bar, :percentage])
27
+ pbar = RTUI::Progress.new("test", 100, :components => [:bar, :percentage])
27
28
  100.times {sleep(0.1); pbar.inc}; pbar.finish
28
29
 
29
30
  |====================================================================| 100%
data/Rakefile CHANGED
@@ -1,27 +1,57 @@
1
- %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
2
- require File.dirname(__FILE__) + '/lib/rtui'
3
-
4
- # Generate all the Rake tasks
5
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
6
- $hoe = Hoe.new('rtui', Rtui::VERSION) do |p|
7
- p.developer('Marcos Piccinini', 'x@nofxx.com')
8
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
9
- p.rubyforge_name = p.name # TODO this is default value
10
- p.summary = "Ruby TUI Helpers"
11
- p.description = "Set of tools for TUI Eye Candy"
12
- p.url = "http://github.com/nofxx/rtui"
13
- p.extra_dev_deps = [
14
- ['newgem', ">= #{::Newgem::VERSION}"]
15
- ]
16
-
17
- p.clean_globs |= %w[**/.DS_Store tmp *.log]
18
- path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
19
- p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
20
- p.rsync_args = '-av --delete --ignore-errors'
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "rtui"
8
+ gem.summary = "Set of tools for TUI Eye Candy"
9
+ gem.email = "see@github"
10
+ gem.homepage = "http://github.com/nofxx/rtui"
11
+ gem.authors = ["Marcos Augusto"]
12
+ gem.add_dependency 'rspec' # ,'>=1.1.11'],
13
+ gem.add_dependency 'rtui' #,'>= 0.1.8']
14
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
+ end
16
+
17
+ rescue LoadError
18
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
21
19
  end
22
20
 
23
- require 'newgem/tasks' # load /tasks/*.rake
24
- Dir['tasks/**/*.rake'].each { |t| load t }
21
+ require 'rake/testtask'
22
+ Rake::TestTask.new(:test) do |test|
23
+ test.libs << 'lib' << 'test'
24
+ test.pattern = 'test/**/*_test.rb'
25
+ test.verbose = true
26
+ end
27
+
28
+ begin
29
+ require 'rcov/rcovtask'
30
+ Rcov::RcovTask.new do |test|
31
+ test.libs << 'test'
32
+ test.pattern = 'test/**/*_test.rb'
33
+ test.verbose = true
34
+ end
35
+ rescue LoadError
36
+ task :rcov do
37
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
38
+ end
39
+ end
25
40
 
26
- # TODO - want other tests/tasks run by default? Add them to the list
27
- # task :default => [:spec, :features]
41
+
42
+ task :default => :test
43
+
44
+ require 'rake/rdoctask'
45
+ Rake::RDocTask.new do |rdoc|
46
+ if File.exist?('VERSION.yml')
47
+ config = YAML.load(File.read('VERSION.yml'))
48
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
49
+ else
50
+ version = ""
51
+ end
52
+
53
+ rdoc.rdoc_dir = 'rdoc'
54
+ rdoc.title = "rspec_spinner #{version}"
55
+ rdoc.rdoc_files.include('README*')
56
+ rdoc.rdoc_files.include('lib/**/*.rb')
57
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.1
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+ require "rubygems"
3
+
4
+ BANNER = <<BANNER
5
+ RTUI - Eye candy for ruby command line apps.
6
+
7
+ install - Dumps rtui to a single file for standalone use.
8
+ help - Prints RTUI Readme.
9
+
10
+ BANNER
11
+
12
+ FILES = ["progress", "dump", "table"]
13
+ ME = "rtui"
14
+
15
+ class CLI
16
+ def self.install
17
+ out = FILES.map do |file|
18
+ read = File.read(Gem.required_location(ME, "#{ME}/#{file}.rb"))
19
+ read.gsub!(/module RTUI|^end|/, "") # Remove bunch of modules and ends
20
+ read.gsub!(/^\s*#.*\n|^\s*\n/, "") # Remove comments and empty lines
21
+ end
22
+ File.open('rtui.rb', 'w') do |f|
23
+ f.write("#\n# RTUI - http://github.com/nofxx/rtui\n#\nmodule RTUI\n#{out}end\n")
24
+ end
25
+ puts "RTUI copied to ./rtui.rb (#{File.size('rtui.rb')/1000}Kb). Have fun!"
26
+ end
27
+
28
+ def self.help
29
+ puts File.read(Gem.required_location('rtui', 'rtui.rb').gsub(/lib\/rtui.rb/, "README.rdoc"))
30
+ end
31
+ end
32
+
33
+ if ARGV.empty? || !CLI.respond_to?(ARGV[0])
34
+ puts BANNER
35
+ else
36
+ CLI.send(ARGV[0])
37
+ end
38
+
@@ -1,9 +1,6 @@
1
1
  $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
-
4
- require 'rtui/progress'
5
3
 
6
-
7
- module Rtui
8
- VERSION = '0.1.8'
9
- end
4
+ require "rtui/progress"
5
+ require "rtui/table"
6
+ require "rtui/tty"
@@ -0,0 +1,7 @@
1
+ module RTUI
2
+ module Dump
3
+
4
+
5
+ end
6
+
7
+ end
@@ -1,9 +1,4 @@
1
1
  #
2
- #
3
- #
4
- #
5
- # Original code:
6
- #
7
2
  # Ruby/ProgressBar - a text progress bar library VERSION = "0.9"
8
3
  #
9
4
  # Copyright (C) 2001-2005 Satoru Takabayashi <satoru@namazu.org>
@@ -13,13 +8,10 @@
13
8
  # You can redistribute it and/or modify it under the terms
14
9
  # of Ruby's license.
15
10
  #
16
- #
17
- #
11
+ #
18
12
  #require 'rtui/progress/bar'
19
13
  #require 'rtui/progress/spinner'
20
-
21
- module Rtui
22
-
14
+ module RTUI
23
15
  #
24
16
  # Progress indicators
25
17
  #
@@ -28,23 +20,23 @@ module Rtui
28
20
  attr_reader :current
29
21
  attr_reader :total
30
22
  attr_accessor :start_time
31
-
23
+
32
24
  #
33
25
  # Initializes a progress indicator.
34
26
  #
35
27
  # Examples:
36
28
  #
37
29
  # Just a bar and ETA:
38
- # Rtui::Progress.new("Foo", 10, { :components => [:bar, :stat]})
30
+ # RTUI::Progress.new("Foo", 10, { :components => [:bar, :stat]})
39
31
  #
40
32
  # A Spinner with just percentage:
41
- # Rtui::Progress.new("Foo", 10, { :components => [:spinner, :percentage]})
33
+ # RTUI::Progress.new("Foo", 10, { :components => [:spinner, :percentage]})
34
+ #
42
35
  #
43
- #
44
36
  # Options:
45
- # - bar => "="
46
- # - out => STDERR
47
- #
37
+ # - bar => "="
38
+ # - out => STDERR
39
+ #
48
40
  # Components:
49
41
  # - title
50
42
  # - spinner
@@ -65,7 +57,7 @@ module Rtui
65
57
  @title_width = 14
66
58
  @subject = ""
67
59
 
68
- @out = options[:out] || STDERR
60
+ @out = options[:out] || STDOUT
69
61
  @bar_mark = options[:bar] || "="
70
62
  @colors = options[:colors] || false
71
63
  @components = options[:components] || [:title, :percentage, :bar, :stat]
@@ -75,7 +67,7 @@ module Rtui
75
67
  end
76
68
 
77
69
  def clear
78
- @out.print "\r#{(" " * (get_width - 1))}\r"
70
+ @out.print "\r#{(" " * (TTY.get_width - 1))}\r"
79
71
  end
80
72
 
81
73
  def finish
@@ -127,41 +119,41 @@ module Rtui
127
119
  end
128
120
 
129
121
  def inspect
130
- "#<Rtui::Progress:#{@current}/#{@total}>"
122
+ "#<RTUI::Progress:#{@current}/#{@total}>"
131
123
  end
132
-
133
-
124
+
125
+
134
126
  private
135
-
127
+
136
128
  def fmt_subject
137
129
  @subject ||= ""
138
130
  blank = @terminal_width - @subject.length
139
- out = " " + @subject
131
+ out = " " + @subject
140
132
  out << " " * blank if blank > 0
141
133
  out[0, @terminal_width - 5]
142
134
  end
143
135
 
144
136
  def fmt_bar
145
137
  bar_width = do_percentage * @terminal_width / 100
146
- sprintf("|%s%s|",
147
- @bar_mark * bar_width,
138
+ sprintf("|%s%s|",
139
+ @bar_mark * bar_width,
148
140
  " " * (@terminal_width - bar_width))
149
141
  end
150
-
142
+
151
143
  def fmt_spinner
152
144
  bar_width = do_percentage * @terminal_width / 100
153
- sprintf(" %s%s ",
145
+ sprintf(" %s%s ",
154
146
  do_percentage == 100 ? " " : '/-\\|'[do_percentage%4].chr ,
155
- " " * (@terminal_width / 100) )
147
+ " " * (@terminal_width / 100) )
156
148
  end
157
-
149
+
158
150
  def fmt_pong
159
151
  bar_width = do_percentage * @terminal_width / 100
160
- sprintf("|%s%s|",
161
- " " * bar_width + @bar_mark,
152
+ sprintf("|%s%s|",
153
+ " " * bar_width + @bar_mark,
162
154
  " " * (@terminal_width - bar_width))
163
155
  end
164
-
156
+
165
157
  def fmt_percentage
166
158
  "%3d%%" % do_percentage
167
159
  end
@@ -231,34 +223,13 @@ module Rtui
231
223
  @current * 100 / @total
232
224
  end
233
225
 
234
- def get_width
235
- # FIXME: I don't know how portable it is.
236
- #
237
- # Works linux...
238
- # Fails OSX
239
- #
240
- default_width = 80
241
- begin
242
- tiocgwinsz = 0x5413
243
- data = [0, 0, 0, 0].pack("SSSS")
244
- if @out.ioctl(tiocgwinsz, data) >= 0 then
245
- rows, cols, xpixels, ypixels = data.unpack("SSSS")
246
- if cols >= 0 then cols else default_width end
247
- else
248
- default_width
249
- end
250
- rescue Exception
251
- default_width
252
- end
253
- end
254
-
255
226
  def show
256
- line = @components.map {|method|
227
+ line = @components.map {|method|
257
228
  send(sprintf("fmt_%s", method))
258
229
  }.join " "
259
230
 
260
- width = get_width
261
- if line.length == width - 1
231
+ width = TTY.get_width
232
+ if line.length == width - 1
262
233
  @out.print(line + eol)
263
234
  @out.flush
264
235
  elsif line.length >= width
@@ -281,21 +252,21 @@ module Rtui
281
252
  end
282
253
 
283
254
  # Use "!=" instead of ">" to support negative changes
284
- if cur_percentage != prev_percentage ||
255
+ if cur_percentage != prev_percentage ||
285
256
  Time.now - @previous_time >= 1 || @finished
286
257
  show
287
258
  end
288
-
259
+
289
260
  end
290
261
 
291
262
  end
292
263
 
293
264
  class ReversedProgress < Progress
294
-
265
+
295
266
  def do_percentage
296
267
  100 - super
297
268
  end
298
-
269
+
299
270
  end
300
-
271
+
301
272
  end
@@ -0,0 +1,43 @@
1
+ module RTUI
2
+ class Table
3
+ def initialize(title, items, *fields)
4
+ @title = title
5
+ @items = items
6
+ @fields = fields
7
+ end
8
+
9
+ # http://gist.github.com/72234
10
+ def print
11
+ return if @items.empty?
12
+ puts @title
13
+ #find max length for each field; start with the field names themselves
14
+ @fields = @items.first.class.column_names unless @fields.any?
15
+ max_len = Hash[*@fields.map {|f| [f, f.to_s.length]}.flatten]
16
+ @items.each do |item|
17
+ @fields.each do |field|
18
+ len = item.send(field).to_s.length
19
+ max_len[field] = len if len > max_len[field]
20
+ end
21
+ end
22
+
23
+ border = '+-' + @fields.map {|f| '-' * max_len[f] }.join('-+-') + '-+'
24
+ title_row = '| ' + @fields.map do |f|
25
+ sprintf("%-#{max_len[f]}s", f.to_s.split("_")[0].capitalize)
26
+ end.join(' | ') + ' |'
27
+
28
+ puts border
29
+ puts title_row
30
+ puts border
31
+
32
+ @items.each do |item|
33
+ row = '| ' + @fields.map do |f|
34
+ sprintf("%-#{max_len[f]}s", item.send(f))
35
+ end.join(' | ') + ' |'
36
+ puts row
37
+ end
38
+
39
+ puts border
40
+ puts "#{@items.length} items\n"
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,31 @@
1
+ module RTUI
2
+ module TTY
3
+ class << self
4
+ def get_width
5
+ # FIXME: I don't know how portable it is. Works Linux/OSX.
6
+ begin
7
+ tiocgwinsz = 0x5413
8
+ data = [0, 0, 0, 0].pack("SSSS")
9
+ if @out.ioctl(tiocgwinsz, data) >= 0 then
10
+ rows, cols, xpixels, ypixels = data.unpack("SSSS")
11
+ if cols >= 0 then cols else default_width end
12
+ else
13
+ default_width
14
+ end
15
+ rescue Exception
16
+ default_width
17
+ end
18
+ end
19
+
20
+ def default_width
21
+ stty = `stty size`
22
+ if stty =~ /^\d+ \d+/
23
+ stty.split[1].to_i
24
+ else
25
+ 80
26
+ end
27
+ end
28
+
29
+ end
30
+ end
31
+ end
@@ -1,37 +1,68 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
1
4
  # -*- encoding: utf-8 -*-
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = %q{rtui}
5
- s.version = "0.1.8"
8
+ s.version = "0.2.1"
6
9
 
7
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Marcos Piccinini"]
9
- s.date = %q{2008-12-21}
10
- s.description = %q{Set of tools for TUI Eye Candy}
11
- s.email = ["x@nofxx.com"]
12
- s.extra_rdoc_files = ["History.txt", "LICENSE.txt", "Manifest.txt", "README.rdoc"]
13
- s.files = ["History.txt", "LICENSE.txt", "Manifest.txt", "README.rdoc", "Rakefile", "lib/rtui.rb", "lib/rtui/progress.rb", "rspec.rake", "rtui.gemspec", "script/console", "script/destroy", "script/generate", "spec/rtui/progress_spec.rb", "spec/rtui_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake"]
14
- s.has_rdoc = true
11
+ s.authors = ["Marcos Augusto"]
12
+ s.date = %q{2010-03-18}
13
+ s.default_executable = %q{rtui}
14
+ s.email = %q{see@github}
15
+ s.executables = ["rtui"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE.txt",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".gitignore",
22
+ "History.txt",
23
+ "LICENSE.txt",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "bin/rtui",
28
+ "lib/rtui.rb",
29
+ "lib/rtui/dump.rb",
30
+ "lib/rtui/progress.rb",
31
+ "lib/rtui/table.rb",
32
+ "lib/rtui/tty.rb",
33
+ "rtui.gemspec",
34
+ "spec/rtui/progress_spec.rb",
35
+ "spec/rtui/table_spec.rb",
36
+ "spec/rtui_spec.rb",
37
+ "spec/spec.opts",
38
+ "spec/spec_helper.rb"
39
+ ]
15
40
  s.homepage = %q{http://github.com/nofxx/rtui}
16
- s.rdoc_options = ["--main", "README.rdoc"]
41
+ s.rdoc_options = ["--charset=UTF-8"]
17
42
  s.require_paths = ["lib"]
18
- s.rubyforge_project = %q{rtui}
19
- s.rubygems_version = %q{1.3.1}
20
- s.summary = %q{Ruby TUI Helpers}
43
+ s.rubygems_version = %q{1.3.6}
44
+ s.summary = %q{Set of tools for TUI Eye Candy}
45
+ s.test_files = [
46
+ "spec/rtui/table_spec.rb",
47
+ "spec/rtui/progress_spec.rb",
48
+ "spec/rtui_spec.rb",
49
+ "spec/spec_helper.rb"
50
+ ]
21
51
 
22
52
  if s.respond_to? :specification_version then
23
53
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
- s.specification_version = 2
54
+ s.specification_version = 3
25
55
 
26
56
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
- s.add_development_dependency(%q<newgem>, [">= 1.2.1"])
28
- s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
57
+ s.add_runtime_dependency(%q<rspec>, [">= 0"])
58
+ s.add_runtime_dependency(%q<rtui>, [">= 0"])
29
59
  else
30
- s.add_dependency(%q<newgem>, [">= 1.2.1"])
31
- s.add_dependency(%q<hoe>, [">= 1.8.0"])
60
+ s.add_dependency(%q<rspec>, [">= 0"])
61
+ s.add_dependency(%q<rtui>, [">= 0"])
32
62
  end
33
63
  else
34
- s.add_dependency(%q<newgem>, [">= 1.2.1"])
35
- s.add_dependency(%q<hoe>, [">= 1.8.0"])
64
+ s.add_dependency(%q<rspec>, [">= 0"])
65
+ s.add_dependency(%q<rtui>, [">= 0"])
36
66
  end
37
67
  end
68
+
@@ -2,9 +2,8 @@ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
2
 
3
3
  describe "Progress Bar" do
4
4
 
5
-
6
5
  #
7
- # Ok. Need real tests.
6
+ # Ok. Need real tests.
8
7
  # But this REALLY works =D
9
8
  #
10
9
  describe "Visual tests" do
@@ -12,41 +11,41 @@ describe "Progress Bar" do
12
11
  SleepUnit = 0.01
13
12
 
14
13
  def do_make_progress_bar (title, total)
15
- Rtui::Progress.new(title, total)
14
+ RTUI::Progress.new(title, total)
16
15
  end
17
-
16
+
18
17
  it "should pong" do
19
18
  total = 100
20
- pbar = Rtui::Progress.new("test(inc)", total, :bar => "o",
19
+ pbar = RTUI::Progress.new("test(inc)", total, :bar => "o",
21
20
  :components => [:pong, :percentage])
22
21
  total.times { sleep(0.01); pbar.inc }
23
22
  pbar.finish
24
23
  end
25
-
24
+
26
25
  it "should spin!" do
27
26
  total = 100
28
- pbar = Rtui::Progress.new("test(inc)", total,
27
+ pbar = RTUI::Progress.new("test(inc)", total,
29
28
  :components => [:spinner, :percentage, :stat])
30
29
  total.times { sleep(0.01); pbar.inc }
31
- pbar.finish
30
+ pbar.finish
32
31
  end
33
-
32
+
34
33
  it "different bar" do
35
34
  total = 100
36
- pbar = Rtui::Progress.new("test(inc)", total, :bar => "_",
35
+ pbar = RTUI::Progress.new("test(inc)", total, :bar => "_",
37
36
  :components => [ :stat, :bar, :percentage])
38
37
  total.times { sleep(SleepUnit); pbar.inc }
39
38
  pbar.finish
40
39
  end
41
-
40
+
42
41
  it "should spin 2!" do
43
42
  total = 100
44
- pbar = Rtui::Progress.new("test(inc)", total,
43
+ pbar = RTUI::Progress.new("test(inc)", total,
45
44
  :components => [:spinner, :percentage])
46
45
  total.times { sleep(0.01); pbar.inc }
47
- pbar.finish
46
+ pbar.finish
48
47
  end
49
-
48
+
50
49
  it "should handle bytes" do
51
50
  total = 1024 * 1024
52
51
  pbar = do_make_progress_bar("test(bytes)", total)
@@ -56,18 +55,18 @@ describe "Progress Bar" do
56
55
  sleep(SleepUnit)
57
56
  }
58
57
  pbar.finish
59
-
58
+
60
59
  end
61
60
 
62
61
  it "should show a subject!" do
63
62
  total = 100
64
- pbar = Rtui::Progress.new("test(inc)", total,
63
+ pbar = RTUI::Progress.new("test(inc)", total,
65
64
  :components => [:spinner, :percentage, :subject, :stat])
66
- total.times { |i| sleep(0.1); pbar.subject = "inter #{i} times!!!"; pbar.inc }
65
+ total.times { |i| sleep(0.01); pbar.subject = "inter #{i} times!!!"; pbar.inc }
67
66
  pbar.subject = "finish it"
68
- pbar.finish
67
+ pbar.finish
69
68
  end
70
- #
69
+ #
71
70
  # it "should clear" do
72
71
  # total = 100
73
72
  # pbar = do_make_progress_bar("test(clear)", total)
@@ -78,7 +77,7 @@ describe "Progress Bar" do
78
77
  # pbar.clear
79
78
  # puts
80
79
  # end
81
- #
80
+ #
82
81
  # def test_halt
83
82
  # total = 100
84
83
  # pbar = do_make_progress_bar("test(halt)", total)
@@ -88,7 +87,7 @@ describe "Progress Bar" do
88
87
  # }
89
88
  # pbar.halt
90
89
  # end
91
- #
90
+ #
92
91
  # it "should test_inc" do
93
92
  # total = 100
94
93
  # pbar = do_make_progress_bar("test(inc)", total)
@@ -98,7 +97,7 @@ describe "Progress Bar" do
98
97
  # }
99
98
  # pbar.finish
100
99
  # end
101
- #
100
+ #
102
101
  # it "should test_inc_x" do
103
102
  # total = File.size(File.dirname(__FILE__) + '/bar_spec.rb')
104
103
  # pbar = do_make_progress_bar("test(inc(x))", total)
@@ -108,7 +107,7 @@ describe "Progress Bar" do
108
107
  # }
109
108
  # pbar.finish
110
109
  # end
111
- #
110
+ #
112
111
  # def test_invalid_set
113
112
  # total = 100
114
113
  # pbar = do_make_progress_bar("test(invalid set)", total)
@@ -118,7 +117,7 @@ describe "Progress Bar" do
118
117
  # puts e.message
119
118
  # end
120
119
  # end
121
- #
120
+ #
122
121
  # def test_set
123
122
  # total = 1000
124
123
  # pbar = do_make_progress_bar("test(set)", total)
@@ -128,7 +127,7 @@ describe "Progress Bar" do
128
127
  # }
129
128
  # pbar.finish
130
129
  # end
131
- #
130
+ #
132
131
  # def test_slow
133
132
  # total = 100000
134
133
  # pbar = do_make_progress_bar("test(slow)", total)
@@ -138,14 +137,14 @@ describe "Progress Bar" do
138
137
  # }
139
138
  # pbar.halt
140
139
  # end
141
- #
140
+ #
142
141
  # def test_total_zero
143
142
  # total = 0
144
143
  # pbar = do_make_progress_bar("test(total=0)", total)
145
144
  # pbar.finish
146
145
  # end
147
146
  # end
148
- #
147
+ #
149
148
  # class ReversedProgressBarTest < ProgressBarTest
150
149
  # def do_make_progress_bar (title, total)
151
150
  # ReversedProgressBar.new(title, total)
@@ -0,0 +1,16 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ describe "Progress Bar" do
4
+
5
+ #
6
+ # Ok. Need real tests.
7
+ # But this REALLY works =D
8
+ #
9
+ describe "Visual tests" do
10
+ it "should print" do
11
+ RTUI::Table.new("foo", [Time, Time], :now).print
12
+ end
13
+ end
14
+ end
15
+
16
+
@@ -2,10 +2,10 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
3
  # Time to add your specs!
4
4
  # http://rspec.info/
5
- describe "Place your specs here" do
6
-
7
- it "find this spec in spec directory" do
8
- "Be sure to write your specs"
5
+ describe RTUI do
6
+
7
+ it "should define RTUI" do
8
+ RTUI::Progress.should be_a Class
9
9
  end
10
-
10
+
11
11
  end
metadata CHANGED
@@ -1,95 +1,106 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 1
9
+ version: 0.2.1
5
10
  platform: ruby
6
11
  authors:
7
- - Marcos Piccinini
12
+ - Marcos Augusto
8
13
  autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2008-12-21 00:00:00 -02:00
13
- default_executable:
17
+ date: 2010-03-18 00:00:00 -03:00
18
+ default_executable: rtui
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
- name: newgem
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
23
- version: 1.2.1
24
- version:
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ version_requirements: *id001
25
32
  - !ruby/object:Gem::Dependency
26
- name: hoe
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
33
+ name: rtui
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - ">="
32
38
  - !ruby/object:Gem::Version
33
- version: 1.8.0
34
- version:
35
- description: Set of tools for TUI Eye Candy
36
- email:
37
- - x@nofxx.com
38
- executables: []
39
-
39
+ segments:
40
+ - 0
41
+ version: "0"
42
+ type: :runtime
43
+ version_requirements: *id002
44
+ description:
45
+ email: see@github
46
+ executables:
47
+ - rtui
40
48
  extensions: []
41
49
 
42
50
  extra_rdoc_files:
43
- - History.txt
44
51
  - LICENSE.txt
45
- - Manifest.txt
46
52
  - README.rdoc
47
53
  files:
54
+ - .gitignore
48
55
  - History.txt
49
56
  - LICENSE.txt
50
- - Manifest.txt
51
57
  - README.rdoc
52
58
  - Rakefile
59
+ - VERSION
60
+ - bin/rtui
53
61
  - lib/rtui.rb
62
+ - lib/rtui/dump.rb
54
63
  - lib/rtui/progress.rb
55
- - rspec.rake
64
+ - lib/rtui/table.rb
65
+ - lib/rtui/tty.rb
56
66
  - rtui.gemspec
57
- - script/console
58
- - script/destroy
59
- - script/generate
60
67
  - spec/rtui/progress_spec.rb
68
+ - spec/rtui/table_spec.rb
61
69
  - spec/rtui_spec.rb
62
70
  - spec/spec.opts
63
71
  - spec/spec_helper.rb
64
- - tasks/rspec.rake
65
72
  has_rdoc: true
66
73
  homepage: http://github.com/nofxx/rtui
67
74
  licenses: []
68
75
 
69
76
  post_install_message:
70
77
  rdoc_options:
71
- - --main
72
- - README.rdoc
78
+ - --charset=UTF-8
73
79
  require_paths:
74
80
  - lib
75
81
  required_ruby_version: !ruby/object:Gem::Requirement
76
82
  requirements:
77
83
  - - ">="
78
84
  - !ruby/object:Gem::Version
85
+ segments:
86
+ - 0
79
87
  version: "0"
80
- version:
81
88
  required_rubygems_version: !ruby/object:Gem::Requirement
82
89
  requirements:
83
90
  - - ">="
84
91
  - !ruby/object:Gem::Version
92
+ segments:
93
+ - 0
85
94
  version: "0"
86
- version:
87
95
  requirements: []
88
96
 
89
- rubyforge_project: rtui
90
- rubygems_version: 1.3.5
97
+ rubyforge_project:
98
+ rubygems_version: 1.3.6
91
99
  signing_key:
92
- specification_version: 2
93
- summary: Ruby TUI Helpers
94
- test_files: []
95
-
100
+ specification_version: 3
101
+ summary: Set of tools for TUI Eye Candy
102
+ test_files:
103
+ - spec/rtui/table_spec.rb
104
+ - spec/rtui/progress_spec.rb
105
+ - spec/rtui_spec.rb
106
+ - spec/spec_helper.rb
@@ -1,17 +0,0 @@
1
- History.txt
2
- LICENSE.txt
3
- Manifest.txt
4
- README.rdoc
5
- Rakefile
6
- lib/rtui.rb
7
- lib/rtui/progress.rb
8
- rspec.rake
9
- rtui.gemspec
10
- script/console
11
- script/destroy
12
- script/generate
13
- spec/rtui/progress_spec.rb
14
- spec/rtui_spec.rb
15
- spec/spec.opts
16
- spec/spec_helper.rb
17
- tasks/rspec.rake
data/rspec.rake DELETED
@@ -1,21 +0,0 @@
1
- begin
2
- require 'spec'
3
- rescue LoadError
4
- require 'rubygems'
5
- require 'spec'
6
- end
7
- begin
8
- require 'spec/rake/spectask'
9
- rescue LoadError
10
- puts <<-EOS
11
- To use rspec for testing you must install rspec gem:
12
- gem install rspec
13
- EOS
14
- exit(0)
15
- end
16
-
17
- desc "Run the specs under spec/models"
18
- Spec::Rake::SpecTask.new do |t|
19
- t.spec_opts = ['--options', "spec/spec.opts"]
20
- t.spec_files = FileList['spec/**/*_spec.rb']
21
- end
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # File: script/console
3
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
-
5
- libs = " -r irb/completion"
6
- # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
- # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
- libs << " -r #{File.dirname(__FILE__) + '/../lib/rtui.rb'}"
9
- puts "Loading rtui gem"
10
- exec "#{irb} #{libs} --simple-prompt"
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/destroy'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Destroy.new.run(ARGV)
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/generate'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Generate.new.run(ARGV)
@@ -1,21 +0,0 @@
1
- begin
2
- require 'spec'
3
- rescue LoadError
4
- require 'rubygems'
5
- require 'spec'
6
- end
7
- begin
8
- require 'spec/rake/spectask'
9
- rescue LoadError
10
- puts <<-EOS
11
- To use rspec for testing you must install rspec gem:
12
- gem install rspec
13
- EOS
14
- exit(0)
15
- end
16
-
17
- desc "Run the specs under spec/models"
18
- Spec::Rake::SpecTask.new do |t|
19
- t.spec_opts = ['--options', "spec/spec.opts"]
20
- t.spec_files = FileList['spec/**/*_spec.rb']
21
- end