Overclocking rake with geminabox?

Is there a way to set up the bundler so that when I do rake release

it will send the gem to my own gem server ( gem in the box ) and not rubighems?

Ideally this configuration would be something impossible from my git repository.

+3


source to share


4 answers


Rubygems is actually hardcoded into bundler and I only found one way around it.

The following monkeypatch file should get what you want:

module Bundler
  class GemHelper
    protected
    def rubygem_push(path)
      if Pathname.new("~/.gem/nexus").expand_path.exist?
        sh("gem nexus '#{path}'")
        Bundler.ui.confirm "Pushed #{name} #{version} to https://<your-url-here>/."
      else
        raise "Your Nexus credentials aren't set. Run `gem nexus #{path}` to push your gem and set credentials."
      end
    end
  end
end

      



The above applies to Nexus instead of Geminabox, but the concept should apply to.

As far as dropping out of git, I'm afraid we're out of luck. However, you can share this between projects, so it will only need to be tested in one place, not many. Hope this helps!

+2


source


I created a free error source for this that simulates a geminabox http post request and overwrites the rake release with the rake: inabox release



https://github.com/dfherr/geminabox-release

+1


source


I was able to change the task that loads the gem into rubygems, which is less intrusive than the solution provided by JohnIV, although the concept is the same.

Rake::Task['release:rubygem_push'].clear
namespace :release do
    task :rubygem_push do
      version = ModuleName::VERSION
      name = 'module_name'
      cmd = "gem nexus pkg/#{name}-#{version}.gem"
      puts `#{cmd} 2>&1`
    end
end

      

0


source


Add 'bundler_geminabox'

to your Gemfile:

group :development do
  gem 'bundler_geminabox'
end

      

Then in your rake file instead of asking 'bundler/gem_tasks'

:

require 'bundler_geminabox/gem_tasks'

      

You don't need to add any tasks to the rakefile; you will automatically receive rake build

, rake install

and rake release

, the last of which will be uploaded to the server specified in ~/.gem/geminabox

. Otherwise, the behavior will be the same as the equivalent tasks provided bundler/gem_tasks

.

Gem on Github: https://github.com/joshkrueger/bundler_geminabox

-1


source







All Articles