Class: Pod::Command::Spec
- Inherits:
-
Pod::Command
- Object
- Pod::Command
- Pod::Command::Spec
- Defined in:
- lib/cocoapods/command/spec.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(argv) ⇒ Spec
constructor
A new instance of Spec.
- #lint ⇒ Object
- #run ⇒ Object
Methods inherited from Pod::Command
Methods included from Pod::Config::Mixin
Constructor Details
#initialize(argv) ⇒ Spec
Returns a new instance of Spec.
17 18 19 20 21 22 23 24 |
# File 'lib/cocoapods/command/spec.rb', line 17 def initialize(argv) args = argv.arguments unless (args[0] == 'create' && args.size == 2) || (args[0] == 'lint' && args.size <= 2) super end @action, @name = args.first(2) end |
Class Method Details
.banner ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/cocoapods/command/spec.rb', line 4 def self. %{Managing PodSpec files: $ pod spec create NAME Creates a PodSpec, in the current working dir, called `NAME.podspec'. $ pod spec lint NAME.podspec Validates `NAME.podspec'. In case `NAME.podspec' is omitted, it defaults to `*.podspec' in the current working dir.} end |
Instance Method Details
#create ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/cocoapods/command/spec.rb', line 30 def create = `git config --get user.name`.strip email = `git config --get user.email`.strip spec = " Pod::Spec.new do |s|\n s.name = '\#{@name}'\n s.version = '1.0.0'\n s.license = 'MIT'\n s.summary = 'A short description of \#{@name}.'\n s.homepage = 'http://example.com/\#{@name}'\n s.author = { '\#{author}' => '\#{email}' }\n s.source = { :git => 'http://example.com/\#{@name}.git', :tag => '1.0.0' }\n\n s.description = 'An optional longer description of \#{@name}.'\n\n # A list of file patterns. If the pattern is a directory then the path will\n # automatically have '*.{h,m,mm,c,cpp}' appended.\n s.source_files = 'Classes', 'Classes/**/*.{h,m}'\n\n s.framework = 'SomeRequiredFramework'\n\n s.dependency 'SomeLibraryThat\#{@name}DependsOn', '>= 1.0.0'\n end\n SPEC\n (Pathname.pwd + \"\#{@name}.podspec\").open('w') { |f| f << spec }\nend\n".gsub(/^ /, '') |
#lint ⇒ Object
57 58 59 60 61 |
# File 'lib/cocoapods/command/spec.rb', line 57 def lint file = @name ? Pathname.new(@name) : Pathname.pwd.glob('*.podspec').first spec = Specification.from_file(file) spec.validate! end |
#run ⇒ Object
26 27 28 |
# File 'lib/cocoapods/command/spec.rb', line 26 def run send @action end |