Class: Pod::Command::RepoSvn::Push
- Inherits:
-
Pod::Command::RepoSvn
- Object
- Pod::Command
- Pod::Command::RepoSvn
- Pod::Command::RepoSvn::Push
- Defined in:
- lib/pod/command/repo_svn.rb
Overview
———————————————————————–#
Pushes a podspec to the specified repo
Most of this was taken directly from the CocoaPods ‘push` command
Class Method Summary collapse
Instance Method Summary collapse
- #add_specs_to_repo ⇒ Object
-
#initialize(argv) ⇒ Push
constructor
A new instance of Push.
- #run ⇒ Object
-
#update_repo ⇒ void
Updates the git repo against the remote.
- #validate! ⇒ Object
Methods inherited from Pod::Command::RepoSvn
Constructor Details
#initialize(argv) ⇒ Push
Returns a new instance of Push.
308 309 310 311 312 313 |
# File 'lib/pod/command/repo_svn.rb', line 308 def initialize(argv) @local_only = argv.flag?('local-only') @repo = argv.shift_argument @podspec = argv.shift_argument super end |
Class Method Details
.options ⇒ Object
304 305 306 |
# File 'lib/pod/command/repo_svn.rb', line 304 def self. [['--local-only', 'Does not perform the step of committing changes to REPO']].concat(super) end |
Instance Method Details
#add_specs_to_repo ⇒ Object
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
# File 'lib/pod/command/repo_svn.rb', line 334 def add_specs_to_repo UI.puts "\nAdding the #{'spec'.pluralize(podspec_files.count)} to the `#{@repo}' repo\n".yellow 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? = "[Fix] #{spec}" elsif Pathname.new(File.join(repo_dir, spec.name)).exist? = "[Update] #{spec}" else = "[Add] #{spec}" end FileUtils.mkdir_p(output_path) FileUtils.cp(spec_file, output_path) if !@local_only Dir.chdir(repo_dir) do # only commit if modified UI.puts "Committing changes" UI.puts `svn add #{spec.name} 2> /dev/null` UI.puts `svn commit -m "#{}"` end end end end |
#run ⇒ Object
320 321 322 323 |
# File 'lib/pod/command/repo_svn.rb', line 320 def run update_repo add_specs_to_repo end |
#update_repo ⇒ void
This method returns an undefined value.
Updates the git repo against the remote.
329 330 331 332 |
# File 'lib/pod/command/repo_svn.rb', line 329 def update_repo UI.puts "Updating the `#{@repo}' repo\n".yellow Dir.chdir(repo_dir) { UI.puts `svn update .` } end |
#validate! ⇒ Object
315 316 317 318 |
# File 'lib/pod/command/repo_svn.rb', line 315 def validate! super help! 'A spec-repo name is required.' unless @repo end |