terminal_game_of_life 1.0.5 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f01833ac38b2fcfb9f8ea6581642e2d95a9f40521d79773178c5499e23a2530
4
- data.tar.gz: 5f8540b420def7ca4eb0a9371140419bd47489089bed0c5f68f204a266d9946c
3
+ metadata.gz: c7c06d9b3fa0064f9909d6a6fa9e074d5d19c986864b39c4bcb5e894e2f95797
4
+ data.tar.gz: 45ceec6d3597e6a25321e9d2e16aa4514854842cbd5a78fac56a6c391d4b0e43
5
5
  SHA512:
6
- metadata.gz: 3fbf0db73b5fb37de4b2565813f4ba5ab5500930630fea8151f627b972ed7ef1bdfd95253675da6160451734b9d24d688802e92a36532140b1920fdb4b45d00e
7
- data.tar.gz: ec4959be702a801f10229c9f85edcd148326d60d919c6b099c1bcd0b06a8f2b1efb24fa225121d14ab28f6239583ab05aacde14c659e74c77ff2262e7b466e8f
6
+ metadata.gz: 17eb17da0045de01fd74edf451984086eaf9f8ea3d0f79b43c5224261abc59cc771638ade18b29a10c948c08157bc836ace1e97224b9e4e9eac4b61783410248
7
+ data.tar.gz: 06a25e28dadc410701131cc71eefbd7f3a411d706640029add6478317463922e28db728051e2b6c57acc2c9ac46921e2e7fa179a2f61da1b676636e2c0de7bcf
data/README.md CHANGED
@@ -10,7 +10,7 @@ $ gem install terminal_game_of_life
10
10
  ## Usage
11
11
 
12
12
  ```bash
13
- $game-of-life -i https://meta.sr.ht/~a14m.keys --live-cell +
13
+ $game-of-life -i https://example.com --live-cell +
14
14
  $game-of-life -i /path/to/file.txt --height 35 --width 35
15
15
  $game-of-life -s 1337 --delay 250
16
16
  ```
data/bin/game-of-life CHANGED
@@ -49,11 +49,12 @@ end
49
49
 
50
50
  begin
51
51
  CLI.start(ARGV)
52
- rescue SystemExit, Interrupt
52
+ rescue Interrupt
53
53
  # Print Seed/File used in previous run when user exits with Interrupt (CMD/Ctrl + C)
54
54
  print "\e[?1049l"
55
55
  print "#{GameOfLife::BANNER}\n\e[0m"
56
- rescue NotImplementedError, GameOfLife::Error => e
57
- print e.message
56
+ exit(0)
57
+ rescue GameOfLife::Error => e
58
+ print "#{e.message}\n\e[0m"
58
59
  exit(-1)
59
60
  end
data/game_of_life.gemspec CHANGED
@@ -19,23 +19,11 @@ Gem::Specification.new do |spec|
19
19
  spec.metadata["source_code_uri"] = "https://git.sr.ht/~a14m/game-of-life/tree/master/CLI/ruby"
20
20
  spec.metadata["documentation_uri"] = "https://rubydoc.info/gems/terminal_game_of_life"
21
21
  spec.metadata["changelog_uri"] = "https://git.sr.ht/~a14m/game-of-life/tree/master/CLI/ruby/CHANGELOG.md"
22
+ spec.metadata["rubygems_mfa_required"] = "true"
22
23
 
23
24
  spec.executables = ["game-of-life"]
24
25
  spec.require_paths = ["lib"]
25
26
  spec.files = Dir["README.md", "game_of_life.gemspec", "bin/game-of-life", "lib/**/*.rb", ".yardopts"]
26
27
 
27
28
  spec.add_dependency "thor", "~> 1.0"
28
-
29
- spec.add_development_dependency "bundler"
30
- spec.add_development_dependency "pry-byebug"
31
- spec.add_development_dependency "rake"
32
- spec.add_development_dependency "rspec"
33
- spec.add_development_dependency "rubocop"
34
- spec.add_development_dependency "rubocop-rspec"
35
- # Code Coverage dependencies
36
- spec.add_development_dependency "codecov"
37
- spec.add_development_dependency "simplecov"
38
- # Documentation dependencies
39
- spec.add_development_dependency "redcarpet"
40
- spec.add_development_dependency "yard"
41
29
  end
@@ -5,10 +5,10 @@ require "socket"
5
5
 
6
6
  module GameOfLife
7
7
  module Generators
8
- # Generate a new Universe/Board with a parsed local file or remote URL/file
8
+ # Generate a new Universe/Board from a parsed local file or remote URL/file
9
9
  module Input
10
10
  class << self
