Class: Gem::SparseMirror::Mirror
- Inherits:
-
Mirror
- Object
- Mirror
- Gem::SparseMirror::Mirror
- Defined in:
- lib/gem-sparse-mirror/mirror.rb
Instance Attribute Summary collapse
-
#except ⇒ Object
Returns the value of attribute except.
-
#only ⇒ Object
Returns the value of attribute only.
Instance Method Summary collapse
Instance Attribute Details
#except ⇒ Object
Returns the value of attribute except.
8 9 10 |
# File 'lib/gem-sparse-mirror/mirror.rb', line 8 def except @except end |
#only ⇒ Object
Returns the value of attribute only.
8 9 10 |
# File 'lib/gem-sparse-mirror/mirror.rb', line 8 def only @only end |
Instance Method Details
#fetch_specs_using_bundler ⇒ Object
29 30 31 32 33 34 |
# File 'lib/gem-sparse-mirror/mirror.rb', line 29 def fetch_specs_using_bundler fetcher = Bundler::Fetcher.new(from) deps = fetcher.fetch_remote_specs(only) deps.values.first.map(&:first).uniq end |
#gems ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gem-sparse-mirror/mirror.rb', line 10 def gems update_specs unless File.exists?(to(SPECS_FILE)) gems = Marshal.load(Gem.read_binary(to(SPECS_FILE))) if only only_with_deps = fetch_specs_using_bundler gems = gems.find_all { |name, _, _| only_with_deps.include?(name) } end gems.reject! { |name, _, _| except.include?(name) } gems.map! do |name, ver, plat| # If the platform is ruby, it is not in the gem name "#{name}-#{ver}#{"-#{plat}" unless plat == RUBY}.gem" end gems end |