Change name from Miniparse to Miniparser

This commit is contained in:
VetheonGames 2023-08-24 06:41:11 -06:00
parent 87f9ee2cf1
commit 329fb07787
12 changed files with 28 additions and 27 deletions

1
.gitignore vendored
View File

@ -9,3 +9,4 @@
# rspec failure tracking # rspec failure tracking
.rspec_status .rspec_status
Miniparser-1.0.0.gem

View File

@ -1,32 +1,32 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative 'lib/Miniparse/version' require_relative 'lib/Miniparser/version'
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = 'Miniparse' spec.name = 'Miniparser'
spec.version = Miniparse::VERSION spec.version = Miniparser::VERSION
spec.authors = ['VetheonGames'] spec.authors = ['VetheonGames']
spec.email = ['ceo@pixelatedstudios.net'] spec.email = ['ceo@pixelatedstudios.net']
spec.summary = 'A Gem for Validating and Minifying HTML, CSS, and JS smartly' 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 spec.description = 'Miniparser 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 either 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' a file (path) and a text return, respective to what input it got'
spec.homepage = 'https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Miniparse' spec.homepage = 'https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Miniparser'
spec.license = 'MIT' spec.license = 'MIT'
spec.required_ruby_version = '>= 3.2.2' spec.required_ruby_version = '>= 3.2.2'
spec.metadata['homepage_uri'] = spec.homepage spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = 'https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Miniparse' spec.metadata['source_code_uri'] = 'https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Miniparser'
spec.metadata['changelog_uri'] = 'https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Miniparse/src/branch/main/CHANGELOG.md' spec.metadata['changelog_uri'] = 'https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Miniparser/src/branch/main/CHANGELOG.md'
# Specify which files should be added to the gem when it is released. # Specify which files should be added to the gem when it is released.
spec.files = Dir.glob('{bin,lib,sig}/**/*') + Dir.glob('*').reject do |f| spec.files = Dir.glob('{bin,lib,sig}/**/*') + Dir.glob('*').reject do |f|
f.start_with?('spec', '.rspec', 'Miniparse.gemspec') f.start_with?('spec', '.rspec', 'Miniparser.gemspec')
end end
spec.files << 'LICENSE.txt' spec.files << 'LICENSE'
spec.files << 'README.md' spec.files << 'README.md'
spec.files << 'Miniparse.gemspec' spec.files << 'Miniparser.gemspec'
spec.require_paths = ['lib'] spec.require_paths = ['lib']
end end

View File

@ -1,13 +1,13 @@
# Miniparse # Miniparser
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. Miniparser 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 ## Installation
Add this line to your application's Gemfile: Add this line to your application's Gemfile:
```ruby ```ruby
gem 'Miniparse' gem 'Miniparser'
``` ```
And then execute: And then execute:
@ -19,7 +19,7 @@ $ bundle install
Or install it yourself as: Or install it yourself as:
```bash ```bash
$ gem install Miniparse $ gem install Miniparser
``` ```
## Usage ## Usage
@ -31,7 +31,7 @@ Miniparse provides two main methods to process either a file or a string contain
You can process a file by calling the `type_file` method and passing the file path as an argument: You can process a file by calling the `type_file` method and passing the file path as an argument:
```ruby ```ruby
result = Miniparse::Processor.type_file('path/to/yourfile.html') result = Miniparser::Processor.type_file('path/to/yourfile.html')
``` ```
### Processing a String ### Processing a String
@ -39,7 +39,7 @@ result = Miniparse::Processor.type_file('path/to/yourfile.html')
You can process a string containing code by calling the `type_string` method: You can process a string containing code by calling the `type_string` method:
```ruby ```ruby
result = Miniparse::Processor.type_string('<html><head></head><body></body></html>') result = Miniparser::Processor.type_string('<html><head></head><body></body></html>')
``` ```
Both methods return a hash containing the validation status, any errors, and the minified code if the input was valid: Both methods return a hash containing the validation status, any errors, and the minified code if the input was valid:

View File

@ -2,7 +2,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require "bundler/setup" require "bundler/setup"
require "Miniparse" require "Miniparser"
# You can add fixtures and/or initialization code here to make experimenting # You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like. # with your gem easier. You can also use a different console, if you like.

View File

@ -1,11 +1,11 @@
# frozen_string_literal: true # frozen_string_literal: true
require_relative 'Miniparse/version' require_relative 'Miniparser/version'
require_relative 'lang_detect' require_relative 'lang_detect'
require_relative 'lang_minify' require_relative 'lang_minify'
require_relative 'lang_validate' require_relative 'lang_validate'
module Miniparse module Miniparser
class Error < StandardError; end class Error < StandardError; end
class Processor class Processor

View File

@ -1,5 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
module Miniparse module Miniparser
VERSION = "1.0.0" VERSION = "1.0.0"
end end

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
module Miniparse module Miniparser
class LanguageDetector class LanguageDetector
def detect(code) def detect(code)
return :html if code.match?(/<\s*html.*>|<\s*head.*>|<\s*body.*>/i) return :html if code.match?(/<\s*html.*>|<\s*head.*>|<\s*body.*>/i)

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
module Miniparse module Miniparser
class Minifier class Minifier
def initialize(language) def initialize(language)
@language = language @language = language

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'English' require 'English'
module Miniparse module Miniparser
class Validator class Validator
def initialize(language) def initialize(language)
@language = language @language = language

View File

@ -1,4 +1,4 @@
module Miniparse module Miniparser
VERSION: String VERSION: String
# See the writing guide of rbs: https://github.com/ruby/rbs#guides # See the writing guide of rbs: https://github.com/ruby/rbs#guides
end end

View File

@ -1,8 +1,8 @@
# frozen_string_literal: true # frozen_string_literal: true
RSpec.describe Miniparse do RSpec.describe Miniparser do
it "has a version number" do it "has a version number" do
expect(Miniparse::VERSION).not_to be nil expect(Miniparser::VERSION).not_to be nil
end end
it "does something useful" do it "does something useful" do

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require "Miniparse" require "Miniparser"
RSpec.configure do |config| RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure # Enable flags like --only-failures and --next-failure