Notes for a Columbus Ruby Brigade live-coding talk on 11-19-2012.
- Compartmentalize the feature within your project
- define your API
- use
bundle open
and undefined method errors to discover "hooks" for your feature
- Create gem skeleton
bundle gem gemname
- add info to gemspec
- Write README
- if you can't clearly explain how to use your gem, it's not worth releasing
- Move code from source project to gem
- start with boilerplate in
lib/gemname.rb
- just get it working – don't worry about lib structure
- in project Gemfile:
gem gemname, :path => '../local_gem_path'
- restart server, make sure it works
- start with boilerplate in
- Bring over any JS or other assets
- subclass Rails::Engine to make gem assets availablet to asset pipeline
- Install as a real gem
rake install
- in project Gemfile:
gem gemname
(remove:path
)
- Release to rubygems.org
rake release
- create a rubygems account if you haven't before