rsb-gol 0.4.1 → 0.4.2

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: 20c5316450c6817252ff2069a664b6ca9c2d54e4
4
- data.tar.gz: c7e8c01d370d89715c4d3421fdaef74c32aaf365
3
+ metadata.gz: bbbcc6ecbfbcea3087b5a19641a833c67af2ca2e
4
+ data.tar.gz: cbd7992ceb20e9ac07137110dbeaa5fc9d061623
5
5
  SHA512:
6
- metadata.gz: 77ad4d9c53850749aa3bfd9d75a44ff41f49394bbd17fc8294f723ad7b081412490f74d3e08771c0804d6c78c5508a97369c7732f74087ce04731004c3ffc1fc
7
- data.tar.gz: 281331232bf054a1b93b56c0c6bbfc80d23356e4055d9926c6425abe9580dd2a4532ac905f2981f0e08fb9db88ae79f9ee763ed35ae7994d7ebee3f9c947dc56
6
+ metadata.gz: 6ddb001d77f6448a6e4f01b3baae1246ea0288f622093af5a1f3ba318258062c7e852186a6dd4b6f2fffbc84aef21bf7d226b2c561a7bb337ae69a6aca812c06
7
+ data.tar.gz: 51ac8947c922921d69415f12a4e49852a14f3c58f9d8ef9d58088c715f129ca61cc912cb4287f52dad3b84e463b0cdb3d08f719e1588aa159d9bed7c33aff716
@@ -1,4 +1,5 @@
1
1
  require 'thor'
2
+ require 'highline'
2
3
 
3
4
  module Rsb
4
5
  module Gol
@@ -11,10 +12,12 @@ module Rsb
11
12
 
12
13
  desc 'start', 'start the game of life'
13
14
  def start
14
- rows, columns = screen_size
15
- iterations = options.iterations
16
- alive = options.alive_char
17
- dead = options.death_char
15
+ columns, rows = HighLine::SystemExtensions.terminal_size
16
+ rows -= 10
17
+ columns -= 10
18
+ iterations = options.iterations
19
+ alive = options.alive_char
20
+ dead = options.death_char
18
21
 
19
22
  columns = options.columns if options.columns?
20
23
  rows = options.rows if options.rows?
@@ -23,38 +26,6 @@ module Rsb
23
26
  game = Rsb::Gol::Game.new(cols: columns, rows: rows)
24
27
  game.start(iterations, alive, dead)
25
28
  end
26
-
27
- no_commands do
28
- # credit to: https://gist.github.com/nixpulvis/6025433
29
- # From the tty_ioctl man page in Linux.
30
- #
31
- # TIOCGWINSZ struct winsize *argp
32
- # Get window size.
33
- #
34
- # TIOCSWINSZ const struct winsize *argp
35
- # Set window size.
36
- #
37
- # The struct used by these ioctls is defined as
38
- #
39
- # struct winsize {
40
- # unsigned short ws_row;
41
- # unsigned short ws_col;
42
- # unsigned short ws_xpixel; /* unused */
43
- # unsigned short ws_ypixel; /* unused */
44
- # };
45
- # rows cols width height
46
- def screen_size
47
- window = [0, 0, 0, 0].pack('SSSS')
48
- fd = IO.sysopen('/dev/tty', 'w')
49
- terminal = IO.new(fd, "w")
50
-
51
- # The in in this call is === TIOCGWINSZ. No idea where it is defined.
52
- # I found it using ruby-termios with `Termios::TIOCGWINSZ`
53
- terminal.ioctl(1074295912, window)
54
- rows, cols, _, _ = window.unpack('SSSS')
55
- [rows - 10, cols - 10]
56
- end
57
- end
58
29
  end
59
30
  end
60
31
  end
@@ -1,5 +1,5 @@
1
1
  module Rsb
2
2
  module Gol
3
- VERSION = "0.4.1"
3
+ VERSION = "0.4.2"
4
4
  end
5
5
  end
@@ -20,10 +20,12 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.add_dependency "thor", "~> 0.19.1"
23
+ spec.add_dependency "thor", ">= 0.19.1"
24
+ spec.add_dependency "highline", ">= 1.7.2"
24
25
 
25
26
  spec.add_development_dependency "bundler", "~> 1.10"
26
27
  spec.add_development_dependency "rake", "~> 10.0"
27
28
  spec.add_development_dependency "pry", "~> 0.10.1"
28
29
  spec.add_development_dependency "rspec", "~> 3.2.0"
30
+ spec.required_ruby_version = '>= 2.0'
29
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsb-gol
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Scott-Buccleuch
@@ -14,16 +14,30 @@ dependencies:
14
14
  name: thor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.19.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.19.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: highline
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.7.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.7.2
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -118,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
132
  requirements:
119
133
  - - ">="
120
134
  - !ruby/object:Gem::Version
121
- version: '0'
135
+ version: '2.0'
122
136
  required_rubygems_version: !ruby/object:Gem::Requirement
123
137
  requirements:
124
138
  - - ">="