Method: Frontline::Index#post_git
- Defined in:
- lib/frontline/controllers/index.rb
#post_git(command) ⇒ Object
run given Git task and stream result to browser.
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/frontline/controllers/index.rb', line 136 def post_git command case command when 'init' cmd = 'git init' when 'origin' url = params[:url] || halt(400, 'Please provide remote URL') cmd = 'git remote add origin "%s"' % url.gsub('"', '\"') when 'commit' = params[:message] || halt(400, 'Can not deploy without a deploy message') cmd = 'git add . && git commit -am "%s"' % .gsub('"', '\"') when 'push' cmd = 'git push' else halt(400, 'Unknown command "%s"' % command) end @uuid = params.delete('uuid') stream do pty_stream 'modal', 'show' passed, failure_id = pty_spawn(cmd) if passed pty_stream 'modal', 'hide' else pty_stream 'failures', failure_id end end end |