keithsalisbury-subtrac 0.1.15 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/History.rdoc +3 -0
  2. data/{lib/subtrac/templates/projects/blank/svn/branches/README → README.rdoc} +0 -0
  3. data/bin/subtrac +1 -3
  4. data/lib/subtrac.rb +97 -292
  5. data/spec/subtrac_spec.rb +54 -0
  6. data/subtrac.gemspec +37 -0
  7. data/tasks/docs.rake +13 -0
  8. data/tasks/gemspec.rake +3 -0
  9. data/tasks/spec.rake +25 -0
  10. metadata +27 -45
  11. data/LICENSE +0 -20
  12. data/README.markdown +0 -200
  13. data/Rakefile +0 -56
  14. data/VERSION.yml +0 -4
  15. data/lib/subtrac/commands.rb +0 -6
  16. data/lib/subtrac/commands/create.rb +0 -13
  17. data/lib/subtrac/commands/install.rb +0 -10
  18. data/lib/subtrac/common/clients/index.wsgi +0 -89
  19. data/lib/subtrac/common/favicon.ico +0 -0
  20. data/lib/subtrac/common/images/trac/banner_bg.jpg +0 -0
  21. data/lib/subtrac/common/images/trac/bar_bg.gif +0 -0
  22. data/lib/subtrac/common/images/trac/footer_back.png +0 -0
  23. data/lib/subtrac/common/images/trac/main_bg.gif +0 -0
  24. data/lib/subtrac/common/images/trac/saint_logo_small.png +0 -0
  25. data/lib/subtrac/common/static/404.html +0 -14
  26. data/lib/subtrac/common/styles/trac.css +0 -222
  27. data/lib/subtrac/config/config.yml +0 -58
  28. data/lib/subtrac/passwords +0 -3
  29. data/lib/subtrac/shared/trac.ini +0 -178
  30. data/lib/subtrac/templates/location.erb +0 -16
  31. data/lib/subtrac/templates/projects/blank/svn/tags/README +0 -0
  32. data/lib/subtrac/templates/projects/blank/svn/trunk/README +0 -0
  33. data/lib/subtrac/templates/projects/blank/trac/wiki/WikiStart +0 -57
  34. data/lib/subtrac/templates/projects/new/svn/trunk/trac/wiki/WikiStart +0 -46
  35. data/lib/subtrac/templates/projects/new/trac/wiki/WikiStart +0 -23
  36. data/lib/subtrac/templates/projects/trac_theme/svn/trunk/index/index.html +0 -21
  37. data/lib/subtrac/templates/projects/trac_theme/svn/trunk/templates/layout.html +0 -56
  38. data/lib/subtrac/templates/projects/trac_theme/svn/trunk/templates/site.html +0 -27
  39. data/lib/subtrac/templates/projects/trac_theme/svn/trunk/templates/theme.html +0 -86
  40. data/lib/subtrac/templates/projects/trac_theme/trac/wiki/WikiStart +0 -4
  41. data/lib/subtrac/templates/trac.erb +0 -25
  42. data/lib/subtrac/templates/vhost.erb +0 -38
  43. data/lib/subtrac/version.rb +0 -4
data/History.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ === 1.0.0 / 2009-04-14
2
+
3
+ * Initial release
data/bin/subtrac CHANGED
@@ -1,9 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'rubygems'
4
- require 'commander'
5
-
6
- $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+ #require 'commander'
7
5
  require 'subtrac'
8
6
 
9
7
  program :name, 'subtrac'
data/lib/subtrac.rb CHANGED
@@ -39,384 +39,189 @@ require 'yaml'
39
39
  require 'erb'
40
40
  require 'fileutils'
41
41
  require 'subtrac/version'
42
- require 'subtrac/commands'
43
-
44
42
 
45
43
  module Subtrac
46
-
47
- SUBTRAC_ROOT = "#{File.dirname(__FILE__)}/" unless defined?(SUBTRAC_ROOT)
48
- SUBTRAC_ENV = (ENV['SUBTRAC_ENV'] || 'development').dup unless defined?(SUBTRAC_ENV)
49
- USER_CONFIG = 'config/user.yml'
50
-
51
- class << self
52
-
53
- # The Configuration instance used to configure the Subtrac environment
54
- def configuration
55
- @@configuration
56
- end
57
-
58
- def configuration=(configuration)
59
- @@configuration = configuration
60
- end
61
-
62
- def initialized?
63
- @initialized || false
64
- end
65
-
66
- def initialized=(initialized)
67
- @initialized ||= initialized
68
- end
69
-
70
- def root
71
- Pathname.new(SUBTRAC_ROOT) if defined?(SUBTRAC_ROOT)
72
- end
73
-
74
- def public_path
75
- @@public_path ||= self.root ? File.join(self.root, "public") : "public"
76
- end
77
-
78
- def subtrac_path
79
- @@subtrac_path ||= self.root ? File.join(self.root, "subtrac") : "subtrac"
80
- end
81
-
82
- def public_path=(path)
83
- @@public_path = path
84
- end
85
-
86
- def docs_dir
87
- @@docs_dir ||= File.join(@install_dir,@APP_CONFIG[:dirs][:docs])
88
- end
89
-
90
- def docs_dir=(dir)
91
- @@docs_dir = dir
92
- end
93
-
94
- def svn_dir
95
- @@svn_dir ||= File.join(@install_dir,@APP_CONFIG[:dirs][:svn])
96
- end
97
-
98
- def svn_dir=(dir)
99
- @@svn_dir = dir
100
- end
101
-
102
- def trac_dir
103
- @@trac_dir ||= File.join(@install_dir,@APP_CONFIG[:dirs][:trac])
104
- end
105
-
106
- def trac_dir=(dir)
107
- @@trac_dir = dir
108
- end
109
-
110
- def temp_dir
111
- @@temp_dir ||= File.join(@install_dir,@APP_CONFIG[:dirs][:temp])
112
- end
113
-
114
- def temp_dir=(dir)
115
- @@temp_dir = dir
116
- end
117
-
118
- def log_dir
119
- @@log_dir ||= File.join(@install_dir,@APP_CONFIG[:dirs][:log])
120
- end
121
-
122
- def log_dir=(dir)
123
- @@log_dir = dir
44
+ DEV_ENV = 'test' # should be a system environment var
45
+ DEV_ROOT = Dir.getwd
46
+ module Commands
47
+ class Install
48
+ def initialize(args, options)
49
+ Devserver.load_config()
50
+ Devserver.install(args,options)
51
+ end
124
52
  end
125
-
126
- def locations_dir
127
- @@locations_dir ||= File.join(@install_dir,@APP_CONFIG[:dirs][:locations])
53
+ class Create
54
+ def initialize(args, options)
55
+ project = ask("What is the name of the project you would like to create?") if !options.project
56
+ client = ask("Which client is this project for?") if !options.client
57
+ Devserver.load_config()
58
+ Devserver.create_project(options.project,options.client)
59
+ end
128
60
  end
61
+ end
129
62
 
130
- def locations_dir=(dir)
131
- @@locations_dir = dir
63
+ # Install
64
+ def self.install(args,options)
65
+ # Ask if the user agrees (yes or no)
66
+ confirm = agree("Are you sure?") if options.clean
67
+ if confirm
68
+ # clear previous data
69
+ clean()
70
+ create_environment_directories()
71
+ else
72
+ puts "\nAttempt install without overwrites"
132
73
  end
133
-
74
+ install_common_files()
75
+ create_virtual_host()
76
+ # create default project and client
77
+ #create_client(@APP_CONFIG[:default_client])
78
+ create_project(@APP_CONFIG[:default_project],@APP_CONFIG[:default_client])
134
79
  end
80
+
81
+ private
135
82
 
136
83
  # Loads the configuration YML file
137
84
  def self.load_config
138
- # TODO: We need to refactor this code so it will load the default configuration only if one has not been created
139
85
  puts "\n==== Loading configuration file ===="
140
86
  # load configuration file
141
- file_path = File.join(subtrac_path, USER_CONFIG)
142
- file_path = File.join(subtrac_path,"/config/config.yml") if not File.exists?(file_path)
143
- puts "Attempting to read config file: #{file_path}"
144
87
  begin
145
- raw_config = File.read(file_path)
146
- yamlFile = YAML.load(raw_config)
88
+ yamlFile = YAML.load_file("#{DEV_ROOT}/config/config.yml")
147
89
  rescue Exception => e
148
- raise StandardError, "Config #{file_path} could not be loaded."
90
+ raise StandardError, "config/config.yml could not be loaded."
149
91
  end
150
92
  if yamlFile
151
- if yamlFile[SUBTRAC_ENV]
152
- @APP_CONFIG = yamlFile[SUBTRAC_ENV]
93
+ if yamlFile[DEV_ENV]
94
+ @APP_CONFIG = yamlFile[DEV_ENV]
153
95
  else
154
- raise StandardError, "config/config.yml exists, but doesn't have a configuration for #{SUBTRAC_ENV}."
96
+ raise StandardError, "config/config.yml exists, but doesn't have a configuration for DEV_ENV=#{DEV_ENV}."
155
97
  end
156
98
  else
157
99
  raise StandardError, "config/config.yml does not exist."
158
100
  end
159
- puts "\n==== Installation options ===="
160
-
161
- say("Setting up default configuration...")
162
- @server_name = @APP_CONFIG[:server_name]
163
- @server_hostname = @APP_CONFIG[:server_hostname]
164
- @server_ip = @APP_CONFIG[:server_ip]
165
-
166
- @default_client = @APP_CONFIG[:default_client]
167
- @default_project = @APP_CONFIG[:default_project]
168
-
169
- @install_dir = File.expand_path(@APP_CONFIG[:installation_dir])
170
- @conf_dir = @APP_CONFIG[:apache2_conf]
171
-
172
- @ldap_enable = @APP_CONFIG[:ldap][:enable]
173
- if (@ldap_enable) then
174
- @ldap_bind_dn = @APP_CONFIG[:ldap][:bind_dn]
175
- @ldap_bind_password = @APP_CONFIG[:ldap][:bind_password]
176
- @ldap_url = @APP_CONFIG[:ldap][:host]
177
- end
178
-
179
- end
180
-
181
-
182
- # Install
183
- def self.install(args,options)
184
- puts "\n==== Installing development server files ===="
185
- # check where we are installing
186
- change_install_dir = agree("The default installation directory is \"#{@install_dir}\". Would you like to change this? [Y/n]")
187
- @install_dir = ask("Where would you like to install this server?") if change_install_dir
188
-
189
- unless !File.directory?(@install_dir)
190
- # Ask if the user agrees (yes or no)
191
- confirm_clean = agree("Err, it seems there's some stuff in there. You sure you want me to overwrite? [Y/n]") if options.clean
192
- confirm_clean = agree("Doubly sure? I can't undo this....[Y/n]") if confirm_clean
193
- end
194
-
195
- # right lets install
196
- change_server_name = agree("The default server name is \"#{@server_name}\". Would you like to change this? [Y/n]")
197
- @server_name = ask("What would you like to call your new development server? ") if change_server_name
198
-
199
- create_environment_directories(confirm_clean)
200
- install_common_files()
201
- configure_admin_user()
202
- # TODO: Need to check for default client/project before creating virtual host
203
- # otherwise we need remove the rewrite rule
204
- create_virtual_host()
205
- confirm_default_client = agree("Do you want to create a default client project? [Y/n]")
206
- # create default project and client
207
- if confirm_default_client
208
- change_client = agree("The default client name is \"#{@default_client}\". Would you like to change this? [Y/n]")
209
- @default_client = ask("What client name would you like to use? ") if change_client
210
- change_project = agree("The default project name is \"#{@default_project}\". Would you like to change this? [Y/n]")
211
- @default_project = ask("What would you like to call your new project? ") if change_project
212
- create_project(@default_project,@default_client)
213
- end
214
- save_config()
215
- end
216
-
217
- private
218
-
219
- # Write the changes configuration to disk
220
- def self.save_config
221
- # save the things that might have changed
222
- @APP_CONFIG[:server_name] = @server_name
223
- @APP_CONFIG[:server_hostname] = @server_hostname
224
- @APP_CONFIG[:server_ip] = @server_ip
225
-
226
- @APP_CONFIG[:default_client] = @default_client
227
- @APP_CONFIG[:default_project] = @default_project
228
-
229
- @APP_CONFIG[:installation_dir] = @install_dir
230
- @APP_CONFIG[:apache2_conf] = @conf_dir
231
-
232
- @APP_CONFIG[:ldap][:bind_dn] = @ldap_bind_dn
233
- @APP_CONFIG[:ldap][:bind_password] = @ldap_bind_password
234
- @APP_CONFIG[:ldap][:host] = @ldap_url
235
-
236
- file_path = File.join(subtrac_path, USER_CONFIG)
237
- open(file_path, 'w') {|f| YAML.dump({SUBTRAC_ENV => @APP_CONFIG}, f)}
238
101
  end
239
102
 
240
103
  # creates a directory if it does not exist
241
- def self.create_if_missing(*names)
242
- names.each do |name|
243
- unless File.directory?(name)
244
- puts "Creating directory called #{names}..."
245
- FileUtils.mkdir_p(name)
246
- end
247
- end
104
+ def self.create_if_missing *names
105
+ puts "\n==== Creating directory #{names} ===="
106
+ names.each do |name| FileUtils.mkdir_p(name) unless File.directory?(name) end
248
107
  end
249
108
 
250
109
  # publishes an erb template
251
110
  def self.parse_template(infile,outfile,binding)
252
- file = File.open(outfile, 'w+')
111
+ file = File.new(outfile, "w")
253
112
  if file
254
- template = ERB.new(IO.read(infile))
255
- if template
256
- file.syswrite(template.result(binding))
257
- else
258
- raise "Could not read template. file #{infile}"
259
- end
113
+ file.syswrite(ERB.new(IO.read(infile)).result(binding))
260
114
  else
261
- raise "Unable to open file for writing. file #{outfile}"
115
+ puts "Unable to write to file #{outfile}!"
262
116
  end
263
117
  end
264
118
 
265
119
  # creates a new virtual host and reloads apache and enables the new virtual host
266
120
  def self.create_virtual_host
267
121
  puts "\n==== Creating new virtual host ===="
268
- vhost_template = File.join(subtrac_path, @APP_CONFIG[:templates][:virtual_host])
269
- puts "group apache tempalte: #{vhost_template}"
270
- new_vhost = File.join(@conf_dir,@server_hostname)
271
- puts "group apache file: #{new_vhost}"
272
- parse_template(vhost_template,new_vhost,binding) if SUBTRAC_ENV != 'test'
122
+ parse_template(@APP_CONFIG[:templates][:virtual_host],"#{@APP_CONFIG[:dirs][:apache2_conf]}/#{@APP_CONFIG[:server][:hostname]}",binding)
273
123
  # reload apache configuration
274
- `/etc/init.d/apache2 force-reload` if SUBTRAC_ENV != 'test'
275
- `a2ensite #{@server_hostname}` if SUBTRAC_ENV != 'test'
124
+ `/etc/init.d/apache2 force-reload` if DEV_ENV != 'test'
125
+ `a2ensite #{@APP_CONFIG[:server][:hostname]}` if DEV_ENV != 'test'
276
126
  end
277
127
 
278
128
  def self.install_common_files
279
129
  puts "\n==== Installing common files ===="
280
- # TODO: implement a mask for .svn folders
130
+ # TODO: implement a mash for .svn folders
281
131
  # TODO: refactor /common to the app config
282
- FileUtils.cp_r(Dir.glob(File.join(subtrac_path, "common/.")),docs_dir)
283
- FileUtils.cp_r(Dir.glob(File.join(subtrac_path, "shared/.")),create_if_missing(File.join(trac_dir, ".shared")))
284
- # this need to be replaced with a question/answer session
285
- #FileUtils.cp(,@install_dir)
286
- end
287
-
288
- def self.configure_admin_user
289
- puts "\n==== Configure admin user ===="
290
- # create admin user
291
- passwd_file = File.join(@install_dir, ".passwd")
292
- admin_user = ask("Pick an admin username: ") { |q| q.echo = true }
293
- `htpasswd -c #{passwd_file} #{admin_user}`
294
- @APP_CONFIG[:admin_user] = admin_user
295
- # ensure this guy is added to trac admin group
296
- @APP_CONFIG[:trac][:permissions][admin_user] = "admins"
297
- #FileUtils.chown_R('www-data', 'www-data', passwd_file, :verbose => true) if SUBTRAC_ENV != 'test'
132
+ source = Dir.glob("#{DEV_ROOT}/common/.")
133
+ dest = @APP_CONFIG[:dirs][:document]
134
+ FileUtils.cp_r(source,dest)
298
135
  end
299
136
 
300
- def self.create_environment_directories(overwrite=false)
137
+ def self.create_environment_directories
301
138
  puts "\n==== Creating new environment directories ===="
302
- FileUtils.rm_rf @install_dir if overwrite
303
- create_if_missing @install_dir
304
139
  # create the environment directories
305
140
  @APP_CONFIG[:dirs].each do |key, value|
306
- dir = File.join(@install_dir,value)
307
- create_if_missing dir
141
+ create_if_missing value
308
142
  end
309
143
  end
310
144
 
145
+ def self.clean
146
+ puts "\n==== Remove old data if exists ===="
147
+ @APP_CONFIG[:dirs].each do |key, value|
148
+ unless [@APP_CONFIG[:dirs][:install]].include? value
149
+ #TODO: Ask for confirmation - yes,no,All
150
+ puts "Deleting #{value}"
151
+ FileUtils.rm_rf value
152
+ end
153
+ end
154
+ end
155
+
311
156
  def self.create_client(name)
312
- puts "\n==== Create a new client called #{name} ===="
157
+ puts "\n==== Create a new client #{name} ===="
313
158
  client_name = name.downcase
314
159
  # create apache configuration
315
- puts "subtrac_path: #{subtrac_path}"
316
- puts "templates_location: #{@APP_CONFIG[:templates][:location]}"
317
- location_template = File.join(subtrac_path, @APP_CONFIG[:templates][:location])
318
- puts "location_template: #{location_template}"
319
- location_conf = File.join(locations_dir,"#{client_name}.conf")
320
- puts "location_conf: #{location_conf}"
321
- parse_template(location_template,location_conf,binding)
322
- `/etc/init.d/apache2 force-reload` if SUBTRAC_ENV != 'test'
160
+ # create apache template
161
+ parse_template(@APP_CONFIG[:templates][:location],"#{@APP_CONFIG[:dirs][:conf_locations]}/#{client_name}.conf",binding)
162
+ `/etc/init.d/apache2 force-reload` if DEV_ENV != 'test'
323
163
 
324
164
  # create svn+trac directory
325
- create_if_missing File.join(svn_dir,client_name)
326
- create_if_missing File.join(trac_dir,client_name)
327
-
328
- # create a project for this clients trac theme
329
- create_project("trac_theme", client_name,@APP_CONFIG[:default_theme_template])
330
-
331
- # check the theme project out
332
- client_theme_dir = File.join(trac_dir,client_name,".theme")
333
- create_if_missing(client_theme_dir)
334
- FileUtils.chown_R('www-data', 'www-data', client_theme_dir, :verbose => true) if SUBTRAC_ENV != 'test'
335
- puts "Attempting checkout of theme project..."
336
-
337
- `sudo svn co --username #{@APP_CONFIG[:admin][:username]} --password #{@APP_CONFIG[:admin][:password]} \
338
- file://#{svn_dir}/#{client_name}/trac_theme/trunk #{client_theme_dir}` if SUBTRAC_ENV != 'test'
339
-
165
+ create_if_missing "#{@APP_CONFIG[:dirs][:svn]}/#{client_name}"
166
+ create_if_missing "#{@APP_CONFIG[:dirs][:trac]}/#{client_name}"
340
167
  end
341
168
 
342
- def self.create_project(project, client, project_type=@APP_CONFIG[:default_project_template])
343
- puts "\n==== Create a new project called #{project} for #{client} ===="
169
+ def self.create_project(project, client)
170
+ puts "\n==== Create a new project #{project} for #{client} ===="
344
171
 
345
172
  client_name = client.downcase
346
173
  project_name = project.downcase
347
174
 
348
175
  # create client directory if needed
349
- create_client(client_name) if (!File.directory? File.join(svn_dir,client_name))
176
+ create_client(client_name) if (!File.directory? "#{@APP_CONFIG[:dirs][:svn]}/#{client_name}")
350
177
 
351
- project_svn_dir = File.join(svn_dir,client_name,project_name)
352
- project_trac_dir = File.join(trac_dir,client_name,project_name)
353
-
354
- # TODO: Need to change this to use a 'groups' yml file
355
- if (File.directory? project_svn_dir) then
178
+ svn_dir = "#{@APP_CONFIG[:dirs][:svn]}/#{client_name}/#{project_name}"
179
+ trac_dir = "#{@APP_CONFIG[:dirs][:trac]}/#{client_name}/#{project_name}"
180
+ if (File.directory? svn_dir) then
356
181
  raise StandardError, "A project called #{project} already exists in the #{client} repository. Would you like to replace it?"
357
182
  end
358
183
 
359
- # create new project directories
360
- say("Create project directories...")
361
- create_if_missing project_svn_dir
362
- create_if_missing project_trac_dir
363
-
364
- project_template = File.join(subtrac_path, @APP_CONFIG[:templates][:projects],project_type)
365
-
366
184
  # copy template svn project to a temp folder, then svn import it into the repo
367
- say("Create temporary project directory and copy template files...")
368
- svn_template_dir = File.join(project_template,"svn")
369
- project_temp_dir = File.join(temp_dir,project_name)
370
- FileUtils.cp_r(svn_template_dir,project_temp_dir)
185
+ svn_template_dir = "#{@APP_CONFIG[:templates][:blank]}/svn/."
186
+ temp_dir = "#{@APP_CONFIG[:dirs][:temp]}/#{project_name}"
187
+ FileUtils.cp_r(svn_template_dir,temp_dir)
371
188
 
372
189
  # create a new subversion repository
373
- say("Creating a new subversion repository...")
374
- `svnadmin create #{project_svn_dir}` if SUBTRAC_ENV != 'test'
190
+ `svnadmin create #{svn_dir}` if DEV_ENV != 'test'
375
191
 
376
- # import into svn
377
- say("Importing temporary project into the new subversion repository...")
378
- `svn import #{project_temp_dir} file:///#{project_svn_dir} --message "initial import"` if SUBTRAC_ENV != 'test'
379
- # delete the temporary directory
380
- FileUtils.rm_r(project_temp_dir, :force => true)
192
+ # import into svn and delete the temporary directory
193
+ `svn import #{temp_dir} file:///#{svn_dir} --message "initial import"` if DEV_ENV != 'test'
194
+ FileUtils.rm_r(temp_dir, :force => true)
381
195
 
382
196
  # create a new trac site
383
- say("Creating a new trac site...")
384
- result = `trac-admin #{project_trac_dir} initenv #{project_name} sqlite:#{project_trac_dir}/db/trac.db svn #{project_svn_dir}` if SUBTRAC_ENV != 'test'
385
- FileUtils.chown_R('www-data', 'www-data', project_trac_dir, :verbose => true) if SUBTRAC_ENV != 'test'
386
- FileUtils.mkdir_p("#{project_trac_dir}/conf") if SUBTRAC_ENV == 'test' # fake the folder for tests
197
+ `trac-admin #{trac_dir} initenv #{project_name} sqlite:#{trac_dir}/db/trac.db svn #{svn_dir}` if DEV_ENV != 'test'
198
+ FileUtils.chown_R('www-data', 'www-data', trac_dir, :verbose => true) if DEV_ENV != 'test'
199
+ FileUtils.mkdir_p("#{trac_dir}/conf") if DEV_ENV == 'test' # fake the folder for tests
387
200
 
388
- say("Installing trac configuration...")
389
201
  # install shared trac.ini
390
- trac_ini_template = File.join(subtrac_path, @APP_CONFIG[:templates][:trac])
391
- parse_template(trac_ini_template,File.join(project_trac_dir,"/conf/trac.ini"),binding)
202
+ parse_template(@APP_CONFIG[:templates][:trac],"#{trac_dir}/conf/trac.ini",binding)
392
203
 
393
204
  # remove custom templates directory so trac uses the shared location (while we wait for trac patch)
394
- FileUtils.rm_rf("#{project_trac_dir}/templates")
205
+ FileUtils.rm_rf("#{trac_dir}/templates")
395
206
 
396
- say("Setting up default trac permissions...")
207
+ puts "Setting up default trac permission..."
397
208
  # set up trac permissions
398
209
  @APP_CONFIG[:trac][:permissions].each do |key, value|
399
- `sudo trac-admin #{project_trac_dir} permission add #{key} #{value}` if SUBTRAC_ENV != 'test'
210
+ `trac-admin #{trac_dir} permission add #{key} #{value}` if DEV_ENV != 'test'
400
211
  end
401
212
 
402
- say("Adding default trac wiki pages...")
403
- # loop through the directory and import all pages
404
- Dir.foreach("#{project_template}/trac/wiki/.") do |file|
213
+ puts "Adding default trac wiki pages..."
214
+ # this needs to loop through the directory and import all pages
215
+ Dir.foreach("#{DEV_ROOT}/#{@APP_CONFIG[:default_project_template]}/trac/wiki/.") do |file|
405
216
  # do something with the file here
406
217
  unless ['.', '..','.svn'].include? file
407
- temp_file = File.join(temp_dir,file)
408
- puts = binding
409
- parse_template(File.join(project_template,"trac/wiki",file), temp_file, binding)
410
- `trac-admin #{project_trac_dir} wiki import #{file} #{temp_file}` if SUBTRAC_ENV != 'test'
411
- FileUtils.rm(temp_file)
218
+ parse_template("#{DEV_ROOT}/#{@APP_CONFIG[:default_project_template]}/trac/wiki/#{file}","#{@APP_CONFIG[:dirs][:temp]}/#{file}", binding)
219
+ `trac-admin #{trac_dir} wiki import #{file} #{@APP_CONFIG[:dirs][:temp]}/#{file}` if DEV_ENV != 'test'
220
+ FileUtils.rm("#{@APP_CONFIG[:dirs][:temp]}/#{file}")
412
221
  end
413
222
  end
414
-
415
- # run trac upgrade
416
- say("Upgrading the trac installation...")
417
- `trac-admin #{project_trac_dir} upgrade` if SUBTRAC_ENV != 'test'
418
-
419
223
  end
224
+
420
225
  end
421
226
 
422
227