diff --git a/.gitignore b/.gitignore index b04a8c8..473f85e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ # rspec failure tracking .rspec_status +Miniparser-1.0.0.gem diff --git a/Miniparse.gemspec b/Miniparser.gemspec similarity index 69% rename from Miniparse.gemspec rename to Miniparser.gemspec index 238606e..8e96327 100644 --- a/Miniparse.gemspec +++ b/Miniparser.gemspec @@ -1,32 +1,32 @@ # frozen_string_literal: true -require_relative 'lib/Miniparse/version' +require_relative 'lib/Miniparser/version' Gem::Specification.new do |spec| - spec.name = 'Miniparse' - spec.version = Miniparse::VERSION + spec.name = 'Miniparser' + spec.version = Miniparser::VERSION spec.authors = ['VetheonGames'] spec.email = ['ceo@pixelatedstudios.net'] 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 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.required_ruby_version = '>= 3.2.2' spec.metadata['homepage_uri'] = spec.homepage - spec.metadata['source_code_uri'] = 'https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Miniparse' - spec.metadata['changelog_uri'] = 'https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Miniparse/src/branch/main/CHANGELOG.md' + spec.metadata['source_code_uri'] = 'https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Miniparser' + 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. 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 - spec.files << 'LICENSE.txt' + spec.files << 'LICENSE' spec.files << 'README.md' - spec.files << 'Miniparse.gemspec' + spec.files << 'Miniparser.gemspec' spec.require_paths = ['lib'] end diff --git a/README.md b/README.md index 05c2a84..7875c56 100644 --- a/README.md +++ b/README.md @@ -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 Add this line to your application's Gemfile: ```ruby -gem 'Miniparse' +gem 'Miniparser' ``` And then execute: @@ -19,7 +19,7 @@ $ bundle install Or install it yourself as: ```bash -$ gem install Miniparse +$ gem install Miniparser ``` ## 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: ```ruby -result = Miniparse::Processor.type_file('path/to/yourfile.html') +result = Miniparser::Processor.type_file('path/to/yourfile.html') ``` ### 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: ```ruby -result = Miniparse::Processor.type_string('') +result = Miniparser::Processor.type_string('') ``` Both methods return a hash containing the validation status, any errors, and the minified code if the input was valid: diff --git a/bin/console b/bin/console index 5b0e42f..c4dcca4 100755 --- a/bin/console +++ b/bin/console @@ -2,7 +2,7 @@ # frozen_string_literal: true require "bundler/setup" -require "Miniparse" +require "Miniparser" # 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. diff --git a/lib/Miniparse.rb b/lib/Miniparser.rb similarity index 94% rename from lib/Miniparse.rb rename to lib/Miniparser.rb index 9fd3853..a47e796 100644 --- a/lib/Miniparse.rb +++ b/lib/Miniparser.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true -require_relative 'Miniparse/version' +require_relative 'Miniparser/version' require_relative 'lang_detect' require_relative 'lang_minify' require_relative 'lang_validate' -module Miniparse +module Miniparser class Error < StandardError; end class Processor diff --git a/lib/Miniparse/version.rb b/lib/Miniparser/version.rb similarity index 75% rename from lib/Miniparse/version.rb rename to lib/Miniparser/version.rb index 8e1dbbb..d2314f3 100644 --- a/lib/Miniparse/version.rb +++ b/lib/Miniparser/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Miniparse +module Miniparser VERSION = "1.0.0" end diff --git a/lib/lang_detect.rb b/lib/lang_detect.rb index 29bdfbe..04ee4a3 100644 --- a/lib/lang_detect.rb +++ b/lib/lang_detect.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Miniparse +module Miniparser class LanguageDetector def detect(code) return :html if code.match?(/<\s*html.*>|<\s*head.*>|<\s*body.*>/i) diff --git a/lib/lang_minify.rb b/lib/lang_minify.rb index ff55520..874acd3 100644 --- a/lib/lang_minify.rb +++ b/lib/lang_minify.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Miniparse +module Miniparser class Minifier def initialize(language) @language = language diff --git a/lib/lang_validate.rb b/lib/lang_validate.rb index 3a252c4..3647062 100644 --- a/lib/lang_validate.rb +++ b/lib/lang_validate.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'English' -module Miniparse +module Miniparser class Validator def initialize(language) @language = language diff --git a/sig/Miniparse.rbs b/sig/Miniparser.rbs similarity index 83% rename from sig/Miniparse.rbs rename to sig/Miniparser.rbs index fb4ca98..31c6191 100644 --- a/sig/Miniparse.rbs +++ b/sig/Miniparser.rbs @@ -1,4 +1,4 @@ -module Miniparse +module Miniparser VERSION: String # See the writing guide of rbs: https://github.com/ruby/rbs#guides end diff --git a/spec/Miniparse_spec.rb b/spec/Miniparser_spec.rb similarity index 65% rename from spec/Miniparse_spec.rb rename to spec/Miniparser_spec.rb index f781f05..73f17f8 100644 --- a/spec/Miniparse_spec.rb +++ b/spec/Miniparser_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -RSpec.describe Miniparse do +RSpec.describe Miniparser do it "has a version number" do - expect(Miniparse::VERSION).not_to be nil + expect(Miniparser::VERSION).not_to be nil end it "does something useful" do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f197d29..c62a156 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require "Miniparse" +require "Miniparser" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure