summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authora14m <[email protected]>2020-11-27 17:02:40 +0100
committera14m <[email protected]>2020-11-27 17:55:36 +0100
commit8185d66664367eab60edb3ab27103d22c1631769 (patch)
tree6b2b8f68a3a559e8f24d65003ae17848e3111e5d
parentd1a020777af347f59b73b58f0ce96bb360dc6b35 (diff)
Initial commit of the ruby gem
-rw-r--r--CLI/ruby/.gitignore11
-rw-r--r--CLI/ruby/.rspec3
-rw-r--r--CLI/ruby/.rubocop.yml38
-rw-r--r--CLI/ruby/.ruby-version1
-rw-r--r--CLI/ruby/Gemfile6
-rw-r--r--CLI/ruby/Gemfile.lock66
-rw-r--r--CLI/ruby/README.md44
-rw-r--r--CLI/ruby/Rakefile8
-rwxr-xr-xCLI/ruby/bin/game-of-life4
-rw-r--r--CLI/ruby/game_of_life.gemspec30
-rw-r--r--CLI/ruby/lib/game_of_life.rb8
-rw-r--r--CLI/ruby/lib/game_of_life/version.rb5
-rw-r--r--CLI/ruby/spec/game_of_life_spec.rb11
-rw-r--r--CLI/ruby/spec/spec_helper.rb16
14 files changed, 251 insertions, 0 deletions
diff --git a/CLI/ruby/.gitignore b/CLI/ruby/.gitignore
new file mode 100644
index 0000000..b04a8c8
--- /dev/null
+++ b/CLI/ruby/.gitignore
@@ -0,0 +1,11 @@
+/.bundle/
+/.yardoc
+/_yardoc/
+/coverage/
+/doc/
+/pkg/
+/spec/reports/
+/tmp/
+
+# rspec failure tracking
+.rspec_status
diff --git a/CLI/ruby/.rspec b/CLI/ruby/.rspec
new file mode 100644
index 0000000..34c5164
--- /dev/null
+++ b/CLI/ruby/.rspec
@@ -0,0 +1,3 @@
+--format documentation
+--color
+--require spec_helper
diff --git a/CLI/ruby/.rubocop.yml b/CLI/ruby/.rubocop.yml
new file mode 100644
index 0000000..59385a2
--- /dev/null
+++ b/CLI/ruby/.rubocop.yml
@@ -0,0 +1,38 @@
+AllCops:
+ TargetRubyVersion: 2.4
+ NewCops: enable
+
+Layout/EmptyLineAfterGuardClause:
+ Enabled: false
+
+Layout/LineLength:
+ Max: 120
+
+Style/AccessModifierDeclarations:
+ EnforcedStyle: inline
+
+Style/BlockDelimiters:
+ Exclude:
+ - 'spec/**/*'
+
+Style/Documentation:
+ Enabled: false
+
+Style/FormatString:
+ EnforcedStyle: format
+
+Style/SignalException:
+ EnforcedStyle: semantic
+
+Style/StringLiterals:
+ EnforcedStyle: double_quotes
+
+Style/TrailingCommaInArguments:
+ EnforcedStyleForMultiline: comma
+
+Style/TrailingCommaInArrayLiteral:
+ EnforcedStyleForMultiline: comma
+
+Style/TrailingCommaInHashLiteral:
+ EnforcedStyleForMultiline: comma
+
diff --git a/CLI/ruby/.ruby-version b/CLI/ruby/.ruby-version
new file mode 100644
index 0000000..37c2961
--- /dev/null
+++ b/CLI/ruby/.ruby-version
@@ -0,0 +1 @@
+2.7.2
diff --git a/CLI/ruby/Gemfile b/CLI/ruby/Gemfile
new file mode 100644
index 0000000..c0c8dc1
--- /dev/null
+++ b/CLI/ruby/Gemfile
@@ -0,0 +1,6 @@
+# frozen_string_literal: true
+
+source "https://rubygems.org"
+
+# Specify your gem's dependencies in game_of_life.gemspec
+gemspec
diff --git a/CLI/ruby/Gemfile.lock b/CLI/ruby/Gemfile.lock
new file mode 100644
index 0000000..978f3fb
--- /dev/null
+++ b/CLI/ruby/Gemfile.lock
@@ -0,0 +1,66 @@
+PATH
+ remote: .
+ specs:
+ game_of_life (0.1.0)
+
+GEM
+ remote: https://rubygems.org/
+ specs:
+ ast (2.4.1)
+ byebug (11.1.3)
+ coderay (1.1.3)
+ diff-lcs (1.4.4)
+ method_source (1.0.0)
+ parallel (1.20.1)
+ parser (2.7.2.0)
+ ast (~> 2.4.1)
+ pry (0.13.1)
+ coderay (~> 1.1)
+ method_source (~> 1.0)
+ pry-byebug (3.9.0)
+ byebug (~> 11.0)
+ pry (~> 0.13.0)
+ rainbow (3.0.0)
+ rake (13.0.1)
+ regexp_parser (2.0.0)
+ rexml (3.2.4)
+ rspec (3.10.0)
+ rspec-core (~> 3.10.0)
+ rspec-expectations (~> 3.10.0)
+ rspec-mocks (~> 3.10.0)
+ rspec-core (3.10.0)
+ rspec-support (~> 3.10.0)
+ rspec-expectations (3.10.0)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.10.0)
+ rspec-mocks (3.10.0)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.10.0)
+ rspec-support (3.10.0)
+ rubocop (1.4.2)
+ parallel (~> 1.10)
+ parser (>= 2.7.1.5)
+ rainbow (>= 2.2.2, < 4.0)
+ regexp_parser (>= 1.8)
+ rexml
+ rubocop-ast (>= 1.1.1)
+ ruby-progressbar (~> 1.7)
+ unicode-display_width (>= 1.4.0, < 2.0)
+ rubocop-ast (1.2.0)
+ parser (>= 2.7.1.5)
+ ruby-progressbar (1.10.1)
+ unicode-display_width (1.7.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ bundler
+ game_of_life!
+ pry-byebug
+ rake
+ rspec
+ rubocop
+
+BUNDLED WITH
+ 2.1.4
diff --git a/CLI/ruby/README.md b/CLI/ruby/README.md
new file mode 100644
index 0000000..58d1cfd
--- /dev/null
+++ b/CLI/ruby/README.md
@@ -0,0 +1,44 @@
+# GameOfLife
+
+Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/game_of_life`. To experiment with that code, run `bin/console` for an interactive prompt.
+
+TODO: Delete this and the text above, and describe your gem
+
+## Installation
+
+Add this line to your application's Gemfile:
+
+```ruby
+gem 'game_of_life'
+```
+
+And then execute:
+
+ $ bundle install
+
+Or install it yourself as:
+
+ $ gem install game_of_life
+
+## Usage
+
+TODO: Write usage instructions here
+
+## Development
+
+After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
+
+To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
+
+## Contributing
+
+Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/game_of_life. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/game_of_life/blob/master/CODE_OF_CONDUCT.md).
+
+
+## License
+
+The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
+
+## Code of Conduct
+
+Everyone interacting in the GameOfLife project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/game_of_life/blob/master/CODE_OF_CONDUCT.md).
diff --git a/CLI/ruby/Rakefile b/CLI/ruby/Rakefile
new file mode 100644
index 0000000..b6ae734
--- /dev/null
+++ b/CLI/ruby/Rakefile
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+
+require "bundler/gem_tasks"
+require "rspec/core/rake_task"
+
+RSpec::Core::RakeTask.new(:spec)
+
+task default: :spec
diff --git a/CLI/ruby/bin/game-of-life b/CLI/ruby/bin/game-of-life
new file mode 100755
index 0000000..4d62bac
--- /dev/null
+++ b/CLI/ruby/bin/game-of-life
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+require "game_of_life"
diff --git a/CLI/ruby/game_of_life.gemspec b/CLI/ruby/game_of_life.gemspec
new file mode 100644
index 0000000..94b879d
--- /dev/null
+++ b/CLI/ruby/game_of_life.gemspec
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+require_relative "lib/game_of_life/version"
+
+Gem::Specification.new do |spec|
+ spec.name = "game_of_life"
+ spec.version = GameOfLife::VERSION
+ spec.authors = ["a14m"]
+ spec.email = ["[email protected]"]
+
+ spec.summary = "Game of Life CLI"
+ spec.description = "Conway's game of life implementation as a CLI ruby gem."
+ spec.homepage = "https://gitlab.com/a14m/game-of-life"
+ spec.license = "MIT"
+ spec.required_ruby_version = ">= 2.4.0"
+
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
+ spec.metadata["homepage_uri"] = spec.homepage
+ spec.metadata["source_code_uri"] = "https://gitlab.com/a14m/game-of-life/-/tree/master/CLI/ruby/"
+
+ spec.executables = ["game-of-life"]
+ spec.require_paths = ["lib"]
+ spec.files = Dir["README.md", "game_of_life.gemspec", "bin/game-of-life", "lib/**/*.rb"]
+
+ spec.add_development_dependency "bundler"
+ spec.add_development_dependency "pry-byebug"
+ spec.add_development_dependency "rake"
+ spec.add_development_dependency "rspec"
+ spec.add_development_dependency "rubocop"
+end
diff --git a/CLI/ruby/lib/game_of_life.rb b/CLI/ruby/lib/game_of_life.rb
new file mode 100644
index 0000000..4cff146
--- /dev/null
+++ b/CLI/ruby/lib/game_of_life.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+
+require "game_of_life/version"
+
+module GameOfLife
+ class Error < StandardError; end
+ # Your code goes here...
+end
diff --git a/CLI/ruby/lib/game_of_life/version.rb b/CLI/ruby/lib/game_of_life/version.rb
new file mode 100644
index 0000000..5d13768
--- /dev/null
+++ b/CLI/ruby/lib/game_of_life/version.rb
@@ -0,0 +1,5 @@
+# frozen_string_literal: true
+
+module GameOfLife
+ VERSION = "0.1.0"
+end
diff --git a/CLI/ruby/spec/game_of_life_spec.rb b/CLI/ruby/spec/game_of_life_spec.rb
new file mode 100644
index 0000000..bb1abaa
--- /dev/null
+++ b/CLI/ruby/spec/game_of_life_spec.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+RSpec.describe GameOfLife do
+ it "has a version number" do
+ expect(GameOfLife::VERSION).not_to be nil
+ end
+
+ it "does something useful" do
+ expect(false).to eq(true)
+ end
+end
diff --git a/CLI/ruby/spec/spec_helper.rb b/CLI/ruby/spec/spec_helper.rb
new file mode 100644
index 0000000..b65df8e
--- /dev/null
+++ b/CLI/ruby/spec/spec_helper.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+require "bundler/setup"
+require "game_of_life"
+
+RSpec.configure do |config|
+ # Enable flags like --only-failures and --next-failure
+ config.example_status_persistence_file_path = ".rspec_status"
+
+ # Disable RSpec exposing methods globally on `Module` and `main`
+ config.disable_monkey_patching!
+
+ config.expect_with :rspec do |c|
+ c.syntax = :expect
+ end
+end