Class: Cran::Repository
- Inherits:
-
Object
- Object
- Cran::Repository
- Defined in:
- lib/cran/repository.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
Returns the value of attribute index.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #file_map(url) ⇒ Object
-
#initialize(options = {}) ⇒ Repository
constructor
A new instance of Repository.
- #new_files ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Repository
Returns a new instance of Repository.
6 7 8 |
# File 'lib/cran/repository.rb', line 6 def initialize( = {}) = Cran::Config.get(:repository).merge() end |
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
3 4 5 |
# File 'lib/cran/repository.rb', line 3 def index @index end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/cran/repository.rb', line 4 def end |
Instance Method Details
#file_map(url) ⇒ Object
21 22 23 |
# File 'lib/cran/repository.rb', line 21 def file_map(url) lambda{|f| URI.join(url, f.text).to_s} end |
#new_files ⇒ Object
32 33 34 35 36 |
# File 'lib/cran/repository.rb', line 32 def new_files files = (index - Cran::Db.list) logger.info "News files : #{files.count}" files end |
#update ⇒ Object
25 26 27 28 29 30 |
# File 'lib/cran/repository.rb', line 25 def update Parallel.each(new_files, :in_processes => .fetch(:processes), :progress => "Indexing") do |f| package = Cran::Package.new(f) package.save end end |