class RightPublish::GemRepo
Constants
- DEFAULT_GEM_DIR
- GEMS_SUBDIRECTORY
- GEM_EXT
- REPO_KEY
- REPO_OPTIONS
Public Instance Methods
add(file_or_dir, target)
click to toggle source
# File lib/right_publish/repos/gem.rb, line 10 def add(file_or_dir, target) gems_list = get_pkg_list(file_or_dir, GEM_EXT) # Copy gem files to the repository destination = File.join(repo_config[:subdir], GEMS_SUBDIRECTORY) gems_list.each do |path| # RubyGems repos do not normally prune; it must be explicitly enabled. if repo_config[:prune] do_in_subdir(destination) { prune_all("#{pkg_parts(path)[:name]}-*.gem") } end install_file(path, destination) end # Rebuild the gem index Profile.log("Rebuilding Gem Index...") do_in_subdir(repo_config[:subdir]) do indexed = system('gem generate_index 2>&1 >/dev/null') # requires 'builder' gem to be installed raise Exception, "gem generate_index failed; cannot continue publishing" unless indexed end end
annotate(options={})
click to toggle source
Calls superclass method
RightPublish::Repo#annotate
# File lib/right_publish/repos/gem.rb, line 32 def annotate(options={}) options[:subdir] ||= File.join(repo_config[:subdir], 'gems') options[:filter] = ['*.gem'] super(options) end
Protected Instance Methods
pkg_parts(name)
click to toggle source
# File lib/right_publish/repos/gem.rb, line 40 def pkg_parts(name) result = {:name=>nil, :version=>nil} result[:name], result[:version] = /([A-Za-z0-9\-_]+)-([0-9\.]+)\.#{GEM_EXT}\Z/.match(name).captures result end