Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added handler for :xcodeproj in launch options #514

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ark-konopacki
Copy link
Contributor

For me it looks more like a workaround or hack, but i cannot find better way to do that.

related to #454

@jmoody
Copy link
Contributor

jmoody commented Oct 13, 2016

Needs rspec tests and we need to clean up the commit history - I will not merge with those merge commits.

@ark-konopacki ark-konopacki force-pushed the feature/xcodeproj_launch_options branch from 43fd26d to 454bf04 Compare October 13, 2016 09:24
@ark-konopacki ark-konopacki force-pushed the feature/xcodeproj_launch_options branch from 454bf04 to f8d2a31 Compare October 13, 2016 09:29
@jmoody
Copy link
Contributor

jmoody commented Oct 19, 2017

This is the order in which to look for the Xcode project:

  1. Use XCODEPROJ environment if it exists
  2. Use options[:xcodeproj] if it exists; raise an error if the option is defined, but no project exists
  3. Try to find the project in the file system.

You need to implement the second option in the DetectAUT::Xcode class.

# Needs to be in the DectectAUT::Xcode class
# This needs to raise an error if the :xcodeproj => a file that does not exist
 def self.xcodeproj_from_options(options)
 +      value = options[:xcodeproj]
 +      if value.nil? || value == ""
 +        nil
 +      else
           # Raise if file does not exist
 +        File.expand_path(value)
 +      end
 +    end

Then this method needs to be updated to call ^ that method:

      def xcodeproj
        xcodeproj = RunLoop::Environment.xcodeproj

        if xcodeproj && !File.directory?(xcodeproj)
          raise_xcodeproj_missing(xcodeproj)
        end

        # XCODEPROJ defined and exists
        return xcodeproj if xcodeproj

        # TODO detect from options

        projects = find_xcodeproj

        return nil if projects.empty?
        return projects[0] if projects.count == 1

        raise_multiple_xcodeproj(projects)
      end

There needs to be rspec tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants