apache-config-generator 0.1.2 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.2. Another minor release, lots of improvements since 0.1.
2
+
1
3
  v0.1.2. Some more small fixes.
2
4
 
3
5
  v0.1.1. Stupid bug in initial release.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{apache-config-generator}
5
- s.version = "0.1.2"
5
+ s.version = "0.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["John Bintz"]
@@ -113,5 +113,11 @@ module Apache
113
113
  opts.each { |o| server_alias o } if !opts.empty?
114
114
  end
115
115
  end
116
+
117
+ def document_root(*opts)
118
+ directory? opts.first
119
+ self << "DocumentRoot #{quoteize(opts.first)}"
120
+ end
121
+ alias :document_root! :document_root
116
122
  end
117
123
  end
@@ -47,8 +47,8 @@ module Apache
47
47
  when String
48
48
  @config << "#{which} #{opts * " "}"
49
49
  when Array
50
- which.each do |w|
51
- @config << "#{w} #{opts.shift}"
50
+ which.each do |tag|
51
+ @config << "#{tag} #{opts.shift}"
52
52
  end
53
53
  end
54
54
  end
@@ -170,7 +170,7 @@ module Apache
170
170
  module RegularExpressionMatcher
171
171
  # Test this rewritable thing
172
172
  def test(from, opts = {})
173
- from = from.gsub(@from, @to.gsub(/\$([0-9])/) { |m| '\\' + $1 })
173
+ from = from.gsub(@from, @to.gsub(/\$([0-9])/) { |match| '\\' + $1 })
174
174
  replace_placeholders(from, opts)
175
175
  end
176
176
 
@@ -179,14 +179,14 @@ module Apache
179
179
  end
180
180
 
181
181
  # Replace the placeholders in this rewritable thing
182
- def replace_placeholders(s, opts)
182
+ def replace_placeholders(string, opts)
183
183
  opts.each do |opt, value|
184
184
  case value
185
185
  when String
186
- s = s.gsub('%{' + opt.to_s.upcase + '}', value)
186
+ string = string.gsub('%{' + opt.to_s.upcase + '}', value)
187
187
  end
188
188
  end
189
- s.gsub(%r{%\{[^\}]+\}}, '')
189
+ string.gsub(%r{%\{[^\}]+\}}, '')
190
190
  end
191
191
  end
192
192
 
@@ -387,12 +387,9 @@ module Apache
387
387
  end
388
388
 
389
389
  result = false
390
- case to[0..0]
391
- when '-'
392
- case to
393
- when '-f'
394
- result = opts[:files].include? source if opts[:files]
395
- end
390
+ case to
391
+ when '-f'
392
+ result = opts[:files].include?(source) if opts[:files]
396
393
  else
397
394
  result = source[Regexp.new(to)]
398
395
  end
@@ -3,12 +3,13 @@ module Apache
3
3
  def enable_ssl_engine(options = {})
4
4
  self << ""
5
5
  self << "SSLEngine on"
6
- options.each do |k, v|
7
- case k
6
+ options.each do |key, value|
7
+ value = quoteize(value).first
8
+ case key
8
9
  when :certificate_file, :certificate_key_file
9
- self << "SSL#{apachify(k)} #{quoteize(v).first}"
10
+ self << "SSL#{apachify(key)} #{value}"
10
11
  when :ca_certificate_file
11
- self << "SSLCACertificateFile #{quoteize(v).first}"
12
+ self << "SSLCACertificateFile #{value}"
12
13
  end
13
14
  end
14
15
  self << ""
metadata CHANGED
@@ -4,9 +4,8 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
7
  - 2
9
- version: 0.1.2
8
+ version: "0.2"
10
9
  platform: ruby
11
10
  authors:
12
11
  - John Bintz