keithsalisbury-subtrac 0.1.7 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +133 -0
- data/VERSION.yml +1 -1
- data/lib/subtrac.rb +208 -91
- data/lib/subtrac/config/config.yml +1 -1
- data/lib/subtrac/templates/location.erb +3 -3
- data/lib/subtrac/templates/trac.erb +2 -2
- data/lib/subtrac/templates/vhost.erb +7 -7
- metadata +2 -3
- data/lib/subtrac/common/trac.ini +0 -178
data/README.markdown
CHANGED
@@ -21,6 +21,139 @@ For all users, you can add it here:
|
|
21
21
|
|
22
22
|
...
|
23
23
|
export PATH=$PATH:/var/lib/gems/1.8/bin
|
24
|
+
|
25
|
+
|
26
|
+
# Installing on VirtualBox
|
27
|
+
|
28
|
+
Start with a Fresh VM Image
|
29
|
+
Install jeos (hardy)
|
30
|
+
# mount guest additions -
|
31
|
+
sudo mount /media/cdrom0/ -o unhide
|
32
|
+
|
33
|
+
# install gcc and make
|
34
|
+
sudo aptitude install build-essential linux-headers-`uname -r`
|
35
|
+
|
36
|
+
# install the guest additions
|
37
|
+
sudo /cdrom/VBoxLinuxAdditions-x86.run all
|
38
|
+
|
39
|
+
# install openssh-server?
|
40
|
+
sudo apt-get install openssh-server
|
41
|
+
|
42
|
+
# install gems
|
43
|
+
sudo apt-get install ruby rubygems
|
44
|
+
|
45
|
+
# update gems
|
46
|
+
sudo apt-get update --system
|
47
|
+
|
48
|
+
# edit bash.bashrc so all users can run the gem binaries
|
49
|
+
sudo vi /etc/bash.bashrc
|
50
|
+
|
51
|
+
# add github to the gem sources list
|
52
|
+
sudo gem sources -a http://gems.github.com
|
53
|
+
|
54
|
+
# some other pre-requisites
|
55
|
+
sudo aptitude install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 sqlite3
|
56
|
+
|
57
|
+
# install subtrac gem package
|
58
|
+
sudo gem install --include-dependencies keithsalisbury-subtrac
|
59
|
+
|
60
|
+
# enable mod_rewrite
|
61
|
+
a2enmod rewrite
|
62
|
+
|
63
|
+
# enable dav
|
64
|
+
sudo apt-get install libapache2-svn
|
65
|
+
|
66
|
+
# enable mod_python
|
67
|
+
sudo apt-get install libapache2-mod-python libapache2-mod-python-doc
|
68
|
+
|
69
|
+
sudo apt-get install apache2 libapache2-mod-python \
|
70
|
+
libapache2-svn python-setuptools subversion python-subversion
|
71
|
+
sudo easy_install Trac
|
72
|
+
|
73
|
+
# some trac plugin requirements
|
74
|
+
sudo apt-get install build-essential graphviz
|
75
|
+
sudo apt-get install htmldoc
|
76
|
+
sudo apt-get install enscript
|
77
|
+
|
78
|
+
easy_install -U setuptools
|
79
|
+
|
80
|
+
# some cool plugins
|
81
|
+
sudo easy_install http://svn.edgewall.org/repos/genshi/trunk/
|
82
|
+
sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk
|
83
|
+
sudo easy_install http://trac-hacks.org/svn/customfieldadminplugin/0.11
|
84
|
+
sudo easy_install http://trac-hacks.org/svn/eclipsetracplugin/tracrpcext/0.10
|
85
|
+
sudo easy_install http://trac-hacks.org/svn/iniadminplugin/0.11
|
86
|
+
sudo easy_install http://trac-hacks.org/svn/masterticketsplugin/0.11
|
87
|
+
sudo easy_install http://trac-hacks.org/svn/pagetopdfplugin/0.10/
|
88
|
+
sudo easy_install http://trac-hacks.org/svn/progressmetermacro/0.11
|
89
|
+
sudo easy_install http://trac-hacks.org/svn/ticketdeleteplugin/0.11
|
90
|
+
sudo easy_install http://trac-hacks.org/svn/tracwysiwygplugin/0.11
|
91
|
+
sudo easy_install http://wikinotification.ufsoft.org/svn/trunk
|
92
|
+
|
93
|
+
# install subtrac server
|
94
|
+
sudo subtrac install [--clean]
|
95
|
+
|
96
|
+
# Mount a shared host folder from the VM Guest
|
97
|
+
mount.vboxsf pkg /mnt/subtrac/
|
98
|
+
|
99
|
+
# Setting up VM to use an internal loop back interface
|
100
|
+
|
101
|
+
## Create the interal interface
|
102
|
+
Snakey:~ adambarton$ sudo -i
|
103
|
+
Snakey:~ root# python
|
104
|
+
Python 2.5.1 (r251:54863, Apr 15 2008, 22:57:26)
|
105
|
+
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
|
106
|
+
Type "help", "copyright", "credits" or "license" for more information.
|
107
|
+
>>> import os
|
108
|
+
>>> file_path = '/dev/tap1'
|
109
|
+
>>> dev_file = os.open(file_path, os.O_RDWR)
|
110
|
+
>>> interface = 'tap1'
|
111
|
+
|
112
|
+
Leave this window open...
|
113
|
+
|
114
|
+
## Configure the interface
|
115
|
+
|
116
|
+
Snakey:~ root# ifconfig tap1 10.0.2.100 up
|
117
|
+
Snakey:~ root# ifconfig tap1
|
118
|
+
tap1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
|
119
|
+
inet 100.100.100.100 netmask 0xff000000 broadcast 100.255.255.255
|
120
|
+
ether ea:a2:95:41:b0:8f
|
121
|
+
open (pid 4104)
|
122
|
+
|
123
|
+
## Configure the VM
|
124
|
+
|
125
|
+
VBoxManage modifyvm TestHost1 -nic1 hostif -hostifdev1 'tap1: ethernet'
|
126
|
+
|
127
|
+
Boot it, and give it a static address on the same subnet
|
128
|
+
|
129
|
+
## Assign a static ip
|
130
|
+
|
131
|
+
sudo vi /etc/networking/interfaces
|
132
|
+
|
133
|
+
# The primary network interface
|
134
|
+
auto eth0
|
135
|
+
iface eth0 inet static
|
136
|
+
address 10.0.2.2
|
137
|
+
netmask 255.255.255.0
|
138
|
+
network 10.0.2.0
|
139
|
+
broadcast 10.0.2.255
|
140
|
+
gateway 10.0.2.200
|
141
|
+
|
142
|
+
# The secondary network interface
|
143
|
+
auto eth1
|
144
|
+
iface eth0 inet dhcp
|
145
|
+
|
146
|
+
# For linux users there's an even cooler way to set this up...
|
147
|
+
|
148
|
+
http://muffinresearch.co.uk/archives/2009/04/08/virtualbox-access-guests-via-a-virtual-interface/
|
149
|
+
|
150
|
+
# OSX Map your new domain to the ip
|
151
|
+
|
152
|
+
sudo mate /private/etc/hosts
|
153
|
+
|
154
|
+
10.0.2.2 dev.subtrac.com
|
155
|
+
|
156
|
+
|
24
157
|
|
25
158
|
## Copyright
|
26
159
|
|
data/VERSION.yml
CHANGED
data/lib/subtrac.rb
CHANGED
@@ -41,11 +41,96 @@ require 'fileutils'
|
|
41
41
|
require 'subtrac/version'
|
42
42
|
|
43
43
|
module Subtrac
|
44
|
-
SUBTRAC_ROOT = File.join(File.dirname(__FILE__), "subtrac")
|
45
|
-
DEV_ENV = 'development' # should be a system environment var
|
46
|
-
|
47
|
-
attr_accessor :server_name, :server_hostname, :server_ip, :default_client, :default_project, :install_dir, :docs_dir, :conf_dir, :locations_dir, :svn_dir, :trac_dir, :temp_dir
|
48
44
|
|
45
|
+
SUBTRAC_ROOT = "#{File.dirname(__FILE__)}/" unless defined?(SUBTRAC_ROOT)
|
46
|
+
SUBTRAC_ENV = (ENV['SUBTRAC_ENV'] || 'development').dup unless defined?(SUBTRAC_ENV)
|
47
|
+
USER_CONFIG = 'config/user.yml'
|
48
|
+
|
49
|
+
class << self
|
50
|
+
|
51
|
+
# The Configuration instance used to configure the Subtrac environment
|
52
|
+
def configuration
|
53
|
+
@@configuration
|
54
|
+
end
|
55
|
+
|
56
|
+
def configuration=(configuration)
|
57
|
+
@@configuration = configuration
|
58
|
+
end
|
59
|
+
|
60
|
+
def initialized?
|
61
|
+
@initialized || false
|
62
|
+
end
|
63
|
+
|
64
|
+
def initialized=(initialized)
|
65
|
+
@initialized ||= initialized
|
66
|
+
end
|
67
|
+
|
68
|
+
def root
|
69
|
+
Pathname.new(SUBTRAC_ROOT) if defined?(SUBTRAC_ROOT)
|
70
|
+
end
|
71
|
+
|
72
|
+
def public_path
|
73
|
+
@@public_path ||= self.root ? File.join(self.root, "public") : "public"
|
74
|
+
end
|
75
|
+
|
76
|
+
def subtrac_path
|
77
|
+
@@subtrac_path ||= self.root ? File.join(self.root, "subtrac") : "subtrac"
|
78
|
+
end
|
79
|
+
|
80
|
+
def public_path=(path)
|
81
|
+
@@public_path = path
|
82
|
+
end
|
83
|
+
|
84
|
+
def docs_dir
|
85
|
+
@@docs_dir ||= File.join(@install_dir,@APP_CONFIG[:dirs][:docs])
|
86
|
+
end
|
87
|
+
|
88
|
+
def docs_dir=(dir)
|
89
|
+
@@docs_dir = dir
|
90
|
+
end
|
91
|
+
|
92
|
+
def svn_dir
|
93
|
+
@@svn_dir ||= File.join(@install_dir,@APP_CONFIG[:dirs][:svn])
|
94
|
+
end
|
95
|
+
|
96
|
+
def svn_dir=(dir)
|
97
|
+
@@svn_dir = dir
|
98
|
+
end
|
99
|
+
|
100
|
+
def trac_dir
|
101
|
+
@@trac_dir ||= File.join(@install_dir,@APP_CONFIG[:dirs][:trac])
|
102
|
+
end
|
103
|
+
|
104
|
+
def trac_dir=(dir)
|
105
|
+
@@trac_dir = dir
|
106
|
+
end
|
107
|
+
|
108
|
+
def temp_dir
|
109
|
+
@@temp_dir ||= File.join(@install_dir,@APP_CONFIG[:dirs][:temp])
|
110
|
+
end
|
111
|
+
|
112
|
+
def temp_dir=(dir)
|
113
|
+
@@temp_dir = dir
|
114
|
+
end
|
115
|
+
|
116
|
+
def log_dir
|
117
|
+
@@log_dir ||= File.join(@install_dir,@APP_CONFIG[:dirs][:log])
|
118
|
+
end
|
119
|
+
|
120
|
+
def log_dir=(dir)
|
121
|
+
@@log_dir = dir
|
122
|
+
end
|
123
|
+
|
124
|
+
def locations_dir
|
125
|
+
@@locations_dir ||= File.join(@install_dir,@APP_CONFIG[:dirs][:locations])
|
126
|
+
end
|
127
|
+
|
128
|
+
def locations_dir=(dir)
|
129
|
+
@@locations_dir = dir
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
|
49
134
|
module Commands
|
50
135
|
class Install
|
51
136
|
def initialize(args, options)
|
@@ -55,54 +140,34 @@ module Subtrac
|
|
55
140
|
end
|
56
141
|
class Create
|
57
142
|
def initialize(args, options)
|
58
|
-
project = ask("What is the name of the project you would like to create? ") if !options.project
|
59
|
-
client = ask("Which client is this project for? ") if !options.client
|
143
|
+
options.project = ask("What is the name of the project you would like to create? ") if !options.project
|
144
|
+
options.client = ask("Which client is this project for? ") if !options.client
|
145
|
+
# this needs to load the updated configuration?
|
60
146
|
Subtrac.load_config()
|
61
147
|
Subtrac.create_project(options.project,options.client)
|
62
148
|
end
|
63
149
|
end
|
64
150
|
end
|
65
|
-
|
66
|
-
# Install
|
67
|
-
def self.install(args,options)
|
68
|
-
puts "\n==== Installing development server files ===="
|
69
|
-
# Ask if the user agrees (yes or no)
|
70
|
-
confirm_clean = agree("Are you sure you would like a clean install? [Y/n]") if options.clean
|
71
|
-
# clear previous data
|
72
|
-
clean() if confirm_clean
|
73
|
-
# right lets install
|
74
|
-
change_server_name = agree("The default server name is \"#{@server_name}\". Would you like to change this? [Y/n]")
|
75
|
-
@server_name = ask("What would you like to call your new development server? ") if change_server_name
|
76
|
-
|
77
|
-
create_environment_directories()
|
78
|
-
install_common_files()
|
79
|
-
create_virtual_host()
|
80
|
-
confirm_default_client = agree("Do you want to create a default client project? [Y/n]")
|
81
|
-
# create default project and client
|
82
|
-
if confirm_default_client
|
83
|
-
change_client = agree("The default client name is \"#{@default_client}\". Would you like to change this? [Y/n]")
|
84
|
-
@default_client = ask("What client name would you like to use? ") if change_client
|
85
|
-
change_project = agree("The default project name is \"#{@default_project}\". Would you like to change this? [Y/n]")
|
86
|
-
@default_project = ask("What would you like to call your new project? ") if change_project
|
87
|
-
create_project(@default_project,@default_client)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
151
|
+
|
91
152
|
# Loads the configuration YML file
|
92
153
|
def self.load_config
|
154
|
+
# TODO: We need to refactor this code so it will load the default configuration only if one has not been created
|
93
155
|
puts "\n==== Loading configuration file ===="
|
94
156
|
# load configuration file
|
157
|
+
file_path = File.join(subtrac_path, USER_CONFIG)
|
158
|
+
file_path = File.join(subtrac_path,"/config/config.yml") if not File.exists?(file_path)
|
159
|
+
puts "Attempting to read config file: #{file_path}"
|
95
160
|
begin
|
96
|
-
raw_config = File.read(
|
161
|
+
raw_config = File.read(file_path)
|
97
162
|
yamlFile = YAML.load(raw_config)
|
98
163
|
rescue Exception => e
|
99
164
|
raise StandardError, "Config #{file_path} could not be loaded."
|
100
165
|
end
|
101
166
|
if yamlFile
|
102
|
-
if yamlFile[
|
103
|
-
@APP_CONFIG = yamlFile[
|
167
|
+
if yamlFile[SUBTRAC_ENV]
|
168
|
+
@APP_CONFIG = yamlFile[SUBTRAC_ENV]
|
104
169
|
else
|
105
|
-
raise StandardError, "config/config.yml exists, but doesn't have a configuration for
|
170
|
+
raise StandardError, "config/config.yml exists, but doesn't have a configuration for #{SUBTRAC_ENV}."
|
106
171
|
end
|
107
172
|
else
|
108
173
|
raise StandardError, "config/config.yml does not exist."
|
@@ -118,25 +183,69 @@ module Subtrac
|
|
118
183
|
@default_project = @APP_CONFIG[:default_project]
|
119
184
|
|
120
185
|
@install_dir = File.expand_path(@APP_CONFIG[:installation_dir])
|
121
|
-
@docs_dir = File.join(@install_dir,@APP_CONFIG[:dirs][:docs])
|
122
186
|
@conf_dir = @APP_CONFIG[:apache2_conf]
|
123
|
-
@locations_dir = File.join(@install_dir,@APP_CONFIG[:dirs][:conf_locations])
|
124
|
-
@svn_dir = File.join(@install_dir,@APP_CONFIG[:dirs][:svn])
|
125
|
-
@trac_dir = File.join(@install_dir,@APP_CONFIG[:dirs][:trac])
|
126
|
-
@temp_dir = File.join(@install_dir,@APP_CONFIG[:dirs][:temp])
|
127
|
-
@log_dir = File.join(@install_dir,@APP_CONFIG[:dirs][:log])
|
128
187
|
|
129
188
|
@ldap_bind_dn = @APP_CONFIG[:ldap][:bind_dn]
|
130
189
|
@ldap_bind_password = @APP_CONFIG[:ldap][:bind_password]
|
131
190
|
@ldap_url = @APP_CONFIG[:ldap][:host]
|
191
|
+
|
192
|
+
end
|
193
|
+
|
194
|
+
|
195
|
+
# Install
|
196
|
+
def self.install(args,options)
|
197
|
+
puts "\n==== Installing development server files ===="
|
198
|
+
# check where we are installing
|
199
|
+
change_install_dir = agree("The default installation directory is \"#{@install_dir}\". Would you like to change this? [Y/n]")
|
200
|
+
@install_dir = ask("Where would you like to install this server?") if change_install_dir
|
201
|
+
|
202
|
+
unless !File.directory?(@install_dir)
|
203
|
+
# Ask if the user agrees (yes or no)
|
204
|
+
confirm_clean = agree("Err, that dirctory's got stuff init. You sure you want me to overwrite? [Y/n]") if options.clean
|
205
|
+
end
|
132
206
|
|
207
|
+
# right lets install
|
208
|
+
change_server_name = agree("The default server name is \"#{@server_name}\". Would you like to change this? [Y/n]")
|
209
|
+
@server_name = ask("What would you like to call your new development server? ") if change_server_name
|
210
|
+
|
211
|
+
create_environment_directories(confirm_clean)
|
212
|
+
install_common_files()
|
213
|
+
# TODO: Need to check for default client/project before creating virtual host
|
214
|
+
# otherwise we need remove the rewrite rule
|
215
|
+
create_virtual_host()
|
216
|
+
confirm_default_client = agree("Do you want to create a default client project? [Y/n]")
|
217
|
+
# create default project and client
|
218
|
+
if confirm_default_client
|
219
|
+
change_client = agree("The default client name is \"#{@default_client}\". Would you like to change this? [Y/n]")
|
220
|
+
@default_client = ask("What client name would you like to use? ") if change_client
|
221
|
+
change_project = agree("The default project name is \"#{@default_project}\". Would you like to change this? [Y/n]")
|
222
|
+
@default_project = ask("What would you like to call your new project? ") if change_project
|
223
|
+
create_project(@default_project,@default_client)
|
224
|
+
end
|
225
|
+
save_config()
|
133
226
|
end
|
134
227
|
|
135
228
|
private
|
136
229
|
|
137
|
-
#
|
138
|
-
def self.
|
230
|
+
# Write the changes configuration to disk
|
231
|
+
def self.save_config
|
232
|
+
# save the things that might have changed
|
233
|
+
@APP_CONFIG[:server_name] = @server_name
|
234
|
+
@APP_CONFIG[:server_hostname] = @server_hostname
|
235
|
+
@APP_CONFIG[:server_ip] = @server_ip
|
236
|
+
|
237
|
+
@APP_CONFIG[:default_client] = @default_client
|
238
|
+
@APP_CONFIG[:default_project] = @default_project
|
239
|
+
|
240
|
+
@APP_CONFIG[:installation_dir] = @install_dir
|
241
|
+
@APP_CONFIG[:apache2_conf] = @conf_dir
|
139
242
|
|
243
|
+
@APP_CONFIG[:ldap][:bind_dn] = @ldap_bind_dn
|
244
|
+
@APP_CONFIG[:ldap][:bind_password] = @ldap_bind_password
|
245
|
+
@APP_CONFIG[:ldap][:host] = @ldap_url
|
246
|
+
|
247
|
+
file_path = File.join(subtrac_path, USER_CONFIG)
|
248
|
+
open(file_path, 'w') {|f| YAML.dump({SUBTRAC_ENV => @APP_CONFIG}, f)}
|
140
249
|
end
|
141
250
|
|
142
251
|
# creates a directory if it does not exist
|
@@ -167,53 +276,51 @@ module Subtrac
|
|
167
276
|
# creates a new virtual host and reloads apache and enables the new virtual host
|
168
277
|
def self.create_virtual_host
|
169
278
|
puts "\n==== Creating new virtual host ===="
|
170
|
-
vhost_template = File.join(
|
279
|
+
vhost_template = File.join(subtrac_path, @APP_CONFIG[:templates][:virtual_host])
|
280
|
+
puts "group apache tempalte: #{vhost_template}"
|
171
281
|
new_vhost = File.join(@conf_dir,@server_hostname)
|
172
|
-
|
282
|
+
puts "group apache file: #{new_vhost}"
|
283
|
+
parse_template(vhost_template,new_vhost,binding) if SUBTRAC_ENV != 'test'
|
173
284
|
# reload apache configuration
|
174
|
-
`/etc/init.d/apache2 force-reload` if
|
175
|
-
`a2ensite #{@server_hostname}` if
|
285
|
+
`/etc/init.d/apache2 force-reload` if SUBTRAC_ENV != 'test'
|
286
|
+
`a2ensite #{@server_hostname}` if SUBTRAC_ENV != 'test'
|
176
287
|
end
|
177
288
|
|
178
289
|
def self.install_common_files
|
179
290
|
puts "\n==== Installing common files ===="
|
180
291
|
# TODO: implement a mask for .svn folders
|
181
292
|
# TODO: refactor /common to the app config
|
182
|
-
|
183
|
-
|
184
|
-
dest = @docs_dir
|
185
|
-
FileUtils.cp_r(source,dest)
|
293
|
+
FileUtils.cp_r(Dir.glob(File.join(subtrac_path, "common/.")),docs_dir)
|
294
|
+
FileUtils.cp_r(Dir.glob(File.join(subtrac_path, "shared/.")),File.join(trac_dir, ".shared"))
|
186
295
|
end
|
187
296
|
|
188
|
-
def self.create_environment_directories
|
297
|
+
def self.create_environment_directories(overwrite=false)
|
189
298
|
puts "\n==== Creating new environment directories ===="
|
299
|
+
FileUtils.rm_rf @install_dir if overwrite
|
300
|
+
create_if_missing @install_dir
|
190
301
|
# create the environment directories
|
191
302
|
@APP_CONFIG[:dirs].each do |key, value|
|
192
|
-
|
303
|
+
dir = File.join(@install_dir,value)
|
304
|
+
create_if_missing dir
|
193
305
|
end
|
194
306
|
end
|
195
307
|
|
196
|
-
def self.clean
|
197
|
-
puts "\n==== Remove old data if exists ===="
|
198
|
-
@APP_CONFIG[:dirs].each do |key, value|
|
199
|
-
#TODO: Ask for confirmation - yes,no,All
|
200
|
-
puts "Deleting #{value}"
|
201
|
-
FileUtils.rm_rf value
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
308
|
def self.create_client(name)
|
206
309
|
puts "\n==== Create a new client called #{name} ===="
|
207
310
|
client_name = name.downcase
|
208
311
|
# create apache configuration
|
209
|
-
|
210
|
-
|
312
|
+
puts "subtrac_path: #{subtrac_path}"
|
313
|
+
puts "templates_location: #{@APP_CONFIG[:templates][:location]}"
|
314
|
+
location_template = File.join(subtrac_path, @APP_CONFIG[:templates][:location])
|
315
|
+
puts "location_template: #{location_template}"
|
316
|
+
location_conf = File.join(locations_dir,"#{client_name}.conf")
|
317
|
+
puts "location_conf: #{location_conf}"
|
211
318
|
parse_template(location_template,location_conf,binding)
|
212
|
-
`/etc/init.d/apache2 force-reload` if
|
319
|
+
`/etc/init.d/apache2 force-reload` if SUBTRAC_ENV != 'test'
|
213
320
|
|
214
321
|
# create svn+trac directory
|
215
|
-
create_if_missing File.join(
|
216
|
-
create_if_missing File.join(
|
322
|
+
create_if_missing File.join(svn_dir,client_name)
|
323
|
+
create_if_missing File.join(trac_dir,client_name)
|
217
324
|
end
|
218
325
|
|
219
326
|
def self.create_project(project, client)
|
@@ -223,51 +330,57 @@ module Subtrac
|
|
223
330
|
project_name = project.downcase
|
224
331
|
|
225
332
|
# create client directory if needed
|
226
|
-
create_client(client_name) if (!File.directory? File.join(
|
333
|
+
create_client(client_name) if (!File.directory? File.join(svn_dir,client_name))
|
334
|
+
|
335
|
+
project_svn_dir = File.join(svn_dir,client_name,project_name)
|
336
|
+
project_trac_dir = File.join(trac_dir,client_name,project_name)
|
227
337
|
|
228
|
-
|
229
|
-
|
230
|
-
if (File.directory? svn_dir) then
|
338
|
+
# TODO: Need to change this to use a 'groups' yml file
|
339
|
+
if (File.directory? project_svn_dir) then
|
231
340
|
raise StandardError, "A project called #{project} already exists in the #{client} repository. Would you like to replace it?"
|
232
341
|
end
|
233
342
|
|
234
343
|
# create new project directories
|
235
|
-
|
236
|
-
create_if_missing
|
344
|
+
say("Create project directories...")
|
345
|
+
create_if_missing project_svn_dir
|
346
|
+
create_if_missing project_trac_dir
|
237
347
|
|
238
|
-
project_template = File.join(
|
348
|
+
project_template = File.join(subtrac_path, @APP_CONFIG[:templates][:projects],@APP_CONFIG[:default_project_template])
|
239
349
|
|
240
350
|
# copy template svn project to a temp folder, then svn import it into the repo
|
351
|
+
say("Create temporary project directory and copy template files...")
|
241
352
|
svn_template_dir = File.join(project_template,"svn")
|
242
|
-
|
243
|
-
FileUtils.cp_r(svn_template_dir,
|
353
|
+
project_temp_dir = File.join(temp_dir,project_name)
|
354
|
+
FileUtils.cp_r(svn_template_dir,project_temp_dir)
|
244
355
|
|
245
356
|
# create a new subversion repository
|
246
357
|
say("Creating a new subversion repository...")
|
247
|
-
`svnadmin create #{
|
358
|
+
`svnadmin create #{project_svn_dir}` if SUBTRAC_ENV != 'test'
|
248
359
|
|
249
360
|
# import into svn
|
250
|
-
|
361
|
+
say("Importing temporary project into the new subversion repository...")
|
362
|
+
`svn import #{project_temp_dir} file:///#{project_svn_dir} --message "initial import"` if SUBTRAC_ENV != 'test'
|
251
363
|
# delete the temporary directory
|
252
|
-
FileUtils.rm_r(
|
364
|
+
FileUtils.rm_r(project_temp_dir, :force => true)
|
253
365
|
|
254
366
|
# create a new trac site
|
255
367
|
say("Creating a new trac site...")
|
256
|
-
result = `trac-admin #{
|
257
|
-
FileUtils.chown_R('www-data', 'www-data',
|
258
|
-
FileUtils.mkdir_p("#{
|
368
|
+
result = `trac-admin #{project_trac_dir} initenv #{project_name} sqlite:#{project_trac_dir}/db/trac.db svn #{project_svn_dir}` if SUBTRAC_ENV != 'test'
|
369
|
+
FileUtils.chown_R('www-data', 'www-data', project_trac_dir, :verbose => true) if SUBTRAC_ENV != 'test'
|
370
|
+
FileUtils.mkdir_p("#{project_trac_dir}/conf") if SUBTRAC_ENV == 'test' # fake the folder for tests
|
259
371
|
|
372
|
+
say("Installing trac configuration...")
|
260
373
|
# install shared trac.ini
|
261
|
-
trac_ini_template = File.join(
|
262
|
-
parse_template(trac_ini_template,File.join(
|
374
|
+
trac_ini_template = File.join(subtrac_path, @APP_CONFIG[:templates][:trac])
|
375
|
+
parse_template(trac_ini_template,File.join(project_trac_dir,"/conf/trac.ini"),binding)
|
263
376
|
|
264
377
|
# remove custom templates directory so trac uses the shared location (while we wait for trac patch)
|
265
|
-
FileUtils.rm_rf("#{
|
378
|
+
FileUtils.rm_rf("#{project_trac_dir}/templates")
|
266
379
|
|
267
|
-
say("Setting up default trac
|
380
|
+
say("Setting up default trac permissions...")
|
268
381
|
# set up trac permissions
|
269
382
|
@APP_CONFIG[:trac][:permissions].each do |key, value|
|
270
|
-
`trac-admin #{
|
383
|
+
`trac-admin #{project_trac_dir} permission add #{key} #{value}` if SUBTRAC_ENV != 'test'
|
271
384
|
end
|
272
385
|
|
273
386
|
say("Adding default trac wiki pages...")
|
@@ -275,13 +388,17 @@ module Subtrac
|
|
275
388
|
Dir.foreach("#{project_template}/trac/wiki/.") do |file|
|
276
389
|
# do something with the file here
|
277
390
|
unless ['.', '..','.svn'].include? file
|
278
|
-
temp_file = File.join(
|
391
|
+
temp_file = File.join(temp_dir,file)
|
279
392
|
parse_template(File.join(project_template,"trac/wiki",file), temp_file, binding)
|
280
|
-
`trac-admin #{
|
393
|
+
`trac-admin #{project_trac_dir} wiki import #{file} #{temp_file}` if SUBTRAC_ENV != 'test'
|
281
394
|
FileUtils.rm(temp_file)
|
282
395
|
end
|
283
396
|
end
|
284
|
-
|
397
|
+
|
398
|
+
# run trac upgrade
|
399
|
+
say("Upgrading the trac installation...")
|
400
|
+
`trac-admin #{project_trac_dir} upgrade` if SUBTRAC_ENV != 'test'
|
401
|
+
|
285
402
|
end
|
286
403
|
end
|
287
404
|
|
@@ -2,14 +2,14 @@
|
|
2
2
|
SetHandler mod_python
|
3
3
|
PythonInterpreter main_interpreter
|
4
4
|
PythonHandler trac.web.modpython_frontend
|
5
|
-
PythonOption TracEnvParentDir <%=
|
5
|
+
PythonOption TracEnvParentDir <%= trac_dir %>/<%= client_name %>
|
6
6
|
PythonOption TracUriRoot /<%= client_name %>
|
7
|
-
PythonOption TracEnvIndexTemplate <%=
|
7
|
+
PythonOption TracEnvIndexTemplate <%= trac_dir %>/<%= client_name %>/trac_theme/htdocs/index/index.html
|
8
8
|
PythonOption PYTHON_EGG_CACHE /tmp
|
9
9
|
</location>
|
10
10
|
<location <%= @APP_CONFIG[:urls][:svn] %>/<%= client_name %>>
|
11
11
|
DAV svn
|
12
|
-
SVNParentPath <%=
|
12
|
+
SVNParentPath <%= svn_dir %>/<%= client_name %>
|
13
13
|
SVNListParentPath On
|
14
14
|
SVNAutoversioning On
|
15
15
|
SVNReposName "Saint Digital Source Repository for <%= client_name %>"
|
@@ -1,19 +1,19 @@
|
|
1
1
|
<virtualhost *>
|
2
2
|
ServerAdmin webmaster@localhost
|
3
3
|
ServerName <%= @server_hostname %>
|
4
|
-
DocumentRoot <%=
|
5
|
-
ErrorLog <%=
|
6
|
-
CustomLog <%=
|
4
|
+
DocumentRoot <%= docs_dir %>
|
5
|
+
ErrorLog <%= log_dir %>/error.<%= @server_hostname %>.log
|
6
|
+
CustomLog <%= log_dir %>/access.<%= @server_hostname %>.log combined
|
7
7
|
LogLevel error
|
8
8
|
|
9
9
|
RewriteEngine On
|
10
|
-
RewriteRule ^/$ http://<%= @server_hostname %>/<%= @default_client %>/<%= @default_project %>
|
11
|
-
RewriteRule ^/index*$ http://<%= @server_hostname %>/<%= @default_client %>/<%= @default_project %>
|
10
|
+
RewriteRule ^/$ http://<%= @server_hostname %>/<%= @default_client.downcase %>/<%= @default_project.downcase %>
|
11
|
+
RewriteRule ^/index*$ http://<%= @server_hostname %>/<%= @default_client.downcase %>/<%= @default_project.downcase %>
|
12
12
|
|
13
13
|
<location />
|
14
14
|
AuthType Basic
|
15
15
|
AuthName '<%= @server_name %>'
|
16
|
-
AuthUserFile <%= @
|
16
|
+
AuthUserFile <%= @install_dir %>/passwords
|
17
17
|
#Require valid-user
|
18
18
|
#AuthBasicProvider file ldap
|
19
19
|
#AuthLDAPBindDN '<%= @ldap_bind_dn %>'
|
@@ -30,6 +30,6 @@
|
|
30
30
|
SVNReposName '<%= @server_name %>'
|
31
31
|
</location>
|
32
32
|
|
33
|
-
Include <%=
|
33
|
+
Include <%= locations_dir %>/*
|
34
34
|
|
35
35
|
</virtualhost>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: keithsalisbury-subtrac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Salisbury
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-19 00:00:00 -07:00
|
13
13
|
default_executable: subtrac
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -47,7 +47,6 @@ files:
|
|
47
47
|
- lib/subtrac/common/images/trac/saint_logo_small.png
|
48
48
|
- lib/subtrac/common/static/404.html
|
49
49
|
- lib/subtrac/common/styles/trac.css
|
50
|
-
- lib/subtrac/common/trac.ini
|
51
50
|
- lib/subtrac/config/config.yml
|
52
51
|
- lib/subtrac/passwords
|
53
52
|
- lib/subtrac/shared/trac.ini
|
data/lib/subtrac/common/trac.ini
DELETED
@@ -1,178 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
[attachment]
|
4
|
-
max_size = 262144
|
5
|
-
render_unsafe_content = false
|
6
|
-
|
7
|
-
[browser]
|
8
|
-
color_scale = True
|
9
|
-
downloadable_paths = /trunk, /branches/*, /tags/*
|
10
|
-
hide_properties = svk:merge
|
11
|
-
intermediate_color =
|
12
|
-
intermediate_point =
|
13
|
-
newest_color = (255, 136, 136)
|
14
|
-
oldest_color = (136, 136, 255)
|
15
|
-
oneliner_properties = trac:summary
|
16
|
-
render_unsafe_content = false
|
17
|
-
wiki_properties = trac:description
|
18
|
-
|
19
|
-
[changeset]
|
20
|
-
max_diff_bytes = 10000000
|
21
|
-
max_diff_files = 0
|
22
|
-
wiki_format_messages = true
|
23
|
-
|
24
|
-
[header_logo]
|
25
|
-
alt = Saint Development Server
|
26
|
-
height = -1
|
27
|
-
link = /
|
28
|
-
src = /images/trac/saint_logo_small.png
|
29
|
-
width = -1
|
30
|
-
|
31
|
-
[inherit]
|
32
|
-
plugins_dir =
|
33
|
-
templates_dir =
|
34
|
-
|
35
|
-
[logging]
|
36
|
-
log_file = trac.log
|
37
|
-
# log_format = <inherited>
|
38
|
-
log_level = DEBUG
|
39
|
-
log_type = none
|
40
|
-
|
41
|
-
[milestone]
|
42
|
-
stats_provider = DefaultTicketGroupStatsProvider
|
43
|
-
|
44
|
-
[mimeviewer]
|
45
|
-
enscript_modes = text/x-dylan:dylan:4
|
46
|
-
enscript_path = enscript
|
47
|
-
max_preview_size = 262144
|
48
|
-
mime_map = text/x-dylan:dylan,text/x-idl:ice,text/x-ada:ads:adb
|
49
|
-
php_path = php
|
50
|
-
tab_width = 8
|
51
|
-
|
52
|
-
[notification]
|
53
|
-
admit_domains =
|
54
|
-
always_notify_owner = false
|
55
|
-
always_notify_reporter = false
|
56
|
-
always_notify_updater = true
|
57
|
-
ignore_domains =
|
58
|
-
mime_encoding = base64
|
59
|
-
smtp_always_bcc =
|
60
|
-
smtp_always_cc =
|
61
|
-
smtp_default_domain =
|
62
|
-
smtp_enabled = false
|
63
|
-
smtp_from = trac@localhost
|
64
|
-
smtp_from_name =
|
65
|
-
smtp_password =
|
66
|
-
smtp_port = 25
|
67
|
-
smtp_replyto = trac@localhost
|
68
|
-
smtp_server = localhost
|
69
|
-
smtp_subject_prefix = __default__
|
70
|
-
smtp_user =
|
71
|
-
ticket_subject_template = $prefix #$ticket.id: $summary
|
72
|
-
use_public_cc = false
|
73
|
-
use_short_addr = false
|
74
|
-
use_tls = false
|
75
|
-
|
76
|
-
[project]
|
77
|
-
admin =
|
78
|
-
admin_trac_url = .
|
79
|
-
descr = My example project
|
80
|
-
footer = Visit the Trac open source project at<br /><a href="http://trac.edgewall.org/">http://trac.edgewall.org/</a>
|
81
|
-
icon = /favicon.ico
|
82
|
-
url =
|
83
|
-
|
84
|
-
[query]
|
85
|
-
default_anonymous_query = status!=closed&cc~=$USER
|
86
|
-
default_query = status!=closed&owner=$USER
|
87
|
-
items_per_page = 100
|
88
|
-
|
89
|
-
[report]
|
90
|
-
items_per_page = 100
|
91
|
-
items_per_page_rss = 0
|
92
|
-
|
93
|
-
[revisionlog]
|
94
|
-
default_log_limit = 100
|
95
|
-
|
96
|
-
[roadmap]
|
97
|
-
stats_provider = DefaultTicketGroupStatsProvider
|
98
|
-
|
99
|
-
[search]
|
100
|
-
min_query_length = 3
|
101
|
-
|
102
|
-
[svn]
|
103
|
-
branches = trunk,branches/*
|
104
|
-
tags = tags/*
|
105
|
-
|
106
|
-
[ticket]
|
107
|
-
default_cc =
|
108
|
-
default_component =
|
109
|
-
default_description =
|
110
|
-
default_keywords =
|
111
|
-
default_milestone =
|
112
|
-
default_owner =
|
113
|
-
default_priority = major
|
114
|
-
default_resolution = fixed
|
115
|
-
default_severity =
|
116
|
-
default_summary =
|
117
|
-
default_type = defect
|
118
|
-
default_version =
|
119
|
-
max_comment_size = 262144
|
120
|
-
max_description_size = 262144
|
121
|
-
preserve_newlines = default
|
122
|
-
restrict_owner = false
|
123
|
-
workflow = ConfigurableTicketWorkflow
|
124
|
-
|
125
|
-
[ticket-workflow]
|
126
|
-
accept = new,assigned,accepted,reopened -> accepted
|
127
|
-
accept.operations = set_owner_to_self
|
128
|
-
accept.permissions = TICKET_MODIFY
|
129
|
-
leave = * -> *
|
130
|
-
leave.default = 1
|
131
|
-
leave.operations = leave_status
|
132
|
-
reassign = new,assigned,accepted,reopened -> assigned
|
133
|
-
reassign.operations = set_owner
|
134
|
-
reassign.permissions = TICKET_MODIFY
|
135
|
-
reopen = closed -> reopened
|
136
|
-
reopen.operations = del_resolution
|
137
|
-
reopen.permissions = TICKET_CREATE
|
138
|
-
resolve = new,assigned,accepted,reopened -> closed
|
139
|
-
resolve.operations = set_resolution
|
140
|
-
resolve.permissions = TICKET_MODIFY
|
141
|
-
|
142
|
-
[timeline]
|
143
|
-
abbreviated_messages = True
|
144
|
-
changeset_collapse_events = false
|
145
|
-
changeset_long_messages = false
|
146
|
-
changeset_show_files = 0
|
147
|
-
default_daysback = 30
|
148
|
-
max_daysback = 90
|
149
|
-
newticket_formatter = oneliner
|
150
|
-
ticket_show_details = false
|
151
|
-
|
152
|
-
[trac]
|
153
|
-
authz_file =
|
154
|
-
authz_module_name =
|
155
|
-
auto_reload = False
|
156
|
-
base_url =
|
157
|
-
check_auth_ip = false
|
158
|
-
database = sqlite:db/trac.db
|
159
|
-
default_charset = iso-8859-15
|
160
|
-
htdocs_location =
|
161
|
-
ignore_auth_case = false
|
162
|
-
mainnav = wiki,timeline,roadmap,browser,tickets,newticket,search
|
163
|
-
metanav = login,logout,prefs,help,about
|
164
|
-
permission_policies = DefaultPermissionPolicy, LegacyAttachmentPolicy
|
165
|
-
permission_store = DefaultPermissionStore
|
166
|
-
repository_type = svn
|
167
|
-
secure_cookies = False
|
168
|
-
show_email_addresses = false
|
169
|
-
show_ip_addresses = false
|
170
|
-
timeout = 20
|
171
|
-
use_base_url_for_redirect = False
|
172
|
-
|
173
|
-
[wiki]
|
174
|
-
ignore_missing_pages = false
|
175
|
-
max_size = 262144
|
176
|
-
render_unsafe_content = false
|
177
|
-
split_page_names = false
|
178
|
-
|