Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Bundler's rake tasks define no dependencies between eachother or any required files #2121

Closed
postmodern opened this Issue · 12 comments

4 participants

@postmodern

Bundler appears to only use rake as an invocation mechanism for Bundler's internal gem building/releasing methods. The rake tasks lack proper dependencies between each other, and the files which they require. This prevents other rake tasks from hooking into Bundler's release process. For example, md2man needs to generate man-pages before Bundler creates a gem containing all files listed in the gemspec.

Bundler::GemHelper should either be rewritten to properly utilize Rake, or Bundler should consider deprecating it's Rake tasks in favour of an agnostic/lightweight set of Rake tasks; such as rubygems-tasks, mg or gem-release.

@indirect
Owner

Uh. Hmm. So the reason that we refer to the Bundler tasks instead of directly outputting them into a generated gem's Rakefile is so that we can update and fix the tasks automatically for anyone who uses them. As for "proper dependencies", it does look like we should change the release and install tasks to depend on the build task. Is there other stuff that I'm missing there to make it "properly utilize Rake"?

@postmodern

@indirect sorry if I wasn't clear. By "properly utilize Rake" I mean Bundler should make use of file and directory tasks, as well as define dependencies between the tasks/files. Generating the Rakefile with the tasks inlined would be silly :)

@indirect
Owner
@postmodern

The first step would be to decouple the build_gem method from install_gem. Both install_gem and release_gem depend on the return value of build_gem. Then the install / release tasks can depend on build, and have the gem only built once.

@lwoggardner

Would a simple implementation be to have :build, :install and :release all depend on a no-op :pre-build task?

@indirect
Owner

@lwoggardner it's trivial to add your own pre-build task. Simply put a line like this in your Rakefile:

task :before_build { p "pre-build task" }
task :build => :before_build

No need for a patch to Bundler.

@indirect indirect closed this
@lwoggardner

no, we have to do

task :before_build { p "pre-build task" }
task :build => :before_build
task :install => :before_build
task :release => :before_build

which is counterintuitive, since we expect :install and :release to already be dependant on :build

I was just suggesting that embedding this in bundler might be easier that actually making install_gem dependent on build_gem

@indirect
Owner

Ahhh, I understand. Yes, install and release will become dependent on build. The tasks will also be changed to use Rubygems' actual API to build gems, instead of shelling out to them.

@postmodern

Also, the tasks should define a file tasks for the .gem file.

In the meantime, I encourage users of Bundler to use proper Rake tasks for building/releasing gems, such as rubygems-tasks or mg.

Gemfile

gem 'rubygems-tasks'

Rakefile

require 'rake'
require 'rubygems/tasks'
Gem::Tasks.new
@sunaku

Please reopen this issue because it's still unresolved. :sweat:

@indirect indirect reopened this
@sunaku

I submitted a patch for this issue in pull request #2328.

@sunaku sunaku referenced this issue from a commit in sunaku/bundler
@sunaku sunaku make 'install' and 'build' tasks depend on 'build'
This patch attempts to fix issue #2121 in Bundler.
dcbbef7
@indirect indirect referenced this issue from a commit
@sunaku sunaku make 'install' and 'build' tasks depend on 'build'
This patch attempts to fix issue #2121 in Bundler.
71e14bc
@sunaku

My pull request #2328 has been merged. We can close this issue now. :cop:

@postmodern postmodern closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.