Git Product home page Git Product logo

united_states's Introduction

UnitedStates

CircleCI

The names and postal codes of each United States of America State.

Installation

Add this line to your application's Gemfile:

gem 'united_states'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install united_states

united_states is tested against the following stable ruby versions:

  • MRI 2.1.10
  • MRI 2.2.10
  • MRI 2.3.8
  • MRI 2.4.4
  • MRI 2.5.3
  • MRI 2.6.0

Usage

require 'united_states'

UnitedStates.all
# => [#<UnitedStates::State::Designation...@string="WY">]
UnitedStates.names
#=> [#<UnitedStates::State::Name...@string="Wyoming">]
UnitedStates.postal_codes
#=> [#<UnitedStates::State::PostalCode...@string="WY"]
UnitedStates[:LA]
# => [#<UnitedStates::State::Designation...@string="LA">]
UnitedStates['mississippi']
# => [#<UnitedStates::State::Designation...@string="MS">]
UnitedStates['car']
# => UnitedStates::NoDesignationFoundError

Development

Branching

Checkout the repo. If making a hot_fix branch, branch from master. If making a bug_fix/chore/enhancement branch, branch from development. Be sure to update CHANGELOG.md (see http://keepachangelog.com/en/0.3.0/) with your changes.

Setup

Run ./bin/setup to install dependencies.

Testing

Run ./bin/test to run code quality checks and tests.

Documenting

Run ./bin/document to generate doc/ and open doc/index.html to view the documentation. See http://www.rubydoc.info/gems/yard/file/docs/GettingStarted.md for documentation syntax.

Seat-of-the-Pants Testing

Run ./bin/console for an interactive prompt that will allow you to experiment.

Manual installation

To install this gem onto your local machine, run bundle exec rake install.

Deployment

To release a new version, you must first have authorization to push to rubygems. If so, make a new chore/#ISSUE_NUMBER_update_version_to_MAJOR_MINOR_PATCH, update UnitedStates::VERSION number (per Semantic Versioning) in lib/united_states/version.rb, change the Unreleased section of CHANGELOG.md to the new version number, and then make a pull request merging to development.

After development has been updated with the new version number, make a pull request merging the new changes to master.

Once master has been updated, checkout the latest master and run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/kWhittington/united_states. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

united_states's People

Contributors

kwhittington avatar

Watchers

James Cloos avatar  avatar

united_states's Issues

NameError: uninitialized constant UnitedStates::Pathname

This error is thrown whenever attempting to use the UnitedStates.names method from an irb console:

kwhittin at Kyles-MacBook-Pro in ~/D/P/R/playground (master|✔)
» gem install united_states
Fetching: united_states-1.2.0.gem (100%)
Successfully installed united_states-1.2.0
Parsing documentation for united_states-1.2.0
Installing ri documentation for united_states-1.2.0
Done installing documentation for united_states after 0 seconds
1 gem installed
kwhittin at Kyles-MacBook-Pro in ~/D/P/R/playground (master|✔)
» irb
irb(main):001:0> require 'united_states'
=> true
irb(main):002:0> UnitedStates.names
NameError: uninitialized constant UnitedStates::Pathname
        from /Users/kwhittin/.rvm/gems/ruby-2.3.1/gems/united_states-1.2.0/lib/united_states.rb:89:in `array_from_yaml_file'
        from /Users/kwhittin/.rvm/gems/ruby-2.3.1/gems/united_states-1.2.0/lib/united_states.rb:36:in `all'
        from /Users/kwhittin/.rvm/gems/ruby-2.3.1/gems/united_states-1.2.0/lib/united_states.rb:133:in `names'
        from (irb):2
        from /Users/kwhittin/.rvm/rubies/ruby-2.3.1/bin/irb:11:in `<main>'

Issue with path to YAML file

I keep getting this error when trying to implement the collection + methods in a form: "'./lib/united_states/designations.yml' does not exist.
Please supply a path to a YAML file."
I get this error when experiment with 'UnitedStates.names' in my console and local server.

Add branching instructions to `README.md`

The development branch will be taking in new chore/bug_fix/enhancement branch pull request. I should update the README.md to include these branching instructions.

Release 1.2.0

Time to release all the work done for moving state designation configuration into a YAML file.

Add deployment instructions to `README.md`

README.md Deployment section needs to be updated to include the pull request workflow:
when releasing a new version, branch a chore/#N_update_version_to_MAJOR_MINOR_PATCH from development, update UnitedStates::VERSION (following SemVer protocol), make a pull request merging to development. After development has been updated, make a pull request merging development to master. After master has been updated, checkout the latest master and run bundle exec rake release.

Add `development` branch to GitHub

  • Push up a development branch to GitHub.
  • Set it as a "Protected Branch".
    • Require everyone but admins to need an approved review.
    • Require everyone to have a successful CircleCI build.

Make a configuration method that takes a YAML file

A module function to load an array of UnitedState::State::Designation values from a YAML file.

require 'united_states'

UnitedStates.from_yaml_file(path: './config/states.yml')
# => [<UnitedStates::State::Designation . . . >, . . ., <UnitedStates::State::Designation . . . >]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.