class Pod::Command::Repo::Bump
Public Class Methods
new(argv)
click to toggle source
Calls superclass method
# File lib/pod/command/bump-version.rb, line 24 def initialize(argv) @tag_version = argv.shift_argument super end
options()
click to toggle source
Calls superclass method
# File lib/pod/command/bump-version.rb, line 20 def self.options [].concat(super) end
Public Instance Methods
modify_podspec(path, version)
click to toggle source
# File lib/pod/command/bump-version.rb, line 50 def modify_podspec(path, version) unless version =~ /^(\d+\.)?(\d+\.)?(\*|\d+)$/ UI.puts "Invalid version #{version}" return end unless File.exist?path UI.puts "Podspec file not found" return end File.open(path, "r+") do |f| s = "" f.each_line do |line| if line.to_s =~ /s\.version\s*=\s*'(\d+\.)?(\d+\.)?(\*|\d+)'/ line = line.sub(/(\d+\.)?(\d+\.)?(\*|\d+)/) do |match| version.to_s end end if line.to_s =~ /s\.version\s*=\s*"(\d+\.)?(\d+\.)?(\*|\d+)"/ line = line.sub(/(\d+\.)?(\d+\.)?(\*|\d+)/) do |match| version.to_s end end s += line end File.open(path, "w+") do |f| f.write(s) end end end
podspec_files()
click to toggle source
@return [Array<Pathname>] The path of the specifications to push.
def podspec_files
if @podspec path = Pathname(@podspec) raise Informative, "Couldn't find #{@podspec}" unless path.exist? [path] else files = Pathname.glob('**/*.podspec') raise Informative, "Couldn't find any podspec files in current directory" if files.empty? files end
end
# File lib/pod/command/bump-version.rb, line 94 def podspec_files files = Pathname.glob('**/*.podspec') raise Informative, "Couldn't find any podspec files in current directory" if files.empty? files end
run()
click to toggle source
# File lib/pod/command/bump-version.rb, line 39 def run podspec_files.each do |spec_file| spec = Pod::Specification.from_file(spec_file) if @tag_version.to_s != spec.version.to_s modify_podspec(spec_file, @tag_version) else UI.puts " - [No change] #{spec.name}: #{@tag_version}" end end end
validate!()
click to toggle source
Calls superclass method
# File lib/pod/command/bump-version.rb, line 29 def validate! super help! 'A bump version is required.' unless @tag_version unless @tag_version raise Informative, "A bump version is required." \ '`pod repo bump 0.1.0`.' end end