deprec 1.7.1 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,45 @@
1
+ Capistrano.configuration(:must_exist).load do
2
+
3
+ set :memcache_ip, '127.0.0.1'
4
+ set :memcache_port, 11211
5
+ set :memcache_memory, 256
6
+
7
+ # XXX needs thought/work
8
+ task :memcached_start do
9
+ run "memcached -d -m #{memcache_memory} -l #{memcache_ip} -p #{memcache_port}"
10
+ end
11
+
12
+ # XXX needs thought/work
13
+ task :memcached_stop do
14
+ run "killall memcached"
15
+ end
16
+
17
+ # XXX needs thought/work
18
+ task :memcached_restart do
19
+ memcached_stop
20
+ memcached_start
21
+ end
22
+
23
+ task :install_memcached do
24
+ version = 'memcached-1.2.2'
25
+ set :src_package, {
26
+ :file => version + '.tar.gz',
27
+ :md5sum => 'a08851f7fa7b15e92ee6320b7a79c321 memcached-1.2.2.tar.gz',
28
+ :dir => version,
29
+ :url => "http://www.danga.com/memcached/dist/#{version}.tar.gz",
30
+ :unpack => "tar zxf #{version}.tar.gz;",
31
+ :configure => %w{
32
+ ./configure
33
+ --prefix=/usr/local
34
+ ;
35
+ }.reject{|arg| arg.match '#'}.join(' '),
36
+ :make => 'make;',
37
+ :install => 'make install;',
38
+ :post_install => 'install -b support/apachectl /etc/init.d/httpd;'
39
+ }
40
+ apt.install( {:base => %w(libevent-dev)}, :stable )
41
+ deprec.download_src(src_package, src_dir)
42
+ deprec.install_from_src(src_package, src_dir)
43
+ end
44
+
45
+ end
@@ -1,4 +1,5 @@
1
1
  require 'fileutils'
2
+ require 'uri'
2
3
 
3
4
  Capistrano.configuration(:must_exist).load do
4
5
 
@@ -9,23 +10,67 @@ Capistrano.configuration(:must_exist).load do
9
10
  #
10
11
  # however the SVN docs convinced me it's probably overkill.
11
12
  # http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.serverconfig.pathbasedauthz
13
+ #
12
14
  set :scm_group, 'scm'
13
15
 
14
- set :svn_root, '/usr/local/svn'
16
+ # The following values define the svn repository to work with.
17
+ # If any are undefined but :repository is set, we'll extract the
18
+ # necessary values from it, otherwise we'll prompt the user.
19
+ #
20
+ # An example of :repository entries are:
21
+ #
22
+ # set :repository, 'svn+ssh://scm.deprecated.org/var/svn/deprec/trunk'
23
+ # set :repository, 'file:///tmp/svn/deprec/trunk'
24
+ #
25
+ # I've only used svn+ssh but it shouldn't be hard to get the file scheme working.
26
+ #
27
+ set (:svn_scheme) do
28
+ repository ? URI.parse(repository).scheme : 'svn+ssh'
29
+ end
30
+
31
+ set (:scm_host) do
32
+ if repository
33
+ URI.parse(repository).host || 'localhost'
34
+ elsif ENV['HOSTS']
35
+ svn_host = ENV['HOSTS']
36
+ else
37
+ Capistrano::CLI.password_prompt('svn host: ')
38
+ end
39
+ end
40
+
41
+ # This is the actual path in the svn repos where we'll check our project into
42
+ set (:repos_path) do
43
+ repository ? URI.parse(repository).path : Capistrano::CLI.password_prompt('svn repos path: ')
44
+ end
45
+
46
+ # We'll calculate this based on the repos_path. It's used when initializing the repository
47
+ set (:repos_root) do
48
+ (repository ? URI.parse(repository).path : repos_path).sub(/\/(trunk|tags|branches)$/, '')
49
+ end
15
50
 
51
+ # account name to perform actions on
52
+ # this is a hack to allow us to optionally pass a variable to tasks
53
+ set (:svn_account) do
54
+ Capistrano::CLI.prompt('account name: ')
55
+ end
16
56
 
