BigCat 0.0.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/BigCat.gemspec ADDED
@@ -0,0 +1,54 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{BigCat}
8
+ s.version = "1.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Nolan Eakins"]
12
+ s.date = %q{2011-09-01}
13
+ s.default_executable = %q{bigcat}
14
+ s.description = %q{I cat BIG.}
15
+ s.email = %q{sneakin+bigcat@semanticgap.com}
16
+ s.executables = ["bigcat"]
17
+ s.extra_rdoc_files = [
18
+ "README.md"
19
+ ]
20
+ s.files = [
21
+ "BigCat.gemspec",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "README.md",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "bin/bigcat",
28
+ "lib/bigcat.rb",
29
+ "spec/integration/bigcat_spec.rb"
30
+ ]
31
+ s.homepage = %q{http://github.com/sneakin/BigCat}
32
+ s.require_paths = ["lib"]
33
+ s.rubygems_version = %q{1.4.1}
34
+ s.summary = %q{RAWR!!}
35
+
36
+ if s.respond_to? :specification_version then
37
+ s.specification_version = 3
38
+
39
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
40
+ s.add_runtime_dependency(%q<jeweler>, [">= 0"])
41
+ s.add_runtime_dependency(%q<rspec>, [">= 0"])
42
+ s.add_development_dependency(%q<rspec>, [">= 0"])
43
+ else
44
+ s.add_dependency(%q<jeweler>, [">= 0"])
45
+ s.add_dependency(%q<rspec>, [">= 0"])
46
+ s.add_dependency(%q<rspec>, [">= 0"])
47
+ end
48
+ else
49
+ s.add_dependency(%q<jeweler>, [">= 0"])
50
+ s.add_dependency(%q<rspec>, [">= 0"])
51
+ s.add_dependency(%q<rspec>, [">= 0"])
52
+ end
53
+ end
54
+
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
1
  source :rubygems
2
2
 
3
- gem 'jeweler'
3
+ gem 'jeweler'
4
+ gem 'rspec'
data/Gemfile.lock CHANGED
@@ -1,15 +1,25 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ diff-lcs (1.1.3)
4
5
  git (1.2.5)
5
6
  jeweler (1.6.4)
6
7
  bundler (~> 1.0)
7
8
  git (>= 1.2.5)
8
9
  rake
9
10
  rake (0.9.2)
11
+ rspec (2.6.0)
12
+ rspec-core (~> 2.6.0)
13
+ rspec-expectations (~> 2.6.0)
14
+ rspec-mocks (~> 2.6.0)
15
+ rspec-core (2.6.4)
16
+ rspec-expectations (2.6.0)
17
+ diff-lcs (~> 1.1.2)
18
+ rspec-mocks (2.6.0)
10
19
 
11
20
  PLATFORMS
12
21
  ruby
13
22
 
14
23
  DEPENDENCIES
15
24
  jeweler
25
+ rspec
data/Rakefile CHANGED
@@ -13,4 +13,9 @@ begin
13
13
  Jeweler::GemcutterTasks.new
14
14
  rescue LoadError
15
15
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
16
- end
16
+ end
17
+
18
+ require 'rspec/core/rake_task'
19
+ RSpec::Core::RakeTask.new(:spec) do |spec|
20
+ spec.pattern = 'spec/**/*_spec.rb'
21
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 1.0.0
data/bin/bigcat ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+ $: << Pathname.new(__FILE__).parent.parent.join('lib')
5
+
6
+ require 'bigcat'
7
+ BigCat::Command.new.run!
data/lib/bigcat.rb ADDED
@@ -0,0 +1,19 @@
1
+ module BigCat
2
+ class Command
3
+ def initialize()
4
+ end
5
+
6
+ def run!
7
+ begin
8
+ line = $stdin.readline
9
+ if line == "\n"
10
+ $stdout.puts("\n\n")
11
+ else
12
+ $stdout.puts("\e#3#{line}\e#4#{line}")
13
+ end
14
+ $stdout.flush
15
+ end while true
16
+ rescue EOFError
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,87 @@
1
+ describe 'bigcat' do
2
+ let!(:bigcat) { Pathname.new(__FILE__).parent.parent.parent.join('bin', 'bigcat') }
3
+
4
+ def run(&block)
5
+ IO.popen(bigcat, 'r+') do |io|
6
+ if block
7
+ block.call(io)
8
+ else
9
+ io.close
10
+ end
11
+ end
12
+
13
+ $?.exitstatus
14
+ end
15
+
16
+ context 'without any arguments' do
17
+ context 'immediate EOF' do
18
+ it "exits with retval of 0" do
19
+ run.should == 0
20
+ end
21
+ end
22
+
23
+ context 'immediate newline' do
24
+ it "writes two empty lines" do
25
+ run do |io|
26
+ io.puts("")
27
+ io.read(2).should == "\n\n"
28
+ end
29
+ end
30
+
31
+ it "exits on EOF" do
32
+ ret = run do |io|
33
+ io.puts
34
+ io.read(2)
35
+ io.close
36
+ end
37
+ ret.should == 0
38
+ end
39
+ end
40
+
41
+ context 'multiple newlines' do
42
+ it "writes two empty lines for each line" do
43
+ run do |io|
44
+ io.write("\n\n\n")
45
+ io.read(6).should == "\n\n\n\n\n\n"
46
+ end
47
+ end
48
+ end
49
+
50
+ context 'line with characters' do
51
+ let!(:string) { "Hello" }
52
+
53
+ it "writes the line as two lines wrapped with VT100's top half double sized escape" do
54
+ run do |io|
55
+ io.puts(string)
56
+ io.readline.should == "\e#3#{string}\n"
57
+ io.readline.should == "\e#4#{string}\n"
58
+ end
59
+ end
60
+
61
+ it "is waiting for more input" do
62
+ run do |io|
63
+ io.puts(string)
64
+ io.readline
65
+ io.readline
66
+
67
+ io.puts(string)
68
+ io.readline.should_not be_empty
69
+ end
70
+ end
71
+ end
72
+
73
+ context 'multiple lines before EOF' do
74
+ it "writes each line wrapped as line pairs with VT100's double size escape sequences" do
75
+ run do |io|
76
+ io.puts("hello")
77
+ io.puts("world")
78
+
79
+ io.readline.should == "\e#3hello\n"
80
+ io.readline.should == "\e#4hello\n"
81
+ io.readline.should == "\e#3world\n"
82
+ io.readline.should == "\e#4world\n"
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: BigCat
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
+ - 1
7
8
  - 0
8
9
  - 0
9
- - 0
10
- version: 0.0.0
10
+ version: 1.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nolan Eakins
@@ -15,8 +15,8 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-28 00:00:00 -04:00
19
- default_executable:
18
+ date: 2011-09-01 00:00:00 -04:00
19
+ default_executable: bigcat
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -42,24 +42,42 @@ dependencies:
42
42
  segments:
43
43
  - 0
44
44
  version: "0"
45
- type: :development
45
+ type: :runtime
46
46
  name: rspec
47
47
  requirement: *id002
48
48
  prerelease: false
49
+ - !ruby/object:Gem::Dependency
50
+ version_requirements: &id003 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ hash: 3
56
+ segments:
57
+ - 0
58
+ version: "0"
59
+ type: :development
60
+ name: rspec
61
+ requirement: *id003
62
+ prerelease: false
49
63
  description: I cat BIG.
50
64
  email: sneakin+bigcat@semanticgap.com
51
- executables: []
52
-
65
+ executables:
66
+ - bigcat
53
67
  extensions: []
54
68
 
55
69
  extra_rdoc_files:
56
70
  - README.md
57
71
  files:
72
+ - BigCat.gemspec
58
73
  - Gemfile
59
74
  - Gemfile.lock
60
75
  - README.md
61
76
  - Rakefile
62
77
  - VERSION
78
+ - bin/bigcat
79
+ - lib/bigcat.rb
80
+ - spec/integration/bigcat_spec.rb
63
81
  has_rdoc: true
64
82
  homepage: http://github.com/sneakin/BigCat
65
83
  licenses: []