Permalink
Browse files

Allow bundler to automatically build a gem directly from git

Using bundler (now included with Rails 3.0), it's possible to fetch gems
directly from specific branches in a git repository.  This is very handy
for contributors and people who need to make small fixes.

With this patch applied, it's possible to include the following line
in a Gemfile:

  gem 'mail', :git => 'git://github.com/mikel/mail.git'

Then you can install the latest master branch using bundler:

  bundle install

This patch changes two things about the development process.  First,
gems are now built using:

  rake build

...or:

  gem build mail.gemspec

Second, the generated gemfile now appears in the top-level directory,
and not in a pkg/ subdirectory.
  • Loading branch information...
emk committed Apr 15, 2010
1 parent 25cc941 commit 018a1dc29a284f1089d0adeac8401542c130d75b
Showing with 24 additions and 25 deletions.
  1. +1 −1 .gitignore
  2. +3 −24 Rakefile
  3. +20 −0 mail.gemspec
View
@@ -1,7 +1,7 @@
.bundle
coverage
gems
-pkg
+/mail-*.gem
rdoc
mail.tmproj
spec/fixtures/emails/failed_emails/
View
@@ -1,34 +1,13 @@
require File.expand_path('../spec/environment', __FILE__)
require 'rake/rdoctask'
-require 'rake/gempackagetask'
require 'rake/testtask'
require 'spec/rake/spectask'
require 'cucumber/rake/task'
-spec = Gem::Specification.new do |s|
- s.name = "mail"
- s.version = "2.2.0"
- s.author = "Mike Lindsaar"
- s.email = "raasdnil@gmail.com"
- s.homepage = "http://github.com/mikel/mail"
- s.description = "A really Ruby Mail handler."
- s.summary = "Mail provides a nice Ruby DSL for making, sending and reading emails."
-
- s.platform = Gem::Platform::RUBY
- s.has_rdoc = true
- s.extra_rdoc_files = ["README.rdoc", "CHANGELOG.rdoc", "TODO.rdoc"]
-
- s.add_dependency('activesupport', ">= 2.3.4")
- s.add_dependency('mime-types')
- s.add_dependency('treetop', '>= 1.4.5')
-
- s.require_path = 'lib'
- s.files = %w(README.rdoc Rakefile TODO.rdoc) + Dir.glob("lib/**/*")
-end
-
-Rake::GemPackageTask.new(spec) do |pkg|
- pkg.gem_spec = spec
+desc "Build a gem file"
+task :build do
+ system "gem build mail.gemspec"
end
task :default => :spec
View
@@ -0,0 +1,20 @@
+Gem::Specification.new do |s|
+ s.name = "mail"
+ s.version = "2.2.0"
+ s.author = "Mike Lindsaar"
+ s.email = "raasdnil@gmail.com"
+ s.homepage = "http://github.com/mikel/mail"
+ s.description = "A really Ruby Mail handler."
+ s.summary = "Mail provides a nice Ruby DSL for making, sending and reading emails."
+
+ s.platform = Gem::Platform::RUBY
+ s.has_rdoc = true
+ s.extra_rdoc_files = ["README.rdoc", "CHANGELOG.rdoc", "TODO.rdoc"]
+
+ s.add_dependency('activesupport', ">= 2.3.4")
+ s.add_dependency('mime-types')
+ s.add_dependency('treetop', '>= 1.4.5')
+
+ s.require_path = 'lib'
+ s.files = %w(README.rdoc Rakefile TODO.rdoc) + Dir.glob("lib/**/*")
+end

1 comment on commit 018a1dc

mikel commented on 018a1dc May 7, 2010

Thank you man, this rocks. Have been meaning to do it for some time... but it's awesome you did it for us all!!!!

Merging!!

Mikel

Please sign in to comment.