Commit d4eac5e9 authored by Bart Jacobs's avatar Bart Jacobs

[Repo Command] Add ability to add custom commit message when pushing spec

parent e547edd6
......@@ -8,6 +8,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements
* Add the ability to add a custom commit message when pushing a spec.
[Bart Jacobs](https://github.com/bartjacobs)
[#4583](https://github.com/CocoaPods/CocoaPods/issues/4583)
* Added support for `pod env` to print the pod environment without having to crash.
[Hemal Shah](https://github.com/hemal)
[#3660](https://github.com/CocoaPods/CocoaPods/issues/3660)
......
require 'tempfile'
require 'fileutils'
require 'active_support/core_ext/string/inflections'
......@@ -28,6 +29,7 @@ module Pod
'Multiple sources must be comma-delimited.'],
['--local-only', 'Does not perform the step of pushing REPO to its remote'],
['--no-private', 'Lint includes checks that apply only to public repos'],
['--message', 'Add custom commit message']
].concat(super)
end
......@@ -39,6 +41,7 @@ module Pod
@podspec = argv.shift_argument
@use_frameworks = !argv.flag?('use-libraries')
@private = argv.flag?('private', true)
@message = argv.flag?('message')
super
end
......@@ -48,6 +51,7 @@ module Pod
end
def run
open_editor if @message
check_if_master_repo
validate_podspec_files
check_repo_status
......@@ -65,6 +69,21 @@ module Pod
extend Executable
executable :git
# Open default editor to allow users to enter commit message
#
def open_editor
file = Tempfile.new('cocoapods')
File.chmod(0777, file.path)
file.close
unless ENV['EDITOR'].nil?
system("#{ENV['EDITOR']} #{file.path}")
@message = File.read file.path
else
@message = nil
end
end
# Temporary check to ensure that users do not push accidentally private
# specs to the master repo.
#
......@@ -143,7 +162,9 @@ module Pod
podspec_files.each do |spec_file|
spec = Pod::Specification.from_file(spec_file)
output_path = File.join(repo_dir, spec.name, spec.version.to_s)
if Pathname.new(output_path).exist?
if @message && !@message.empty?
message = @message
elsif Pathname.new(output_path).exist?
message = "[Fix] #{spec}"
elsif Pathname.new(File.join(repo_dir, spec.name)).exist?
message = "[Update] #{spec}"
......
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