Ruby
Various notes, links, and information about the Ruby programming language (wikipedia).
Guides and Tutorial
- Pragmatic Programmers, first edition
- this is a freely available version, which covers Ruby 1.6
- the Pragmatic Bookshelf has upto date Ruby books on sale
- Learning Ruby the Hardway
- Ruby on Rails Guides
- Rails Tutorial, from Michael Hartl
Feature Flags
Feature flags can be used to enable and disable code dynamically. This makes it easier to do Continuous Deployment since a new feature can be enabled in a limited manner.
There are a variety of gems which implement features flags in various ways:
- https://github.com/jamesgolick/rollout
- https://github.com/pda/flip
- https://github.com/pandurang90/feature_flags
- https://github.com/gmontard/helioth
- https://github.com/ckdake/setler
- https://github.com/MongoHQ/mongoid-feature-flags
- https://github.com/grillpanda/dolphin
- https://github.com/qype/feature_flipper
Sources and Discussion
- http://stackoverflow.com/questions/4995556/ruby-feature-switches-feature-flippers
- http://www.stakelon.com/2012/01/simple-feature-flags-for-rails-mongoid/
Invariants and Assertions
Software Assertions are statements in a routine which should always be true. There statements may or may not be disabled in production.
A simple version of this could be implemented just by raising exceptions. However there are gems which allow for better control and make the difference between exceptions and assertions more clear.
Building Gems
Guidelines for building/maintaining gem projects
- manage with bundler
- choose a license
- setup support services and add badges to README
- RubyGems (released version)
- CodeClimate (code quality and test coverage)
- TravisCI (continuous integration)
- InchCI (documentation quality)
- gems to use by default:
- sign the published gems
- publish the project code and related information
- code of conduct
- changelog
- README
- include an "Elsewhere" section which includes links to all the profiles, and places which this project can be found. Including its homepage and git repository
- if appropriate, include an "Alternates" or "Similar Projects" section which describes other projects. This section can also describe the differences between projects, and aid user in choosing what to use
- contribution guidelines
When setting up TravisCI and CodeClimate, for a gem supporting Ruby 2.0 and up, the following .travis.yml can be used:
language: ruby
os:
- linux
- osx
sudo: false
rvm:
- 2.0
- 2.1
- 2.2
- 2.3
- 2.4
- 2.5
- ruby-head
matrix:
allow_failures:
- rvm: ruby-head
- rvm: 2.0
os: osx
- rvm: 2.4
os: osx
after_success:
- bundle exec codeclimate-test-reporter
You will also need to add the CODECLIMATE_REPO_TOKEN to the TravisCI environment variables, getting the value from the Code Climate repository Settings > Test Coverage.
Deprecating a project
Once a gem is no-longer maintained, it should be clearly marked as such. Depending upon where the repository is hosted you should set as many of these points as possible.
- update the title in the README.md to
# :no_entry: DEPRECATED project name
- add the tags
- unmaintained
- deprecated
- outdated
- mark the repository as archived
Reference
- shields.io a service for generating more README shields
- https://philna.sh/blog/2017/07/12/two-tests-you-should-run-against-your-ruby-project-now/
- How I Start - Let's Build a Gem Together! (Book Edition) by Steve Klabnik
- Standard way of marking a github organization or repository as deprecated?
- GemCheck
- there are some othe tools which automate similar checklist stuff
Ruby Blog Entires
Finally, "Is Ruby Dead?"
A questions which seems to be continuously asked, but as Ruby continues to be a great language to write in, and pretty alive I think the answer a solid no.
There is also a website which answers the question Is Ruby Dead? And their answer is also NO.
But rubyisdead.science has graphs, fake quotes and "science". (And a tongue firmly planted in check.)