terminal_game_of_life 0.1.0 → 0.1.1

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: e653045a66a53af6c2b4c5b58f0330ec18d8125e7ce70b2b9c8803e8d7f67b2a
4
- data.tar.gz: 75ffbbd48c0b9cb883a2cd1aab1f0b7e7606856223a18e88c4dd0a9916a5afc6
3
+ metadata.gz: 840950936964f043278b2b2169e096a054384a3ee8c5eed35afef6e66d68801f
4
+ data.tar.gz: 010dd81355f54729acaf4154c3f69f33997b3511f397f8352190f0a8ec423fff
5
5
  SHA512:
6
- metadata.gz: a4ae52be24a7bbadf45997c129b1e4b407f3b6f47ecc1cb6c6c63c002d57add5f6ac231581ef024458f366189555f73fad4995a279d4b9b92c0fc5e2d5721141
7
- data.tar.gz: b3f717f56369f87ed173a57ff9f79364e3400af441c543c58a64a244fa8b9a328304fd00a9de8d82593fbb6aeb0795f81d15ceb67b29a698d1b0ebe0133ff1ea
6
+ metadata.gz: 7c951bd38ccadb0348811e859faf8280b75ecf20d15df7375b899befc4e41438ace91284db9c8e38fafa2b545d95e102a69da3b4110c1883ea6b8d61c347b2d0
7
+ data.tar.gz: 123ba4920e029bcc9cb7a66112e900ddfe147d66c987466d756fdefc4e4b986b3b83496d9942b6da060b56e20b6eba9865f15955faacb436d262597ff4c9d22d
data/README.md CHANGED
@@ -9,6 +9,8 @@ $ gem install terminal_game_of_life
9
9
 
10
10
  ## Usage
11
11
 
12
+ Run `$game-of-life -i https://gitlab.com/a14m --live-cell +`
13
+
12
14
  Check `game-of-life --help` for usage info.
13
15
 
14
16
  ```
@@ -29,6 +31,9 @@ Options:
29
31
  # Default: 50
30
32
  ```
31
33
 
34
+ ## Demo
35
+ [![asciicast](https://asciinema.org/a/h7G2EUAXRfwlBVLZjQuXjoTnp.svg)](https://asciinema.org/a/h7G2EUAXRfwlBVLZjQuXjoTnp)
36
+
32
37
  ## Development
33
38
 
34
39
  - Clone the repo.
@@ -46,6 +51,15 @@ Run `bundle exec rspec` or `bundle exec rake spec`
46
51
  ## Documentation
47
52
  Run `bundle exec yard`
48
53
 
54
+ ## Release
55
+ - Update the [version](./lib/game_of_live/version.rb) number
56
+ - Run `bundle install` and commit changes
57
+ - Update the [CHANGELOG](./CHANGELOG.md)
58
+ - Create a git(lab) tag `ruby/v#{version_number}` ex: `ruby/v0.1.1-pre`
59
+
60
+ The tag will automatically trigger the release workflow after successful build/test
61
+ and release the changes to [rubygems.org](https://rubygems.org/gems/terminal_game_of_life)
62
+
49
63
  ## Extra information
50
64
  ### [Contributing](../../CONTRIBUTING.md)
51
65
  ### [License](../../LICENSE.md)
@@ -60,6 +60,7 @@ begin
60
60
  CLI.start(ARGV)
61
61
  rescue SystemExit, Interrupt
62
62
  "Do nothing when user exits with Interrupt (CMD/Ctrl + C)"
63
- rescue NotImplementedError
64
- puts "Seed option isn't implemented yet, please use --input option"
63
+ rescue NotImplementedError, GameOfLife::Error => e
64
+ puts e.message
65
+ exit(-1)
65
66
  end
@@ -7,6 +7,9 @@ require "game_of_life/cell"
7
7
 
8
8
  # Game of Life module entry point
9
9
  module GameOfLife
10
+ # Base Error class
11
+ class Error < StandardError; end
12
+
10
13
  class << self
11
14
  # Generate a universe based on the options (from an input file/URI) or using a random/passed seed
12
15
  # This method also sets the Classes/Modules constants for the run defining the options for
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "open-uri"
4
+ require "socket"
4
5
 
5
6
  module GameOfLife
6
7
  module Generators
@@ -22,6 +23,11 @@ module GameOfLife
22
23
  # where any alpha numeric character is considered a living cell (true)
23
24
  raw.map! { |row| row.chars.map { |char| char.match?(/[[:alnum:]]/) } }
24
25
  populate(parsed_input: raw, width: options["width"].to_i, height: options["height"].to_i)
26
+ rescue ::OpenURI::HTTPError, ::SocketError
27
+ raise GameOfLife::Error, "URL isn't avaialable, please check it again and make sure the URL is correct"
28
+ rescue ::Errno::ENOENT
29
+ raise GameOfLife::Error,
30
+ "File isn't avaialable, please check it again and make sure the path to the input file is correct"
25
31
  end
26
32
 
27
33
  # Populate the {GameOfLife::Universe} with reference to the parsed input 2D array (True/False)
@@ -12,7 +12,7 @@ module GameOfLife
12
12
  # @option options [Numeric] "height" (floored) and used as the height of the universe
13
13
  # @return [GameOfLife::Universe] populated with the parsed input
14
14
  def new(options)
15
- fail NotImplementedError
15
+ fail ::NotImplementedError, "Seed option isn't implemented yet, please use --input option"
16
16
  end
17
17
  end
18
18
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GameOfLife
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  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: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - a14m
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-04 00:00:00.000000000 Z
11
+ date: 2020-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -147,7 +147,7 @@ metadata:
147
147
  allowed_push_host: https://rubygems.org
148
148
  homepage_uri: https://gitlab.com/a14m/game-of-life
149
149
  source_code_uri: https://gitlab.com/a14m/game-of-life/-/tree/master/CLI/ruby/
150
- post_install_message:
150
+ post_install_message:
151
151
  rdoc_options: []
152
152
  require_paths:
153
153
  - lib
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  version: '0'
164
164
  requirements: []
165
165
  rubygems_version: 3.1.4
166
- signing_key:
166
+ signing_key:
167
167
  specification_version: 4
168
168
  summary: Game of Life CLI
169
169
  test_files: []