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
a75716f9
Unverified
Commit
a75716f9
authored
May 15, 2016
by
Nate West
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPC] Separate IPC subcommands
parent
474ce948
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
194 additions
and
178 deletions
+194
-178
command.rb
lib/cocoapods/command.rb
+1
-1
inter_process_communication.rb
lib/cocoapods/command/inter_process_communication.rb
+0
-177
ipc.rb
lib/cocoapods/command/ipc.rb
+18
-0
list.rb
lib/cocoapods/command/ipc/list.rb
+40
-0
podfile.rb
lib/cocoapods/command/ipc/podfile.rb
+31
-0
repl.rb
lib/cocoapods/command/ipc/repl.rb
+51
-0
spec.rb
lib/cocoapods/command/ipc/spec.rb
+29
-0
update_search_index.rb
lib/cocoapods/command/ipc/update_search_index.rb
+24
-0
No files found.
lib/cocoapods/command.rb
View file @
a75716f9
...
@@ -22,7 +22,7 @@ module Pod
...
@@ -22,7 +22,7 @@ module Pod
require
'cocoapods/command/env'
require
'cocoapods/command/env'
require
'cocoapods/command/init'
require
'cocoapods/command/init'
require
'cocoapods/command/install'
require
'cocoapods/command/install'
require
'cocoapods/command/i
nter_process_communication
'
require
'cocoapods/command/i
pc
'
require
'cocoapods/command/lib'
require
'cocoapods/command/lib'
require
'cocoapods/command/list'
require
'cocoapods/command/list'
require
'cocoapods/command/outdated'
require
'cocoapods/command/outdated'
...
...
lib/cocoapods/command/inter_process_communication.rb
deleted
100644 → 0
View file @
474ce948
module
Pod
class
Command
class
IPC
<
Command
self
.
abstract_command
=
true
self
.
summary
=
'Inter-process communication'
def
output_pipe
STDOUT
end
#-----------------------------------------------------------------------#
class
Spec
<
IPC
self
.
summary
=
'Converts a podspec to JSON'
self
.
description
=
'Converts a podspec to JSON and prints it to STDOUT.'
self
.
arguments
=
[
CLAide
::
Argument
.
new
(
'PATH'
,
true
),
]
def
initialize
(
argv
)
@path
=
argv
.
shift_argument
super
end
def
validate!
super
help!
'A specification path is required.'
unless
@path
end
def
run
require
'json'
spec
=
Specification
.
from_file
(
@path
)
output_pipe
.
puts
(
spec
.
to_pretty_json
)
end
end
#-----------------------------------------------------------------------#
class
Podfile
<
IPC
include
ProjectDirectory
self
.
summary
=
'Converts a Podfile to YAML'
self
.
description
=
'Converts a Podfile to YAML and prints it to STDOUT.'
self
.
arguments
=
[
CLAide
::
Argument
.
new
(
'PATH'
,
true
),
]
def
initialize
(
argv
)
@path
=
argv
.
shift_argument
super
end
def
validate!
super
help!
'A Podfile path is required.'
unless
@path
end
def
run
require
'yaml'
podfile
=
Pod
::
Podfile
.
from_file
(
@path
)
output_pipe
.
puts
podfile
.
to_yaml
end
end
#-----------------------------------------------------------------------#
class
List
<
IPC
self
.
summary
=
'Lists the specifications known to CocoaPods'
self
.
description
=
<<-
DESC
Prints to STDOUT a YAML dictionary where the keys are the name of the
specifications and each corresponding value is a dictionary with
the following keys:
- defined_in_file
- version
- authors
- summary
- description
- platforms
DESC
def
run
require
'yaml'
sets
=
config
.
sources_manager
.
aggregate
.
all_sets
result
=
{}
sets
.
each
do
|
set
|
begin
spec
=
set
.
specification
result
[
spec
.
name
]
=
{
'authors'
=>
spec
.
authors
.
keys
,
'summary'
=>
spec
.
summary
,
'description'
=>
spec
.
description
,
'platforms'
=>
spec
.
available_platforms
.
map
{
|
p
|
p
.
name
.
to_s
},
}
rescue
DSLError
next
end
end
output_pipe
.
puts
result
.
to_yaml
end
end
#-----------------------------------------------------------------------#
class
UpdateSearchIndex
<
IPC
self
.
summary
=
'Updates the search index'
self
.
description
=
<<-
DESC
Updates the search index and prints its path to standard output.
The search index is a YAML encoded dictionary where the keys
are the names of the Pods and the values are a dictionary containing
the following information:
- version
- summary
- description
- authors
DESC
def
run
config
.
sources_manager
.
updated_search_index
output_pipe
.
puts
(
config
.
sources_manager
.
search_index_path
)
end
end
#-----------------------------------------------------------------------#
class
Repl
<
IPC
include
ProjectDirectory
END_OF_OUTPUT_SIGNAL
=
"
\n\r
"
self
.
summary
=
'The repl listens to commands on standard input'
self
.
description
=
<<-
DESC
The repl listens to commands on standard input and prints their
result to standard output.
It accepts all the other ipc subcommands. The repl will signal the
end of output with the the ASCII CR+LF `
\\
n
\\
r`.
DESC
def
run
print_version
signal_end_of_output
listen
end
def
print_version
output_pipe
.
puts
"version: '
#{
Pod
::
VERSION
}
'"
end
def
signal_end_of_output
output_pipe
.
puts
(
END_OF_OUTPUT_SIGNAL
)
STDOUT
.
flush
end
def
listen
while
repl_command
=
STDIN
.
gets
execute_repl_command
(
repl_command
)
end
end
def
execute_repl_command
(
repl_command
)
if
(
repl_command
!=
"
\n
"
)
repl_commands
=
repl_command
.
split
subcommand
=
repl_commands
.
shift
.
capitalize
arguments
=
repl_commands
subcommand_class
=
Pod
::
Command
::
IPC
.
const_get
(
subcommand
)
subcommand_class
.
new
(
CLAide
::
ARGV
.
new
(
arguments
)).
run
signal_end_of_output
end
end
end
#-----------------------------------------------------------------------#
end
end
end
lib/cocoapods/command/ipc.rb
0 → 100644
View file @
a75716f9
require
'cocoapods/command/ipc/list'
require
'cocoapods/command/ipc/podfile'
require
'cocoapods/command/ipc/repl'
require
'cocoapods/command/ipc/spec'
require
'cocoapods/command/ipc/update_search_index'
module
Pod
class
Command
class
IPC
<
Command
self
.
abstract_command
=
true
self
.
summary
=
'Inter-process communication'
def
output_pipe
STDOUT
end
end
end
end
lib/cocoapods/command/ipc/list.rb
0 → 100644
View file @
a75716f9
module
Pod
class
Command
class
IPC
<
Command
class
List
<
IPC
self
.
summary
=
'Lists the specifications known to CocoaPods'
self
.
description
=
<<-
DESC
Prints to STDOUT a YAML dictionary where the keys are the name of the
specifications and each corresponding value is a dictionary with
the following keys:
- defined_in_file
- version
- authors
- summary
- description
- platforms
DESC
def
run
require
'yaml'
sets
=
config
.
sources_manager
.
aggregate
.
all_sets
result
=
{}
sets
.
each
do
|
set
|
begin
spec
=
set
.
specification
result
[
spec
.
name
]
=
{
'authors'
=>
spec
.
authors
.
keys
,
'summary'
=>
spec
.
summary
,
'description'
=>
spec
.
description
,
'platforms'
=>
spec
.
available_platforms
.
map
{
|
p
|
p
.
name
.
to_s
},
}
rescue
DSLError
next
end
end
output_pipe
.
puts
result
.
to_yaml
end
end
end
end
end
lib/cocoapods/command/ipc/podfile.rb
0 → 100644
View file @
a75716f9
module
Pod
class
Command
class
IPC
<
Command
class
Podfile
<
IPC
include
ProjectDirectory
self
.
summary
=
'Converts a Podfile to YAML'
self
.
description
=
'Converts a Podfile to YAML and prints it to STDOUT.'
self
.
arguments
=
[
CLAide
::
Argument
.
new
(
'PATH'
,
true
),
]
def
initialize
(
argv
)
@path
=
argv
.
shift_argument
super
end
def
validate!
super
help!
'A Podfile path is required.'
unless
@path
end
def
run
require
'yaml'
podfile
=
Pod
::
Podfile
.
from_file
(
@path
)
output_pipe
.
puts
podfile
.
to_yaml
end
end
end
end
end
lib/cocoapods/command/ipc/repl.rb
0 → 100644
View file @
a75716f9
module
Pod
class
Command
class
IPC
<
Command
class
Repl
<
IPC
include
ProjectDirectory
END_OF_OUTPUT_SIGNAL
=
"
\n\r
"
self
.
summary
=
'The repl listens to commands on standard input'
self
.
description
=
<<-
DESC
The repl listens to commands on standard input and prints their
result to standard output.
It accepts all the other ipc subcommands. The repl will signal the
end of output with the the ASCII CR+LF `
\\
n
\\
r`.
DESC
def
run
print_version
signal_end_of_output
listen
end
def
print_version
output_pipe
.
puts
"version: '
#{
Pod
::
VERSION
}
'"
end
def
signal_end_of_output
output_pipe
.
puts
(
END_OF_OUTPUT_SIGNAL
)
STDOUT
.
flush
end
def
listen
while
repl_command
=
STDIN
.
gets
execute_repl_command
(
repl_command
)
end
end
def
execute_repl_command
(
repl_command
)
if
(
repl_command
!=
"
\n
"
)
repl_commands
=
repl_command
.
split
subcommand
=
repl_commands
.
shift
.
capitalize
arguments
=
repl_commands
subcommand_class
=
Pod
::
Command
::
IPC
.
const_get
(
subcommand
)
subcommand_class
.
new
(
CLAide
::
ARGV
.
new
(
arguments
)).
run
signal_end_of_output
end
end
end
end
end
end
lib/cocoapods/command/ipc/spec.rb
0 → 100644
View file @
a75716f9
module
Pod
class
Command
class
IPC
<
Command
class
Spec
<
IPC
self
.
summary
=
'Converts a podspec to JSON'
self
.
description
=
'Converts a podspec to JSON and prints it to STDOUT.'
self
.
arguments
=
[
CLAide
::
Argument
.
new
(
'PATH'
,
true
),
]
def
initialize
(
argv
)
@path
=
argv
.
shift_argument
super
end
def
validate!
super
help!
'A specification path is required.'
unless
@path
end
def
run
require
'json'
spec
=
Specification
.
from_file
(
@path
)
output_pipe
.
puts
(
spec
.
to_pretty_json
)
end
end
end
end
end
lib/cocoapods/command/ipc/update_search_index.rb
0 → 100644
View file @
a75716f9
module
Pod
class
Command
class
IPC
<
Command
class
UpdateSearchIndex
<
IPC
self
.
summary
=
'Updates the search index'
self
.
description
=
<<-
DESC
Updates the search index and prints its path to standard output.
The search index is a YAML encoded dictionary where the keys
are the names of the Pods and the values are a dictionary containing
the following information:
- version
- summary
- description
- authors
DESC
def
run
config
.
sources_manager
.
updated_search_index
output_pipe
.
puts
(
config
.
sources_manager
.
search_index_path
)
end
end
end
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