57
+ # XXX sudo apt-get install swig python-dev
58
+ # XXX requires apache already installed...
17
59
  desc "install Subversion version control system"
18
- task :install_svn do
60
+ task :svn_install, :roles => :scm do
19
61
  # svn 1.4 server improves on 1.3 and is backwards compatible with 1.3 clients
20
62
  # http://subversion.tigris.org/svn_1.4_releasenotes.html
21
63
  #
22
64
  # We're using FSFS instead of BerkeleyDB. Read why below:
23
65
  # http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.reposadmin.basics.backends
24
66
  #
25
- version = 'subversion-1.4.3'
67
+ # NOTE: we're bulding the python bindings for trac
68
+ # ./subversion/bindings/swig/INSTALL
69
+ #
70
+ version = 'subversion-1.4.4'
26
71
  set :src_package, {
27
72
  :file => version + '.tar.gz',
28
- :md5sum => '6b991b63e3e1f69670c9e15708e40176 subversion-1.4.3.tar.gz',
73
+ :md5sum => '702655defa418bab8f683f6268b4fd30 subversion-1.4.4.tar.gz',
29
74
  :dir => version,
30
75
  :url => "http://subversion.tigris.org/downloads/#{version}.tar.gz",
31
76
  :unpack => "tar zxf #{version}.tar.gz;",
@@ -35,32 +80,60 @@ Capistrano.configuration(:must_exist).load do
35
80
  --with-apxs=/usr/local/apache2/bin/apxs
36
81
  --with-apr=/usr/local/apache2
37
82
  --with-apr-util=/usr/local/apache2
83
+ PYTHON=/usr/bin/python
38
84
  ;
39
85
  ).reject{|arg| arg.match '#'}.join(' ') , # DRY this up
40
86
  :make => 'make;',
41
- :install => 'make install;'
87
+ :install => 'make install;',
88
+ :post_install => '
89
+ make swig-py;
90
+ make install-swig-py;
91
+ echo /usr/local/lib/svn-python > /usr/lib/python2.4/site-packages/subversion.pth;
92
+ '
42
93
  }
43
- apt.install( {:base => %w(libneon25 libneon25-dev)}, :stable )
94
+ enable_universe
95
+ apt.install( {:base => %w(libneon25 libneon25-dev swig python-dev)}, :stable )
44
96
  deprec.download_src(src_package, src_dir)
45
97
  deprec.install_from_src(src_package, src_dir)
46
98
  end
47
99
 
48
- desc "create a repository and import a project"
49
- task :svn_create_repos, :roles => :scm do
50
- svn_repos ||= "#{svn_root}/#{application}"
100
+ desc "grant a user access to svn repos"
101
+ task :svn_grant_user_access, :roles => :scm do
102
+ deprec.useradd(svn_account)
51
103
  deprec.groupadd(scm_group)
52
- deprec.add_user_to_group(user, scm_group)
53
- deprec.mkdir(svn_root, :mode => '0755')
54
- deprec.mkdir(svn_repos, :mode => '2775', :group => scm_group)
55
- sudo "svnadmin verify #{svn_repos} > /dev/null 2>&1 || sudo svnadmin create #{svn_repos}"
56
- sudo "chmod -R g+w #{svn_repos}"
104
+ deprec.add_user_to_group(svn_account, scm_group)
105
+ end
106
+
107
+ task :scm_setup do # deprecated
108
+ svn_setup
109
+ end
110
+
111
+ task :svn_setup do
112
+ svn_import_project
113
+ end
114
+
115
+ desc "Create subversion repository and import project into it"
116
+ task :svn_import_project, :roles => :scm do
117
+ svn_create_repos
118
+ svn_import
57
119
  end
58
-
59
- # XXX check through and test the next two [mike]
60
120
 
61
- # from Bradley Taylors RailsMachine gem
62
- desc "Import code into svn repository."
63
- task :svn_import do
121
+ desc "Create a subversion repository"
122
+ task :svn_create_repos, :roles => :scm do
123
+ set :svn_account, user
124
+ svn_grant_user_access
125
+ # deprec.useradd(user)
126
+ # deprec.groupadd(scm_group)
127
+ # deprec.add_user_to_group(user, scm_group)
128
+ deprec.mkdir(repos_root, :mode => '2775', :group => scm_group)
129
+ sudo "svnadmin verify #{repos_root} > /dev/null 2>&1 || sudo svnadmin create #{repos_root}"
130
+ sudo "chmod -R g+w #{repos_root}"
131
+ end
132
+
133
+ # Adapted from code in Bradley Taylors RailsMachine gem
134
+ desc "Import project into subversion repository."
135
+ task :svn_import, :roles => :scm do
136
+ repository ||= "#{svn_scheme}://#{scm_host == 'localhost' ? '/' : scm_host}/#{repos_path}"
64
137
  new_path = "../#{application}"
65
138
  tags = repository.sub("trunk", "tags")
66
139
  branches = repository.sub("trunk", "branches")
@@ -75,43 +148,41 @@ Capistrano.configuration(:must_exist).load do
75
148
  puts "Checking out application."
76
149
  system "svn co #{repository} #{application}"
77
150
  Dir.chdir application
78
- puts "removing log directory contents from svn"
79
- system "svn remove log/*"
80
- puts "ignoring log directory"
81
- system "svn propset svn:ignore '*.log' log/"
82
- system "svn update log/"
83
- puts "removing tmp directory from svn"
84
- system "svn remove tmp/"
85
- puts "ignoring tmp directory"
86
- system "svn propset svn:ignore '*' tmp/"
87
- system "svn update tmp/"
88
- puts "committing changes"
89
- system "svn commit -m 'Removed and ignored log files and tmp'"
151
+ svn_remove_log_and_tmp
90
152
  puts "Your repository is: #{repository}"
91
153
  end
92
154
 
93
- # from Bradley Taylors RailsMachine gem
155
+ # Lifted from Bradley Taylors RailsMachine gem
94
156
  desc "remove and ignore log files and tmp from subversion"
95
- task :svn_remove_log_and_tmp do
157
+ task :svn_remove_log_and_tmp, :roles => :scm do
96
158
  puts "removing log directory contents from svn"
97
159
  system "svn remove log/*"
98
160
  puts "ignoring log directory"
99
161
  system "svn propset svn:ignore '*.log' log/"
100
162
  system "svn update log/"
101
- puts "removing tmp directory from svn"
102
- system "svn remove tmp/"
163
+ puts "removing contents of tmp sub-directorys from svn"
164
+ system "svn remove tmp/cache/*"
165
+ system "svn remove tmp/pids/*"
166
+ system "svn remove tmp/sessions/*"
167
+ system "svn remove tmp/sockets/*"
103
168
  puts "ignoring tmp directory"
104
- system "svn propset svn:ignore '*' tmp/"
169
+ system "svn propset svn:ignore '*' tmp/cache"
170
+ system "svn propset svn:ignore '*' tmp/pids"
171
+ system "svn propset svn:ignore '*' tmp/sessions"
172
+ system "svn propset svn:ignore '*' tmp/sockets"
105
173
  system "svn update tmp/"
106
174
  puts "committing changes"
107
175
  system "svn commit -m 'Removed and ignored log files and tmp'"
108
176
  end
109
177
 
110
- desc "Cache svn name and password on the server. Useful for http-based repositories."
178
+ # desc "Cache svn name and password on the server. Useful for http-based repositories."
111
179
  task :svn_cache_credentials do
112
180
  run_with_input "svn list #{repository}"
113
181
  end
114
182
 
183
+
184
+
185
+
115
186
  # XXX TODO
116
187
  # desc "backup repository"
117
188
  # task :svn_backup_respository, :roles => :scm do
@@ -1,6 +1,17 @@
1
1
  Capistrano.configuration(:must_exist).load do
2
2
 
3
- task :install_trac do
3
+ set :trac_password_file, lambda { "#{trac_path}/conf/users.htdigest" }
4
+ set :trac_pidfile, lambda { "#{deploy_to}/shared/pids/trac.pid" }
5
+ set :tracd_port, '9000'
6
+ set (:trac_path) do
7
+ deploy_to ? "#{deploy_to}/trac" : Capistrano::CLI.prompt('path to trac config: ')
8
+ end
9
+ set (:trac_account) do
10
+ Capistrano::CLI.prompt('enter new trac user account name: ')
11
+ end
12
+ set :trac_passwordfile_exists, true # hack - should check on remote system instead
13
+
14
+ task :trac_install, :roles => :scm do
4
15
  version = 'trac-0.10.4'
5
16
  set :src_package, {
6
17
  :file => version + '.tar.gz',
@@ -10,8 +21,78 @@ Capistrano.configuration(:must_exist).load do
10
21
  :unpack => "tar zxf #{version}.tar.gz;",
11
22
  :install => 'python ./setup.py install --prefix=/usr/local;'
12
23
  }
24
+ enable_universe
25
+ apt.install( {:base => %w(python-sqlite sqlite python-clearsilver)}, :stable )
13
26
  deprec.download_src(src_package, src_dir)
14
27
  deprec.install_from_src(src_package, src_dir)
15
- # mysql.create_database(wordpress_db_name, wordpress_db_user, wordpress_db_pass )
16
28
  end
29
+
30
+ task :trac_create_pid_dir, :roles => :scm do
31
+ deprec.mkdir(File.dirname(trac_pidfile))
32
+ end
33
+
34
+ task :trac_setup, :roles => :scm do
35
+ trac_init
36
+ trac_config
37
+ # create trac account for current user
38
+ set :trac_account, user
39
+ set :trac_passwordfile_exists, false # hack - should check on remote system instead
40
+ trac_user_add
41
+
42
+ trac_create_pid_dir
43
+ end
44
+
45
+ task :trac_init, :roles => :scm do
46
+ sudo "trac-admin #{trac_path} initenv #{application} sqlite:db/trac.db svn #{repos_root} /usr/local/share/trac/templates"
47
+ trac_set_default_permissions
48
+ end
49
+
50
+ task :trac_set_default_permissions, :roles => :scm do
51
+ trac_anonymous_disable
52
+ trac_authenticated_enable
53
+ end
54
+
55
+ # desc "disable anonymous access to everything"
56
+ task :trac_anonymous_disable, :roles => :scm do
57
+ sudo "trac-admin #{trac_path} permission remove anonymous '*'"
58
+ end
59
+
60
+ # desc "enable authenticated users access to everything"
61
+ task :trac_authenticated_enable, :roles => :scm do
62
+ sudo "trac-admin #{trac_path} permission add authenticated TRAC_ADMIN"
63
+ end
64
+
65
+ task :trac_config, :roles => :scm do
66
+ deprec.render_template_to_file('trac.ini.erb', "#{trac_path}/conf/trac.ini")
67
+ end
68
+
69
+ task :trac_start, :roles => :scm do
70
+ # XXX enable this for cap2
71
+ # XXX run "echo point your browser to http://$CAPISTRANO:HOST$:#{tracd_port}/trac"
72
+ auth_string = "--auth=*,#{trac_password_file},#{application}"
73
+ sudo "tracd #{auth_string} --daemonize --single-env --port=#{tracd_port} --pidfile=#{trac_pidfile} #{trac_path}"
74
+ end
75
+
76
+ task :trac_stop, :roles => :scm do
77
+ sudo "kill `cat #{trac_pidfile}` >/dev/null 2>&1"
78
+ sudo "rm -f #{trac_pidfile}"
79
+ end
80
+
81
+ desc "create a trac user"
82
+ task :trac_user_add, :roles => :scm do
83
+ create_file = trac_passwordfile_exists ? '' : ' -c '
84
+ htdigest = '/usr/local/apache2/bin/htdigest'
85
+ # XXX check if htdigest file exists and add '-c' option if not
86
+ # sudo "test -f #{trac_path/conf/users.htdigest}
87
+ create_file = trac_passwordfile_exists ? '' : ' -c '
88
+ sudo_with_input("#{htdigest} #{create_file} #{trac_path}/conf/users.htdigest #{application} #{trac_account}", /password:/)
89
+ end
90
+
91
+ desc "list trac users"
92
+ task :trac_list_users, :roles => :scm do
93
+ sudo "cat #{trac_path}/conf/users.htdigest"
94
+ end
95
+
96
+
97
+
17
98
  end
