Creating GEMs
Create GEM from scratch
In directory: __DEVELOPMENT__/__RAILS/__GEMS
# bundle gem <gem_name> $ bundle gem ld4l–foaf–rdf
Releasing GEMs
Build GEM
# gem build <gem_name>.gemspec $ gem build ld4l-foaf_rdf.gemspec
Release Gem to RubyGems.org
# gem push <gem_name>-<gem_version>.gem $ gem push ld4l-foaf_rdf-0.1.0.gem
NOTE: Will want to create a corresponding release of code in GitHub.
Using GEMs
Using Released GEMs
Refs to released versions
'>= 2.2.0' # all versions from 2.2.0 forward are good '>= 2.2.0', '< 3.0' # all versions from 2.2.0 thru 3.0 (not inclusive) '~> 2.2.0' # all versions from 2.2.0 thru 2.3.0 (not inclusive) '~> 2.2' # all versions from 2.2 thru 3.0 (not inclusive) '~> 2.2', '>= 2.2.1' # all versions from 2.2.1 thru 3.0 (not inclusive)
More examples in API Dock. Also see Pessimistic Version Constraint.
Using GEMs from GitHub
Examples including a gem from a github
# github syntax to get master branch of the same respository gem "active-triples", :github => 'no-reply/ActiveTriples' # github syntax to get a specific branch of the repository gem "active-triples", :github => 'no-reply/ActiveTriples', :branch => 'patch-1' # github syntax to get a specific commit of the repository gem "active-triples", :github => 'no-reply/ActiveTriples', :tag => '4e9fbd3bade894d20ebf67170033128f31c54208'
NOTE: Cannot reference a github pull request. To do that, comment out the dependency for the versioned gem in gemspec, AND add the github version in Gemfile.
Using local code for a GEM
Example including a gem from code on local machine.
gem "active_triples-local_name", :path => "/Users/elr37/Documents/__DEVELOPMENT__/__CLEAN_TESTS/active_triples-local_name_minter"