Class: GemRepo
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- GemRepo
- Defined in:
- lib/gemrepo.rb
Instance Method Summary collapse
Instance Method Details
#gem_repository ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/gemrepo.rb', line 39 def gem_repository @gem_repository ||= ( dir = File.join(settings.gemdir, "gems") FileUtils.mkdir_p(dir) unless File.directory?(dir) dir ) end |
#indexer ⇒ Object
48 49 50 |
# File 'lib/gemrepo.rb', line 48 def indexer @indexer = Gem::Indexer.new settings.gemdir end |
#pull_spec ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/gemrepo.rb', line 20 def pull_spec format = Gem::Format.from_io request.body @spec = format.spec rescue Exception => ex puts ex. false end |
#reindex ⇒ Object
35 36 37 |
# File 'lib/gemrepo.rb', line 35 def reindex indexer.generate_index end |
#save ⇒ Object
28 29 30 31 32 33 |
# File 'lib/gemrepo.rb', line 28 def save path = "#{gem_repository}/#{@spec.original_name}.gem" File.open(path, "wb") { |io| io << request.body.string } end |