Module: Stickler::Middleware::Helpers::Specs
- Included in:
- Index
- Defined in:
- lib/stickler/middleware/helpers.rb
Overview
Manage the contents of the stickler.specs
environment variable. It is used as as communcation method between the various types of middlewares managing gem repositories. The Index server will use the values in this variable in generating the responses to gem index requests
env is a Hash itself, the key being the return value of root_dir
from the Class it is included in, the value for each key is the Array of SpecLite’s.
Instance Method Summary collapse
-
#collect_specs_via(method) ⇒ Object
Collect all the specs via a call on each Repository.
-
#latest_specs ⇒ Object
return the list of all the latest_specs in all the repos.
-
#prerelease_specs ⇒ Object
return the list of all the pre-release specs.
-
#released_specs ⇒ Object
return just the list of the releeased specs in all the repos.
-
#specs ⇒ Object
return the list of all the specs in all the repos.
-
#specs_by_first_upcase_char ⇒ Object
Return all the specs as a hash of specs_by_name.
-
#specs_by_name ⇒ Object
return the specs as a hash of lists, keyedy by gemname.
-
#specs_by_repo ⇒ Object
The specs by repository.
-
#specs_grouped_by_name(spec_list) ⇒ Object
Given a list of specs, this will group them by name.
Instance Method Details
#collect_specs_via(method) ⇒ Object
Collect all the specs via a call on each Repository
70 71 72 73 74 |
# File 'lib/stickler/middleware/helpers.rb', line 70 def collect_specs_via( method ) specs_by_repo.values.collect do |idx| idx.send( method ) end.flatten.sort end |
#latest_specs ⇒ Object
return the list of all the latest_specs in all the repos
49 50 51 |
# File 'lib/stickler/middleware/helpers.rb', line 49 def latest_specs collect_specs_via( :latest_specs ) end |
#prerelease_specs ⇒ Object
return the list of all the pre-release specs
56 57 58 |
# File 'lib/stickler/middleware/helpers.rb', line 56 def prerelease_specs collect_specs_via( :prerelease_specs ) end |
#released_specs ⇒ Object
return just the list of the releeased specs in all the repos
63 64 65 |
# File 'lib/stickler/middleware/helpers.rb', line 63 def released_specs collect_specs_via( :released_specs ) end |
#specs ⇒ Object
return the list of all the specs in all the repos
42 43 44 |
# File 'lib/stickler/middleware/helpers.rb', line 42 def specs collect_specs_via( :specs ) end |
#specs_by_first_upcase_char ⇒ Object
Return all the specs as a hash of specs_by_name. The keys in this case are the first character of the gem name
87 88 89 90 91 92 93 94 95 |
# File 'lib/stickler/middleware/helpers.rb', line 87 def specs_by_first_upcase_char by_char = Hash.new{ |h,k| h[k] = Array.new } specs.each do |spec| by_char[spec.name[0...1].upcase] << spec end by_char.keys.each { |k| by_char[k] = specs_grouped_by_name(by_char[k]) } return by_char end |
#specs_by_name ⇒ Object
return the specs as a hash of lists, keyedy by gemname
79 80 81 |
# File 'lib/stickler/middleware/helpers.rb', line 79 def specs_by_name specs_grouped_by_name( specs ) end |
#specs_by_repo ⇒ Object
The specs by repository
35 36 37 |
# File 'lib/stickler/middleware/helpers.rb', line 35 def specs_by_repo Stickler::Repository::Local.repos end |
#specs_grouped_by_name(spec_list) ⇒ Object
Given a list of specs, this will group them by name
100 101 102 103 104 105 106 |
# File 'lib/stickler/middleware/helpers.rb', line 100 def specs_grouped_by_name( spec_list ) by_name = Hash.new{ |h,k| h[k] = Array.new } spec_list.each do |spec| by_name[spec.name.downcase] << spec end return by_name end |