diff --git a/Gemfile b/Gemfile index 64c00e1..938e47d 100644 --- a/Gemfile +++ b/Gemfile @@ -8,3 +8,4 @@ gemspec gem "rake", "~> 13.0" gem "minitest", "~> 5.0" +gem 'minitest-reporters', '1.6.0' \ No newline at end of file diff --git a/README.md b/README.md index 2eba6df..d8328a5 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,45 @@ -# Lz196Palindrome +# Palindrome detector -TODO: Delete this and the text below, and describe your gem - -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/lz196_palindrome`. To experiment with that code, run `bin/console` for an interactive prompt. +`Lz196Palindrome` is a sample Ruby gem created in [*Learn Enough Ruby to Be Dangerous*](https://www.learnenough.com/ruby-tutorial) by Leon. ## Installation -TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org. - -Install the gem and add to the application's Gemfile by executing: - - $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG +To install `Lz196Palindrome`, add this line to your application's `Gemfile`: -If bundler is not being used to manage dependencies, install the gem by executing: +``` +gem 'mhartl_palindrome' +``` - $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG - -## Usage +Then install as follows: -TODO: Write usage instructions here +``` +$ bundle install +``` -## Development +Or install it directly using `gem`: -After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. +``` +$ gem install Lz196Palindrome +``` -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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). - -## Contributing +## Usage -Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/lz196_palindrome. 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]/lz196_palindrome/blob/master/CODE_OF_CONDUCT.md). +`Lz196Palindrome` adds a `palindrome?` method to the `String` class, and can be used as follows: + +``` +$ irb +>> require 'Lz196Palindrome' +>> "honey badger".palindrome? +=> false +>> "deified".palindrome? +=> true +>> "Able was I, ere I saw Elba.".palindrome? +=> true +>> phrase = "Madam, I'm Adam." +>> phrase.palindrome? +=> true +``` ## 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 Lz196Palindrome project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/lz196_palindrome/blob/master/CODE_OF_CONDUCT.md). +The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). \ No newline at end of file diff --git a/lz196_palindrome.gemspec b/lz196_palindrome.gemspec index 4318a86..9478b58 100644 --- a/lz196_palindrome.gemspec +++ b/lz196_palindrome.gemspec @@ -8,17 +8,15 @@ Gem::Specification.new do |spec| spec.authors = ["Leon Zheng"] spec.email = ["leon.zheng@hotmail.com"] - spec.summary = "TODO: Write a short summary, because RubyGems requires one." - spec.description = "TODO: Write a longer description or delete this line." - spec.homepage = "TODO: Put your gem's website or public repo URL here." + spec.summary = "Palindrome detector" + spec.description = "Learn Enough Ruby palindrome detector" + spec.homepage = "https://github.com/le0n" spec.license = "MIT" spec.required_ruby_version = ">= 2.6.0" spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'" spec.metadata["homepage_uri"] = spec.homepage - spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here." - spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here." # Specify which files should be added to the gem when it is released. # The `git ls-files -z` loads the files in the RubyGem that have been added into git. @@ -30,6 +28,7 @@ Gem::Specification.new do |spec| spec.bindir = "exe" spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] + # Uncomment to register a new dependency of your gem # spec.add_dependency "example-gem", "~> 1.0" diff --git a/test/test_helper.rb b/test/test_helper.rb index 7e2b42b..63d2d5d 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -4,3 +4,5 @@ require "lz196_palindrome" require "minitest/autorun" +require "minitest/reporters" +Minitest::Reporters.use! \ No newline at end of file