Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
9ba5654d
Commit
9ba5654d
authored
Sep 19, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a `spec create NAME` command which creates a stub file.
parent
11a8a32a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
9 deletions
+74
-9
command.rb
lib/cocoapods/command.rb
+1
-0
spec.rb
lib/cocoapods/command/spec.rb
+55
-8
specification.rb
lib/cocoapods/specification.rb
+1
-1
command_spec.rb
spec/functional/command_spec.rb
+17
-0
No files found.
lib/cocoapods/command.rb
View file @
9ba5654d
...
@@ -89,3 +89,4 @@ module Pod
...
@@ -89,3 +89,4 @@ module Pod
end
end
end
end
end
end
lib/cocoapods/command/spec.rb
View file @
9ba5654d
...
@@ -7,22 +7,69 @@ module Pod
...
@@ -7,22 +7,69 @@ module Pod
$ pod help spec
$ pod help spec
pod spec create NAME
pod spec create NAME
Creates a directory for your new pod, named `NAME', with a default
directory structure and accompanying `NAME.podspec'.
pod spec init NAME
Creates a PodSpec, in the current working dir, called `NAME.podspec'.
Creates a PodSpec, in the current working dir, called `NAME.podspec'.
Use this for existing libraries.
Use this for existing libraries.
pod spec lint NAME
pod spec lint NAME
.podspec
Validates `NAME.podspec'
from a local spec-repo. In case `NAME' i
s
Validates `NAME.podspec'
. In case `NAME.podspec' is omitted, it default
s
omitted, it defaults to the PodSpec
in the current working dir.
to `*.podspec'
in the current working dir.
pod spec push REMOTE
pod spec push
NAME
REMOTE
Validates `NAME.podspec' in the current working dir, copies it to the
Validates `NAME.podspec' in the current working dir, copies it to the
local clone of the `REMOTE' spec-repo, and pushes it to the `REMOTE'
local clone of the `REMOTE' spec-repo, and pushes it to the `REMOTE'
spec-repo. In case `REMOTE' is omitted, it defaults to `master'.}
spec-repo. In case `REMOTE' is omitted, it defaults to `master'.}
end
end
def
initialize
(
argv
)
super
unless
argv
.
arguments
.
size
==
2
case
argv
.
arguments
.
first
when
'create'
,
'lint'
@action
,
@name
=
argv
.
arguments
.
first
(
2
)
when
'push'
@action
,
@name
,
@remote
=
argv
.
arguments
.
first
(
3
)
else
super
end
end
def
run
send
@action
end
def
create
author
=
`git config --get user.name`
.
strip
email
=
`git config --get user.email`
.
strip
spec
=
<<-
SPEC
.
gsub
(
/^ /
,
''
)
Pod::Spec.new do
name '
#{
@name
}
'
version '1.0.0'
summary 'A short description of
#{
@name
}
.'
homepage 'http://example.com/
#{
@name
}
'
author '
#{
author
}
' => '
#{
email
}
'
source :git => 'http://example.com/
#{
@name
}
.git',
:tag => '1.0.0'
description 'An optional longer description of
#{
@name
}
.'
# A list of file patterns. If the pattern is a directory then the path will
# automatically have '*.{h,m,mm,c,cpp' appended.
source_files 'Classes', 'Classes/**/*.{h,m}'
xcconfig 'OTHER_LDFLAGS' => '-framework SomeRequiredFramework'
end
SPEC
(
Pathname
.
pwd
+
"
#{
@name
}
.podspec"
).
open
(
'w'
)
{
|
f
|
f
<<
spec
}
end
#def lint
#file = @name ? Pathname.new(@name) : config.project_podfile
#spec = Specification.from_podspec(file)
#spec.validate!
#end
#def push
#end
end
end
end
end
end
end
lib/cocoapods/specification.rb
View file @
9ba5654d
...
@@ -45,7 +45,7 @@ module Pod
...
@@ -45,7 +45,7 @@ module Pod
authors
=
list
.
last
.
is_a?
(
Hash
)
?
list
.
pop
:
{}
authors
=
list
.
last
.
is_a?
(
Hash
)
?
list
.
pop
:
{}
list
.
each
{
|
name
|
authors
[
name
]
=
nil
}
list
.
each
{
|
name
|
authors
[
name
]
=
nil
}
end
end
@authors
=
authors
||
list
@authors
=
authors
||
list
.
first
end
end
alias_method
:author
,
:authors
alias_method
:author
,
:authors
...
...
spec/functional/command_spec.rb
View file @
9ba5654d
...
@@ -38,6 +38,23 @@ describe "Pod::Command" do
...
@@ -38,6 +38,23 @@ describe "Pod::Command" do
(
repo3
.
dir
+
'README'
).
read
.
should
.
include
'Added!'
(
repo3
.
dir
+
'README'
).
read
.
should
.
include
'Added!'
end
end
it
"creates a new podspec stub file"
do
Dir
.
chdir
(
temporary_directory
)
do
command
(
'spec'
,
'create'
,
'Bananas'
)
end
path
=
temporary_directory
+
'Bananas.podspec'
spec
=
Pod
::
Specification
.
from_podspec
(
path
)
spec
.
read
(
:name
).
should
==
'Bananas'
spec
.
read
(
:version
).
should
==
Pod
::
Version
.
new
(
'1.0.0'
)
spec
.
read
(
:summary
).
should
==
'A short description of Bananas.'
spec
.
read
(
:homepage
).
should
==
'http://example.com/Bananas'
spec
.
read
(
:authors
).
should
==
{
`git config --get user.name`
.
strip
=>
`git config --get user.email`
.
strip
}
spec
.
read
(
:source
).
should
==
{
:git
=>
'http://example.com/Bananas.git'
,
:tag
=>
'1.0.0'
}
spec
.
read
(
:description
).
should
==
'An optional longer description of Bananas.'
spec
.
read
(
:source_files
).
should
==
[
Pathname
.
new
(
'Classes'
),
Pathname
.
new
(
'Classes/**/*.{h,m}'
)]
spec
.
read
(
:xcconfig
).
should
==
{
'OTHER_LDFLAGS'
=>
'-framework SomeRequiredFramework'
}
end
before
do
before
do
config
.
repos_dir
=
fixture
(
'spec-repos'
)
config
.
repos_dir
=
fixture
(
'spec-repos'
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment