You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

ALL HOW TOs




Create GEM

Create GEM from scratch

In directory:  __DEVELOPMENT__/__RAILS/__GEMS

#   bundle gem <gem_name>
$  bundle gem ld4l–foaf–rdf


Build GEM
#   gem build <gem_name>.gemspec
$ gem build ld4l-foaf_rdf.gemspec

NOTES:

  • Requires git to have all changes committed.
  • 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.

    Examples including a gem from a github
    # get master branch from a git repository
    gem "active-triples", :git => 'git@github.com:no-reply/ActiveTriples.git'
    
    # 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'

      

  • If using local version of gem, add the local version to Gemfile.

    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"


Running Tests
$ bundle exec rspec


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

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.

  • No labels