class Geminabox::Rake

Public Class Methods

install(opts = {})
Alias for: install_tasks
install_tasks(opts = {}) click to toggle source
# File lib/geminabox/rake.rb, line 8
def install_tasks(opts = {})
  opts[:dir] ||= Dir.getwd
  new(opts[:dir], opts[:name], opts).install
end
Also aliased as: install
new(dir, name, opts = {}) click to toggle source
Calls superclass method
# File lib/geminabox/rake.rb, line 15
def initialize(dir, name, opts = {})
  @hosts     = Array(opts[:host]).map do |host|
    URI.parse(host)
  end
  @namespace = opts[:namespace]
  super File.absolute_path(dir), name
end

Public Instance Methods

install() click to toggle source
Calls superclass method
# File lib/geminabox/rake.rb, line 23
def install
  namespace geminabox_task_namespace do
    super
  end
end

Protected Instance Methods

geminabox_host_params() click to toggle source
# File lib/geminabox/rake.rb, line 41
def geminabox_host_params
  @hosts.map do |host|
    host ? "--host '#{host}'" : nil
  end
end
geminabox_host_strings() click to toggle source
# File lib/geminabox/rake.rb, line 47
def geminabox_host_strings
  return 'default host' unless @hosts

  @hosts.map do |host|
    host.dup.tap do |uri|
      uri.user     = uri.password = nil
      uri.user     = '**' if uri.user
      uri.password = '**' if uri.password
    end
  end
end
geminabox_task_namespace() click to toggle source
# File lib/geminabox/rake.rb, line 59
def geminabox_task_namespace
  @namespace || 'geminabox'
end
rubygem_push(path) click to toggle source
# File lib/geminabox/rake.rb, line 31
def rubygem_push(path)
  params  = geminabox_host_params
  strings = geminabox_host_strings

  params.each_with_index do |param, i|
    sh("bundle exec gem push '#{path}' #{param}")
    Bundler.ui.confirm "Pushed #{name} #{version} to #{strings[i]}."
  end
end