ktec-subtrac 0.1.39 → 0.1.41
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.rb +0 -4
- data/lib/subtrac/config.rb +197 -0
- data/lib/subtrac/version.rb +1 -1
- metadata +2 -1
data/VERSION.yml
CHANGED
data/lib/subtrac.rb
CHANGED
@@ -226,7 +226,6 @@ module Subtrac
|
|
226
226
|
open(file_path, 'w') {|f| YAML.dump(user_config, f)}
|
227
227
|
end
|
228
228
|
|
229
|
-
|
230
229
|
# Install
|
231
230
|
def self.install(args,options)
|
232
231
|
puts "\n==== Installing development server files ===="
|
@@ -306,9 +305,6 @@ module Subtrac
|
|
306
305
|
# fix privileges
|
307
306
|
give_apache_privileges()
|
308
307
|
|
309
|
-
# return the project
|
310
|
-
project
|
311
|
-
|
312
308
|
end
|
313
309
|
|
314
310
|
private
|
@@ -0,0 +1,197 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Copyright (c) 2009, Keith Salisbury (www.globalkeith.com)
|
3
|
+
# All rights reserved.
|
4
|
+
# All the config stuff should go in here...
|
5
|
+
|
6
|
+
require 'fileutils'
|
7
|
+
|
8
|
+
module Subtrac
|
9
|
+
class Config
|
10
|
+
|
11
|
+
USER_CONFIG_FILE = 'config/user.yml'
|
12
|
+
|
13
|
+
def initialize()
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
# Loads the configuration YML file
|
18
|
+
def load_config
|
19
|
+
# TODO: We need to refactor this code so it will load the default configuration only if one has not been created
|
20
|
+
puts "\n==== Loading configuration file ===="
|
21
|
+
# load configuration file
|
22
|
+
file_path = File.join(subtrac_path, USER_CONFIG_FILE)
|
23
|
+
file_path = File.join(subtrac_path,"/config/config.yml") if not File.exists?(file_path)
|
24
|
+
puts "Attempting to read config file: #{file_path}"
|
25
|
+
begin
|
26
|
+
yamlFile = YAML.load(File.read(file_path))
|
27
|
+
rescue Exception => e
|
28
|
+
raise StandardError, "Config #{file_path} could not be loaded."
|
29
|
+
end
|
30
|
+
if yamlFile
|
31
|
+
if yamlFile[SUBTRAC_ENV]
|
32
|
+
@APP_CONFIG = yamlFile[SUBTRAC_ENV]
|
33
|
+
else
|
34
|
+
raise StandardError, "config/config.yml exists, but doesn't have a configuration for #{SUBTRAC_ENV}."
|
35
|
+
end
|
36
|
+
else
|
37
|
+
raise StandardError, "config/config.yml does not exist."
|
38
|
+
end
|
39
|
+
say("Configuration loaded successfully...")
|
40
|
+
end
|
41
|
+
|
42
|
+
# Write the changes configuration to disk
|
43
|
+
def self.save_config
|
44
|
+
# save the things that might have changed
|
45
|
+
file_path = File.join(subtrac_path, USER_CONFIG_FILE)
|
46
|
+
user_config = {SUBTRAC_ENV => @APP_CONFIG}
|
47
|
+
open(file_path, 'w') {|f| YAML.dump(user_config, f)}
|
48
|
+
end
|
49
|
+
|
50
|
+
# User configured options
|
51
|
+
def server_name
|
52
|
+
@server_name ||= @APP_CONFIG[:server_name]
|
53
|
+
end
|
54
|
+
|
55
|
+
def server_name=(name)
|
56
|
+
@APP_CONFIG[:server_name] = @server_name = name
|
57
|
+
end
|
58
|
+
|
59
|
+
def server_hostname
|
60
|
+
@server_hostname ||= @APP_CONFIG[:server_hostname]
|
61
|
+
end
|
62
|
+
|
63
|
+
def server_hostname=(name)
|
64
|
+
@APP_CONFIG[:server_hostname] = @server_hostname = name
|
65
|
+
end
|
66
|
+
|
67
|
+
def default_client
|
68
|
+
@default_client ||= @APP_CONFIG[:default_client]
|
69
|
+
end
|
70
|
+
|
71
|
+
def default_client=(name)
|
72
|
+
@APP_CONFIG[:default_client] = @default_client = name
|
73
|
+
end
|
74
|
+
|
75
|
+
def default_project
|
76
|
+
@default_project ||= @APP_CONFIG[:default_project]
|
77
|
+
end
|
78
|
+
|
79
|
+
def default_project=(name)
|
80
|
+
puts "Updating default_project to #{name}"
|
81
|
+
@APP_CONFIG[:default_project] = @default_project = name
|
82
|
+
end
|
83
|
+
|
84
|
+
def default_project_type
|
85
|
+
@default_project_type ||= @APP_CONFIG[:default_project_type]
|
86
|
+
end
|
87
|
+
|
88
|
+
def default_project_type=(name)
|
89
|
+
puts "Updating default_project_type to #{name}"
|
90
|
+
@APP_CONFIG[:default_project_type] = @default_project_type = name
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
# Filesystem directories
|
95
|
+
def root
|
96
|
+
Pathname.new(SUBTRAC_ROOT) if defined?(SUBTRAC_ROOT)
|
97
|
+
end
|
98
|
+
|
99
|
+
def public_path
|
100
|
+
@public_path ||= self.root ? File.join(self.root, "public") : "public"
|
101
|
+
end
|
102
|
+
|
103
|
+
def public_path=(path)
|
104
|
+
@public_path = path
|
105
|
+
end
|
106
|
+
|
107
|
+
def subtrac_path
|
108
|
+
@subtrac_path ||= self.root ? File.join(self.root, "subtrac") : "subtrac"
|
109
|
+
end
|
110
|
+
|
111
|
+
def install_dir
|
112
|
+
@install_dir ||= File.expand_path(@APP_CONFIG[:installation_dir])
|
113
|
+
end
|
114
|
+
|
115
|
+
def install_dir=(name)
|
116
|
+
puts "Setting new install_dir variable to #{name}"
|
117
|
+
@APP_CONFIG[:installation_dir] = @install_dir = name
|
118
|
+
end
|
119
|
+
|
120
|
+
def apache_conf_dir
|
121
|
+
@apache_conf_dir ||= @APP_CONFIG[:apache_conf_dir]
|
122
|
+
end
|
123
|
+
|
124
|
+
def apache_conf_dir=(name)
|
125
|
+
@APP_CONFIG[:apache_conf_dir] = @apache_conf_dir = name
|
126
|
+
end
|
127
|
+
|
128
|
+
def docs_dir
|
129
|
+
@docs_dir ||= File.join(install_dir,@APP_CONFIG[:dirs][:docs])
|
130
|
+
end
|
131
|
+
|
132
|
+
def svn_dir
|
133
|
+
@svn_dir ||= File.join(install_dir,@APP_CONFIG[:dirs][:svn])
|
134
|
+
end
|
135
|
+
|
136
|
+
def trac_dir
|
137
|
+
@trac_dir ||= File.join(install_dir,@APP_CONFIG[:dirs][:trac])
|
138
|
+
end
|
139
|
+
|
140
|
+
def temp_dir
|
141
|
+
@temp_dir ||= File.join(install_dir,@APP_CONFIG[:dirs][:temp])
|
142
|
+
end
|
143
|
+
|
144
|
+
def log_dir
|
145
|
+
@log_dir ||= File.join(install_dir,@APP_CONFIG[:dirs][:log])
|
146
|
+
end
|
147
|
+
|
148
|
+
def locations_dir
|
149
|
+
@locations_dir ||= File.join(install_dir,@APP_CONFIG[:dirs][:locations])
|
150
|
+
end
|
151
|
+
|
152
|
+
# Urls
|
153
|
+
def svn_url
|
154
|
+
@svn_url ||= @APP_CONFIG[:urls][:svn]
|
155
|
+
end
|
156
|
+
|
157
|
+
def trac_permissions
|
158
|
+
@trac_permissions ||= @APP_CONFIG[:trac][:permissions]
|
159
|
+
end
|
160
|
+
|
161
|
+
# LDAP
|
162
|
+
def enable_ldap
|
163
|
+
@enable_ldap ||= @APP_CONFIG[:ldap][:enable]
|
164
|
+
end
|
165
|
+
|
166
|
+
def enable_ldap=(value)
|
167
|
+
@APP_CONFIG[:ldap][:enable] = @enable_ldap = value
|
168
|
+
end
|
169
|
+
|
170
|
+
def ldap_bind_dn
|
171
|
+
@ldap_bind_dn ||= @APP_CONFIG[:ldap][:bind_dn]
|
172
|
+
end
|
173
|
+
|
174
|
+
def ldap_bind_dn=(value)
|
175
|
+
@APP_CONFIG[:ldap][:bind_dn] = @ldap_bind_dn = value
|
176
|
+
end
|
177
|
+
|
178
|
+
def ldap_bind_password
|
179
|
+
@ldap_bind_password ||= @APP_CONFIG[:ldap][:bind_password]
|
180
|
+
end
|
181
|
+
|
182
|
+
def ldap_bind_password=(value)
|
183
|
+
@APP_CONFIG[:ldap][:bind_password] = @ldap_bind_password = value
|
184
|
+
end
|
185
|
+
|
186
|
+
def ldap_bind_host
|
187
|
+
@ldap_bind_host ||= @APP_CONFIG[:ldap][:bind_host]
|
188
|
+
end
|
189
|
+
|
190
|
+
def ldap_bind_host=(value)
|
191
|
+
@APP_CONFIG[:ldap][:bind_host] = @ldap_bind_password = value
|
192
|
+
end
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
end
|
197
|
+
end
|
data/lib/subtrac/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ktec-subtrac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.41
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Salisbury
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- lib/subtrac/common/images/trac/footer_back.png
|
52
52
|
- lib/subtrac/common/images/trac/main_bg.gif
|
53
53
|
- lib/subtrac/common/images/trac/saint_logo_small.png
|
54
|
+
- lib/subtrac/config.rb
|
54
55
|
- lib/subtrac/config/config.yml
|
55
56
|
- lib/subtrac/core_ext.rb
|
56
57
|
- lib/subtrac/core_ext/file.rb
|