Changeset 93

Show
Ignore:
Timestamp:
06/21/07 14:52:16 (2 years ago)
Author:
mbailey
Message:

trac works

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1-7-stable/lib/deprec/recipes/trac.rb

    r87 r93  
    11Capistrano.configuration(:must_exist).load do 
    22     
    3   set :trac_path, lambda { deploy_to ? "#{deploy_to}/trac" : Capistrano::CLI.password_prompt('path to trac config: ') } 
    4        
     3  set (:trac_path) do 
     4    deploy_to ? "#{deploy_to}/trac" : Capistrano::CLI.prompt('path to trac config: ') 
     5  end 
     6  set (:trac_account) do 
     7    Capistrano::CLI.prompt('account name: ') 
     8  end   
     9  set :trac_passwordfile_exists, true # hack - should check on remote system instead 
     10   
    511  task :trac_install, :roles => :scm do 
    612    version = 'trac-0.10.4' 
     
    2228    trac_init 
    2329    trac_config 
     30    set :trac_account, user 
     31    set :trac_passwordfile_exists, false # hack - should check on remote system instead 
     32    trac_user_add 
     33    trac_disable_anon 
    2434  end 
    2535   
    2636  task :trac_init, :roles => :scm do 
    27     puts trac_path + 'foo' 
    2837    sudo "trac-admin #{trac_path} initenv #{application} sqlite:db/trac.db svn #{repos_root} /usr/local/share/trac/templates" 
    2938  end 
     
    3544  task :trac_start, :roles => :scm do 
    3645    # XXX enable this for cap2 
    37     # XXX run "echo point your browser to http://$CAPISTRANO:HOST$:8000/trac"     
    38     sudo "tracd --port 8000 #{trac_path}" 
     46    # XXX run "echo point your browser to http://$CAPISTRANO:HOST$:8000/trac"   
     47    auth_string = "--auth=*,#{trac_path}/conf/users.htdigest,#{application}" 
     48    sudo "tracd #{auth_string} --port 8000 #{trac_path}" 
     49  end 
     50   
     51  desc "create a trac user" 
     52  task :trac_user_add, :roles => :scm do 
     53    create_file = trac_passwordfile_exists ? '' : ' -c ' 
     54    htdigest = '/usr/local/apache2/bin/htdigest' 
     55    # XXX check if htdigest file exists and add '-c' option if not 
     56    # sudo "test -f #{trac_path/conf/users.htdigest} 
     57    create_file = trac_passwordfile_exists ? '' : ' -c ' 
     58    sudo_with_input("#{htdigest} #{create_file} #{trac_path}/conf/users.htdigest #{application} #{trac_account}", /password:/)  
     59    sudo "trac-admin #{trac_path} permission add anonymous '*'" 
     60    sudo "trac-admin #{trac_path} permission add authenticated TRAC_ADMIN" 
     61  end 
     62   
     63  desc "list trac users" 
     64  task :trac_list_users, :roles => :scm do 
     65    sudo "cat #{trac_path}/conf/users.htdigest" 
     66  end 
     67   
     68  desc "disable anonymous access to everything" 
     69  task :trac_disable_anon, :roles => :scm do 
     70    sudo "trac-admin #{trac_path} permission remove anonymous '*'" 
    3971  end 
    4072