Skip to content

Instantly share code, notes, and snippets.

@mattwildig
Last active December 14, 2015 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattwildig/5013595 to your computer and use it in GitHub Desktop.
Save mattwildig/5013595 to your computer and use it in GitHub Desktop.
Gem with dependencies
#!/usr/bin/env ruby
#this should be in bin/ dir - gist doesn't allow directories anymore
require 'haml'
puts Haml::VERSION
Gem::Specification.new do |s|
s.name = 'foo'
s.version = '0.1.0'
s.summary = "This is an example!"
s.description = "Much longer explanation of the example!"
s.authors = ["Ruby Coder"]
s.email = 'rubycoder@example.com'
s.files = ["bin/foo"]
s.homepage = 'http://rubygems.org/gems/example'
s.executables << 'foo'
s.add_dependency('haml', '< 4.0')
end
gem-deps (master %)$ gem list
*** LOCAL GEMS ***
bundler (1.2.3)
rake (10.0.3)
rvm (1.11.3.6)
gem-deps (master %)$ gem install haml
Fetching: tilt-1.3.3.gem (100%)
Fetching: haml-4.0.0.gem (100%)
HEADS UP! Haml 4.0 has many improvements, but also has changes that may break
your application:
* Support for Ruby 1.8.6 dropped
* Support for Rails 2 dropped
* Sass filter now always outputs <style> tags
* Data attributes are now hyphenated, not underscored
* html2haml utility moved to the html2haml gem
* Textile and Maruku filters moved to the haml-contrib gem
For more info see:
http://rubydoc.info/github/haml/haml/file/CHANGELOG.md
Successfully installed tilt-1.3.3
Successfully installed haml-4.0.0
2 gems installed
gem-deps (master %)$ gem build foo.gemspec
Successfully built RubyGem
Name: foo
Version: 0.1.0
File: foo-0.1.0.gem
gem-deps (master %)$ ./bin/foo
4.0.0
gem-deps (master %)$ gem install foo-0.1.0.gem
Fetching: haml-3.1.8.gem (100%)
Successfully installed haml-3.1.8
Successfully installed foo-0.1.0
2 gems installed
gem-deps (master %)$ foo
3.1.8 (Separated Sally)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment