From 87f9ee2cf1825dd6d118455deea64fe5a8411f86 Mon Sep 17 00:00:00 2001 From: VetheonGames Date: Thu, 24 Aug 2023 06:33:49 -0600 Subject: [PATCH] Make Readme not a template, update Gemspec --- LICENSE.txt | 21 ------------------ Miniparse.gemspec | 4 ++-- README.md | 56 +++++++++++++++++++++++++++++++++-------------- 3 files changed, 41 insertions(+), 40 deletions(-) delete mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index 372b7a7..0000000 --- a/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2023 VetheonGames - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/Miniparse.gemspec b/Miniparse.gemspec index b70e86e..238606e 100644 --- a/Miniparse.gemspec +++ b/Miniparse.gemspec @@ -10,8 +10,8 @@ Gem::Specification.new do |spec| spec.summary = 'A Gem for Validating and Minifying HTML, CSS, and JS smartly' spec.description = 'Miniparse works pretty simply. You pass the Gem some input (HTML, JS, or CSS), and it will - validate it, return the validated status, then minify it, and return the minified version as both - a file (path) and a text return accessible through a variable' + validate it, return the validated status, then minify it, and return the minified version as either + a file (path) and a text return, respective to what input it got' spec.homepage = 'https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Miniparse' spec.license = 'MIT' spec.required_ruby_version = '>= 3.2.2' diff --git a/README.md b/README.md index c00a67e..05c2a84 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,61 @@ # Miniparse -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/Miniparse`. To experiment with that code, run `bin/console` for an interactive prompt. +Miniparse is a Ruby gem that takes code as input (HTML, JavaScript, or CSS), determines the code language, validates it, and then minifies it. It returns whether the code is valid or not, and if valid, provides the minified code. ## Installation -TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_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. +Add this line to your application's Gemfile: -Install the gem and add to the application's Gemfile by executing: +```ruby +gem 'Miniparse' +``` - $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG +And then execute: -If bundler is not being used to manage dependencies, install the gem by executing: +```bash +$ bundle install +``` - $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG +Or install it yourself as: + +```bash +$ gem install Miniparse +``` ## Usage -TODO: Write usage instructions here +Miniparse provides two main methods to process either a file or a string containing HTML, JavaScript, or CSS code. -## Development +### Processing a File -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. +You can process a file by calling the `type_file` method and passing the file path as an argument: -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). +```ruby +result = Miniparse::Processor.type_file('path/to/yourfile.html') +``` + +### Processing a String + +You can process a string containing code by calling the `type_string` method: + +```ruby +result = Miniparse::Processor.type_string('') +``` + +Both methods return a hash containing the validation status, any errors, and the minified code if the input was valid: + +```ruby +{ + valid: true or false, + errors: "Error message if any", + minified_code: "Minified code if valid" +} +``` ## Contributing -Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/Miniparse. 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]/Miniparse/blob/master/CODE_OF_CONDUCT.md). +Bug reports and pull requests are welcome. Please adhere to the code of conduct. ## 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 Miniparse project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/Miniparse/blob/master/CODE_OF_CONDUCT.md).