Commit b08b005e authored by Fabio Pelosin's avatar Fabio Pelosin

Experimental support for bleeding version for git repos.

parent d4f319bc
...@@ -6,7 +6,8 @@ require 'open-uri' ...@@ -6,7 +6,8 @@ require 'open-uri'
module Pod module Pod
class Dependency < Gem::Dependency class Dependency < Gem::Dependency
attr_reader :external_source attr_reader :external_source, :bleeding
alias :bleeding? :bleeding
attr_accessor :specification attr_accessor :specification
def initialize(*name_and_version_requirements, &block) def initialize(*name_and_version_requirements, &block)
...@@ -18,6 +19,13 @@ module Pod ...@@ -18,6 +19,13 @@ module Pod
elsif !name_and_version_requirements.empty? && block.nil? elsif !name_and_version_requirements.empty? && block.nil?
if name_and_version_requirements.last.is_a?(Hash) if name_and_version_requirements.last.is_a?(Hash)
@external_source = ExternalSources.from_params(name_and_version_requirements[0].split('/').first, name_and_version_requirements.pop) @external_source = ExternalSources.from_params(name_and_version_requirements[0].split('/').first, name_and_version_requirements.pop)
elsif name_and_version_requirements.last.is_a?(Symbol)
symbol = name_and_version_requirements.pop
if symbol == :bleeding
@bleeding = true
else
raise Informative, "Unrecognized symbol `#{symbol}' for dependency `#{name_and_version_requirements[0]}'"
end
end end
super(*name_and_version_requirements) super(*name_and_version_requirements)
...@@ -68,7 +76,10 @@ module Pod ...@@ -68,7 +76,10 @@ module Pod
elsif @version_requirements != Gem::Requirement.default elsif @version_requirements != Gem::Requirement.default
version << @version_requirements.to_s version << @version_requirements.to_s
end end
version.empty? ? @name : "#{@name} (#{version})" result = @name
result = result + " (#{version})" unless version.empty?
result = result + " [BLEEDING]" if bleeding?
result
end end
def specification_from_sandbox(sandbox, platform) def specification_from_sandbox(sandbox, platform)
......
...@@ -65,6 +65,7 @@ module Pod ...@@ -65,6 +65,7 @@ module Pod
@loaded_specs << spec.name @loaded_specs << spec.name
@specs[spec.name] = spec @specs[spec.name] = spec
spec.activate_platform(target_definition.platform) spec.activate_platform(target_definition.platform)
spec.bleeding = dependency.bleeding?
# And recursively load the dependencies of the spec. # And recursively load the dependencies of the spec.
find_dependency_specs(spec, spec.dependencies, target_definition) if spec.dependencies find_dependency_specs(spec, spec.dependencies, target_definition) if spec.dependencies
end end
......
...@@ -187,8 +187,14 @@ module Pod ...@@ -187,8 +187,14 @@ module Pod
### Top level attributes. These attributes represent the unique features of pod and can't be specified by subspecs. ### Top level attributes. These attributes represent the unique features of pod and can't be specified by subspecs.
# @!method bleeding
#
# @return [BOOL] returns wheter the specification is in bleeding mode.
#
top_attr_accessor :bleeding
alias_method :bleeding?, :bleeding
top_attr_accessor :defined_in_file top_attr_accessor :defined_in_file
top_attr_accessor :source
top_attr_accessor :homepage top_attr_accessor :homepage
top_attr_accessor :summary top_attr_accessor :summary
top_attr_accessor :documentation top_attr_accessor :documentation
...@@ -198,6 +204,23 @@ module Pod ...@@ -198,6 +204,23 @@ module Pod
top_attr_reader :description, lambda { |instance, ivar| ivar || instance.summary } top_attr_reader :description, lambda { |instance, ivar| ivar || instance.summary }
top_attr_writer :description, lambda { |d| d.strip_heredoc } top_attr_writer :description, lambda { |d| d.strip_heredoc }
# @!method source
#
# @abstract
# Returns the source of the pod. If the specification is set in bleeding mode
# and the source is a git repository the head of master will be returned.
#
top_attr_writer :source
top_attr_reader :source, lambda { |instance, ivar|
if instance.bleeding?
raise Informative, 'Bleeding is supported only for git repos' unless ivar[:git]
{ :git => ivar[:git] }
else
ivar
end
}
# @!method license # @!method license
# #
# @abstract # @abstract
...@@ -439,7 +462,9 @@ module Pod ...@@ -439,7 +462,9 @@ module Pod
end end
def to_s def to_s
"#{name} (#{version})" result = "#{name} (#{version})"
result << " [BLEEDING]" if bleeding?
result
end end
def inspect def inspect
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment