lib/pod/command/try.rb in cocoapods-try-release-fix-0.1.1 vs lib/pod/command/try.rb in cocoapods-try-release-fix-0.1.2
- old
+ new
@@ -5,11 +5,11 @@
#
class Try < Command
self.summary = "Try a Pod!"
self.description = <<-DESC
- Donwloads the Pod with the given NAME and opens its project.
+ Downloads the Pod with the given NAME and opens its project.
DESC
self.arguments = 'NAME'
def initialize(argv)
@@ -92,11 +92,15 @@
#
# @return [String] The path of the project.
#
def pick_demo_project(dir)
glob_match = Dir.glob("#{dir}/**/*.xc{odeproj,workspace}")
- glob_match = glob_match.reject { |p| p.include?('Pods.xcodeproj') }
+ glob_match = glob_match.reject do |p|
+ p.include?('Pods.xcodeproj') || \
+ p.end_with?('.xcodeproj/project.xcworkspace') || \
+ (p.end_with?('.xcodeproj') && glob_match.include?(p.chomp(File.extname(p.to_s)) + '.xcworkspace'))
+ end
if glob_match.count == 0
raise Informative, "Unable to find any project in the source files" \
"of the Pod: `#{dir}`"
elsif glob_match.count == 1
@@ -132,10 +136,15 @@
if podfile_path.exist?
Dir.chdir(dirname) do
perform_cocoapods_installation
podfile = Pod::Podfile.from_file(podfile_path)
- File.expand_path(podfile.workspace_path)
+
+ if podfile.workspace_path
+ File.expand_path(podfile.workspace_path)
+ else
+ proj.chomp(File.extname(proj.to_s)) + '.xcworkspace'
+ end
end
else
proj
end
end