Skip to content

Commit

Permalink
Initial code commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shivam091 committed Nov 9, 2023
0 parents commit f23bc27
Show file tree
Hide file tree
Showing 17 changed files with 343 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Ruby
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
name: Ruby ${{ matrix.ruby }}
runs-on: ubuntu-latest
env:
RAILS_ENV: test
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
strategy:
matrix:
ruby:
- "3.2.2"
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run test cases
run: bundle exec rake
- name: Publish code coverage
uses: paambaati/[email protected]
31 changes: 31 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Documentation to GitHub Pages
on:
push:
branches:
- main
jobs:
build:
name: Publish Documentation to GitHub Pages ${{ matrix.ruby }}
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
ruby:
- "3.2.2"
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set Up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Install Dependencies
run: gem install yard
- name: Generate Documentation
run: yardoc
- name: Deploy to GitHub Pages
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/

# rspec failure tracking
.rspec_status
3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--format documentation
--color
--require spec_helper
1 change: 1 addition & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--private
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## 0.1.0 - 2023-11-09

### Initial release

-----------

### Unreleased
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- encoding: utf-8 -*-
# -*- frozen_string_literal: true -*-
# -*- warn_indent: true -*-

source "https://rubygems.org"

gemspec
71 changes: 71 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
PATH
remote: .
specs:
composite_unit_measurements (0.1.0)
activesupport (~> 7.0)
unit_measurements (~> 5)

GEM
remote: https://rubygems.org/
specs:
activesupport (7.1.1)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
base64 (0.2.0)
bigdecimal (3.1.4)
byebug (11.1.3)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
diff-lcs (1.5.0)
docile (1.4.0)
drb (2.2.0)
ruby2_keywords
i18n (1.14.1)
concurrent-ruby (~> 1.0)
minitest (5.20.0)
mutex_m (0.2.0)
rake (13.1.0)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
ruby2_keywords (0.0.5)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unit_measurements (5.8.0)
activesupport (~> 7.0)

PLATFORMS
x86_64-linux

DEPENDENCIES
byebug (~> 11)
composite_unit_measurements!
rake (~> 13.0)
rspec (~> 3.0)
simplecov (~> 0.21, >= 0.21.2)

BUNDLED WITH
2.4.10
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

**Copyright (c) 2023 Harshal LADHE**

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.
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Composite Unit Measurements

A set of specialized parsers for dealing with composite measurement strings.

[![Ruby](https://github.com/shivam091/composite_unit_measurements/actions/workflows/main.yml/badge.svg)](https://github.com/shivam091/composite_unit_measurements/actions/workflows/main.yml)
[![Gem Version](https://badge.fury.io/rb/composite_unit_measurements.svg)](https://badge.fury.io/rb/composite_unit_measurements)
[![Gem Downloads](https://img.shields.io/gem/dt/composite_unit_measurements.svg)](http://rubygems.org/gems/composite_unit_measurements)
[![Maintainability](https://api.codeclimate.com/v1/badges/94e13b43cdd19e6c462c/maintainability)](https://codeclimate.com/github/shivam091/composite_unit_measurements/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/94e13b43cdd19e6c462c/test_coverage)](https://codeclimate.com/github/shivam091/composite_unit_measurements/test_coverage)
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/shivam091/composite_unit_measurements/blob/main/LICENSE)

**Harshal V. Ladhe, M.Sc. Computer Science.**

## Introduction

The `CompositeUnitMeasurements` gem is a versatile solution tailored for parsing
composite measurement strings. By harnessing the capabilities of the `unit_measurements`
gem, it empowers you to seamlessly handle composite measurements in various units.

## Minimum Requirements

* Ruby 3.2.2+ (https://www.ruby-lang.org/en/downloads/branches/)

## Installation

If using bundler, first add this line to your application's Gemfile:

```ruby
gem "composite_unit_measurements"
```

And then execute:

`$ bundle install`

Or otherwise simply install it yourself as:

`$ gem install composite_unit_measurements`

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am "Add some feature"`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

## License

Copyright 2023 [Harshal V. LADHE]((https://shivam091.github.io)), Released under the [MIT License](http://opensource.org/licenses/MIT).
10 changes: 10 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- encoding: utf-8 -*-
# -*- frozen_string_literal: true -*-
# -*- warn_indent: true -*-

require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

task default: :spec
44 changes: 44 additions & 0 deletions composite_unit_measurements.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# -*- encoding: utf-8 -*-
# -*- frozen_string_literal: true -*-
# -*- warn_indent: true -*-

lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require "composite_unit_measurements/version"

Gem::Specification.new do |spec|
spec.name = "composite_unit_measurements"
spec.version = CompositeUnitMeasurements::VERSION
spec.authors = ["Harshal LADHE"]
spec.email = ["[email protected]"]

spec.summary = "A set of specialized parsers for dealing with composite measurement strings."
spec.description = spec.summary
spec.homepage = "https://github.com/shivam091/composite_unit_measurements"
spec.license = "MIT"
spec.required_ruby_version = ">= 3.2.2"

spec.metadata["allowed_push_host"] = "https://rubygems.org"

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/shivam091/composite_unit_measurements"
spec.metadata["changelog_uri"] = "https://github.com/shivam091/composite_unit_measurements/blob/main/CHANGELOG.md"
spec.metadata["documentation_uri"] = "https://shivam091.github.io/composite_unit_measurements"
spec.metadata["bug_tracker_uri"] = "https://github.com/shivam091/composite_unit_measurements/issues"

spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_runtime_dependency "activesupport", "~> 7.0"
spec.add_runtime_dependency "unit_measurements", "~> 5"

spec.add_development_dependency "rake", "~> 13.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "simplecov", "~> 0.21", ">= 0.21.2"
spec.add_development_dependency "byebug", "~> 11"
end
9 changes: 9 additions & 0 deletions lib/composite_unit_measurements.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- encoding: utf-8 -*-
# -*- frozen_string_literal: true -*-
# -*- warn_indent: true -*-

require "composite_unit_measurements/version"

module CompositeUnitMeasurements
class Error < StandardError; end
end
7 changes: 7 additions & 0 deletions lib/composite_unit_measurements/base.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- encoding: utf-8 -*-
# -*- frozen_string_literal: true -*-
# -*- warn_indent: true -*-

require "unit_measurements/base"

require "composite_unit_measurements/version"
7 changes: 7 additions & 0 deletions lib/composite_unit_measurements/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- encoding: utf-8 -*-
# -*- frozen_string_literal: true -*-
# -*- warn_indent: true -*-

module CompositeUnitMeasurements
VERSION = "0.1.0"
end
6 changes: 6 additions & 0 deletions spec/composite_unit_measurements_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- encoding: utf-8 -*-
# -*- frozen_string_literal: true -*-
# -*- warn_indent: true -*-

RSpec.describe CompositeUnitMeasurements do
end
27 changes: 27 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- encoding: utf-8 -*-
# -*- frozen_string_literal: true -*-
# -*- warn_indent: true -*-

ENV["RAILS_ENV"] ||= "test"

require "simplecov"
SimpleCov.start

$:.unshift File.expand_path("../../lib", __FILE__)
require "composite_unit_measurements"

RSpec.configure do |config|
config.color = true
config.formatter = :documentation
config.order = "default"

# 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

0 comments on commit f23bc27

Please sign in to comment.