Skip to content

Latest commit

 

History

History
89 lines (60 loc) · 2.78 KB

CONTRIBUTING.md

File metadata and controls

89 lines (60 loc) · 2.78 KB

Contributing

Please see our community docs on contributing.

This document is for developers or programmers contributing to source code. If you're interested in contributing a different way, please see the link above.

Project Structure

This project follows a standard Ruby gem structure. Here's a brief overview of the main directories and files:

  • lib/: Contains the main source code for the GurmukhiUtils gem.
    • gurmukhi_utils.rb: The main entry point for the gem. This file requires all other necessary files.
    • <feature>.rb files: Each additional file in this directory represents a specific feature/module of the gem.
  • spec/: Contains the RSpec test files for the gem. Test files should be placed in this directory, following the naming convention <feature>_spec.rb.
  • Gemfile: Specifies the gem dependencies for development and testing.
  • Gemfile.lock: Generated by Bundler, this file contains the exact gem versions and their dependencies used in the project.
  • gurmukhi_utils.gemspec: The gem specification file, which provides information about the gem. We need this to publish and release the gem.

Development

  • Install ruby. This project's ruby version is listed in Gemfile.
  • Install project dependencies with bundle install.
  • Run tests with bundle exec rspec.

Testing

  • Local tests are located in the ruby folder.
  • The tests run against the root gurmukhi-utils test folder.
  • The test runner is rspec.
  • Run tests by setting the ruby folder as your current working directory in the terminal and then executing bundle exec rspec.

Adding New Features to GurmukhiUtils

To add a new feature to GurmukhiUtils, follow these steps:

Step 1.

Create a new file in the lib/ directory for the new feature, and place the new functionality within the GurmukhiUtils module.

For example, if you want to create an ascii method, create a new file called ascii.rb:

# lib/ascii.rb

module GurmukhiUtils
  def self.helpers
    # ...
  end

  def self.other_methods
    # ...
  end

  def self.ascii
    # ...
  end
end

Step 2.

Update the lib/gurmukhi_utils.rb file to require the new feature file using require_relative:

# lib/gurmukhi_utils.rb

require_relative 'gurmukhi_utils/version'
require_relative 'unicode'
require_relative 'ascii' # Add this line for the new feature

Step 3.

Test the feature

Write tests for the new feature in the spec directory.

You can also use irb and do:

001 > require_relative "lib/gurmukhi_utils"
 => true
002 > GurmukhiUtils.ascii("...")
 => "..."

Thank you

Your contributions to open source, large or small, make great projects like this possible. Thank you for taking the time to participate in this project.