@@ -17,8 +17,8 @@ |
||
| 17 | 17 | }); |
| 18 | 18 | set('cimonitor_user', function () { |
| 19 | 19 | return [ |
| 20 | - 'name' => runLocally('git config --get user.name'), |
|
| 21 | - 'email' => runLocally('git config --get user.email'), |
|
| 20 | + 'name' => runLocally('git config --get user.name'), |
|
| 21 | + 'email' => runLocally('git config --get user.email'), |
|
| 22 | 22 | ]; |
| 23 | 23 | }); |
| 24 | 24 | |
@@ -95,7 +95,7 @@ |
||
| 95 | 95 | throw new \RuntimeException('Please configure "chatwork_room_id" parameter.'); |
| 96 | 96 | }); |
| 97 | 97 | set('chatwork_api', function () { |
| 98 | - return 'https://api.chatwork.com/v2/rooms/' . get('chatwork_room_id') . '/messages'; |
|
| 98 | + return 'https://api.chatwork.com/v2/rooms/' . get('chatwork_room_id') . '/messages'; |
|
| 99 | 99 | }); |
| 100 | 100 | |
| 101 | 101 | // The Messages |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | throw new \Exception('Please, configure "telegram_chat_id" parameter.'); |
| 73 | 73 | }); |
| 74 | 74 | set('telegram_url', function () { |
| 75 | - return 'https://api.telegram.org/bot' . get('telegram_token') . '/sendmessage'; |
|
| 75 | + return 'https://api.telegram.org/bot' . get('telegram_token') . '/sendmessage'; |
|
| 76 | 76 | }); |
| 77 | 77 | |
| 78 | 78 | // Deploy message |
@@ -112,39 +112,39 @@ discard block |
||
| 112 | 112 | ->once() |
| 113 | 113 | ->hidden(); |
| 114 | 114 | |
| 115 | - desc('Notifies Telegram about deploy finish'); |
|
| 116 | - task('telegram:notify:success', function () { |
|
| 117 | - if (!get('telegram_token', false)) { |
|
| 118 | - warning('No Telegram token configured'); |
|
| 119 | - return; |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - if (!get('telegram_chat_id', false)) { |
|
| 123 | - warning('No Telegram chat id configured'); |
|
| 124 | - return; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - $telegramUrl = get('telegram_url') . '?' . http_build_query ( |
|
| 128 | - Array ( |
|
| 129 | - 'chat_id' => get('telegram_chat_id'), |
|
| 130 | - 'text' => get('telegram_success_text'), |
|
| 131 | - 'parse_mode' => 'Markdown', |
|
| 132 | - ) |
|
| 133 | - ); |
|
| 134 | - |
|
| 135 | - $httpie = Httpie::get($telegramUrl); |
|
| 136 | - |
|
| 137 | - if (get('telegram_proxy', '') !== '') { |
|
| 138 | - $httpie = $httpie->setopt(CURLOPT_PROXY, get('telegram_proxy')); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - $httpie->send(); |
|
| 115 | + desc('Notifies Telegram about deploy finish'); |
|
| 116 | + task('telegram:notify:success', function () { |
|
| 117 | + if (!get('telegram_token', false)) { |
|
| 118 | + warning('No Telegram token configured'); |
|
| 119 | + return; |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + if (!get('telegram_chat_id', false)) { |
|
| 123 | + warning('No Telegram chat id configured'); |
|
| 124 | + return; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + $telegramUrl = get('telegram_url') . '?' . http_build_query ( |
|
| 128 | + Array ( |
|
| 129 | + 'chat_id' => get('telegram_chat_id'), |
|
| 130 | + 'text' => get('telegram_success_text'), |
|
| 131 | + 'parse_mode' => 'Markdown', |
|
| 132 | + ) |
|
| 133 | + ); |
|
| 134 | + |
|
| 135 | + $httpie = Httpie::get($telegramUrl); |
|
| 136 | + |
|
| 137 | + if (get('telegram_proxy', '') !== '') { |
|
| 138 | + $httpie = $httpie->setopt(CURLOPT_PROXY, get('telegram_proxy')); |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + $httpie->send(); |
|
| 142 | 142 | }) |
| 143 | 143 | ->once() |
| 144 | 144 | ->hidden(); |
| 145 | 145 | |
| 146 | - desc('Notifies Telegram about deploy failure'); |
|
| 147 | - task('telegram:notify:failure', function () { |
|
| 146 | + desc('Notifies Telegram about deploy failure'); |
|
| 147 | + task('telegram:notify:failure', function () { |
|
| 148 | 148 | if (!get('telegram_token', false)) { |
| 149 | 149 | warning('No Telegram token configured'); |
| 150 | 150 | return; |
@@ -155,21 +155,21 @@ discard block |
||
| 155 | 155 | return; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - $telegramUrl = get('telegram_url') . '?' . http_build_query ( |
|
| 159 | - Array ( |
|
| 160 | - 'chat_id' => get('telegram_chat_id'), |
|
| 161 | - 'text' => get('telegram_failure_text'), |
|
| 162 | - 'parse_mode' => 'Markdown', |
|
| 163 | - ) |
|
| 164 | - ); |
|
| 158 | + $telegramUrl = get('telegram_url') . '?' . http_build_query ( |
|
| 159 | + Array ( |
|
| 160 | + 'chat_id' => get('telegram_chat_id'), |
|
| 161 | + 'text' => get('telegram_failure_text'), |
|
| 162 | + 'parse_mode' => 'Markdown', |
|
| 163 | + ) |
|
| 164 | + ); |
|
| 165 | 165 | |
| 166 | - $httpie = Httpie::get($telegramUrl); |
|
| 166 | + $httpie = Httpie::get($telegramUrl); |
|
| 167 | 167 | |
| 168 | - if (get('telegram_proxy', '') !== '') { |
|
| 169 | - $httpie = $httpie->setopt(CURLOPT_PROXY, get('telegram_proxy')); |
|
| 170 | - } |
|
| 168 | + if (get('telegram_proxy', '') !== '') { |
|
| 169 | + $httpie = $httpie->setopt(CURLOPT_PROXY, get('telegram_proxy')); |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | - $httpie->send(); |
|
| 172 | + $httpie->send(); |
|
| 173 | 173 | }) |
| 174 | 174 | ->once() |
| 175 | 175 | ->hidden(); |
@@ -158,7 +158,7 @@ |
||
| 158 | 158 | public function testWithinReturningValue() |
| 159 | 159 | { |
| 160 | 160 | $output = within('/foo', function () { |
| 161 | - return 'bar'; |
|
| 161 | + return 'bar'; |
|
| 162 | 162 | }); |
| 163 | 163 | |
| 164 | 164 | self::assertEquals('bar', $output); |
@@ -44,6 +44,6 @@ |
||
| 44 | 44 | set('host_level_callback_config', 'from global'); |
| 45 | 45 | |
| 46 | 46 | task('host_config_from_callback', function () { |
| 47 | - writeln('config value is {{host_level_callback_config}}'); |
|
| 47 | + writeln('config value is {{host_level_callback_config}}'); |
|
| 48 | 48 | }); |
| 49 | 49 | |
@@ -273,8 +273,8 @@ |
||
| 273 | 273 | public function generate(array $components) |
| 274 | 274 | { |
| 275 | 275 | $uri = $components['scheme'] . '://' |
| 276 | - . $components['authority'] |
|
| 277 | - . $components['path']; |
|
| 276 | + . $components['authority'] |
|
| 277 | + . $components['path']; |
|
| 278 | 278 | |
| 279 | 279 | if (array_key_exists('query', $components)) { |
| 280 | 280 | $uri .= $components['query']; |
@@ -58,8 +58,8 @@ |
||
| 58 | 58 | public function generate(array $components) |
| 59 | 59 | { |
| 60 | 60 | $uri = $components['scheme'] . '://' |
| 61 | - . $components['authority'] |
|
| 62 | - . $components['path']; |
|
| 61 | + . $components['authority'] |
|
| 62 | + . $components['path']; |
|
| 63 | 63 | |
| 64 | 64 | if (array_key_exists('query', $components) && strlen($components['query'])) { |
| 65 | 65 | $uri .= '?' . $components['query']; |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | */ |
| 94 | 94 | public function moveTo($targetPath) |
| 95 | 95 | { |
| 96 | - throw new RuntimeException('Not implemented'); |
|
| 96 | + throw new RuntimeException('Not implemented'); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -66,46 +66,46 @@ |
||
| 66 | 66 | return $dest; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function close() |
|
| 70 | - { |
|
| 71 | - if ($this->closed) { |
|
| 72 | - return; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - $this->closed = true; |
|
| 76 | - |
|
| 77 | - // stop listening for incoming events |
|
| 78 | - $this->input->removeListener('data', array($this, 'handleData')); |
|
| 79 | - $this->input->removeListener('error', array($this, 'handleError')); |
|
| 80 | - $this->input->removeListener('end', array($this, 'handleEnd')); |
|
| 81 | - $this->input->removeListener('close', array($this, 'close')); |
|
| 82 | - |
|
| 83 | - // resume the stream to ensure we discard everything from incoming connection |
|
| 84 | - if ($this->paused) { |
|
| 85 | - $this->paused = false; |
|
| 86 | - $this->input->resume(); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - $this->emit('close'); |
|
| 90 | - $this->removeAllListeners(); |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - /** @internal */ |
|
| 94 | - public function handleData($data) |
|
| 95 | - { |
|
| 69 | + public function close() |
|
| 70 | + { |
|
| 71 | + if ($this->closed) { |
|
| 72 | + return; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + $this->closed = true; |
|
| 76 | + |
|
| 77 | + // stop listening for incoming events |
|
| 78 | + $this->input->removeListener('data', array($this, 'handleData')); |
|
| 79 | + $this->input->removeListener('error', array($this, 'handleError')); |
|
| 80 | + $this->input->removeListener('end', array($this, 'handleEnd')); |
|
| 81 | + $this->input->removeListener('close', array($this, 'close')); |
|
| 82 | + |
|
| 83 | + // resume the stream to ensure we discard everything from incoming connection |
|
| 84 | + if ($this->paused) { |
|
| 85 | + $this->paused = false; |
|
| 86 | + $this->input->resume(); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + $this->emit('close'); |
|
| 90 | + $this->removeAllListeners(); |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + /** @internal */ |
|
| 94 | + public function handleData($data) |
|
| 95 | + { |
|
| 96 | 96 | $this->emit('data', array($data)); |
| 97 | - } |
|
| 98 | - |
|
| 99 | - /** @internal */ |
|
| 100 | - public function handleEnd() |
|
| 101 | - { |
|
| 102 | - $this->emit('end'); |
|
| 103 | - $this->close(); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - /** @internal */ |
|
| 107 | - public function handleError(\Exception $e) |
|
| 108 | - { |
|
| 109 | - $this->emit('error', array($e)); |
|
| 110 | - } |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + /** @internal */ |
|
| 100 | + public function handleEnd() |
|
| 101 | + { |
|
| 102 | + $this->emit('end'); |
|
| 103 | + $this->close(); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + /** @internal */ |
|
| 107 | + public function handleError(\Exception $e) |
|
| 108 | + { |
|
| 109 | + $this->emit('error', array($e)); |
|
| 110 | + } |
|
| 111 | 111 | } |