...
...
Create GEM
Create GEM from scratch
In directory: __DEVELOPMENT__/__RAILS/__GEMS
Code Block |
---|
|
# bundle gem <gem_name>
$ bundle gem ld4l–foaf–rdf |
Build GEM
Code Block |
---|
|
# gem build <gem_name>.gemspec
$ gem build ld4l-foaf_rdf.gemspec |
NOTES:
...
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.
Code Block |
---|
language | none |
---|
title | 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.
Code Block |
---|
language | none |
---|
title | 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
Code Block |
---|
|
$ bundle exec rspec |
Code Block |
---|
|
# 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
...
More examples in API Dock. Also see Pessimistic Version Constraint.
Using Gems from GitHub
Code Block |
---|
language | none |
---|
title | 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
Code Block |
---|
language | none |
---|
title | 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" |