{"action":"created","issue":{"url":"https://api.github.com/repos/rgbkrk/atom-script/issues/569","labels_url":"https://api.github.com/repos/rgbkrk/atom-script/issues/569/labels{/name}","comments_url":"https://api.github.com/repos/rgbkrk/atom-script/issues/569/comments","events_url":"https://api.github.com/repos/rgbkrk/atom-script/issues/569/events","html_url":"https://github.com/rgbkrk/atom-script/pull/569","id":105791009,"number":569,"title":"The grand refactoring along with exposing two services to run code from other packages","user":{"login":"s1mplex","id":2053337,"avatar_url":"https://avatars.githubusercontent.com/u/2053337?v=3","gravatar_id":"","url":"https://api.github.com/users/s1mplex","html_url":"https://github.com/s1mplex","followers_url":"https://api.github.com/users/s1mplex/followers","following_url":"https://api.github.com/users/s1mplex/following{/other_user}","gists_url":"https://api.github.com/users/s1mplex/gists{/gist_id}","starred_url":"https://api.github.com/users/s1mplex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s1mplex/subscriptions","organizations_url":"https://api.github.com/users/s1mplex/orgs","repos_url":"https://api.github.com/users/s1mplex/repos","events_url":"https://api.github.com/users/s1mplex/events{/privacy}","received_events_url":"https://api.github.com/users/s1mplex/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-10T11:54:25Z","updated_at":"2015-09-23T20:09:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rgbkrk/atom-script/pulls/569","html_url":"https://github.com/rgbkrk/atom-script/pull/569","diff_url":"https://github.com/rgbkrk/atom-script/pull/569.diff","patch_url":"https://github.com/rgbkrk/atom-script/pull/569.patch"},"body":"Hey @rgbkrk ! This got quite big but hopefully you'll find it worth it. \r\n\r\nI wanted to be able to customize code running so I can provide an input, write output somewhere else etc. I believe the good way to go is to expose a service - this way the script package remains unchanged while we can develop other packages around it. A good use case would be to imagine a Google Code Jam package that'd use atom-script: you'd choose the challenge, the package would run your code locally against the automatically downloaded input and submit your output back to Google.\r\n\r\nI wanted to do it the right way so I did a lot of refactoring. I pulled responsibilities out of the `ScriptView` class into a few more of them:\r\n\r\n* **Runner** that encapsulates running behaviour\r\n* **CodeContextBuilder** which builds CodeContext for Runner\r\n* **CommandContext** which was previously a plain object\r\n* **Runtime** which pulls it all together and can emit events connected with the running lifecycle to observers\r\n* **ViewRuntimeObserver** which listens to Runtime and calls ScriptView\r\n\r\nI also added a few tests to make sure the basic functionality is there.\r\n\r\nLet me know what you think! Just to let you know - I'll be on vacation for two weeks so I might not be very quick with my responses in that time."},"comment":{"url":"https://api.github.com/repos/rgbkrk/atom-script/issues/comments/142714874","html_url":"https://github.com/rgbkrk/atom-script/pull/569#issuecomment-142714874","issue_url":"https://api.github.com/repos/rgbkrk/atom-script/issues/569","id":142714874,"user":{"login":"s1mplex","id":2053337,"avatar_url":"https://avatars.githubusercontent.com/u/2053337?v=3","gravatar_id":"","url":"https://api.github.com/users/s1mplex","html_url":"https://github.com/s1mplex","followers_url":"https://api.github.com/users/s1mplex/followers","following_url":"https://api.github.com/users/s1mplex/following{/other_user}","gists_url":"https://api.github.com/users/s1mplex/gists{/gist_id}","starred_url":"https://api.github.com/users/s1mplex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s1mplex/subscriptions","organizations_url":"https://api.github.com/users/s1mplex/orgs","repos_url":"https://api.github.com/users/s1mplex/repos","events_url":"https://api.github.com/users/s1mplex/events{/privacy}","received_events_url":"https://api.github.com/users/s1mplex/received_events","type":"User","site_admin":false},"created_at":"2015-09-23T20:09:48Z","updated_at":"2015-09-23T20:09:48Z","body":"@rgbkrk any thoughts here? "}}