{"action":"created","comment":{"url":"https://api.github.com/repos/rails/rails/pulls/comments/47308683","id":47308683,"diff_hunk":"@@ -26,20 +30,23 @@ class CommandsTasks # :nodoc:\n  runner       Run a piece of code in the application environment (short-cut alias: \"r\")\n \n All commands can be run with -h (or --help) for more information.\n+\n EOT\n \n-    COMMAND_WHITELIST = %w(plugin generate destroy console server dbconsole runner new version help test)\n+    COMMAND_WHITELIST = %w(plugin generate destroy console server dbconsole runner new version help test rake)\n \n-    def initialize(argv)\n+    def initialize(argv = ARGV)\n       @argv = argv\n     end\n \n     def run_command!(command)\n       command = parse_command(command)\n+\n       if COMMAND_WHITELIST.include?(command)\n         send(command)\n       else\n-        write_error_message(command)\n+        ARGV.unshift(command)\n+        send(:rake)","path":"railties/lib/rails/commands/commands_tasks.rb","position":38,"original_position":38,"commit_id":"668a66ab9586e56fb7cf291c5b406dde9d871b7c","original_commit_id":"668a66ab9586e56fb7cf291c5b406dde9d871b7c","user":{"login":"dharamgollapudi","id":737325,"avatar_url":"https://avatars.githubusercontent.com/u/737325?v=3","gravatar_id":"","url":"https://api.github.com/users/dharamgollapudi","html_url":"https://github.com/dharamgollapudi","followers_url":"https://api.github.com/users/dharamgollapudi/followers","following_url":"https://api.github.com/users/dharamgollapudi/following{/other_user}","gists_url":"https://api.github.com/users/dharamgollapudi/gists{/gist_id}","starred_url":"https://api.github.com/users/dharamgollapudi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dharamgollapudi/subscriptions","organizations_url":"https://api.github.com/users/dharamgollapudi/orgs","repos_url":"https://api.github.com/users/dharamgollapudi/repos","events_url":"https://api.github.com/users/dharamgollapudi/events{/privacy}","received_events_url":"https://api.github.com/users/dharamgollapudi/received_events","type":"User","site_admin":false},"body":"Renaming result variable of `parse_command` won't help here, as the ARGV.shift is done at https://github.com/rails/rails/blob/master/railties/lib/rails/commands.rb#L13 and we need to put it back/unshift it for rake to take over, otherwise rake won't be able to find the right task to run and defaults to the `rake test`.","created_at":"2015-12-11T00:41:34Z","updated_at":"2015-12-11T00:41:34Z","html_url":"https://github.com/rails/rails/pull/22288#discussion_r47308683","pull_request_url":"https://api.github.com/repos/rails/rails/pulls/22288","_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/comments/47308683"},"html":{"href":"https://github.com/rails/rails/pull/22288#discussion_r47308683"},"pull_request":{"href":"https://api.github.com/repos/rails/rails/pulls/22288"}}},"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/22288","id":50711499,"html_url":"https://github.com/rails/rails/pull/22288","diff_url":"https://github.com/rails/rails/pull/22288.diff","patch_url":"https://github.com/rails/rails/pull/22288.patch","issue_url":"https://api.github.com/repos/rails/rails/issues/22288","number":22288,"state":"open","locked":false,"title":"Implement rake proxy for rails cli","user":{"login":"dharamgollapudi","id":737325,"avatar_url":"https://avatars.githubusercontent.com/u/737325?v=3","gravatar_id":"","url":"https://api.github.com/users/dharamgollapudi","html_url":"https://github.com/dharamgollapudi","followers_url":"https://api.github.com/users/dharamgollapudi/followers","following_url":"https://api.github.com/users/dharamgollapudi/following{/other_user}","gists_url":"https://api.github.com/users/dharamgollapudi/gists{/gist_id}","starred_url":"https://api.github.com/users/dharamgollapudi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dharamgollapudi/subscriptions","organizations_url":"https://api.github.com/users/dharamgollapudi/orgs","repos_url":"https://api.github.com/users/dharamgollapudi/repos","events_url":"https://api.github.com/users/dharamgollapudi/events{/privacy}","received_events_url":"https://api.github.com/users/dharamgollapudi/received_events","type":"User","site_admin":false},"body":"- This implements a thin proxy layer for rails cli to invoke the underlying rake tasks.\r\n- With this change all the rake tasks can be called/invoked directly with rails. (ex: `rails stats`, `rails db:version`, etc)\r\n- Also included a `rake` subcommand with shortcut set to `k` which can be used to query\r\nversion and help info of rake, which supports all three formats as `-h`, `--help` and `help`.\r\n- This addresses #18878, and #21012\r\n","created_at":"2015-11-14T01:13:18Z","updated_at":"2015-12-11T00:41:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"15dd5b793159d23027b49822a58cf03e758f62ed","assignee":{"login":"kaspth","id":350807,"avatar_url":"https://avatars.githubusercontent.com/u/350807?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspth","html_url":"https://github.com/kaspth","followers_url":"https://api.github.com/users/kaspth/followers","following_url":"https://api.github.com/users/kaspth/following{/other_user}","gists_url":"https://api.github.com/users/kaspth/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspth/subscriptions","organizations_url":"https://api.github.com/users/kaspth/orgs","repos_url":"https://api.github.com/users/kaspth/repos","events_url":"https://api.github.com/users/kaspth/events{/privacy}","received_events_url":"https://api.github.com/users/kaspth/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/rails/rails/pulls/22288/commits","review_comments_url":"https://api.github.com/repos/rails/rails/pulls/22288/comments","review_comment_url":"https://api.github.com/repos/rails/rails/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rails/rails/issues/22288/comments","statuses_url":"https://api.github.com/repos/rails/rails/statuses/668a66ab9586e56fb7cf291c5b406dde9d871b7c","head":{"label":"dharamgollapudi:rake_proxy_for_rails_cli","ref":"rake_proxy_for_rails_cli","sha":"668a66ab9586e56fb7cf291c5b406dde9d871b7c","user":{"login":"dharamgollapudi","id":737325,"avatar_url":"https://avatars.githubusercontent.com/u/737325?v=3","gravatar_id":"","url":"https://api.github.com/users/dharamgollapudi","html_url":"https://github.com/dharamgollapudi","followers_url":"https://api.github.com/users/dharamgollapudi/followers","following_url":"https://api.github.com/users/dharamgollapudi/following{/other_user}","gists_url":"https://api.github.com/users/dharamgollapudi/gists{/gist_id}","starred_url":"https://api.github.com/users/dharamgollapudi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dharamgollapudi/subscriptions","organizations_url":"https://api.github.com/users/dharamgollapudi/orgs","repos_url":"https://api.github.com/users/dharamgollapudi/repos","events_url":"https://api.github.com/users/dharamgollapudi/events{/privacy}","received_events_url":"https://api.github.com/users/dharamgollapudi/received_events","type":"User","site_admin":false},"repo":{"id":11157185,"name":"rails","full_name":"dharamgollapudi/rails","owner":{"login":"dharamgollapudi","id":737325,"avatar_url":"https://avatars.githubusercontent.com/u/737325?v=3","gravatar_id":"","url":"https://api.github.com/users/dharamgollapudi","html_url":"https://github.com/dharamgollapudi","followers_url":"https://api.github.com/users/dharamgollapudi/followers","following_url":"https://api.github.com/users/dharamgollapudi/following{/other_user}","gists_url":"https://api.github.com/users/dharamgollapudi/gists{/gist_id}","starred_url":"https://api.github.com/users/dharamgollapudi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dharamgollapudi/subscriptions","organizations_url":"https://api.github.com/users/dharamgollapudi/orgs","repos_url":"https://api.github.com/users/dharamgollapudi/repos","events_url":"https://api.github.com/users/dharamgollapudi/events{/privacy}","received_events_url":"https://api.github.com/users/dharamgollapudi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dharamgollapudi/rails","description":"Ruby on Rails","fork":true,"url":"https://api.github.com/repos/dharamgollapudi/rails","forks_url":"https://api.github.com/repos/dharamgollapudi/rails/forks","keys_url":"https://api.github.com/repos/dharamgollapudi/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dharamgollapudi/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dharamgollapudi/rails/teams","hooks_url":"https://api.github.com/repos/dharamgollapudi/rails/hooks","issue_events_url":"https://api.github.com/repos/dharamgollapudi/rails/issues/events{/number}","events_url":"https://api.github.com/repos/dharamgollapudi/rails/events","assignees_url":"https://api.github.com/repos/dharamgollapudi/rails/assignees{/user}","branches_url":"https://api.github.com/repos/dharamgollapudi/rails/branches{/branch}","tags_url":"https://api.github.com/repos/dharamgollapudi/rails/tags","blobs_url":"https://api.github.com/repos/dharamgollapudi/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dharamgollapudi/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dharamgollapudi/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/dharamgollapudi/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dharamgollapudi/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/dharamgollapudi/rails/languages","stargazers_url":"https://api.github.com/repos/dharamgollapudi/rails/stargazers","contributors_url":"https://api.github.com/repos/dharamgollapudi/rails/contributors","subscribers_url":"https://api.github.com/repos/dharamgollapudi/rails/subscribers","subscription_url":"https://api.github.com/repos/dharamgollapudi/rails/subscription","commits_url":"https://api.github.com/repos/dharamgollapudi/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/dharamgollapudi/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/dharamgollapudi/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/dharamgollapudi/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/dharamgollapudi/rails/contents/{+path}","compare_url":"https://api.github.com/repos/dharamgollapudi/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dharamgollapudi/rails/merges","archive_url":"https://api.github.com/repos/dharamgollapudi/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dharamgollapudi/rails/downloads","issues_url":"https://api.github.com/repos/dharamgollapudi/rails/issues{/number}","pulls_url":"https://api.github.com/repos/dharamgollapudi/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/dharamgollapudi/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/dharamgollapudi/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dharamgollapudi/rails/labels{/name}","releases_url":"https://api.github.com/repos/dharamgollapudi/rails/releases{/id}","created_at":"2013-07-03T17:39:37Z","updated_at":"2015-03-10T00:47:40Z","pushed_at":"2015-12-10T23:16:37Z","git_url":"git://github.com/dharamgollapudi/rails.git","ssh_url":"git@github.com:dharamgollapudi/rails.git","clone_url":"https://github.com/dharamgollapudi/rails.git","svn_url":"https://github.com/dharamgollapudi/rails","homepage":"http://rubyonrails.org","size":114088,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"rails:master","ref":"master","sha":"fdf5d4dfc30ce5a599392305567c0230c21b9b84","user":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"repo":{"id":8514,"name":"rails","full_name":"rails/rails","owner":{"login":"rails","id":4223,"avatar_url":"https://avatars.githubusercontent.com/u/4223?v=3","gravatar_id":"","url":"https://api.github.com/users/rails","html_url":"https://github.com/rails","followers_url":"https://api.github.com/users/rails/followers","following_url":"https://api.github.com/users/rails/following{/other_user}","gists_url":"https://api.github.com/users/rails/gists{/gist_id}","starred_url":"https://api.github.com/users/rails/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rails/subscriptions","organizations_url":"https://api.github.com/users/rails/orgs","repos_url":"https://api.github.com/users/rails/repos","events_url":"https://api.github.com/users/rails/events{/privacy}","received_events_url":"https://api.github.com/users/rails/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rails/rails","description":"Ruby on Rails","fork":false,"url":"https://api.github.com/repos/rails/rails","forks_url":"https://api.github.com/repos/rails/rails/forks","keys_url":"https://api.github.com/repos/rails/rails/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rails/rails/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rails/rails/teams","hooks_url":"https://api.github.com/repos/rails/rails/hooks","issue_events_url":"https://api.github.com/repos/rails/rails/issues/events{/number}","events_url":"https://api.github.com/repos/rails/rails/events","assignees_url":"https://api.github.com/repos/rails/rails/assignees{/user}","branches_url":"https://api.github.com/repos/rails/rails/branches{/branch}","tags_url":"https://api.github.com/repos/rails/rails/tags","blobs_url":"https://api.github.com/repos/rails/rails/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rails/rails/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rails/rails/git/refs{/sha}","trees_url":"https://api.github.com/repos/rails/rails/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rails/rails/statuses/{sha}","languages_url":"https://api.github.com/repos/rails/rails/languages","stargazers_url":"https://api.github.com/repos/rails/rails/stargazers","contributors_url":"https://api.github.com/repos/rails/rails/contributors","subscribers_url":"https://api.github.com/repos/rails/rails/subscribers","subscription_url":"https://api.github.com/repos/rails/rails/subscription","commits_url":"https://api.github.com/repos/rails/rails/commits{/sha}","git_commits_url":"https://api.github.com/repos/rails/rails/git/commits{/sha}","comments_url":"https://api.github.com/repos/rails/rails/comments{/number}","issue_comment_url":"https://api.github.com/repos/rails/rails/issues/comments{/number}","contents_url":"https://api.github.com/repos/rails/rails/contents/{+path}","compare_url":"https://api.github.com/repos/rails/rails/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rails/rails/merges","archive_url":"https://api.github.com/repos/rails/rails/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rails/rails/downloads","issues_url":"https://api.github.com/repos/rails/rails/issues{/number}","pulls_url":"https://api.github.com/repos/rails/rails/pulls{/number}","milestones_url":"https://api.github.com/repos/rails/rails/milestones{/number}","notifications_url":"https://api.github.com/repos/rails/rails/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rails/rails/labels{/name}","releases_url":"https://api.github.com/repos/rails/rails/releases{/id}","created_at":"2008-04-11T02:19:47Z","updated_at":"2015-12-10T23:37:24Z","pushed_at":"2015-12-11T00:07:54Z","git_url":"git://github.com/rails/rails.git","ssh_url":"git@github.com:rails/rails.git","clone_url":"https://github.com/rails/rails.git","svn_url":"https://github.com/rails/rails","homepage":"http://rubyonrails.org","size":322034,"stargazers_count":28674,"watchers_count":28674,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11626,"mirror_url":null,"open_issues_count":883,"forks":11626,"open_issues":883,"watchers":28674,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rails/rails/pulls/22288"},"html":{"href":"https://github.com/rails/rails/pull/22288"},"issue":{"href":"https://api.github.com/repos/rails/rails/issues/22288"},"comments":{"href":"https://api.github.com/repos/rails/rails/issues/22288/comments"},"review_comments":{"href":"https://api.github.com/repos/rails/rails/pulls/22288/comments"},"review_comment":{"href":"https://api.github.com/repos/rails/rails/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rails/rails/pulls/22288/commits"},"statuses":{"href":"https://api.github.com/repos/rails/rails/statuses/668a66ab9586e56fb7cf291c5b406dde9d871b7c"}}}}