@@ -0,0 +1,106 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ [attachment]
4
+ max_size = 262144
5
+ render_unsafe_content = false
6
+
7
+ [browser]
8
+ downloadable_paths = /trunk, /branches/*, /tags/*
9
+ hide_properties = svk:merge
10
+ render_unsafe_content = false
11
+
12
+ [changeset]
13
+ max_diff_bytes = 10000000
14
+ max_diff_files = 0
15
+ wiki_format_messages = true
16
+
17
+ [header_logo]
18
+ alt =
19
+ height = -1
20
+ link = http://example.org/
21
+ src = common/trac_banner.png
22
+ width = -1
23
+
24
+ [logging]
25
+ log_file = trac.log
26
+ # log_format = <set in global trac.ini>
27
+ log_level = DEBUG
28
+ log_type = none
29
+
30
+ [mimeviewer]
31
+ enscript_modes = text/x-dylan:dylan:4
32
+ enscript_path = enscript
33
+ max_preview_size = 262144
34
+ mime_map = text/x-dylan:dylan,text/x-idl:ice,text/x-ada:ads:adb
35
+ php_path = php
36
+ silvercity_modes =
37
+ tab_width = 8
38
+
39
+ [notification]
40
+ always_notify_owner = false
41
+ always_notify_reporter = false
42
+ always_notify_updater = true
43
+ mime_encoding = base64
44
+ smtp_always_bcc =
45
+ smtp_always_cc =
46
+ smtp_default_domain =
47
+ smtp_enabled = false
48
+ smtp_from = trac@localhost
49
+ smtp_password =
50
+ smtp_port = 25
51
+ smtp_replyto = trac@localhost
52
+ smtp_server = localhost
53
+ smtp_subject_prefix = __default__
54
+ smtp_user =
55
+ use_public_cc = false
56
+ use_short_addr = false
57
+ use_tls = false
58
+
59
+ [project]
60
+ descr = My example project
61
+ footer = Visit the Trac open source project at<br /><a href="http://trac.edgewall.org/">http://trac.edgewall.org/</a>
62
+ icon = common/trac.ico
63
+ name = <%= application %>
64
+ url = http://example.org/
65
+
66
+ [search]
67
+ min_query_length = 3
68
+
69
+ [ticket]
70
+ default_component =
71
+ default_milestone =
72
+ default_priority = major
73
+ default_type = defect
74
+ default_version =
75
+ restrict_owner = false
76
+
77
+ [timeline]
78
+ changeset_long_messages = false
79
+ changeset_show_files = 0
80
+ default_daysback = 30
81
+ ticket_show_details = false
82
+
83
+ [trac]
84
+ authz_file =
85
+ authz_module_name =
86
+ base_url =
87
+ check_auth_ip = true
88
+ database = sqlite:db/trac.db
89
+ default_charset = iso-8859-15
90
+ default_handler = WikiModule
91
+ htdocs_location =
92
+ ignore_auth_case = false
93
+ mainnav = wiki,timeline,roadmap,browser,tickets,newticket,search
94
+ metanav = login,logout,settings,help,about
95
+ permission_store = DefaultPermissionStore
96
+ repository_dir = <%= repos_root %>
97
+ repository_type = svn
98
+ # request_filters = <set in global trac.ini>
99
+ # templates_dir = <set in global trac.ini>
100
+ timeout = 20
101
+
102
+ [wiki]
103
+ ignore_missing_pages = false
104
+ render_unsafe_content = false
105
+ split_page_names = false
106
+