Class: RightPublish::GemRepo
- Defined in:
- lib/right_publish/repos/gem.rb
Constant Summary collapse
- DEFAULT_GEM_DIR =
'gems/'- REPO_KEY =
:gem_repo- REPO_OPTIONS =
{:subdir=>DEFAULT_GEM_DIR, :prune=>false}
- GEMS_SUBDIRECTORY =
'gems'- GEM_EXT =
'gem'
Constants inherited from Repo
Repo::LOCK_FILE_NAME, Repo::LOCK_PERIOD, Repo::LOCK_RETRY_INTERVAL
Instance Method Summary collapse
Methods inherited from Repo
#initialize, #publish, #pull, #push
Constructor Details
This class inherits a constructor from RightPublish::Repo
Instance Method Details
#add(file_or_dir, target) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# 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 = {}) ⇒ Object
32 33 34 35 36 |
# File 'lib/right_publish/repos/gem.rb', line 32 def annotate(={}) [:subdir] ||= File.join(repo_config[:subdir], 'gems') [:filter] = ['*.gem'] super() end |