tty 0.0.1

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,18 @@
1
+ *.swp
2
+ *.gem
3
+ *.rbc
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ -f s
data/.rvmrc ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env bash
2
+
3
+ environment_id="ruby-1.9.3-p0@tty"
4
+
5
+ #
6
+ # First we attempt to load the desired environment directly from the environment
7
+ # file. This is very fast and efficient compared to running through the entire
8
+ # CLI and selector. If you want feedback on which environment was used then
9
+ # insert the word 'use' after --create as this triggers verbose mode.
10
+ #
11
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
12
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
13
+ then
14
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
15
+
16
+ if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
17
+ then
18
+ . "${rvm_path:-$HOME/.rvm}/hooks/after_use"
19
+ fi
20
+ else
21
+ # If the environment file has not yet been created, use the RVM CLI to select.
22
+ if ! rvm --create "$environment_id"
23
+ then
24
+ echo "Failed to create RVM environment '${environment_id}'."
25
+ return 1
26
+ fi
27
+ fi
28
+
29
+ if [[ $- == *i* ]] # check for interactive shells
30
+ then
31
+ echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
32
+ else
33
+ echo "Using: $GEM_HOME" # don't use colors in interactive shells
34
+ fi
@@ -0,0 +1,20 @@
1
+ language: ruby
2
+ before_install:
3
+ - gem install bundler
4
+ rvm:
5
+ - 1.8.7
6
+ - 1.9.2
7
+ - 1.9.3
8
+ - ruby-head
9
+ - jruby-18mode
10
+ - jruby-19mode
11
+ - rbx-18mode
12
+ - rbx-19mode
13
+ - ree
14
+ - jruby-head
15
+ matrix:
16
+ allow_failures:
17
+ - rvm: ruby-head
18
+ - rvm: jruby-head
19
+ - rvm: jruby-19mode
20
+ - rvm: rbx-18mode
@@ -0,0 +1,4 @@
1
+ --quiet
2
+ README.md
3
+ lib/**/*.rb
4
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in tty.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Piotr Murach
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,65 @@
1
+ # TTY
2
+ [![Build Status](https://secure.travis-ci.org/peter-murach/tty.png?branch=master)][travis] [![Dependency Status](https://gemnasium.com/peter-murach/tty.png?travis)][gemnasium] [![Code Climate](https://codeclimate.com/badge.png)][codeclimate]
3
+
4
+ [travis]: http://travis-ci.org/peter-murach/tty
5
+ [gemnasium]: https://gemnasium.com/peter-murach/tty
6
+ [codeclimate]: https://codeclimate.com/github/peter-murach/tty
7
+
8
+ Toolbox for developing CLI clients.
9
+
10
+ ## Features
11
+
12
+ Jump-start development of your command line app:
13
+
14
+ * Fully customizable table rendering with an easy-to-use API.
15
+ (status: In Progress)
16
+ * Terminal output colorization. (status: TODO)
17
+ * Terminal & System detection utilities. (status: TODO)
18
+ * Text alignment/padding and diffs. (status: TODO)
19
+ * Shell user interface. (status: TODO)
20
+ * No dependencies to allow for easy gem vendoring.
21
+
22
+ ## Installation
23
+
24
+ Add this line to your application's Gemfile:
25
+
26
+ gem 'tty'
27
+
28
+ And then execute:
29
+
30
+ $ bundle
31
+
32
+ Or install it yourself as:
33
+
34
+ $ gem install tty
35
+
36
+ ## Usage
37
+
38
+ ### Table
39
+
40
+ Creating tables
41
+
42
+ ```ruby
43
+ table = TTY::Table.new ['Header 1', 'Header 2']
44
+ table << ['a1', 'a2', 'a3']
45
+ table << ['b1', 'b2', 'b3']
46
+ ```
47
+
48
+ ```ruby
49
+ table = TTY::Table.new header: ['Header 1', 'Header 2'] do |t|
50
+ t << ['a1', 'a2', 'a3']
51
+ t << ['b1', 'b2', 'b3']
52
+ end
53
+ ```
54
+
55
+ ## Contributing
56
+
57
+ 1. Fork it
58
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
59
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
60
+ 4. Push to the branch (`git push origin my-new-feature`)
61
+ 5. Create new Pull Request
62
+
63
+ ## Copyright
64
+
65
+ Copyright (c) 2012 Piotr Murach. See LICENSE for further details.
@@ -0,0 +1,10 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.unshift File.expand_path('../lib', __FILE__)
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec) do |spec|
7
+ spec.pattern = FileList['spec/**/*_spec.rb']
8
+ end
9
+
10
+ task :default => [:spec]
@@ -0,0 +1,11 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require 'tty/version'
4
+ require 'tty/table'
5
+ require 'tty/color'
6
+
7
+ require 'tty/support/utils'
8
+
9
+ module TTY
10
+
11
+ end # TTY
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ module TTY
4
+ class Color
5
+
6
+ # Embed in a String to clear all previous ANSI sequences.
7
+ CLEAR = "\e[0m""]"
8
+ # The start of an ANSI bold sequence.
9
+ BOLD = "\e[1m""]"
10
+
11
+ attr_reader :enabled
12
+
13
+ def self.color?
14
+ %x{tput colors 2>/dev/null}.to_i > 2
15
+ end
16
+
17
+ end # Color
18
+ end # TTY
@@ -0,0 +1,15 @@
1
+ module TTY
2
+ module Utils
3
+ extend self
4
+
5
+ def extract_options!(args)
6
+ args.last.respond_to?(:to_hash) ? args.pop : {}
7
+ end
8
+
9
+ def extract_options(args)
10
+ options = args.last
11
+ options.respond_to?(:to_hash) ? options.to_hash.dup : {}
12
+ end
13
+
14
+ end # Utils
15
+ end # TTY
@@ -0,0 +1,170 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require 'forwardable'
4
+ require 'tty/table/renderer'
5
+
6
+ module TTY
7
+ class Table
8
+ include Comparable, Enumerable, Renderer
9
+ extend Forwardable
10
+
11
+ # The table header
12
+ #
13
+ # @return [Enumerable]
14
+ #
15
+ # @api public
16
+ attr_reader :header
17
+
18
+ # The table rows
19
+ #
20
+ # @return [Enumerable]
21
+ #
22
+ # @api private
23
+ attr_reader :rows
24
+ private :rows
25
+
26
+ # Subset of safe methods that both Array and Hash implement
27
+ def_delegators(:@rows, :[], :assoc, :empty?, :flatten,
28
+ :include?, :index, :inspect, :length, :select, :to_a, :values_at,
29
+ :pretty_print, :rassoc)
30
+
31
+ # The table orientation
32
+ #
33
+ def direction
34
+ # TODO implement table orientation
35
+ end
36
+
37
+ # Instantiate a new Table
38
+ #
39
+ # @example of direct parameters
40
+ # rows = [ ['a1', 'a2'], ['b1', 'b2'] ]
41
+ # table = Table.new ['Header 1', 'Header 2'], rows
42
+ #
43
+ # @example of parameters passed as options
44
+ # rows = [ ['a1', 'a2'], ['b1', 'b2'] ]
45
+ # table = Table.new :header => ['Header 1', 'Header 2'], :rows => rows
46
+ #
47
+ # @api public
48
+ def self.new(*args, &block)
49
+ options = Utils.extract_options!(args)
50
+ if args.first.is_a? Array
51
+ rows = args.size == 2 ? args.pop : []
52
+ super({:header => args.first, :rows => rows}.merge(options), &block)
53
+ else
54
+ super(options, &block)
55
+ end
56
+ end
57
+
58
+ # Initialize a Table
59
+ #
60
+ # @param [Hash] options
61
+ # @return [Table]
62
+ #
63
+ # @api private
64
+ def initialize(options={}, &block)
65
+ @header = options.fetch :header, []
66
+ @rows = options.fetch :rows, []
67
+ @renderer = pick_renderer options[:renderer]
68
+ yield_or_eval &block if block_given?
69
+ end
70
+
71
+ # Lookup an attribute value given an attribute name
72
+ #
73
+ def [](index)
74
+ if index >= 0
75
+ rows.map { |row| row[0] }.compact
76
+ else
77
+ raise IndexError.new("index #{index} not found")
78
+ end
79
+ end
80
+
81
+ # @api public
82
+ def <<(row)
83
+ rows << row
84
+ end
85
+
86
+ # Iterate over each tuple in the set
87
+ #
88
+ # @example
89
+ # table = TTY::Table.new(header, tuples)
90
+ # table.each { |tuple| ... }
91
+ #
92
+ # @yield [tuple]
93
+ #
94
+ # @return [self]
95
+ # @api public
96
+ def each
97
+ return to_enum unless block_given?
98
+ rows.each do |row|
99
+ yield row
100
+ end
101
+ self
102
+ end
103
+
104
+ # Return the number of rows
105
+ #
106
+ # @example
107
+ # table.size # => 5
108
+ #
109
+ # @return [Integer]
110
+ def size
111
+ return rows[0].length if (rows.length > 0)
112
+ return 0
113
+ end
114
+
115
+ # Check table width
116
+ #
117
+ # @return [Integer] width
118
+ def width
119
+
120
+ end
121
+
122
+ # Compare the table with other table for equivalency
123
+ #
124
+ # @example
125
+ # table == other # => true or false
126
+ #
127
+ # @param [TTY::Table] other
128
+ # the other table to compare with
129
+ #
130
+ # @return [Boolean]
131
+ def ==(other)
132
+ header == other.header &&
133
+ to_a == other.to_a
134
+ end
135
+
136
+ # Return string representation of table
137
+ #
138
+ # @api public
139
+ def to_s
140
+ renderer.render(rows)
141
+ end
142
+
143
+ # Coerce an Enumerable into a Table
144
+ #
145
+ # @param [Enumerable] object
146
+ # the object to coerce
147
+ #
148
+ def self.coerce(object)
149
+ if object.kind_of?(TTY::Table)
150
+ object
151
+ elsif object.kind_of?(Hash)
152
+ array = [object.keys]
153
+ array << object.values
154
+ end
155
+ end
156
+
157
+ private
158
+
159
+ # Evaluate block
160
+ #
161
+ # @return [Table]
162
+ #
163
+ # @api private
164
+ def yield_or_eval(&block)
165
+ return unless block
166
+ block.arity > 0 ? yield(self) : self.instance_eval(&block)
167
+ end
168
+
169
+ end # Table
170
+ end # TTY
@@ -0,0 +1,64 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ module TTY
4
+ class Table
5
+
6
+ # @api public
7
+ def self.renderer
8
+ @renderer ||= if TTY::Color.color?
9
+ TTY::Table::Renderer::Color
10
+ else
11
+ TTY::Table::Renderer::Basic
12
+ end
13
+ end
14
+
15
+ # @api public
16
+ def self.renderer=(klass)
17
+ @renderer = klass
18
+ end
19
+
20
+ # A mixin to allow common rendering methods
21
+ #
22
+ # @return [self]
23
+ #
24
+ # @api public
25
+ module Renderer
26
+
27
+ autoload :Basic, 'tty/table/renderer/basic'
28
+ autoload :Color, 'tty/table/renderer/color'
29
+ autoload :Unicode, 'tty/table/renderer/unicode'
30
+
31
+ RENDERER_MAPPER = {
32
+ :basic => TTY::Table::Renderer::Basic,
33
+ :color => TTY::Table::Renderer::Color,
34
+ :unicode => TTY::Table::Renderer::Unicode
35
+ }
36
+
37
+ # Initialize a Renderer
38
+ #
39
+ # @api private
40
+ def initialize(options={})
41
+ super
42
+ self.renderer = RENDERER_MAPPER[:"#{options[:renderer]}"].new
43
+ end
44
+
45
+ def pick_renderer(renderer)
46
+ if renderer
47
+ RENDERER_MAPPER[renderer].new
48
+ else
49
+ self.renderer
50
+ end
51
+ end
52
+
53
+ def renderer
54
+ @renderer ||= TTY::Table.renderer.new
55
+ end
56
+
57
+ def renderer=(renderer)
58
+ @renderer = renderer
59
+ end
60
+
61
+ end # Renderer
62
+
63
+ end # Table
64
+ end # TTY
@@ -0,0 +1,76 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ module TTY
4
+ class Table
5
+ module Renderer
6
+ class Basic
7
+
8
+ attr_reader :padding
9
+
10
+ attr_reader :indent
11
+
12
+ # @param [Hash] options
13
+ # :indent - Indent the first column by indent value
14
+ # :padding - Pad out the row cell by padding value
15
+ # :col_widths - Enforce particular column width values
16
+ #
17
+ # @return [Table::Renderer::Basic]
18
+ def initialize(options={})
19
+ @padding = options.fetch :padding, 0
20
+ @indent = options.fetch :indent, 0
21
+ @col_widths = options.fetch :col_widths, []
22
+ end
23
+
24
+ # Sets the output padding,
25
+ #
26
+ # @param [Integer] value
27
+ # the amount of padding, not allowed to be zero
28
+ #
29
+ # @api public
30
+ def padding=(value)
31
+ @padding = [0, value].max
32
+ end
33
+
34
+ # @api public
35
+ def self.render(rows, options={})
36
+ new(options).render(rows)
37
+ end
38
+
39
+ # @api private
40
+ def extract_column_widths
41
+ # TODO Calculate column widths if none provided
42
+ # throw an error if too many columns as compared to terminal width
43
+ end
44
+
45
+ # Renders table
46
+ #
47
+ # @param [Enumerable] rows
48
+ # the table rows
49
+ #
50
+ # @return [String] string representation of table
51
+ #
52
+ # @api public
53
+ def render(rows)
54
+ return if rows.empty?
55
+
56
+ body = []
57
+ unless rows.length.zero?
58
+ rows.each do |row|
59
+ line = ""
60
+ row.each_with_index do |column, index|
61
+ if index == row.size - 1
62
+ line << "#{column.to_s}"
63
+ else
64
+ line << "#{column.to_s} "
65
+ end
66
+ end
67
+ body << line
68
+ end
69
+ end
70
+ body.join("\n")
71
+ end
72
+
73
+ end # Basic
74
+ end # Renderer
75
+ end # Table
76
+ end # TTY
@@ -0,0 +1,15 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ module TTY
4
+ class Table
5
+ module Renderer
6
+ class Color
7
+
8
+ def initialize
9
+
10
+ end
11
+
12
+ end # Color
13
+ end # Renderer
14
+ end # Table
15
+ end # TTY
@@ -0,0 +1,15 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ module TTY
4
+ class Table
5
+ module Renderer
6
+ class Unicode
7
+
8
+ def initialize
9
+
10
+ end
11
+
12
+ end # Unicode
13
+ end # Renderer
14
+ end # Table
15
+ end # TTY
@@ -0,0 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ module TTY
4
+ VERSION = "0.0.1"
5
+ end
@@ -0,0 +1,17 @@
1
+ require 'rubygems'
2
+
3
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
+
6
+ require 'rspec'
7
+ require 'tty'
8
+
9
+ RSpec.configure do |config|
10
+ config.order = :rand
11
+ end
12
+
13
+ class String
14
+ def normalize
15
+ gsub(/^[ \t]*/, '').chomp
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ require 'spec_helper'
2
+
3
+ describe TTY::Color do
4
+
5
+ end
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require 'spec_helper'
4
+
5
+ describe TTY::Table, '#each' do
6
+ let(:object) { described_class.new header, rows }
7
+ let(:header) { ['Header1', 'Header2'] }
8
+ let(:rows) { [['a1', 'a2'], ['b1', 'b2']] }
9
+
10
+ context 'with no block' do
11
+ subject { object.each }
12
+
13
+ it { should be_instance_of(to_enum.class) }
14
+
15
+ it 'yields the expected values' do
16
+ subject.to_a.should eql(object.to_a)
17
+ end
18
+ end
19
+
20
+ context 'with block' do
21
+ subject { object.each { |row| yields << row } }
22
+ let(:yields) { [] }
23
+
24
+ it 'yields each row' do
25
+ expect { subject }.to change { yields }.
26
+ from( [] ).
27
+ to( rows )
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require 'spec_helper'
4
+
5
+ describe TTY::Table::Renderer::Basic do
6
+ let(:renderer) { TTY::Table::Renderer::Basic.new }
7
+ let(:header) { ['Header1', 'Header2'] }
8
+ let(:rows) { [['a1', 'a2', 'a3'], ['b1', 'b2', 'b3']] }
9
+
10
+ context '#render' do
11
+ it 'displays table without styling' do
12
+ table = TTY::Table.new header, :renderer => :basic
13
+ table << rows[0]
14
+ table << rows[1]
15
+ table.to_s.should == <<-EOS.normalize
16
+ a1 a2 a3
17
+ b1 b2 b3
18
+ EOS
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,37 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require 'spec_helper'
4
+
5
+ describe TTY::Table, '#renderer' do
6
+ let(:basic_renderer) { TTY::Table::Renderer::Basic }
7
+ let(:unicode_renderer) { TTY::Table::Renderer::Unicode }
8
+
9
+ before do
10
+ TTY::Table.renderer = basic_renderer
11
+ TTY::Color.stub(:color?).and_return false
12
+ end
13
+
14
+ after do
15
+ TTY::Table.renderer = basic_renderer
16
+ end
17
+
18
+ it 'sets basic renderer' do
19
+ TTY::Table.renderer.should be TTY::Table::Renderer::Basic
20
+ end
21
+
22
+ it 'has instance renderer' do
23
+ table = TTY::Table.new
24
+ table.renderer.should be_kind_of(basic_renderer)
25
+ end
26
+
27
+ it 'allows to set instance renderer' do
28
+ table = TTY::Table.new :renderer => :unicode
29
+ table.renderer.should be_kind_of(unicode_renderer)
30
+ end
31
+
32
+ it 'allows to set global renderer' do
33
+ TTY::Table.renderer = unicode_renderer
34
+ table = TTY::Table.new
35
+ table.renderer.should be_kind_of(unicode_renderer)
36
+ end
37
+ end
@@ -0,0 +1,75 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require 'spec_helper'
4
+
5
+ describe TTY::Table do
6
+
7
+ it { should be_kind_of(Enumerable) }
8
+ it { should be_kind_of(Comparable) }
9
+
10
+ it { (Enumerable === subject).should be_true }
11
+
12
+ context '#initalize' do
13
+ let(:header) { ['Header1', 'Header2'] }
14
+ let(:rows) { [['a1', 'a2'], ['b1', 'b2']] }
15
+
16
+ it 'initializes table header' do
17
+ table = TTY::Table.new header
18
+ table.header.should == header
19
+ end
20
+
21
+ it 'initializes table header as an option' do
22
+ table = TTY::Table.new :header => header
23
+ table.header.should == header
24
+ end
25
+
26
+ it 'initializes table rows as an option' do
27
+ table = TTY::Table.new :header => header, :rows => rows
28
+ table.to_a.should == rows
29
+ end
30
+
31
+ it 'initializes table rows as an argument' do
32
+ table = TTY::Table.new header, rows
33
+ table.to_a.should == rows
34
+ end
35
+
36
+ it 'initializes table rows in a block with param' do
37
+ table = TTY::Table.new header do |t|
38
+ t << rows[0]
39
+ t << rows[1]
40
+ end
41
+ table.to_a.should == rows
42
+ end
43
+
44
+ it 'initializes table and adds rows' do
45
+ table = TTY::Table.new header
46
+ table << rows[0]
47
+ table << rows[1]
48
+ table.to_a.should == rows
49
+ end
50
+ end
51
+
52
+ context '#size' do
53
+ it 'has no size' do
54
+ table = TTY::Table.new
55
+ table.size.should == 0
56
+ end
57
+
58
+ it 'has size' do
59
+ rows = [['a1', 'a2', 'a3'], ['b1', 'b2', 'c3']]
60
+ table = TTY::Table.new ['Header1', 'Header2'], rows
61
+ table.size.should == 3
62
+ end
63
+ end
64
+
65
+ context '#columns' do
66
+ it 'looks up column' do
67
+ rows = [['a1', 'a2'], ['b1', 'b2']]
68
+ table = TTY::Table.new
69
+ table << rows[0]
70
+ table << rows[1]
71
+ table[0].should == ['a1', 'b1']
72
+ end
73
+ end
74
+
75
+ end # TTY::Table
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'tty/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "tty"
8
+ gem.version = TTY::VERSION
9
+ gem.authors = ["Piotr Murach"]
10
+ gem.email = [""]
11
+ gem.description = %q{Toolbox for developing CLI clients}
12
+ gem.summary = %q{Toolbox for developing CLI clients}
13
+ gem.homepage = "http://github.com/peter-murach/tty"
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
+
20
+ gem.add_development_dependency 'rspec'
21
+ gem.add_development_dependency 'rake'
22
+ gem.add_development_dependency 'yard'
23
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tty
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Piotr Murach
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-09-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &2160191220 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *2160191220
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ requirement: &2160190780 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2160190780
36
+ - !ruby/object:Gem::Dependency
37
+ name: yard
38
+ requirement: &2160190360 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2160190360
47
+ description: Toolbox for developing CLI clients
48
+ email:
49
+ - ''
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - .gitignore
55
+ - .rspec
56
+ - .rvmrc
57
+ - .travis.yml
58
+ - .yardopts
59
+ - Gemfile
60
+ - LICENSE.txt
61
+ - README.md
62
+ - Rakefile
63
+ - lib/tty.rb
64
+ - lib/tty/color.rb
65
+ - lib/tty/support/.utils.rb.swo
66
+ - lib/tty/support/utils.rb
67
+ - lib/tty/table.rb
68
+ - lib/tty/table/renderer.rb
69
+ - lib/tty/table/renderer/basic.rb
70
+ - lib/tty/table/renderer/color.rb
71
+ - lib/tty/table/renderer/unicode.rb
72
+ - lib/tty/version.rb
73
+ - spec/spec_helper.rb
74
+ - spec/tty/color_spec.rb
75
+ - spec/tty/table/each_spec.rb
76
+ - spec/tty/table/renderer/basic_spec.rb
77
+ - spec/tty/table/renderer_spec.rb
78
+ - spec/tty/table/table_spec.rb
79
+ - tty.gemspec
80
+ homepage: http://github.com/peter-murach/tty
81
+ licenses: []
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ none: false
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubyforge_project:
100
+ rubygems_version: 1.8.10
101
+ signing_key:
102
+ specification_version: 3
103
+ summary: Toolbox for developing CLI clients
104
+ test_files:
105
+ - spec/spec_helper.rb
106
+ - spec/tty/color_spec.rb
107
+ - spec/tty/table/each_spec.rb
108
+ - spec/tty/table/renderer/basic_spec.rb
109
+ - spec/tty/table/renderer_spec.rb
110
+ - spec/tty/table/table_spec.rb
111
+ has_rdoc: