Why create a gem?
- For code reuse
- For isolation (easy to test, black box input/output)
- For important and/or complex code
- For community features and feedback (if open sourced)
pry
require_relative 'month_ordinals'
month_ordinals = MonthOrdinals.for 2016
month_ordinals[:first][:friday]
_[7]
month_ordinals = MonthOrdinals.for 2016..2017
month_ordinals
bundle gem month_ordinals
cd month_ordinals
ls -1A
This adds a gemspec, Rakefile (for testing and releasing), stub for your library's code, semver version.rb, minitest, travis.yml, bin/setup and bin/console, an MIT license and a git repository.
vi *gemspec
vi bin/setup bin/console
git commit -am 'Initial commit'
mkdir lib/month_ordinals/ext
vi lib/month_ordinals.rb
git add -p
git commit -v -S
git create ericboehs/month_ordinals
git push -u
bin/console
rake
# or
m test/month_ordinals_test.rb:5
rake -T
rake release
vi -p lib/month_ordinals.rb lib/month_ordinals/version.rb
git add -p
git commit -v
rake release
- gem install bundler
- gem install pry-awesome_print
- gem install m
- gem install hub
- gem install gist
- mkdir -p .git/safe: tpope tweet, .zshrc
- Vim
gqq
: :help gq - tpope/vim-abolish
- christoomey/vim-tmux-runner
- gemfury
gist _README.md month_ordinals.rb