11
- # Generate a new Universe/Board with a parsed local file or remote URL/file
11
+ # Generate a new Universe/Board from a parsed local file or remote URL/file
12
12
  # @param options [Hash] CLI options to generate initial conditions
13
13
  # @option options [String] "input" path to a local file or URL to open
14
14
  # @option options [Numeric] "width" (floored) and used as the width of the universe
@@ -54,7 +54,7 @@ module GameOfLife
54
54
  (0...height).each do |i|
55
55
  (0...width).each do |j|
56
56
  cell = { x: j, y: i, alive: input.fetch(i, nil)&.fetch(j, nil) }
57
- universe[i][j] = ::GameOfLife::Cell.new(cell)
57
+ universe[i][j] = ::GameOfLife::Cell.new(**cell)
58
58
  end
59
59
  end
60
60
  universe
@@ -32,7 +32,7 @@ module GameOfLife
32
32
  # Create a pseudo(stable) random generator from the seed
33
33
  # Generate a sequence of bytes to cover the Game of Life Universe plane
34
34
  # each byte can be unpacked into binary data string (ex. "01101011")
35
- raw = Random.new(seed).bytes(width * height).unpack1("B*").split("").each_slice(width)
35
+ raw = Random.new(seed).bytes(width * height).unpack1("B*").chars.each_slice(width)
36
36
  raw.map { |row| row.map { |char| char.eql?("1") } }
37
37
  end
38
38
 
@@ -48,7 +48,7 @@ module GameOfLife
48
48
  (0...height).each do |i|
49
49
  (0...width).each do |j|
50
50
  cell = { x: j, y: i, alive: input.fetch(i, nil)&.fetch(j, nil) }
51
- universe[i][j] = ::GameOfLife::Cell.new(cell)
51
+ universe[i][j] = ::GameOfLife::Cell.new(**cell)
52
52
  end
53
53
  end
54
54
  universe
@@ -2,5 +2,5 @@
2
2
 
3
3
  module GameOfLife
4
4
  # Game of life version number
5
- VERSION = "1.0.5"
5
+ VERSION = "1.0.7"
6
6
  end
data/lib/game_of_life.rb CHANGED
@@ -36,11 +36,11 @@ module GameOfLife
36
36
  end
37
37
  if (options["width"]&.< 1) || (options["width"]&.> max_width)
38
38
  fail GameOfLife::Error, "Invalid --width value. " \
39
- "must be between 1 and #{max_width} (current terminal width)"
39
+ "must be between 1 and #{max_width} (current terminal width)"
40
40
  end
41
41
  if (options["height"]&.< 1) || (options["height"]&.> max_height)
42
42
  fail GameOfLife::Error, "Invalid --height value. " \
43
- "must be between 1 and #{max_height} (current terminal height)"
43
+ "must be between 1 and #{max_height} (current terminal height)"
44
44
  end
45
45
 
46
46
  fail GameOfLife::Error, "Invalid --live-cell value. must be a single character" if options["live-cell"].length > 1
@@ -111,7 +111,7 @@ module GameOfLife
111
111
  # Ref: https://stackoverflow.com/questions/11023929/using-the-alternate-screen-in-a-bash-script
112
112
  # Ref: https://superuser.com/questions/122911/what-commands-can-i-use-to-reset-and-clear-my-terminal
113
113
  print "\e[?1049h\e[H"
114
- print universe.to_s
114
+ print universe
115
115
  print "\n #{BANNER}"
116
116
  sleep(DELAY / 1000.0)
117
117
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminal_game_of_life
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - a14m
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-16 00:00:00.000000000 Z
11
+ date: 2023-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -24,146 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: pry-byebug
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rake
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: rubocop
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rubocop-rspec
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: codecov
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: simplecov
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: redcarpet
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: yard
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
27
  description: Conway's game of life implementation as a CLI ruby gem.
168
28
  email:
169
29
  - a14m@pm.me
@@ -192,6 +52,7 @@ metadata:
192
52
  source_code_uri: https://git.sr.ht/~a14m/game-of-life/tree/master/CLI/ruby
193
53
  documentation_uri: https://rubydoc.info/gems/terminal_game_of_life
194
54
  changelog_uri: https://git.sr.ht/~a14m/game-of-life/tree/master/CLI/ruby/CHANGELOG.md
55
+ rubygems_mfa_required: 'true'
195
56
  post_install_message:
196
57
  rdoc_options: []
197
58
  require_paths:
@@ -207,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
68
  - !ruby/object:Gem::Version
208
69
  version: '0'
209
70
  requirements: []
210
- rubygems_version: 3.1.4
71
+ rubygems_version: 3.4.10
211
72
  signing_key:
212
73
  specification_version: 4
213
74
  summary: Game of Life CLI