Class: ScmController

Inherits:
ApplicationController show all
Defined in:
app/controllers/scm_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#initialize, #load_project

Constructor Details

This class inherits a constructor from ApplicationController

Instance Method Details

#checkoutObject

Checks out a working copy into the project’s checkout dir.



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/scm_controller.rb', line 6

def checkout
  load_project

  # Do this asynch to give a fast response
  # TODO: guard against multiple concurrent checkouts
  # TODO: put the thread on the daemon side instead
  Thread.new do
    @project.checkout
  end

  # Doing a redirect since this *should* be called via HTTP POST. TODO: verify METHOD
  redirect_to :action => "checkout_status", :id => @project.name
end

#checkout_listObject

Sends the file containing the files currently being checked out.to the client



27
28
29
30
31
32
33
34
# File 'app/controllers/scm_controller.rb', line 27

def checkout_list
  load_project
  if(File.exist?(@project.checkout_list_file))
    send_file(@project.checkout_list_file)
  else
    render_text("No files checked out yet")
  end
end

#checkout_statusObject

Shows the status page with the JS magic that will pull the checkout_list



22
23
24
# File 'app/controllers/scm_controller.rb', line 22

def checkout_status
  @checkout_list_path = "/scm/checkout_list/#{@params['id']}"
end

#createObject

Creates the SCM repo



37
38
39
40
41
# File 'app/controllers/scm_controller.rb', line 37

def create
  load_project
  @project.scm.create
  redirect_to :controller => "project", :action => "view", :id => @project.name
end

#delete_working_copyObject



43
44
45
46
47
# File 'app/controllers/scm_controller.rb', line 43

def delete_working_copy
  load_project
  @project.delete_working_copy
  redirect_to :controller => "project", :action => "view", :id => @project.name
end