Class: Pod::Command::Repo::Add
- Inherits:
-
Pod::Command::Repo
- Object
- CLAide::Command
- Pod::Command
- Pod::Command::Repo
- Pod::Command::Repo::Add
- Defined in:
- lib/cocoapods/command/repo.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Add
constructor
A new instance of Add.
- #run ⇒ Object
- #validate! ⇒ Object
Methods inherited from Pod::Command::Repo
#branch_name, #branch_remote_name, #dir, #url_of_git_repo
Methods included from Executable
Methods inherited from Pod::Command
parse, report_error, run, verify_git_version!
Methods included from Pod::Config::Mixin
Constructor Details
#initialize(argv) ⇒ Add
Returns a new instance of Add.
34 35 36 37 38 |
# File 'lib/cocoapods/command/repo.rb', line 34 def initialize(argv) @shallow = argv.flag?('shallow', false) @name, @url, @branch = argv.shift_argument, argv.shift_argument, argv.shift_argument super end |
Class Method Details
.options ⇒ Object
28 29 30 31 32 |
# File 'lib/cocoapods/command/repo.rb', line 28 def self. [ ['--shallow', 'Create a shallow clone (fast clone, but no push capabilities)'], ].concat(super) end |
Instance Method Details
#run ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/cocoapods/command/repo.rb', line 47 def run prefix = @shallow ? 'Creating shallow clone of' : 'Cloning' UI.section("#{prefix} spec repo `#{@name}` from `#{@url}`#{" (branch `#{@branch}`)" if @branch}") do config.repos_dir.mkpath Dir.chdir(config.repos_dir) do command = "clone '#{@url}' #{@name}" command << ' --depth=1' if @shallow git!(command) end Dir.chdir(dir) { git!("checkout #{@branch}") } if @branch SourcesManager.check_version_information(dir) end end |
#validate! ⇒ Object
40 41 42 43 44 45 |
# File 'lib/cocoapods/command/repo.rb', line 40 def validate! super unless @name && @url help! 'Adding a repo needs a `NAME` and a `URL`.' end end |