Sha256: e16be5a93265fef72d34974ad590b7d58d25194e423f77a1464117d85ff5a570
Contents?: true
Size: 1.28 KB
Versions: 3
Compression:
Stored size: 1.28 KB
Contents
module RightPublish class GemRepo include RightPublish::Repo DEFAULT_GEM_DIR = 'gems/' REPO_KEY = :gem_repo REPO_OPTIONS = {:subdir=>DEFAULT_GEM_DIR} GEMS_SUBDIRECTORY = 'gems' GEM_EXT = 'gem' def publish(file_or_dir, target) gems_list = get_pkg_list(file_or_dir, GEM_EXT) # Synchronize the upstream source to our local cache fetch # Copy gem files to the repository destination = File.join(repo_config[:subdir], GEMS_SUBDIRECTORY) gems_list.each do |path| do_in_subdir(destination) { prune_all("#{pkg_parts(path)[:name]}-*.gem") } 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 # Commit back to remote storage store end 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 end RightPublish::RepoManager.register_repo(GemRepo) end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
right_publish-0.3.0 | lib/right_publish/repos/gem.rb |
right_publish-0.2.1 | lib/right_publish/repos/gem.rb |
right_publish-0.2.0 | lib/right_publish/repos/gem.rb |