Commit 0197647a authored by Bart Jacobs's avatar Bart Jacobs

Add ability to pass custom commit message as argument

parent 0d927123
...@@ -29,7 +29,8 @@ module Pod ...@@ -29,7 +29,8 @@ module Pod
'Multiple sources must be comma-delimited.'], 'Multiple sources must be comma-delimited.'],
['--local-only', 'Does not perform the step of pushing REPO to its remote'], ['--local-only', 'Does not perform the step of pushing REPO to its remote'],
['--no-private', 'Lint includes checks that apply only to public repos'], ['--no-private', 'Lint includes checks that apply only to public repos'],
['--message', 'Add custom commit message'], ['--commit-message="Fix bug in pod"', 'Add custom commit message. ' \
'Opens default editor if no commit message is specified.'],
].concat(super) ].concat(super)
end end
...@@ -41,7 +42,8 @@ module Pod ...@@ -41,7 +42,8 @@ module Pod
@podspec = argv.shift_argument @podspec = argv.shift_argument
@use_frameworks = !argv.flag?('use-libraries') @use_frameworks = !argv.flag?('use-libraries')
@private = argv.flag?('private', true) @private = argv.flag?('private', true)
@message = argv.flag?('message') @message = argv.option('commit-message')
@commit_message = argv.flag?('commit-message', false)
super super
end end
...@@ -51,7 +53,7 @@ module Pod ...@@ -51,7 +53,7 @@ module Pod
end end
def run def run
open_editor if @message open_editor if @commit_message && @message.nil?
check_if_master_repo check_if_master_repo
validate_podspec_files validate_podspec_files
check_repo_status check_repo_status
...@@ -72,17 +74,15 @@ module Pod ...@@ -72,17 +74,15 @@ module Pod
# Open default editor to allow users to enter commit message # Open default editor to allow users to enter commit message
# #
def open_editor def open_editor
return if ENV['EDITOR'].nil?
file = Tempfile.new('cocoapods') file = Tempfile.new('cocoapods')
File.chmod(0777, file.path) File.chmod(0777, file.path)
file.close file.close
if !ENV['EDITOR'].nil?
@message = nil
else
system("#{ENV['EDITOR']} #{file.path}") system("#{ENV['EDITOR']} #{file.path}")
@message = File.read file.path @message = File.read file.path
end end
end
# Temporary check to ensure that users do not push accidentally private # Temporary check to ensure that users do not push accidentally private
# specs to the master repo. # specs to the master repo.
......
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