Module: Polisher::HasState
- Defined in:
- lib/polisher/gem_state.rb
Instance Method Summary collapse
- #distgit ⇒ Object
- #distgit_branches ⇒ Object
- #distgit_state(args = {}) ⇒ Object
- #distgit_versions ⇒ Object
- #koji_state(args = {}) ⇒ Object
- #koji_tags ⇒ Object
-
#state(args = {}) ⇒ Object
Return the ‘state’ of the gem as inferred by the targets which there are versions for.
Instance Method Details
#distgit ⇒ Object
27 28 29 |
# File 'lib/polisher/gem_state.rb', line 27 def distgit @distgit ||= Git::Pkg.new :name => name end |
#distgit_branches ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/polisher/gem_state.rb', line 31 def distgit_branches = [] .each do |tag, version| tag = TagMapper.map(tag) << tag unless tag.nil? end .empty? ? distgit.valid_branches : end |
#distgit_state(args = {}) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/polisher/gem_state.rb', line 49 def distgit_state(args = {}) check_dep = args.key?(:check) begin distgit.clone rescue return :missing_repo end return :missing_branch if distgit.valid_branches.empty? return :missing_spec if distgit_versions.empty? return :available unless check_dep distgit_versions.each do |version| return :available if args[:check].match?(name, version) end return :missing end |
#distgit_versions ⇒ Object
42 43 44 45 46 47 |
# File 'lib/polisher/gem_state.rb', line 42 def distgit_versions distgit_branches.collect do |branch| distgit.fetch branch distgit.spec.version if distgit.spec? end.compact end |
#koji_state(args = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/polisher/gem_state.rb', line 14 def koji_state(args = {}) check_dep = args.key?(:check) return :missing if .empty? return :available unless check_dep .each do |tag, version| return :available if !version.nil? && args[:check].match?(name, version) end return :missing end |
#koji_tags ⇒ Object
10 11 12 |
# File 'lib/polisher/gem_state.rb', line 10 def Koji.tagged_version_for(name) end |
#state(args = {}) ⇒ Object
Return the ‘state’ of the gem as inferred by the targets which there are versions for.
If optional :check argument is specified, version analysis will be restricted to targets satisfying the specified gem dependency requirements
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/polisher/gem_state.rb', line 75 def state(args = {}) return :available if koji_state(args) == :available state = distgit_state(args) return :needs_repo if state == :missing_repo return :needs_branch if state == :missing_branch return :needs_spec if state == :missing_spec return :needs_build if state == :available return :needs_update end |