{"action":"created","comment":{"url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/pulls/comments/45566857","id":45566857,"diff_hunk":"@@ -0,0 +1,48 @@\n+require 'socket'\n+require 'open3'\n+\n+task :default => :boot\n+\n+desc 'Boots the mock server'\n+task :boot do\n+\n+  host = Socket.ip_address_list.find { |a| a.ipv4? && !a.ipv4_loopback? }.ip_address\n+  port = 9292\n+\n+  pid = Boot.execute(host, port)\n+\n+  while true\n+    sleep 0.1\n+    # http://en.wikipedia.org/wiki/Unix_signal\n+    Signal.trap('INT') do\n+      puts \"About to kill process #{pid}\"\n+      `kill -9 #{pid}`\n+      exit\n+    end\n+  end\n+end\n+\n+# Boots up the mock server by spawning a new thread,\n+# calling rack up and outputing stdout and stderr\n+class Boot\n+\n+  def self.execute(host, port)\n+\n+    puts \"About to boot mock server http://#{host}:#{port}\"\n+    puts \"CTRL + C to exit\"\n+\n+    command = \"rackup config.ru -o #{host} -p #{port}\"","path":"Rakefile","position":34,"original_position":34,"commit_id":"20fb3baf20c9fc244a5b319813dfba4c0e92f676","original_commit_id":"20fb3baf20c9fc244a5b319813dfba4c0e92f676","user":{"login":"madhikarma","id":1456685,"avatar_url":"https://avatars.githubusercontent.com/u/1456685?v=3","gravatar_id":"","url":"https://api.github.com/users/madhikarma","html_url":"https://github.com/madhikarma","followers_url":"https://api.github.com/users/madhikarma/followers","following_url":"https://api.github.com/users/madhikarma/following{/other_user}","gists_url":"https://api.github.com/users/madhikarma/gists{/gist_id}","starred_url":"https://api.github.com/users/madhikarma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madhikarma/subscriptions","organizations_url":"https://api.github.com/users/madhikarma/orgs","repos_url":"https://api.github.com/users/madhikarma/repos","events_url":"https://api.github.com/users/madhikarma/events{/privacy}","received_events_url":"https://api.github.com/users/madhikarma/received_events","type":"User","site_admin":false},"body":"Out of interest is specifying <code>config.ru</code> optional? Happy to keep it in there as explicit though ","created_at":"2015-11-22T23:32:22Z","updated_at":"2015-11-22T23:32:22Z","html_url":"https://github.com/madhikarma/sinatra-mock-server-template/pull/1#discussion_r45566857","pull_request_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/pulls/comments/45566857"},"html":{"href":"https://github.com/madhikarma/sinatra-mock-server-template/pull/1#discussion_r45566857"},"pull_request":{"href":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/pulls/1","id":51406964,"html_url":"https://github.com/madhikarma/sinatra-mock-server-template/pull/1","diff_url":"https://github.com/madhikarma/sinatra-mock-server-template/pull/1.diff","patch_url":"https://github.com/madhikarma/sinatra-mock-server-template/pull/1.patch","issue_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/issues/1","number":1,"state":"open","locked":false,"title":"Improvements","user":{"login":"juandelgado","id":3863712,"avatar_url":"https://avatars.githubusercontent.com/u/3863712?v=3","gravatar_id":"","url":"https://api.github.com/users/juandelgado","html_url":"https://github.com/juandelgado","followers_url":"https://api.github.com/users/juandelgado/followers","following_url":"https://api.github.com/users/juandelgado/following{/other_user}","gists_url":"https://api.github.com/users/juandelgado/gists{/gist_id}","starred_url":"https://api.github.com/users/juandelgado/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juandelgado/subscriptions","organizations_url":"https://api.github.com/users/juandelgado/orgs","repos_url":"https://api.github.com/users/juandelgado/repos","events_url":"https://api.github.com/users/juandelgado/events{/privacy}","received_events_url":"https://api.github.com/users/juandelgado/received_events","type":"User","site_admin":false},"body":"Hey there,\r\n\r\nA few improvements, each on its own commit. Pick and choose what you want! \r\n\r\nThe last 2 are meatier, one adding live code reload (time saver!!), the other one allows for easy binding of the local IP address as opposed to localhost, allowing pointing devices to the server a lot easier (since localhost on a device points to the device itself). \r\n\r\nHope it helps.","created_at":"2015-11-20T20:54:00Z","updated_at":"2015-11-22T23:32:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"49f6825d1b6635342303ed1034fb706fb340266d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/pulls/1/commits","review_comments_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/pulls/1/comments","review_comment_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/pulls/comments{/number}","comments_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/issues/1/comments","statuses_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/statuses/20fb3baf20c9fc244a5b319813dfba4c0e92f676","head":{"label":"juandelgado:master","ref":"master","sha":"20fb3baf20c9fc244a5b319813dfba4c0e92f676","user":{"login":"juandelgado","id":3863712,"avatar_url":"https://avatars.githubusercontent.com/u/3863712?v=3","gravatar_id":"","url":"https://api.github.com/users/juandelgado","html_url":"https://github.com/juandelgado","followers_url":"https://api.github.com/users/juandelgado/followers","following_url":"https://api.github.com/users/juandelgado/following{/other_user}","gists_url":"https://api.github.com/users/juandelgado/gists{/gist_id}","starred_url":"https://api.github.com/users/juandelgado/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juandelgado/subscriptions","organizations_url":"https://api.github.com/users/juandelgado/orgs","repos_url":"https://api.github.com/users/juandelgado/repos","events_url":"https://api.github.com/users/juandelgado/events{/privacy}","received_events_url":"https://api.github.com/users/juandelgado/received_events","type":"User","site_admin":false},"repo":{"id":46584843,"name":"sinatra-mock-server-template","full_name":"juandelgado/sinatra-mock-server-template","owner":{"login":"juandelgado","id":3863712,"avatar_url":"https://avatars.githubusercontent.com/u/3863712?v=3","gravatar_id":"","url":"https://api.github.com/users/juandelgado","html_url":"https://github.com/juandelgado","followers_url":"https://api.github.com/users/juandelgado/followers","following_url":"https://api.github.com/users/juandelgado/following{/other_user}","gists_url":"https://api.github.com/users/juandelgado/gists{/gist_id}","starred_url":"https://api.github.com/users/juandelgado/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juandelgado/subscriptions","organizations_url":"https://api.github.com/users/juandelgado/orgs","repos_url":"https://api.github.com/users/juandelgado/repos","events_url":"https://api.github.com/users/juandelgado/events{/privacy}","received_events_url":"https://api.github.com/users/juandelgado/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/juandelgado/sinatra-mock-server-template","description":"A base template for a Ruby based local web server using Sinatra and Rack ","fork":true,"url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template","forks_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/forks","keys_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/teams","hooks_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/hooks","issue_events_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/issues/events{/number}","events_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/events","assignees_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/assignees{/user}","branches_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/branches{/branch}","tags_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/tags","blobs_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/git/refs{/sha}","trees_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/statuses/{sha}","languages_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/languages","stargazers_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/stargazers","contributors_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/contributors","subscribers_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/subscribers","subscription_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/subscription","commits_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/commits{/sha}","git_commits_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/git/commits{/sha}","comments_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/comments{/number}","issue_comment_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/issues/comments{/number}","contents_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/contents/{+path}","compare_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/merges","archive_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/downloads","issues_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/issues{/number}","pulls_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/pulls{/number}","milestones_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/milestones{/number}","notifications_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/labels{/name}","releases_url":"https://api.github.com/repos/juandelgado/sinatra-mock-server-template/releases{/id}","created_at":"2015-11-20T20:24:15Z","updated_at":"2015-11-20T20:24:15Z","pushed_at":"2015-11-20T20:50:06Z","git_url":"git://github.com/juandelgado/sinatra-mock-server-template.git","ssh_url":"git@github.com:juandelgado/sinatra-mock-server-template.git","clone_url":"https://github.com/juandelgado/sinatra-mock-server-template.git","svn_url":"https://github.com/juandelgado/sinatra-mock-server-template","homepage":null,"size":508,"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":"madhikarma:master","ref":"master","sha":"b78b401d0594e1065ace5997aa1e872210ab5afd","user":{"login":"madhikarma","id":1456685,"avatar_url":"https://avatars.githubusercontent.com/u/1456685?v=3","gravatar_id":"","url":"https://api.github.com/users/madhikarma","html_url":"https://github.com/madhikarma","followers_url":"https://api.github.com/users/madhikarma/followers","following_url":"https://api.github.com/users/madhikarma/following{/other_user}","gists_url":"https://api.github.com/users/madhikarma/gists{/gist_id}","starred_url":"https://api.github.com/users/madhikarma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madhikarma/subscriptions","organizations_url":"https://api.github.com/users/madhikarma/orgs","repos_url":"https://api.github.com/users/madhikarma/repos","events_url":"https://api.github.com/users/madhikarma/events{/privacy}","received_events_url":"https://api.github.com/users/madhikarma/received_events","type":"User","site_admin":false},"repo":{"id":46188947,"name":"sinatra-mock-server-template","full_name":"madhikarma/sinatra-mock-server-template","owner":{"login":"madhikarma","id":1456685,"avatar_url":"https://avatars.githubusercontent.com/u/1456685?v=3","gravatar_id":"","url":"https://api.github.com/users/madhikarma","html_url":"https://github.com/madhikarma","followers_url":"https://api.github.com/users/madhikarma/followers","following_url":"https://api.github.com/users/madhikarma/following{/other_user}","gists_url":"https://api.github.com/users/madhikarma/gists{/gist_id}","starred_url":"https://api.github.com/users/madhikarma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madhikarma/subscriptions","organizations_url":"https://api.github.com/users/madhikarma/orgs","repos_url":"https://api.github.com/users/madhikarma/repos","events_url":"https://api.github.com/users/madhikarma/events{/privacy}","received_events_url":"https://api.github.com/users/madhikarma/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/madhikarma/sinatra-mock-server-template","description":"A base template for a Ruby based local web server using Sinatra and Rack ","fork":false,"url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template","forks_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/forks","keys_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/keys{/key_id}","collaborators_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/teams","hooks_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/hooks","issue_events_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/issues/events{/number}","events_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/events","assignees_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/assignees{/user}","branches_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/branches{/branch}","tags_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/tags","blobs_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/git/refs{/sha}","trees_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/git/trees{/sha}","statuses_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/statuses/{sha}","languages_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/languages","stargazers_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/stargazers","contributors_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/contributors","subscribers_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/subscribers","subscription_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/subscription","commits_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/commits{/sha}","git_commits_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/git/commits{/sha}","comments_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/comments{/number}","issue_comment_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/issues/comments{/number}","contents_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/contents/{+path}","compare_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/compare/{base}...{head}","merges_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/merges","archive_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/downloads","issues_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/issues{/number}","pulls_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/pulls{/number}","milestones_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/milestones{/number}","notifications_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/labels{/name}","releases_url":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/releases{/id}","created_at":"2015-11-14T19:31:03Z","updated_at":"2015-11-16T11:59:05Z","pushed_at":"2015-11-20T20:54:00Z","git_url":"git://github.com/madhikarma/sinatra-mock-server-template.git","ssh_url":"git@github.com:madhikarma/sinatra-mock-server-template.git","clone_url":"https://github.com/madhikarma/sinatra-mock-server-template.git","svn_url":"https://github.com/madhikarma/sinatra-mock-server-template","homepage":null,"size":0,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/pulls/1"},"html":{"href":"https://github.com/madhikarma/sinatra-mock-server-template/pull/1"},"issue":{"href":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/issues/1"},"comments":{"href":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/madhikarma/sinatra-mock-server-template/statuses/20fb3baf20c9fc244a5b319813dfba4c0e92f676"}}}}