keithsalisbury-subtrac 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/lib/subtrac/config/config.yml +22 -17
- data/lib/subtrac/templates/vhost.erb +12 -12
- data/lib/subtrac.rb +21 -12
- metadata +3 -3
data/VERSION.yml
CHANGED
@@ -9,27 +9,14 @@ development: &non_production_settings
|
|
9
9
|
:server_ip: "192.168.2.1"
|
10
10
|
|
11
11
|
:installation_dir: test
|
12
|
-
|
13
|
-
:dirs:
|
14
|
-
:svn: svn
|
15
|
-
:trac: trac
|
16
|
-
:log: log
|
17
|
-
:docs: www
|
18
|
-
:conf: conf
|
19
|
-
:conf_locations: conf/locations
|
20
|
-
:temp: tmp
|
21
|
-
:urls:
|
22
|
-
:svn: "/svn"
|
23
|
-
:templates:
|
24
|
-
:virtual_host: "templates/vhost.erb"
|
25
|
-
:location: "templates/location.erb"
|
26
|
-
:trac: "templates/trac.erb"
|
27
|
-
:projects: "templates/projects"
|
28
12
|
|
29
13
|
:default_project_template: "blank"
|
30
14
|
:default_client: "Subtrac"
|
31
15
|
:default_project: "Public"
|
32
16
|
:shared_trac_ini: "shared/trac.ini"
|
17
|
+
|
18
|
+
:apache2_conf: /etc/apache2/sites-available
|
19
|
+
|
33
20
|
:ldap:
|
34
21
|
:enable: false
|
35
22
|
:host:
|
@@ -39,8 +26,9 @@ development: &non_production_settings
|
|
39
26
|
:group_rdn:
|
40
27
|
:store_bind:
|
41
28
|
:group_bind:
|
42
|
-
:
|
29
|
+
:bind_dn:
|
43
30
|
:bind_passwd:
|
31
|
+
|
44
32
|
:trac:
|
45
33
|
:permissions:
|
46
34
|
admins: TRAC_ADMIN
|
@@ -50,6 +38,23 @@ development: &non_production_settings
|
|
50
38
|
salisburyk: admin
|
51
39
|
client: clients
|
52
40
|
|
41
|
+
# Internal config
|
42
|
+
:dirs:
|
43
|
+
:svn: svn
|
44
|
+
:trac: trac
|
45
|
+
:log: log
|
46
|
+
:docs: www
|
47
|
+
:conf: conf
|
48
|
+
:conf_locations: conf/locations
|
49
|
+
:temp: tmp
|
50
|
+
:urls:
|
51
|
+
:svn: "/svn"
|
52
|
+
:templates:
|
53
|
+
:virtual_host: "templates/vhost.erb"
|
54
|
+
:location: "templates/location.erb"
|
55
|
+
:trac: "templates/trac.erb"
|
56
|
+
:projects: "templates/projects"
|
57
|
+
|
53
58
|
test:
|
54
59
|
<<: *non_production_settings
|
55
60
|
|
@@ -2,24 +2,24 @@
|
|
2
2
|
ServerAdmin webmaster@localhost
|
3
3
|
ServerName <%= @server_hostname %>
|
4
4
|
DocumentRoot <%= @docs_dir %>
|
5
|
-
ErrorLog <%= @
|
6
|
-
CustomLog <%= @
|
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
|
11
|
-
RewriteRule ^/index*$ http://<%= @server_hostname
|
10
|
+
RewriteRule ^/$ http://<%= @server_hostname %>/<%= @default_client %>/<%= @default_project %>
|
11
|
+
RewriteRule ^/index*$ http://<%= @server_hostname %>/<%= @default_client %>/<%= @default_project %>
|
12
12
|
|
13
13
|
<location />
|
14
14
|
AuthType Basic
|
15
|
-
AuthName '
|
15
|
+
AuthName '<%= @server_name %>'
|
16
16
|
AuthUserFile <%= @APP_CONFIG[:dirs][:install] %>/passwords
|
17
17
|
#Require valid-user
|
18
|
-
AuthBasicProvider file ldap
|
19
|
-
AuthLDAPBindDN '
|
20
|
-
AuthLDAPBindPassword '
|
21
|
-
AuthLDAPURL '
|
22
|
-
AuthzLDAPAuthoritative off
|
18
|
+
#AuthBasicProvider file ldap
|
19
|
+
#AuthLDAPBindDN '<%= @ldap_bind_dn %>'
|
20
|
+
#AuthLDAPBindPassword '<%= @ldap_bind_password %>'
|
21
|
+
#AuthLDAPURL '<%= @ldap_url %>'
|
22
|
+
#AuthzLDAPAuthoritative off
|
23
23
|
</location>
|
24
24
|
|
25
25
|
<location <%= @APP_CONFIG[:urls][:svn] %>>
|
@@ -27,9 +27,9 @@
|
|
27
27
|
SVNParentPath <%= @APP_CONFIG[:dirs][:svn] %>/
|
28
28
|
SVNListParentPath On
|
29
29
|
SVNAutoversioning On
|
30
|
-
SVNReposName '
|
30
|
+
SVNReposName '<%= @server_name %>'
|
31
31
|
</location>
|
32
32
|
|
33
|
-
Include <%= @
|
33
|
+
Include <%= @locations_dir %>/*
|
34
34
|
|
35
35
|
</virtualhost>
|
data/lib/subtrac.rb
CHANGED
@@ -42,7 +42,7 @@ require 'subtrac/version'
|
|
42
42
|
|
43
43
|
module Subtrac
|
44
44
|
SUBTRAC_ROOT = File.join(File.dirname(__FILE__), "subtrac")
|
45
|
-
DEV_ENV = '
|
45
|
+
DEV_ENV = 'development' # should be a system environment var
|
46
46
|
|
47
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
48
|
|
@@ -88,9 +88,6 @@ module Subtrac
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
-
private
|
92
|
-
|
93
|
-
=begin
|
94
91
|
# Loads the configuration YML file
|
95
92
|
def self.load_config
|
96
93
|
puts "\n==== Loading configuration file ===="
|
@@ -120,15 +117,22 @@ module Subtrac
|
|
120
117
|
@default_client = @APP_CONFIG[:default_client]
|
121
118
|
@default_project = @APP_CONFIG[:default_project]
|
122
119
|
|
123
|
-
@install_dir = @APP_CONFIG[:installation_dir]
|
120
|
+
@install_dir = File.expand_path(@APP_CONFIG[:installation_dir])
|
124
121
|
@docs_dir = File.join(@install_dir,@APP_CONFIG[:dirs][:docs])
|
125
|
-
@conf_dir =
|
122
|
+
@conf_dir = @APP_CONFIG[:apache2_conf]
|
126
123
|
@locations_dir = File.join(@install_dir,@APP_CONFIG[:dirs][:conf_locations])
|
127
124
|
@svn_dir = File.join(@install_dir,@APP_CONFIG[:dirs][:svn])
|
128
125
|
@trac_dir = File.join(@install_dir,@APP_CONFIG[:dirs][:trac])
|
129
126
|
@temp_dir = File.join(@install_dir,@APP_CONFIG[:dirs][:temp])
|
127
|
+
@log_dir = File.join(@install_dir,@APP_CONFIG[:dirs][:log])
|
128
|
+
|
129
|
+
@ldap_bind_dn = @APP_CONFIG[:ldap][:bind_dn]
|
130
|
+
@ldap_bind_password = @APP_CONFIG[:ldap][:bind_password]
|
131
|
+
@ldap_url = @APP_CONFIG[:ldap][:host]
|
130
132
|
|
131
133
|
end
|
134
|
+
|
135
|
+
private
|
132
136
|
|
133
137
|
# Ask the user for configuration details
|
134
138
|
def self.get_config
|
@@ -203,7 +207,7 @@ module Subtrac
|
|
203
207
|
client_name = name.downcase
|
204
208
|
# create apache configuration
|
205
209
|
location_template = File.join(SUBTRAC_ROOT, @APP_CONFIG[:templates][:location])
|
206
|
-
location_conf = File.join(@locations_dir,client_name
|
210
|
+
location_conf = File.join(@locations_dir,"#{client_name}.conf")
|
207
211
|
parse_template(location_template,location_conf,binding)
|
208
212
|
`/etc/init.d/apache2 force-reload` if DEV_ENV != 'test'
|
209
213
|
|
@@ -227,6 +231,10 @@ module Subtrac
|
|
227
231
|
raise StandardError, "A project called #{project} already exists in the #{client} repository. Would you like to replace it?"
|
228
232
|
end
|
229
233
|
|
234
|
+
# create new project directories
|
235
|
+
create_if_missing svn_dir
|
236
|
+
create_if_missing trac_dir
|
237
|
+
|
230
238
|
project_template = File.join(SUBTRAC_ROOT, @APP_CONFIG[:templates][:projects],@APP_CONFIG[:default_project_template])
|
231
239
|
|
232
240
|
# copy template svn project to a temp folder, then svn import it into the repo
|
@@ -235,6 +243,7 @@ module Subtrac
|
|
235
243
|
FileUtils.cp_r(svn_template_dir,temp_dir)
|
236
244
|
|
237
245
|
# create a new subversion repository
|
246
|
+
say("Creating a new subversion repository...")
|
238
247
|
`svnadmin create #{svn_dir}` if DEV_ENV != 'test'
|
239
248
|
|
240
249
|
# import into svn
|
@@ -243,24 +252,25 @@ module Subtrac
|
|
243
252
|
FileUtils.rm_r(temp_dir, :force => true)
|
244
253
|
|
245
254
|
# create a new trac site
|
246
|
-
|
255
|
+
say("Creating a new trac site...")
|
256
|
+
result = `trac-admin #{trac_dir} initenv #{project_name} sqlite:#{trac_dir}/db/trac.db svn #{svn_dir}` if DEV_ENV != 'test'
|
247
257
|
FileUtils.chown_R('www-data', 'www-data', trac_dir, :verbose => true) if DEV_ENV != 'test'
|
248
258
|
FileUtils.mkdir_p("#{trac_dir}/conf") if DEV_ENV == 'test' # fake the folder for tests
|
249
259
|
|
250
260
|
# install shared trac.ini
|
251
261
|
trac_ini_template = File.join(SUBTRAC_ROOT, @APP_CONFIG[:templates][:trac])
|
252
|
-
parse_template(trac_ini_template,"
|
262
|
+
parse_template(trac_ini_template,File.join(trac_dir,"/conf/trac.ini"),binding)
|
253
263
|
|
254
264
|
# remove custom templates directory so trac uses the shared location (while we wait for trac patch)
|
255
265
|
FileUtils.rm_rf("#{trac_dir}/templates")
|
256
266
|
|
257
|
-
|
267
|
+
say("Setting up default trac permission...")
|
258
268
|
# set up trac permissions
|
259
269
|
@APP_CONFIG[:trac][:permissions].each do |key, value|
|
260
270
|
`trac-admin #{trac_dir} permission add #{key} #{value}` if DEV_ENV != 'test'
|
261
271
|
end
|
262
272
|
|
263
|
-
|
273
|
+
say("Adding default trac wiki pages...")
|
264
274
|
# this needs to loop through the directory and import all pages
|
265
275
|
Dir.foreach("#{project_template}/trac/wiki/.") do |file|
|
266
276
|
# do something with the file here
|
@@ -273,7 +283,6 @@ module Subtrac
|
|
273
283
|
end
|
274
284
|
|
275
285
|
end
|
276
|
-
=end
|
277
286
|
end
|
278
287
|
|
279
288
|
|
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.7
|
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-17 00:00:00 -07:00
|
13
13
|
default_executable: subtrac
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -90,7 +90,7 @@ requirements: []
|
|
90
90
|
rubyforge_project:
|
91
91
|
rubygems_version: 1.2.0
|
92
92
|
signing_key:
|
93
|
-
specification_version:
|
93
|
+
specification_version: 3
|
94
94
|
summary: Simple and opinionated helper for creating and managing subversion and trac projects.
|
95
95
|
test_files: []
|
96
96
|
|