vhost_writer 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +15 -3
- data/lib/vhost_writer/cli.rb +5 -5
- data/lib/vhost_writer/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -8,7 +8,9 @@ Automatically generate virtual host config files based on a directory of sites a
|
|
8
8
|
|
9
9
|
## Usage
|
10
10
|
|
11
|
-
|
11
|
+
### Writing configs
|
12
|
+
|
13
|
+
`vhost_writer write` takes the following:
|
12
14
|
|
13
15
|
* A directory of directories that contain sites
|
14
16
|
* Each site's directory should share the name of its domain (like `example.com`)
|
@@ -16,11 +18,21 @@ Automatically generate virtual host config files based on a directory of sites a
|
|
16
18
|
* The path to a template file written in ERB
|
17
19
|
* Within the template, the `site` variable contains the name of the site.
|
18
20
|
|
19
|
-
|
21
|
+
#### Example
|
20
22
|
|
21
23
|
$ vhost_writer write /srv/www/ /etc/apache2/sites-available/ /home/bok/template.erb
|
22
24
|
|
23
|
-
###
|
25
|
+
### Scaffolding
|
26
|
+
|
27
|
+
vhost_writer has the ability to generate sane default ERB templates for you to modify and use with `vhost_writer write`. Access this functionality with `vhost_writer scaffold`.
|
28
|
+
|
29
|
+
# Display a list of included scaffolds
|
30
|
+
$ vhost_writer scaffold
|
31
|
+
|
32
|
+
# Generate an Apache ERB template
|
33
|
+
$ vhost_writer scaffold apache
|
34
|
+
|
35
|
+
## Template Example
|
24
36
|
|
25
37
|
<VirtualHost *:80>
|
26
38
|
ServerAdmin admin@<%= site %>
|
data/lib/vhost_writer/cli.rb
CHANGED
@@ -17,23 +17,23 @@ CONFIG_DIRECTORY using TEMPLATE'
|
|
17
17
|
|
18
18
|
desc 'scaffold [WEB_SERVER]',
|
19
19
|
'Generate a default template for WEB_SERVER. Run without arguments for a
|
20
|
-
list of
|
20
|
+
list of available scaffolds.'
|
21
21
|
def scaffold(scaffold='')
|
22
22
|
if scaffold.empty?
|
23
|
-
say "
|
24
|
-
say "#{
|
23
|
+
say "Available scaffolds:\n ", :yellow
|
24
|
+
say "#{available_scaffolds.join("\n ")}"
|
25
25
|
else
|
26
26
|
write_scaffold scaffold
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
private
|
31
|
-
def
|
31
|
+
def available_scaffolds
|
32
32
|
Dir.glob("#{source_paths.first}*").map { |f| File.basename f, '.erb' }
|
33
33
|
end
|
34
34
|
|
35
35
|
def write_scaffold(scaffold)
|
36
|
-
if
|
36
|
+
if available_scaffolds.include? scaffold
|
37
37
|
copy_file "#{scaffold}.erb"
|
38
38
|
else
|
39
39
|
say "Specified scaffold does not exist", :red
|
data/lib/vhost_writer/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vhost_writer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-06-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|