{"action":"created","comment":{"url":"https://api.github.com/repos/CocoaPods/Xcodeproj/pulls/comments/80507753","id":80507753,"diff_hunk":"@@ -0,0 +1,154 @@\n+require 'xcodeproj/scheme/xml_element_wrapper'\n+\n+module Xcodeproj\n+  class XCScheme\n+    COMMAND_LINE_ARGS_NODE = 'CommandLineArguments'.freeze\n+    COMMAND_LINE_ARG_NODE = 'CommandLineArgument'.freeze\n+\n+    # This class wraps the CommandLineArguments node of a .xcscheme XML file. This\n+    # is just a container of CommandLineArgument objects. It can either appear on a\n+    # LaunchAction or TestAction scheme group.\n+    #\n+    class CommandLineArguments < XMLElementWrapper\n+      # @param [nil,REXML::Element,Array<CommandLineArgument>,Array<Hash{Symbol => String,Bool}>] node_or_arguments\n+      #        The 'CommandLineArguments' XML node, or list of command line arguments, that this object represents.\n+      #          - If nil, an empty 'CommandLineArguments' XML node will be created\n+      #          - If an REXML::Element, it must be named 'CommandLineArguments'\n+      #          - If an Array of objects or Hashes, they'll each be passed to {#assign_argument}\n+      #\n+      def initialize(node_or_arguments = nil)\n+        create_xml_element_with_fallback(node_or_arguments, COMMAND_LINE_ARGS_NODE) do\n+          @all_arguments = []\n+          node_or_arguments.each { |var| assign_argument(var) } unless node_or_arguments.nil?\n+        end\n+      end\n+\n+      # @return [Array<CommandLineArgument>]\n+      #         The key value pairs currently set in @xml_element\n+      #\n+      def all_arguments\n+        @all_arguments ||= @xml_element.get_elements(COMMAND_LINE_ARG_NODE).map { |argument| CommandLineArgument.new(argument) }\n+      end\n+\n+      # Adds a given argument to the set of command line arguments, or replaces it if that key already exists\n+      #\n+      # @param [CommandLineArgument,Hash{Symbol => String,Bool}] argument\n+      #        The argument to add or update, backed by an CommandLineArgument node.\n+      #          - If an CommandLineArgument, the previous reference will still be valid\n+      #          - If a Hash, must conform to {CommandLineArgument#initialize} requirements\n+      # @return [Array<CommandLineArgument>]\n+      #         The new set of command line arguments after addition\n+      #\n+      def assign_argument(argument)\n+        env_var = argument.is_a?(CommandLineArgument) ? argument : CommandLineArgument.new(argument)\n+        all_arguments.each { |existing_var| remove_argument(existing_var) if existing_var.argument == env_var.argument }\n+        @xml_element.add_element(env_var.xml_element)\n+        @all_arguments << env_var\n+      end\n+\n+      # Removes a specified argument (by string or object) from the set of command line arguments\n+      #\n+      # @param [CommandLineArgument,String] argument\n+      #        The argument to remove\n+      # @return [Array<CommandLineArgument>]\n+      #         The new set of command line arguments after removal\n+      #\n+      def remove_argument(argument)\n+        env_var = argument.is_a?(CommandLineArgument) ? argument : all_arguments.find { |var| var.argument == argument }","path":"lib/xcodeproj/scheme/command_line_arguments.rb","position":null,"original_position":57,"commit_id":"f02a000dcb102c1890346c2127b997ce7a656e6e","original_commit_id":"c3eff2bb01d7e2be2de5af5318026aad8b1ebc3c","user":{"login":"davelyon","id":20668,"avatar_url":"https://avatars.githubusercontent.com/u/20668?v=3","gravatar_id":"","url":"https://api.github.com/users/davelyon","html_url":"https://github.com/davelyon","followers_url":"https://api.github.com/users/davelyon/followers","following_url":"https://api.github.com/users/davelyon/following{/other_user}","gists_url":"https://api.github.com/users/davelyon/gists{/gist_id}","starred_url":"https://api.github.com/users/davelyon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davelyon/subscriptions","organizations_url":"https://api.github.com/users/davelyon/orgs","repos_url":"https://api.github.com/users/davelyon/repos","events_url":"https://api.github.com/users/davelyon/events{/privacy}","received_events_url":"https://api.github.com/users/davelyon/received_events","type":"User","site_admin":false},"body":"Updated as well. I have some ideas on how to clean this (and `EnvironmentVariables` up a bit so less of this is needed, but I'll send another pull request since that's a larger set of changes).","created_at":"2016-09-26T15:52:28Z","updated_at":"2016-09-26T15:52:28Z","html_url":"https://github.com/CocoaPods/Xcodeproj/pull/420#discussion_r80507753","pull_request_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/pulls/420","_links":{"self":{"href":"https://api.github.com/repos/CocoaPods/Xcodeproj/pulls/comments/80507753"},"html":{"href":"https://github.com/CocoaPods/Xcodeproj/pull/420#discussion_r80507753"},"pull_request":{"href":"https://api.github.com/repos/CocoaPods/Xcodeproj/pulls/420"}}},"pull_request":{"url":"https://api.github.com/repos/CocoaPods/Xcodeproj/pulls/420","id":86275776,"html_url":"https://github.com/CocoaPods/Xcodeproj/pull/420","diff_url":"https://github.com/CocoaPods/Xcodeproj/pull/420.diff","patch_url":"https://github.com/CocoaPods/Xcodeproj/pull/420.patch","issue_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/issues/420","number":420,"state":"open","locked":false,"title":"Add support for command line arguments","user":{"login":"davelyon","id":20668,"avatar_url":"https://avatars.githubusercontent.com/u/20668?v=3","gravatar_id":"","url":"https://api.github.com/users/davelyon","html_url":"https://github.com/davelyon","followers_url":"https://api.github.com/users/davelyon/followers","following_url":"https://api.github.com/users/davelyon/following{/other_user}","gists_url":"https://api.github.com/users/davelyon/gists{/gist_id}","starred_url":"https://api.github.com/users/davelyon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davelyon/subscriptions","organizations_url":"https://api.github.com/users/davelyon/orgs","repos_url":"https://api.github.com/users/davelyon/repos","events_url":"https://api.github.com/users/davelyon/events{/privacy}","received_events_url":"https://api.github.com/users/davelyon/received_events","type":"User","site_admin":false},"body":"I would like to be able to use `Xcodeproj` to manage the \"Arguments Passed On Launch\" within a projects Schemes. This adds support for getting and setting the `CommandLineArguments` (as the xcscheme format calls them internally).\r\n\r\nI've added specs and based the implementation off of the `EnvironmentVariables` implementation that was in use for the `XCScheme::LaunchAction`.\r\n\r\n![example-setting](https://cloud.githubusercontent.com/assets/20668/18736646/e009ccbc-803d-11e6-862c-97657191dbe4.png)\r\n\r\nWhich Xcode converts in the `xcscheme` to:\r\n\r\n![xcscheme-sample](https://cloud.githubusercontent.com/assets/20668/18736678/26982476-803e-11e6-9d3f-742ab99db550.png)\r\n\r\nI've also moved the `require` for `EnvironmentVariables` from `TestAction` to `AbstractSchemeAction`. \r\n\r\nPlease let me know if anything should be updated/improved.\r\n\r\nThanks!","created_at":"2016-09-22T03:49:20Z","updated_at":"2016-09-26T15:52:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a44f04af270f44088dc1552532330160162dcdb5","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/pulls/420/commits","review_comments_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/pulls/420/comments","review_comment_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/issues/420/comments","statuses_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/statuses/f02a000dcb102c1890346c2127b997ce7a656e6e","head":{"label":"davelyon:master","ref":"master","sha":"f02a000dcb102c1890346c2127b997ce7a656e6e","user":{"login":"davelyon","id":20668,"avatar_url":"https://avatars.githubusercontent.com/u/20668?v=3","gravatar_id":"","url":"https://api.github.com/users/davelyon","html_url":"https://github.com/davelyon","followers_url":"https://api.github.com/users/davelyon/followers","following_url":"https://api.github.com/users/davelyon/following{/other_user}","gists_url":"https://api.github.com/users/davelyon/gists{/gist_id}","starred_url":"https://api.github.com/users/davelyon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davelyon/subscriptions","organizations_url":"https://api.github.com/users/davelyon/orgs","repos_url":"https://api.github.com/users/davelyon/repos","events_url":"https://api.github.com/users/davelyon/events{/privacy}","received_events_url":"https://api.github.com/users/davelyon/received_events","type":"User","site_admin":false},"repo":{"id":68881641,"name":"Xcodeproj","full_name":"davelyon/Xcodeproj","owner":{"login":"davelyon","id":20668,"avatar_url":"https://avatars.githubusercontent.com/u/20668?v=3","gravatar_id":"","url":"https://api.github.com/users/davelyon","html_url":"https://github.com/davelyon","followers_url":"https://api.github.com/users/davelyon/followers","following_url":"https://api.github.com/users/davelyon/following{/other_user}","gists_url":"https://api.github.com/users/davelyon/gists{/gist_id}","starred_url":"https://api.github.com/users/davelyon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davelyon/subscriptions","organizations_url":"https://api.github.com/users/davelyon/orgs","repos_url":"https://api.github.com/users/davelyon/repos","events_url":"https://api.github.com/users/davelyon/events{/privacy}","received_events_url":"https://api.github.com/users/davelyon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/davelyon/Xcodeproj","description":"Create and modify Xcode projects from Ruby.","fork":true,"url":"https://api.github.com/repos/davelyon/Xcodeproj","forks_url":"https://api.github.com/repos/davelyon/Xcodeproj/forks","keys_url":"https://api.github.com/repos/davelyon/Xcodeproj/keys{/key_id}","collaborators_url":"https://api.github.com/repos/davelyon/Xcodeproj/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/davelyon/Xcodeproj/teams","hooks_url":"https://api.github.com/repos/davelyon/Xcodeproj/hooks","issue_events_url":"https://api.github.com/repos/davelyon/Xcodeproj/issues/events{/number}","events_url":"https://api.github.com/repos/davelyon/Xcodeproj/events","assignees_url":"https://api.github.com/repos/davelyon/Xcodeproj/assignees{/user}","branches_url":"https://api.github.com/repos/davelyon/Xcodeproj/branches{/branch}","tags_url":"https://api.github.com/repos/davelyon/Xcodeproj/tags","blobs_url":"https://api.github.com/repos/davelyon/Xcodeproj/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/davelyon/Xcodeproj/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/davelyon/Xcodeproj/git/refs{/sha}","trees_url":"https://api.github.com/repos/davelyon/Xcodeproj/git/trees{/sha}","statuses_url":"https://api.github.com/repos/davelyon/Xcodeproj/statuses/{sha}","languages_url":"https://api.github.com/repos/davelyon/Xcodeproj/languages","stargazers_url":"https://api.github.com/repos/davelyon/Xcodeproj/stargazers","contributors_url":"https://api.github.com/repos/davelyon/Xcodeproj/contributors","subscribers_url":"https://api.github.com/repos/davelyon/Xcodeproj/subscribers","subscription_url":"https://api.github.com/repos/davelyon/Xcodeproj/subscription","commits_url":"https://api.github.com/repos/davelyon/Xcodeproj/commits{/sha}","git_commits_url":"https://api.github.com/repos/davelyon/Xcodeproj/git/commits{/sha}","comments_url":"https://api.github.com/repos/davelyon/Xcodeproj/comments{/number}","issue_comment_url":"https://api.github.com/repos/davelyon/Xcodeproj/issues/comments{/number}","contents_url":"https://api.github.com/repos/davelyon/Xcodeproj/contents/{+path}","compare_url":"https://api.github.com/repos/davelyon/Xcodeproj/compare/{base}...{head}","merges_url":"https://api.github.com/repos/davelyon/Xcodeproj/merges","archive_url":"https://api.github.com/repos/davelyon/Xcodeproj/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/davelyon/Xcodeproj/downloads","issues_url":"https://api.github.com/repos/davelyon/Xcodeproj/issues{/number}","pulls_url":"https://api.github.com/repos/davelyon/Xcodeproj/pulls{/number}","milestones_url":"https://api.github.com/repos/davelyon/Xcodeproj/milestones{/number}","notifications_url":"https://api.github.com/repos/davelyon/Xcodeproj/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/davelyon/Xcodeproj/labels{/name}","releases_url":"https://api.github.com/repos/davelyon/Xcodeproj/releases{/id}","deployments_url":"https://api.github.com/repos/davelyon/Xcodeproj/deployments","created_at":"2016-09-22T03:36:59Z","updated_at":"2016-09-22T03:37:01Z","pushed_at":"2016-09-26T15:49:44Z","git_url":"git://github.com/davelyon/Xcodeproj.git","ssh_url":"git@github.com:davelyon/Xcodeproj.git","clone_url":"https://github.com/davelyon/Xcodeproj.git","svn_url":"https://github.com/davelyon/Xcodeproj","homepage":"http://rubygems.org/gems/xcodeproj","size":3219,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"CocoaPods:master","ref":"master","sha":"c8b7277072c3c2432ac99ef9b45cd1a6d181409e","user":{"login":"CocoaPods","id":1189714,"avatar_url":"https://avatars.githubusercontent.com/u/1189714?v=3","gravatar_id":"","url":"https://api.github.com/users/CocoaPods","html_url":"https://github.com/CocoaPods","followers_url":"https://api.github.com/users/CocoaPods/followers","following_url":"https://api.github.com/users/CocoaPods/following{/other_user}","gists_url":"https://api.github.com/users/CocoaPods/gists{/gist_id}","starred_url":"https://api.github.com/users/CocoaPods/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CocoaPods/subscriptions","organizations_url":"https://api.github.com/users/CocoaPods/orgs","repos_url":"https://api.github.com/users/CocoaPods/repos","events_url":"https://api.github.com/users/CocoaPods/events{/privacy}","received_events_url":"https://api.github.com/users/CocoaPods/received_events","type":"Organization","site_admin":false},"repo":{"id":2725544,"name":"Xcodeproj","full_name":"CocoaPods/Xcodeproj","owner":{"login":"CocoaPods","id":1189714,"avatar_url":"https://avatars.githubusercontent.com/u/1189714?v=3","gravatar_id":"","url":"https://api.github.com/users/CocoaPods","html_url":"https://github.com/CocoaPods","followers_url":"https://api.github.com/users/CocoaPods/followers","following_url":"https://api.github.com/users/CocoaPods/following{/other_user}","gists_url":"https://api.github.com/users/CocoaPods/gists{/gist_id}","starred_url":"https://api.github.com/users/CocoaPods/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CocoaPods/subscriptions","organizations_url":"https://api.github.com/users/CocoaPods/orgs","repos_url":"https://api.github.com/users/CocoaPods/repos","events_url":"https://api.github.com/users/CocoaPods/events{/privacy}","received_events_url":"https://api.github.com/users/CocoaPods/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CocoaPods/Xcodeproj","description":"Create and modify Xcode projects from Ruby.","fork":false,"url":"https://api.github.com/repos/CocoaPods/Xcodeproj","forks_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/forks","keys_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/teams","hooks_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/hooks","issue_events_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/issues/events{/number}","events_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/events","assignees_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/assignees{/user}","branches_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/branches{/branch}","tags_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/tags","blobs_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/git/refs{/sha}","trees_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/statuses/{sha}","languages_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/languages","stargazers_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/stargazers","contributors_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/contributors","subscribers_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/subscribers","subscription_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/subscription","commits_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/commits{/sha}","git_commits_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/git/commits{/sha}","comments_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/comments{/number}","issue_comment_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/issues/comments{/number}","contents_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/contents/{+path}","compare_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/merges","archive_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/downloads","issues_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/issues{/number}","pulls_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/pulls{/number}","milestones_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/milestones{/number}","notifications_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/labels{/name}","releases_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/releases{/id}","deployments_url":"https://api.github.com/repos/CocoaPods/Xcodeproj/deployments","created_at":"2011-11-07T10:59:27Z","updated_at":"2016-09-23T05:53:20Z","pushed_at":"2016-09-26T15:49:45Z","git_url":"git://github.com/CocoaPods/Xcodeproj.git","ssh_url":"git@github.com:CocoaPods/Xcodeproj.git","clone_url":"https://github.com/CocoaPods/Xcodeproj.git","svn_url":"https://github.com/CocoaPods/Xcodeproj","homepage":"http://rubygems.org/gems/xcodeproj","size":3662,"stargazers_count":626,"watchers_count":626,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":193,"mirror_url":null,"open_issues_count":48,"forks":193,"open_issues":48,"watchers":626,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CocoaPods/Xcodeproj/pulls/420"},"html":{"href":"https://github.com/CocoaPods/Xcodeproj/pull/420"},"issue":{"href":"https://api.github.com/repos/CocoaPods/Xcodeproj/issues/420"},"comments":{"href":"https://api.github.com/repos/CocoaPods/Xcodeproj/issues/420/comments"},"review_comments":{"href":"https://api.github.com/repos/CocoaPods/Xcodeproj/pulls/420/comments"},"review_comment":{"href":"https://api.github.com/repos/CocoaPods/Xcodeproj/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CocoaPods/Xcodeproj/pulls/420/commits"},"statuses":{"href":"https://api.github.com/repos/CocoaPods/Xcodeproj/statuses/f02a000dcb102c1890346c2127b997ce7a656e6e"}}}}
{"actor":{"display_login":"davelyon"}}