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
72 73 74 75 76 |
# File 'lib/stickler/middleware/helpers.rb', line 72 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
51 52 53 |
# File 'lib/stickler/middleware/helpers.rb', line 51 def latest_specs collect_specs_via( :latest_specs ) end |
#prerelease_specs ⇒ Object
return the list of all the pre-release specs
58 59 60 |
# File 'lib/stickler/middleware/helpers.rb', line 58 def prerelease_specs collect_specs_via( :prerelease_specs ) end |
#released_specs ⇒ Object
return just the list of the releeased specs in all the repos
65 66 67 |
# File 'lib/stickler/middleware/helpers.rb', line 65 def released_specs collect_specs_via( :released_specs ) end |
#specs ⇒ Object
return the list of all the specs in all the repos
44 45 46 |
# File 'lib/stickler/middleware/helpers.rb', line 44 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
89 90 91 92 93 94 95 96 97 |
# File 'lib/stickler/middleware/helpers.rb', line 89 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
81 82 83 |
# File 'lib/stickler/middleware/helpers.rb', line 81 def specs_by_name specs_grouped_by_name( specs ) end |
#specs_by_repo ⇒ Object
The specs by repository
37 38 39 |
# File 'lib/stickler/middleware/helpers.rb', line 37 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
102 103 104 105 106 107 108 |
# File 'lib/stickler/middleware/helpers.rb', line 102 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 |