Sha256: f97f7d94f289575a6b3689724abc0b356fb622b3abf3b6074011d42d402b8363

Contents?: true

Size: 1.81 KB

Versions: 1

Compression:

Stored size: 1.81 KB

Contents

## Table of Contents
* [Scope](#scope)
* [Design](#design)
  * [Footprint](#footprint)
  * [SRP](#srp)
  * [Test](#test)
* [Usage](#usage)
  * [Library](#library)
  * [CLI](#cli)

## Scope
This gem is the Ruby implementation of the for the [NASA rovers](https://github.com/costajob/nasa_rovers/blob/master/OBJECTIVES.md) code kata.

## Design

### Footprint
The code keeps a minimal footprint, relying on standard library only and reducing it to its minimum (i.e. `optparse` was overkill for the simple CLI interface).

### SRP
The code design follows the single responsibility principle by using a dedicated class for any specific task.  

### Test
The code is covered by fast, isolated unit testing, implemented by `minitest` spec (a standard, faster and as same as powerful alternative to `rspec`).  
To run tests just execute rake:

```shell
bundle exec rake
Run options: --seed 4303

# Running:

.....................

Finished in 0.004475s, 4692.7374 runs/s, 7374.3017 assertions/s.
```

## Usage

### Library
Just execute the `bundle console` command and pass an array of instructions to the `Rover.instruct` method:

```ruby
nasa_data = ["5 5", "1 2 N", "LMLMLMLMM", "3 3 E", "MMRMMRMRRM"]
puts NasaRovers::Rover.instruct(nasa_data)
#1 3 N
#5 1 E
#=> nil
```

### CLI
The library provides a CLI interface via the `nasa_rovers` command from the terminal.  

#### Help
You can print CLI help by:

```shell
$ ./bin/nasa_rovers -h
Usage: nasa_rovers ./nasa_data.txt
    -h --help               Print this help
    <path-to-file>          Instruct rovers with NASA data
```

#### Input
The program accepts as input a file containing the NASA data (for more info check ``SUMMARY.md`)

```txt
# ./nasa_data.txt
5 5
1 2 N
LMLMLMLMM
3 3 E
MMRMMRMRRM
```

Just pass the file path to the program:

```shell
$ ./bin/nasa_rovers ./nasa_data.txt
1 3 N
5 1 E
```

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nasa_rovers-1.0.1 README.md