Revisión | 14872659502139689c24dddad59e06d41b9315f6 (tree) |
---|---|
Tiempo | 2011-10-02 20:20:38 |
Autor | Akihiro Ono <a-ono@user...> |
Commiter | Akihiro Ono |
migrate from email.yml to configuration.yml
@@ -1 +1 @@ | ||
1 | -Subproject commit aff1d2db98350826bfd99327516479bc84aa5a19 | |
1 | +Subproject commit ab28bf68994d856500849ff136239f9e38469c9b |
@@ -12,238 +12,251 @@ class HighLine::Question | ||
12 | 12 | end |
13 | 13 | end |
14 | 14 | |
15 | -ScriptDir = File.dirname(__FILE__) | |
16 | -Dir.glob(ScriptDir + "/lib/*.rb").each {|rb| | |
17 | - require rb | |
18 | -} | |
19 | - | |
20 | -Windows::Authorization.runas_admin | |
21 | - | |
22 | -home = File.expand_path(ENV["PACKAGE_HOME"]) | |
23 | -host = Socket.gethostbyname(Socket.gethostname).first | |
24 | -options = { | |
25 | - :interact => true, | |
26 | - :home => home, | |
27 | - :fqdn_or_ipaddr => host.include?(".") ? host : IPSocket.getaddress(host), | |
28 | - :apache_root => File.join(home, "apache"), | |
29 | - :redmine_root => File.join(home, "redmine"), | |
30 | - :opends_root => File.join(home, "opends"), | |
31 | - :opends_manager_dn => "cn=Directory Manager", | |
32 | - :opends_manager_password => Account.random_password(10) | |
33 | -} | |
34 | -options[:apache_host] = options[:fqdn_or_ipaddr] | |
35 | - | |
36 | -config = [ | |
37 | - {:name => :apache_name, :default => "Apache"}, | |
38 | - {:name => :apache_port, :type => :int, :default => 80}, | |
39 | - {:name => :redmine_name, :default => "Redmine"}, | |
40 | - {:name => :redmine_port, :type => :int, :default => 8000}, | |
41 | - {:name => :jenkins_name, :default => "Jenkins"}, | |
42 | - {:name => :jenkins_port, :type => :int, :default => 8001}, | |
43 | - | |
44 | - {:name => :ldap_setting, :type => :bool, | |
45 | - :message => "Use external LDAP server? (y/n): "}, | |
46 | - {:name => :opends_name, :default => "OpenDS", :parent => :ldap_setting, :if => false}, | |
47 | - {:name => :opends_port, :type => :int, :default => 389, :parent => :ldap_setting, :if => false}, | |
48 | - {:name => :opends_admin_port, :type => :int, :default => 8002, :parent => :ldap_setting, :if => false}, | |
49 | - {:name => :opends_base_dn, :default => "dc=redminele,dc=local", :parent => :ldap_setting, :if => false}, | |
50 | - | |
51 | - {:name => :ldap_host, :default => "localhost", :parent => :ldap_setting, :if => true}, | |
52 | - {:name => :ldap_port, :type => :int, :default => 389, :parent => :ldap_setting, :if => true}, | |
53 | - {:name => :ldap_base_dn, :parent => :ldap_setting, :if => true, :message => "Enter LDAP Base DN (ex. ou=users,dc=local): "}, | |
54 | - {:name => :ldap_anonymous, :type => :bool, :message => "LDAP server permits anonymous bind? ([y]/n): ", :default => true, :parent => :ldap_setting, :if => true}, | |
55 | - {:name => :ldap_bind_dn, :message => "Enter LDAP bind DN (ex. uid=xxx,ou=users,dc=local): ", :parent => :ldap_anonymous, :if => false}, | |
56 | - {:name => :ldap_bind_password, :message => "Enter LDAP bind password: ", :parent => :ldap_anonymous, :if => false, :type => :password}, | |
57 | - {:name => :ldap_user_attribute, :default => "uid", :parent => :ldap_setting, :if => true}, | |
58 | - {:name => :ldap_first_name_attribute, :default => "givenName", :parent => :ldap_setting, :if => true}, | |
59 | - {:name => :ldap_last_name_attribute, :default => "sn", :parent => :ldap_setting, :if => true}, | |
60 | - {:name => :ldap_mail_attribute, :default => "mail", :parent => :ldap_setting, :if => true}, | |
61 | - | |
62 | - {:name => :admin_account}, | |
63 | - {:name => :admin_password, :type => :password}, | |
64 | - {:name => :admin_mail, :type => :mail}, | |
65 | - {:name => :admin_first_name}, | |
66 | - {:name => :admin_last_name}, | |
67 | - | |
68 | - {:name => :smtp_setting, :type => :bool, | |
69 | - :message => "Use redmine email notification? (y/n): "}, | |
70 | - {:name => :mail_sender_address, :parent => :smtp_setting, :if => true, :type => :mail}, | |
71 | - {:name => :smtp_host, :parent => :smtp_setting, :if => true}, | |
72 | - {:name => :smtp_port, :parent => :smtp_setting,:type => :int, :default => 25, :if => true}, | |
73 | - {:name => :smtp_domain, :parent => :smtp_setting, :if => true, | |
74 | - :default => options[:fqdn_or_ipaddr]}, | |
75 | - {:name => :smtp_auth, :parent => :smtp_setting, :if => true, :type => :bool, | |
76 | - :message => "Use smtp auth? (y/n): "}, | |
77 | - {:name => :smtp_user, :parent => :smtp_auth, :if => true}, | |
78 | - {:name => :smtp_password, :parent => :smtp_auth, :if => true, :type => :password} | |
79 | -] | |
80 | - | |
81 | -option_keys = [] | |
82 | -config_hash = {} | |
83 | -config.each {|h| | |
84 | - option_keys.push(key = h[:name]) | |
85 | - name = key.to_s | |
86 | - | |
87 | - if h[:message].nil? | |
88 | - default = h[:default] | |
89 | - default = default.nil? ? "" : " (default: #{default})" | |
90 | - h[:message] = "Enter #{name.gsub('_', ' ')}#{default}: " | |
91 | - end | |
15 | +begin | |
16 | + ScriptDir = File.dirname(__FILE__) | |
17 | + Dir.glob(ScriptDir + "/lib/*.rb").each {|rb| | |
18 | + require rb | |
19 | + } | |
20 | + | |
21 | + Windows::Authorization.runas_admin | |
92 | 22 | |
93 | - optname = name.gsub('_', '-') | |
94 | - h[:option_name] = (h[:type] == :bool) ? | |
95 | - "--[no-]" + optname : "--#{optname}=VAL" | |
96 | - h[:class] = Integer if h[:type] == :int | |
97 | - | |
98 | - config_hash[key] = h | |
99 | -} | |
100 | - | |
101 | -OptionParser.new {|opt| | |
102 | - opt.banner = "Usage: install [options] [file|-]" | |
103 | - opt.on('--[no-]interact') {|v| options[:interact] = v} | |
104 | - | |
105 | - option_keys.each {|key| | |
106 | - conf = config_hash[key] | |
107 | - args = conf[:option_name].to_a | |
108 | - args.push conf[:class] if conf[:class] | |
109 | - opt.on(*args) {|v| options[key] = v.toutf8} | |
23 | + home = File.expand_path(ENV["PACKAGE_HOME"]) | |
24 | + host = Socket.gethostbyname(Socket.gethostname).first | |
25 | + options = { | |
26 | + :interact => true, | |
27 | + :home => home, | |
28 | + :fqdn_or_ipaddr => host.include?(".") ? host : IPSocket.getaddress(host), | |
29 | + :apache_root => File.join(home, "apache"), | |
30 | + :redmine_root => File.join(home, "redmine"), | |
31 | + :opends_root => File.join(home, "opends"), | |
32 | + :opends_manager_dn => "cn=Directory Manager", | |
33 | + :opends_manager_password => Account.random_password(10) | |
110 | 34 | } |
111 | - opt.parse! | |
112 | -} | |
35 | + options[:apache_host] = options[:fqdn_or_ipaddr] | |
113 | 36 | |
114 | -if config_file = ARGV.first | |
115 | - hash = if config_file == "-" | |
116 | - YAML.load(STDIN.read.toutf8) | |
117 | - else | |
118 | - YAML.load_file(config_file) | |
119 | - end || {} | |
120 | - hash.each {|key, val| options[key.to_sym] = val} if hash.is_a?(Hash) | |
121 | - options[:interact] = false | |
122 | -end | |
37 | + config = [ | |
38 | + {:name => :apache_name, :default => "Apache"}, | |
39 | + {:name => :apache_port, :type => :int, :default => 80}, | |
40 | + {:name => :redmine_name, :default => "Redmine"}, | |
41 | + {:name => :redmine_port, :type => :int, :default => 8000}, | |
42 | + {:name => :jenkins_name, :default => "Jenkins"}, | |
43 | + {:name => :jenkins_port, :type => :int, :default => 8001}, | |
44 | + | |
45 | + {:name => :ldap_setting, :type => :bool, | |
46 | + :message => "Use external LDAP server? (y/n): "}, | |
47 | + {:name => :opends_name, :default => "OpenDS", :parent => :ldap_setting, :if => false}, | |
48 | + {:name => :opends_port, :type => :int, :default => 389, :parent => :ldap_setting, :if => false}, | |
49 | + {:name => :opends_admin_port, :type => :int, :default => 8002, :parent => :ldap_setting, :if => false}, | |
50 | + {:name => :opends_base_dn, :default => "dc=redminele,dc=local", :parent => :ldap_setting, :if => false}, | |
123 | 51 | |
124 | -def bind_check(options) | |
125 | - LDAP.setup_connection(options) | |
126 | - unless LDAP.check_connection | |
127 | - %w[ldap_host ldap_port ldap_anonymous ldap_bind_dn ldap_bind_password | |
128 | - ].each {|key| options.delete(key.to_sym)} | |
129 | - return false | |
52 | + {:name => :ldap_host, :default => "localhost", :parent => :ldap_setting, :if => true}, | |
53 | + {:name => :ldap_port, :type => :int, :default => 389, :parent => :ldap_setting, :if => true}, | |
54 | + {:name => :ldap_base_dn, :parent => :ldap_setting, :if => true, :message => "Enter LDAP Base DN (ex. ou=users,dc=local): "}, | |
55 | + {:name => :ldap_anonymous, :type => :bool, :message => "LDAP server permits anonymous bind? ([y]/n): ", :default => true, :parent => :ldap_setting, :if => true}, | |
56 | + {:name => :ldap_bind_dn, :message => "Enter LDAP bind DN (ex. uid=xxx,ou=users,dc=local): ", :parent => :ldap_anonymous, :if => false}, | |
57 | + {:name => :ldap_bind_password, :message => "Enter LDAP bind password: ", :parent => :ldap_anonymous, :if => false, :type => :password}, | |
58 | + {:name => :ldap_user_attribute, :default => "uid", :parent => :ldap_setting, :if => true}, | |
59 | + {:name => :ldap_first_name_attribute, :default => "givenName", :parent => :ldap_setting, :if => true}, | |
60 | + {:name => :ldap_last_name_attribute, :default => "sn", :parent => :ldap_setting, :if => true}, | |
61 | + {:name => :ldap_mail_attribute, :default => "mail", :parent => :ldap_setting, :if => true}, | |
62 | + | |
63 | + {:name => :admin_account}, | |
64 | + {:name => :admin_password, :type => :password}, | |
65 | + {:name => :admin_mail, :type => :mail}, | |
66 | + {:name => :admin_first_name}, | |
67 | + {:name => :admin_last_name}, | |
68 | + | |
69 | + {:name => :smtp_setting, :type => :bool, | |
70 | + :message => "Use redmine email notification? (y/n): "}, | |
71 | + {:name => :mail_sender_address, :parent => :smtp_setting, :if => true, :type => :mail}, | |
72 | + {:name => :smtp_host, :parent => :smtp_setting, :if => true}, | |
73 | + {:name => :smtp_port, :parent => :smtp_setting,:type => :int, :default => 25, :if => true}, | |
74 | + {:name => :smtp_domain, :parent => :smtp_setting, :if => true, | |
75 | + :default => options[:fqdn_or_ipaddr]}, | |
76 | + {:name => :smtp_auth, :parent => :smtp_setting, :if => true, :type => :bool, | |
77 | + :message => "Use smtp auth? (y/n): "}, | |
78 | + {:name => :smtp_user, :parent => :smtp_auth, :if => true}, | |
79 | + {:name => :smtp_password, :parent => :smtp_auth, :if => true, :type => :password} | |
80 | + ] | |
81 | + | |
82 | + option_keys = [] | |
83 | + config_hash = {} | |
84 | + config.each {|h| | |
85 | + option_keys.push(key = h[:name]) | |
86 | + name = key.to_s | |
87 | + | |
88 | + if h[:message].nil? | |
89 | + default = h[:default] | |
90 | + default = default.nil? ? "" : " (default: #{default})" | |
91 | + h[:message] = "Enter #{name.gsub('_', ' ')}#{default}: " | |
92 | + end | |
93 | + | |
94 | + optname = name.gsub('_', '-') | |
95 | + h[:option_name] = (h[:type] == :bool) ? | |
96 | + "--[no-]" + optname : "--#{optname}=VAL" | |
97 | + h[:class] = Integer if h[:type] == :int | |
98 | + | |
99 | + config_hash[key] = h | |
100 | + } | |
101 | + | |
102 | + OptionParser.new {|opt| | |
103 | + opt.banner = "Usage: install [options] [file|-]" | |
104 | + opt.on('--[no-]interact') {|v| options[:interact] = v} | |
105 | + | |
106 | + option_keys.each {|key| | |
107 | + conf = config_hash[key] | |
108 | + args = conf[:option_name].to_a | |
109 | + args.push conf[:class] if conf[:class] | |
110 | + opt.on(*args) {|v| options[key] = v.toutf8} | |
111 | + } | |
112 | + opt.parse! | |
113 | + } | |
114 | + | |
115 | + if config_file = ARGV.first | |
116 | + hash = if config_file == "-" | |
117 | + YAML.load(STDIN.read.toutf8) | |
118 | + else | |
119 | + YAML.load_file(config_file) | |
120 | + end || {} | |
121 | + hash.each {|key, val| options[key.to_sym] = val} if hash.is_a?(Hash) | |
122 | + options[:interact] = false | |
130 | 123 | end |
131 | - true | |
132 | -end | |
133 | 124 | |
134 | -def admin_check(options) | |
135 | - LDAP.setup_connection(options) | |
136 | - unless LDAP.check_bind(options[:admin_account], options[:admin_password]) | |
137 | - %w[ldap_base_dn ldap_user_attribute admin_account admin_password | |
138 | - ].each {|key| options.delete(key.to_sym)} | |
139 | - return false | |
125 | + def bind_check(options) | |
126 | + LDAP.setup_connection(options) | |
127 | + unless LDAP.check_connection | |
128 | + %w[ldap_host ldap_port ldap_anonymous ldap_bind_dn ldap_bind_password | |
129 | + ].each {|key| options.delete(key.to_sym)} | |
130 | + return false | |
131 | + end | |
132 | + true | |
140 | 133 | end |
141 | 134 | |
142 | - attrs = LDAP.search_attributes(options[:admin_account]) | |
143 | - %w[first_name last_name mail].each {|v| | |
144 | - if value = attrs[options[:"ldap_#{v}_attribute"]] | |
145 | - options[:"admin_#{v}"] = value | |
135 | + def admin_check(options) | |
136 | + LDAP.setup_connection(options) | |
137 | + unless LDAP.check_bind(options[:admin_account], options[:admin_password]) | |
138 | + %w[ldap_base_dn ldap_user_attribute admin_account admin_password | |
139 | + ].each {|key| options.delete(key.to_sym)} | |
140 | + return false | |
146 | 141 | end |
147 | - } | |
148 | - true | |
149 | -end | |
150 | 142 | |
151 | -if options[:interact] | |
152 | - option_keys.each {|key| | |
153 | - if options[:ldap_setting] | |
154 | - if key == :ldap_user_attribute && !bind_check(options) | |
155 | - puts "Failed to bind to LDAP server." | |
156 | - retry | |
143 | + attrs = LDAP.search_attributes(options[:admin_account]) | |
144 | + %w[first_name last_name mail].each {|v| | |
145 | + if value = attrs[options[:"ldap_#{v}_attribute"]] | |
146 | + options[:"admin_#{v}"] = value | |
157 | 147 | end |
158 | - if key == :admin_mail && !admin_check(options) | |
159 | - puts "Failed to bind as admin account." | |
160 | - retry | |
148 | + } | |
149 | + true | |
150 | + end | |
151 | + | |
152 | + if options[:interact] | |
153 | + option_keys.each {|key| | |
154 | + if options[:ldap_setting] | |
155 | + if key == :ldap_user_attribute && !bind_check(options) | |
156 | + puts "Failed to bind to LDAP server." | |
157 | + retry | |
158 | + end | |
159 | + if key == :admin_mail && !admin_check(options) | |
160 | + puts "Failed to bind as admin account." | |
161 | + retry | |
162 | + end | |
161 | 163 | end |
162 | - end | |
163 | - next unless options[key].nil? | |
164 | - | |
165 | - conf = config_hash[key] | |
166 | - type = conf[:type] | |
167 | - default = conf[:default] | |
168 | - p_key = conf[:parent] | |
169 | - if p_key && options[p_key] != conf[:if] | |
170 | - options[key] = type == :bool ? nil : default | |
171 | - next | |
172 | - end | |
164 | + next unless options[key].nil? | |
173 | 165 | |
174 | - msg = conf[:message] | |
175 | - options[key] = case type | |
176 | - when :bool | |
177 | - agree(msg) {|q| | |
178 | - q.default = default ? 'y' : 'n' unless default.nil? | |
179 | - q.responses[:ask_on_error] = :question | |
180 | - } | |
181 | - when :int | |
182 | - ask(msg, Integer) {|q| | |
183 | - q.default = default | |
184 | - q.responses[:ask_on_error] = :question | |
185 | - } | |
186 | - when :password | |
187 | - password = ask(msg) {|q| q.echo = '*'} | |
188 | - redo if password.empty? | |
189 | - confirmation = ask("Re-" + msg) {|q| q.echo = '*'} | |
190 | - if password != confirmation | |
191 | - puts "Password doesn't match." | |
192 | - redo | |
166 | + conf = config_hash[key] | |
167 | + type = conf[:type] | |
168 | + default = conf[:default] | |
169 | + p_key = conf[:parent] | |
170 | + if p_key && options[p_key] != conf[:if] | |
171 | + options[key] = type == :bool ? nil : default | |
172 | + next | |
193 | 173 | end |
194 | - password | |
195 | - when :mail | |
196 | - ask(msg) {|q| | |
197 | - q.validate = /^[\x01-\x7f]+@(\w+\.)+[a-zA-Z]+$/ | |
198 | - q.responses[:ask_on_error] = :question | |
199 | - q.responses[:not_valid] = "Invalid email address." | |
200 | - } | |
201 | - else | |
202 | - ans = ask(msg) {|q| q.default = default}.toutf8 | |
203 | - redo if ans.empty? | |
204 | - ans | |
174 | + | |
175 | + msg = conf[:message] | |
176 | + options[key] = case type | |
177 | + when :bool | |
178 | + agree(msg) {|q| | |
179 | + q.default = default ? 'y' : 'n' unless default.nil? | |
180 | + q.responses[:ask_on_error] = :question | |
181 | + } | |
182 | + when :int | |
183 | + ask(msg, Integer) {|q| | |
184 | + q.default = default | |
185 | + q.responses[:ask_on_error] = :question | |
186 | + } | |
187 | + when :password | |
188 | + password = ask(msg) {|q| q.echo = '*'} | |
189 | + redo if password.empty? | |
190 | + confirmation = ask("Re-" + msg) {|q| q.echo = '*'} | |
191 | + if password != confirmation | |
192 | + puts "Password doesn't match." | |
193 | + redo | |
194 | + end | |
195 | + password | |
196 | + when :mail | |
197 | + ask(msg) {|q| | |
198 | + q.validate = /^[\x01-\x7f]+@(\w+\.)+[a-zA-Z]+$/ | |
199 | + q.responses[:ask_on_error] = :question | |
200 | + q.responses[:not_valid] = "Invalid email address." | |
201 | + } | |
202 | + else | |
203 | + ans = ask(msg) {|q| q.default = default}.toutf8 | |
204 | + redo if ans.empty? | |
205 | + ans | |
206 | + end | |
207 | + } | |
208 | + else | |
209 | + config_hash.each {|key, conf| | |
210 | + options[key] = conf[:default] if options[key].nil? | |
211 | + } | |
212 | + | |
213 | + if options[:ldap_setting] | |
214 | + raise "Failed to bind to LDAP server" unless bind_check(options) | |
215 | + raise "Failed to bind as admin account" unless admin_check(options) | |
205 | 216 | end |
206 | - } | |
207 | -else | |
208 | - config_hash.each {|key, conf| | |
209 | - options[key] = conf[:default] if options[key].nil? | |
210 | - } | |
211 | 217 | |
212 | - if options[:ldap_setting] | |
213 | - raise "Failed to bind to LDAP server" unless bind_check(options) | |
214 | - raise "Failed to bind as admin account" unless admin_check(options) | |
218 | + config_hash.each {|key, conf| | |
219 | + next unless options[key].nil? | |
220 | + p_key = conf[:parent] | |
221 | + next if p_key && options[p_key].nil? | |
222 | + raise "#{key.to_s} is not specified" if p_key.nil? | |
223 | + } | |
215 | 224 | end |
225 | + options[:apache_host] += ":#{options[:apache_port]}" unless options[:apache_port] == 80 | |
216 | 226 | |
217 | - config_hash.each {|key, conf| | |
218 | - next unless options[key].nil? | |
219 | - p_key = conf[:parent] | |
220 | - next if p_key && options[p_key].nil? | |
221 | - raise "#{key.to_s} is not specified" if p_key.nil? | |
227 | + options.each {|key, value| | |
228 | + next unless value.is_a?(String) | |
229 | + next if key.to_s.index("password") | |
230 | + options[key].strip! | |
222 | 231 | } |
223 | -end | |
224 | -options[:apache_host] += ":#{options[:apache_port]}" unless options[:apache_port] == 80 | |
225 | - | |
226 | -options.each {|key, value| | |
227 | - next unless value.is_a?(String) | |
228 | - next if key.to_s.index("password") | |
229 | - options[key].strip! | |
230 | -} | |
231 | - | |
232 | -unless options[:ldap_setting] | |
233 | - options[:ldap_host] = "localhost" | |
234 | - options[:ldap_port] = options[:opends_port] | |
235 | - options[:ldap_base_dn] = options[:opends_base_dn] | |
236 | - options[:ldap_anonymous] = false | |
237 | - options[:ldap_bind_dn] = "uid=#{options[:admin_account]},ou=users,#{options[:ldap_base_dn]}" | |
238 | - options[:ldap_bind_password] = options[:admin_password] | |
239 | - options[:ldap_user_attribute] = "uid" | |
240 | - options[:ldap_first_name_attribute] = "givenName" | |
241 | - options[:ldap_last_name_attribute] = "sn" | |
242 | - options[:ldap_mail_attribute] = "mail" | |
243 | -end | |
244 | 232 | |
245 | -Template.install(options) | |
246 | -OpenDS.install(options) unless options[:ldap_setting] | |
247 | -Redmine.install(options) | |
248 | -system(%Q["#{ScriptDir}/service.bat" install]) | |
249 | -Windows::Shortcut.install(options) | |
233 | + unless options[:ldap_setting] | |
234 | + options[:ldap_host] = "localhost" | |
235 | + options[:ldap_port] = options[:opends_port] | |
236 | + options[:ldap_base_dn] = options[:opends_base_dn] | |
237 | + options[:ldap_anonymous] = false | |
238 | + options[:ldap_bind_dn] = "uid=#{options[:admin_account]},ou=users,#{options[:ldap_base_dn]}" | |
239 | + options[:ldap_bind_password] = options[:admin_password] | |
240 | + options[:ldap_user_attribute] = "uid" | |
241 | + options[:ldap_first_name_attribute] = "givenName" | |
242 | + options[:ldap_last_name_attribute] = "sn" | |
243 | + options[:ldap_mail_attribute] = "mail" | |
244 | + end | |
245 | + | |
246 | + Template.install(options) | |
247 | + OpenDS.install(options) unless options[:ldap_setting] | |
248 | + Redmine.install(options) | |
249 | + system(%Q["#{ScriptDir}/service.bat" install]) | |
250 | + Windows::Shortcut.install(options) | |
251 | +rescue => e | |
252 | + if options[:interact] | |
253 | + puts "Error: #{$!}" | |
254 | + puts "\t" + e.backtrace.join("\n\t") | |
255 | + ask("Press any key to exit ... ") {|q| | |
256 | + q.character = true | |
257 | + q.echo = false | |
258 | + } | |
259 | + else | |
260 | + raise e | |
261 | + end | |
262 | +end |
@@ -22,14 +22,12 @@ module Template | ||
22 | 22 | env = Env.new(options) |
23 | 23 | home = env.package_home |
24 | 24 | template_dir = File.join(home, "template") |
25 | - skip_email = !options[:smtp_setting] | |
26 | 25 | skip_opends = options[:ldap_setting] |
27 | 26 | |
28 | 27 | Dir.chdir(template_dir) { |
29 | 28 | Find.find(".") {|input| |
30 | 29 | Find.prune if skip_opends && File.basename(input) == "opends" |
31 | 30 | next if File.directory?(input) || File.extname(input) != ".erb" |
32 | - next if skip_email && input == "./redmine/config/email.yml.erb" | |
33 | 31 | output = File.expand_path(File.join(home, input[0..-5])) |
34 | 32 | |
35 | 33 | puts output |
@@ -16,7 +16,8 @@ module Windows | ||
16 | 16 | |
17 | 17 | # after vista |
18 | 18 | if major >= 6 |
19 | - args = [$0, ARGV.join(" "), Dir.pwd, "runas"] | |
19 | + args = ["cmd", "/c cd #{Dir.pwd.inspect} & #{$0.inspect} " + | |
20 | + ARGV.map(&:inspect).join(" "), Dir.pwd, "runas"] | |
20 | 21 | WIN32OLE.new("Shell.Application").ShellExecute(*args) |
21 | 22 | exit |
22 | 23 | else |
@@ -0,0 +1,148 @@ | ||
1 | +# = Redmine configuration file | |
2 | +# | |
3 | +# Each environment has it's own configuration options. If you are only | |
4 | +# running in production, only the production block needs to be configured. | |
5 | +# Environment specific configuration options override the default ones. | |
6 | +# | |
7 | +# Note that this file needs to be a valid YAML file. | |
8 | +# | |
9 | +# == Outgoing email settings (email_delivery setting) | |
10 | +# | |
11 | +# === Common configurations | |
12 | +# | |
13 | +# ==== Sendmail command | |
14 | +# | |
15 | +# production: | |
16 | +# email_delivery: | |
17 | +# delivery_method: :sendmail | |
18 | +# | |
19 | +# ==== Simple SMTP server at localhost | |
20 | +# | |
21 | +# production: | |
22 | +# email_delivery: | |
23 | +# delivery_method: :smtp | |
24 | +# smtp_settings: | |
25 | +# address: "localhost" | |
26 | +# port: 25 | |
27 | +# | |
28 | +# ==== SMTP server at example.com using LOGIN authentication and checking HELO for foo.com | |
29 | +# | |
30 | +# production: | |
31 | +# email_delivery: | |
32 | +# delivery_method: :smtp | |
33 | +# smtp_settings: | |
34 | +# address: "example.com" | |
35 | +# port: 25 | |
36 | +# authentication: :login | |
37 | +# domain: 'foo.com' | |
38 | +# user_name: 'myaccount' | |
39 | +# password: 'password' | |
40 | +# | |
41 | +# ==== SMTP server at example.com using PLAIN authentication | |
42 | +# | |
43 | +# production: | |
44 | +# email_delivery: | |
45 | +# delivery_method: :smtp | |
46 | +# smtp_settings: | |
47 | +# address: "example.com" | |
48 | +# port: 25 | |
49 | +# authentication: :plain | |
50 | +# domain: 'example.com' | |
51 | +# user_name: 'myaccount' | |
52 | +# password: 'password' | |
53 | +# | |
54 | +# ==== SMTP server at using TLS (GMail) | |
55 | +# | |
56 | +# This requires some additional configuration. See the article at: | |
57 | +# http://redmineblog.com/articles/setup-redmine-to-send-email-using-gmail/ | |
58 | +# | |
59 | +# production: | |
60 | +# email_delivery: | |
61 | +# delivery_method: :smtp | |
62 | +# smtp_settings: | |
63 | +# tls: true | |
64 | +# address: "smtp.gmail.com" | |
65 | +# port: 587 | |
66 | +# domain: "smtp.gmail.com" # 'your.domain.com' for GoogleApps | |
67 | +# authentication: :plain | |
68 | +# user_name: "your_email@gmail.com" | |
69 | +# password: "your_password" | |
70 | +# | |
71 | +# | |
72 | +# === More configuration options | |
73 | +# | |
74 | +# See the "Configuration options" at the following website for a list of the | |
75 | +# full options allowed: | |
76 | +# | |
77 | +# http://wiki.rubyonrails.org/rails/pages/HowToSendEmailsWithActionMailer | |
78 | + | |
79 | + | |
80 | +# default configuration options for all environments | |
81 | +default: | |
82 | + # Outgoing emails configuration (see examples above) | |
83 | + email_delivery: <% if smtp_setting %> | |
84 | + delivery_method: :smtp | |
85 | + smtp_settings: | |
86 | + address: <%= smtp_host %> | |
87 | + port: <%= smtp_port %> | |
88 | + domain: <%= smtp_domain %><% if smtp_auth %> | |
89 | + authentication: :login | |
90 | + user_name: <%= smtp_user %> | |
91 | + password: <%= smtp_password %><% end %> | |
92 | + <% end %> | |
93 | + | |
94 | + # Absolute path to the directory where attachments are stored. | |
95 | + # The default is the 'files' directory in your Redmine instance. | |
96 | + # Your Redmine instance needs to have write permission on this | |
97 | + # directory. | |
98 | + # Examples: | |
99 | + # attachments_storage_path: /var/redmine/files | |
100 | + # attachments_storage_path: D:/redmine/files | |
101 | + attachments_storage_path: | |
102 | + | |
103 | + # Configuration of the autologin cookie. | |
104 | + # autologin_cookie_name: the name of the cookie (default: autologin) | |
105 | + # autologin_cookie_path: the cookie path (default: /) | |
106 | + # autologin_cookie_secure: true sets the cookie secure flag (default: false) | |
107 | + autologin_cookie_name: | |
108 | + autologin_cookie_path: | |
109 | + autologin_cookie_secure: | |
110 | + | |
111 | + # Configuration of SCM executable command. | |
112 | + # Absolute path (e.g. /usr/local/bin/hg) or command name (e.g. hg.exe, bzr.exe) | |
113 | + # On Windows, *.cmd, *.bat (e.g. hg.cmd, bzr.bat) does not work. | |
114 | + # Examples: | |
115 | + # scm_subversion_command: svn # (default: svn) | |
116 | + # scm_mercurial_command: C:\Program Files\TortoiseHg\hg.exe # (default: hg) | |
117 | + # scm_git_command: /usr/local/bin/git # (default: git) | |
118 | + # scm_cvs_command: cvs # (default: cvs) | |
119 | + # scm_bazaar_command: bzr.exe # (default: bzr) | |
120 | + # scm_darcs_command: darcs-1.0.9-i386-linux # (default: darcs) | |
121 | + scm_subversion_command: | |
122 | + scm_mercurial_command: | |
123 | + scm_git_command: | |
124 | + scm_cvs_command: | |
125 | + scm_bazaar_command: | |
126 | + scm_darcs_command: | |
127 | + | |
128 | + # Key used to encrypt sensitive data in the database (SCM and LDAP passwords). | |
129 | + # If you don't want to enable data encryption, just leave it blank. | |
130 | + # WARNING: losing/changing this key will make encrypted data unreadable. | |
131 | + # | |
132 | + # If you want to encrypt existing passwords in your database: | |
133 | + # * set the cipher key here in your configuration file | |
134 | + # * encrypt data using 'rake db:encrypt RAILS_ENV=production' | |
135 | + # | |
136 | + # If you have encrypted data and want to change this key, you have to: | |
137 | + # * decrypt data using 'rake db:decrypt RAILS_ENV=production' first | |
138 | + # * change the cipher key here in your configuration file | |
139 | + # * encrypt data using 'rake db:encrypt RAILS_ENV=production' | |
140 | + database_cipher_key: | |
141 | + | |
142 | +# specific configuration options for production environment | |
143 | +# that overrides the default ones | |
144 | +production: | |
145 | + | |
146 | +# specific configuration options for development environment | |
147 | +# that overrides the default ones | |
148 | +development: |
@@ -1,11 +0,0 @@ | ||
1 | -# Outgoing email settings | |
2 | - | |
3 | -production: | |
4 | - delivery_method: :smtp | |
5 | - smtp_settings: | |
6 | - address: <%= smtp_host %> | |
7 | - port: <%= smtp_port %> | |
8 | - domain: <%= smtp_domain %> | |
9 | -<%= "#" unless smtp_auth %> authentication: :login | |
10 | -<%= "#" unless smtp_auth %> user_name: <%= smtp_user %> | |
11 | -<%= "#" unless smtp_auth %> password: <%= smtp_password %> |