diff --git a/lib/pod/command/release.rb b/lib/pod/command/release.rb index d0d62c6..3513f59 100644 --- a/lib/pod/command/release.rb +++ b/lib/pod/command/release.rb @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/lib/version.rb b/lib/version.rb index d1b6ca6..a447691 100644 --- a/lib/version.rb +++ b/lib/version.rb @@ -1,3 +1,3 @@ module CocoapodRelease - VERSION = "0.3.1" + VERSION = "0.3.2" end