Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions lib/pod/command/release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ def execute(command, options = {})

def self.options
[
['--skip-lint', 'Skip linting'],
['--allow-warnings', 'Allows push even if there are lint warnings'],
['--carthage', 'Validates project for carthage deployment'],
['--reverse', 'Validates and pushes podspecs in reverse order'],
['--verbose', 'Show more debugging information'],
].concat(super.reject { |option, _| option == '--silent' })
end

Expand All @@ -28,6 +30,9 @@ def initialize(argv)
@repo = argv.shift_argument unless argv.arguments.empty?
@carthage = argv.flag?('carthage')
@reverse = argv.flag?('reverse')
@verbose = argv.flag?('verbose') ? "--verbose" : ""
@use_libraries = argv.flag?('use-libraries') ? "--use-libraries" : ""
@skip_lint = argv.flag?('skip-lint')
super
end

Expand All @@ -37,18 +42,26 @@ def run

specs = specs.reverse if @reverse

sources_manager = if defined?(Pod::SourcesManager)
Pod::SourcesManager
else
config.sources_manager
end

puts "#{"==>".magenta} updating repositories"
SourcesManager.update
sources_manager.update

for spec in specs
name = spec.gsub(".podspec", "")
version = Specification.from_file(spec).version
name = Specification.from_file(spec).name

sources = SourcesManager.all.select { |r| r.name == "master" || r.url.start_with?("git") }
#sources = sources_manager.all.select { |r| r.name == "master" || r.url.start_with?("git") }
sources = sources_manager.all
sources = sources.select { |s| s.name == @repo } if @repo

pushed_sources = []
available_sources = SourcesManager.all.map { |r| r.name }
available_sources = sources_manager.all.map { |r| r.name }

abort "Please run #{"pod install".green} to continue" if sources.count == 0
for source in sources
Expand Down Expand Up @@ -81,22 +94,25 @@ def run
abort
end

# verify lib
execute "pod lib lint #{spec} #{@allow_warnings} --sources=#{available_sources.join(',')}"
execute "pod lib lint #{spec} --use-libraries #{@allow_warnings} --sources=#{available_sources.join(',')}"
if !@skip_lint
# verify lib
execute "pod lib lint #{spec} #{@use_libraries} #{@allow_warnings} --sources=#{available_sources.join(',')}"
end

if @carthage
execute "carthage build --no-skip-current"
end

# TODO: create git tag for current version
# Create git tag for current version
puts "#{"==>".magenta} Tagging repository with version #{"#{version}".green}"

unless system("git tag | grep #{version} > /dev/null")
execute "git add -A && git commit -m \"Releases #{version}.\"", :optional => true
execute "git add -A && git commit -m \"Release #{version}\"", :optional => true
execute "git tag #{version}"
execute "git push && git push --tags"
end

repo = @repo || pushed_sources.first.name
repo = @repo || pushed_sources.first
if repo == "master"
execute "pod trunk push #{spec} #{@allow_warnings}"
else
Expand Down
2 changes: 1 addition & 1 deletion lib/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module CocoapodRelease
VERSION = "0.3.1"
VERSION = "0.3.2"
end