Commit 87d76497 authored by Fabio Pelosin's avatar Fabio Pelosin

[Command] Added inter process communication command.

parent 9bee5b81
...@@ -3,22 +3,6 @@ ...@@ -3,22 +3,6 @@
[Core](https://github.com/CocoaPods/Core/master) [Core](https://github.com/CocoaPods/Core/master)
[Xcodeproj](https://github.com/CocoaPods/Xcodeproj/compare/0.4.0...master) [Xcodeproj](https://github.com/CocoaPods/Xcodeproj/compare/0.4.0...master)
###### TODO
- LocalPod should return a has for the resources.
- FileList is not working.
- Bad bug with Specification default values being corroded exponentially in subsequent calls.
- Drop script for resources.?
- Add support for `prefix_header_file` in subspecs
- Add support for `prefix_header_contents` in subspecs
- Add Rake FileList warning.
- Release: Enable CocoaPods Core-warnings
- Subspecs now do not inherit the files patterns from the parent spec.
- The workspace is written only if needed greatly reducing the occasions in
which Xcode asks to revert.
- Specification hooks are only called when the specification is installed.
- The Lockfile is sorted reducing the SCM noise.
###### Specification DSL ###### Specification DSL
- [__Breaking__] Deprecated `header_mappings` hook. - [__Breaking__] Deprecated `header_mappings` hook.
...@@ -36,6 +20,11 @@ ...@@ -36,6 +20,11 @@
###### Enhancements ###### Enhancements
- Subspecs now do not inherit the files patterns from the parent spec.
- The workspace is written only if needed greatly reducing the occasions in
which Xcode asks to revert.
- Specification hooks are only called when the specification is installed.
- The Lockfile is sorted reducing the SCM noise.
- Simplified installation: no specific version of ruby gems is required anymore. - Simplified installation: no specific version of ruby gems is required anymore.
- Released preview [documentation](docs.cocoapods.org). - Released preview [documentation](docs.cocoapods.org).
- CocoaPods now has support for working in teams and not committing the Pods folder. - CocoaPods now has support for working in teams and not committing the Pods folder.
...@@ -47,6 +36,7 @@ ...@@ -47,6 +36,7 @@
- The `--no-clean` option of the `pod spec lint` command now displays the Pods project for inspection. - The `--no-clean` option of the `pod spec lint` command now displays the Pods project for inspection.
- It is now possible to specify default values for the configuration in `~/.cocoapods/config.yaml` ([example]()). - It is now possible to specify default values for the configuration in `~/.cocoapods/config.yaml` ([example]()).
- CocoaPods now checks the checksums of the installed specifications and reinstalls them if needed. - CocoaPods now checks the checksums of the installed specifications and reinstalls them if needed.
- Added new command `pod ipc` to provide support for inter process communication.
###### Bug fixes ###### Bug fixes
......
...@@ -99,3 +99,4 @@ require 'cocoapods/command/repo' ...@@ -99,3 +99,4 @@ require 'cocoapods/command/repo'
require 'cocoapods/command/search' require 'cocoapods/command/search'
require 'cocoapods/command/setup' require 'cocoapods/command/setup'
require 'cocoapods/command/spec' require 'cocoapods/command/spec'
require 'cocoapods/command/inter_process_communication'
module Pod
class Command
class IPC < Command
self.abstract_command = true
self.summary = 'Inter process communication'
#-----------------------------------------------------------------------#
class Spec < IPC
self.summary = 'Converts a podspec to YAML.'
self.description = 'Converts a podspec to YAML and prints it to STDOUT.'
self.arguments = 'PATH'
def initialize(argv)
@path = argv.shift_argument
super
end
def run
if @path.nil?
raise Informative, "Path not given."
elsif !File.exists?(@path)
raise Informative, "The given path doesn't exists `#{@path}` not given."
end
spec = Specification.from_file(@path)
UI.puts spec.to_yaml
end
end
#-----------------------------------------------------------------------#
class List < IPC
self.summary = 'Lists the specifications know to CocoaPods.'
self.description = <<-DESC
Prints to STDOUT a YAML dictionary where the keys are the name of the
specifications and the values are a dictionary with the following
keys.
- defined_in_file
- version
- authors
- summary
- description
- platforms
DESC
def run
sets = SourcesManager.all_sets
result = {}
sets.each do |set|
begin
spec = set.specification
result[spec.name] = {
'defined_in_file' => spec.defined_in_file.to_s,
'version' => spec.version,
'authors' => spec.authors,
'summary' => spec.summary,
'description' => spec.description,
'platforms' => spec.available_platforms.map { |p| p.name.to_s },
}
rescue DSLError
next
end
end
UI.puts result.to_yaml
end
end
#-----------------------------------------------------------------------#
end
end
end
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe Command::IPC do
describe Command::IPC::Spec do
it "converts a podspec to yaml and prints it to STDOUT" do
out = run_command('ipc', 'spec', fixture('banana-lib/BananaLib.podspec'))
out.should.include('---')
out.should.match /name: BananaLib/
out.should.match /version: .1\.0./
out.should.match /description: Full of chunky bananas./
end
end
#-------------------------------------------------------------------------#
describe Command::IPC::List do
it "converts a podspec to yaml and prints it to STDOUT" do
spec = fixture_spec('banana-lib/BananaLib.podspec')
set = Specification.new('BananaLib')
set.stubs(:specification).returns(spec)
SourcesManager.stubs(:all_sets).returns([set])
out = run_command('ipc', 'list')
out.should.include('---')
out.should.match /BananaLib:/
out.should.match /version: .1\.0./
out.should.match /description: Full of chunky bananas./
end
end
#-------------------------------------------------------------------------#
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment