Method: Pod::Command::Spec::Create#run

Defined in:
lib/cocoapods/command/spec/create.rb

#runObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/cocoapods/command/spec/create.rb', line 28

def run
  if repo_id_match = (@url || @name_or_url).match(%r{github.com/([^/\.]*\/[^/\.]*)\.*})
    repo_id = repo_id_match[1]
    data = github_data_for_template(repo_id)
    data[:name] = @name_or_url if @url
    UI.puts semantic_versioning_notice(repo_id, data[:name]) if data[:version] == '0.0.1'
  else
    data = default_data_for_template(@name_or_url)
  end

  spec = spec_template(data)
  (Pathname.pwd + "#{data[:name]}.podspec").open('w') { |f| f << spec }
  UI.puts "\nSpecification created at #{data[:name]}.podspec".green
end