hostess 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +18 -18
- data/lib/hostess/virtual_host.rb +21 -3
- metadata +36 -52
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "rubygems"
|
2
|
-
require "
|
3
|
-
require
|
2
|
+
require "rubygems/package_task"
|
3
|
+
require 'rdoc/task'
|
4
4
|
|
5
5
|
require "rake/testtask"
|
6
6
|
Rake::TestTask.new do |t|
|
@@ -17,32 +17,32 @@ task :default => ["test"]
|
|
17
17
|
# http://rubygems.org/read/chapter/20
|
18
18
|
#
|
19
19
|
spec = Gem::Specification.new do |s|
|
20
|
-
|
20
|
+
|
21
21
|
# Change these as appropriate
|
22
22
|
s.name = "hostess"
|
23
|
-
s.version = "0.1.
|
23
|
+
s.version = "0.1.8"
|
24
24
|
s.summary = "Manage simple apache virtual hosts"
|
25
25
|
s.author = "Chris Roos, James Adam"
|
26
26
|
s.email = "chris@chrisroos.co.uk"
|
27
27
|
s.homepage = "http://chrisroos.co.uk"
|
28
28
|
|
29
29
|
s.has_rdoc = false
|
30
|
-
|
30
|
+
|
31
31
|
# You should probably have a README of some kind. Change the filename
|
32
32
|
# as appropriate
|
33
33
|
s.extra_rdoc_files = %w(README.md)
|
34
34
|
s.rdoc_options = %w(--main README.md)
|
35
|
-
|
35
|
+
|
36
36
|
s.require_paths = ['bin', 'lib']
|
37
37
|
|
38
38
|
# Add any extra files to include in the gem (like your README)
|
39
39
|
s.files = %w(README.md Rakefile) + Dir.glob("{bin}/**/*") + Dir.glob("{lib}/**/*")
|
40
40
|
s.executables = FileList["bin/**"].map { |f| File.basename(f) }
|
41
|
-
|
41
|
+
|
42
42
|
# If you want to depend on other gems, add them here, along with any
|
43
43
|
# relevant versions
|
44
44
|
# s.add_dependency("some_other_gem", "~> 0.1.0")
|
45
|
-
|
45
|
+
|
46
46
|
# If your tests use any gems, include them here
|
47
47
|
s.add_development_dependency("mocha")
|
48
48
|
|
@@ -51,13 +51,13 @@ spec = Gem::Specification.new do |s|
|
|
51
51
|
s.rubyforge_project = "hostess"
|
52
52
|
end
|
53
53
|
|
54
|
-
# This task actually builds the gem. We also regenerate a static
|
54
|
+
# This task actually builds the gem. We also regenerate a static
|
55
55
|
# .gemspec file, which is useful if something (i.e. GitHub) will
|
56
56
|
# be automatically building a gem for this project. If you're not
|
57
57
|
# using GitHub, edit as appropriate.
|
58
|
-
|
58
|
+
Gem::PackageTask.new(spec) do |pkg|
|
59
59
|
pkg.gem_spec = spec
|
60
|
-
|
60
|
+
|
61
61
|
# Generate the gemspec file for github.
|
62
62
|
file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
|
63
63
|
File.open(file, "w") {|f| f << spec.to_ruby }
|
@@ -65,7 +65,7 @@ end
|
|
65
65
|
|
66
66
|
# Generate documentation
|
67
67
|
Rake::RDocTask.new do |rd|
|
68
|
-
|
68
|
+
|
69
69
|
rd.rdoc_files.include("lib/**/*.rb")
|
70
70
|
rd.rdoc_dir = "rdoc"
|
71
71
|
end
|
@@ -75,7 +75,7 @@ task :clean => [:clobber_rdoc, :clobber_package] do
|
|
75
75
|
rm "#{spec.name}.gemspec"
|
76
76
|
end
|
77
77
|
|
78
|
-
# If you want to publish to RubyForge automatically, here's a simple
|
78
|
+
# If you want to publish to RubyForge automatically, here's a simple
|
79
79
|
# task to help do that. If you don't, just get rid of this.
|
80
80
|
# Be sure to set up your Rubyforge account details with the Rubyforge
|
81
81
|
# gem; you'll need to run `rubyforge setup` and `rubyforge config` at
|
@@ -83,10 +83,10 @@ end
|
|
83
83
|
begin
|
84
84
|
require "rake/contrib/sshpublisher"
|
85
85
|
namespace :rubyforge do
|
86
|
-
|
86
|
+
|
87
87
|
desc "Release gem and RDoc documentation to RubyForge"
|
88
88
|
task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
|
89
|
-
|
89
|
+
|
90
90
|
namespace :release do
|
91
91
|
desc "Release a new version of this gem"
|
92
92
|
task :gem => [:package] do
|
@@ -99,17 +99,17 @@ begin
|
|
99
99
|
puts "Publishing #{spec.name}-#{spec.version.to_s} to Rubyforge..."
|
100
100
|
rubyforge.add_release(spec.rubyforge_project, spec.name, spec.version.to_s, path_to_gem)
|
101
101
|
end
|
102
|
-
|
102
|
+
|
103
103
|
desc "Publish RDoc to RubyForge."
|
104
104
|
task :docs => [:rdoc] do
|
105
105
|
config = YAML.load(
|
106
106
|
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
107
107
|
)
|
108
|
-
|
108
|
+
|
109
109
|
host = "#{config['username']}@rubyforge.org"
|
110
110
|
remote_dir = "/var/www/gforge-projects/hostess/" # Should be the same as the rubyforge project name
|
111
111
|
local_dir = 'rdoc'
|
112
|
-
|
112
|
+
|
113
113
|
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
114
114
|
end
|
115
115
|
end
|
data/lib/hostess/virtual_host.rb
CHANGED
@@ -17,6 +17,7 @@ module Hostess
|
|
17
17
|
def delete
|
18
18
|
delete_dns_entry
|
19
19
|
delete_vhost
|
20
|
+
delete_apache_log_directory
|
20
21
|
restart_apache
|
21
22
|
end
|
22
23
|
def list
|
@@ -28,11 +29,25 @@ module Hostess
|
|
28
29
|
@options.display_banner_and_return
|
29
30
|
end
|
30
31
|
private
|
32
|
+
def dscl_works?
|
33
|
+
`sw_vers -productVersion`.strip < '10.7'
|
34
|
+
end
|
35
|
+
def hosts_filename
|
36
|
+
File.join('/', 'etc', 'hosts')
|
37
|
+
end
|
31
38
|
def create_dns_entry
|
32
|
-
|
39
|
+
if dscl_works?
|
40
|
+
run "dscl localhost -create /Local/Default/Hosts/#{@options.domain} IPAddress 127.0.0.1"
|
41
|
+
else
|
42
|
+
run "echo '127.0.0.1 #{@options.domain}' >> #{hosts_filename}"
|
43
|
+
end
|
33
44
|
end
|
34
45
|
def delete_dns_entry
|
35
|
-
|
46
|
+
if dscl_works?
|
47
|
+
run "dscl localhost -delete /Local/Default/Hosts/#{@options.domain}"
|
48
|
+
else
|
49
|
+
run "perl -pi -e 's/127.0.0.1 #{@options.domain}\\n//g' #{hosts_filename}"
|
50
|
+
end
|
36
51
|
end
|
37
52
|
def create_vhost
|
38
53
|
tempfile = Tempfile.new('vhost')
|
@@ -49,6 +64,9 @@ module Hostess
|
|
49
64
|
def create_apache_log_directory
|
50
65
|
run "mkdir -p #{apache_log_directory}"
|
51
66
|
end
|
67
|
+
def delete_apache_log_directory
|
68
|
+
run "rm -r #{apache_log_directory}"
|
69
|
+
end
|
52
70
|
def vhost_config
|
53
71
|
domain, directory = @options.domain, @options.directory
|
54
72
|
template = <<-EOT
|
@@ -101,4 +119,4 @@ module Hostess
|
|
101
119
|
"sudo -s \"#{cmd}\""
|
102
120
|
end
|
103
121
|
end
|
104
|
-
end
|
122
|
+
end
|
metadata
CHANGED
@@ -1,87 +1,71 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: hostess
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 7
|
10
|
-
version: 0.1.7
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.8
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Chris Roos, James Adam
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-10-27 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: mocha
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
33
22
|
type: :development
|
34
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
35
30
|
description:
|
36
31
|
email: chris@chrisroos.co.uk
|
37
|
-
executables:
|
32
|
+
executables:
|
38
33
|
- hostess
|
39
34
|
extensions: []
|
40
|
-
|
41
|
-
extra_rdoc_files:
|
35
|
+
extra_rdoc_files:
|
42
36
|
- README.md
|
43
|
-
files:
|
37
|
+
files:
|
44
38
|
- README.md
|
45
39
|
- Rakefile
|
46
40
|
- bin/hostess
|
47
41
|
- lib/hostess/options.rb
|
48
42
|
- lib/hostess/virtual_host.rb
|
49
43
|
- lib/hostess.rb
|
50
|
-
has_rdoc: false
|
51
44
|
homepage: http://chrisroos.co.uk
|
52
45
|
licenses: []
|
53
|
-
|
54
46
|
post_install_message:
|
55
|
-
rdoc_options:
|
47
|
+
rdoc_options:
|
56
48
|
- --main
|
57
49
|
- README.md
|
58
|
-
require_paths:
|
50
|
+
require_paths:
|
59
51
|
- bin
|
60
52
|
- lib
|
61
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
54
|
none: false
|
63
|
-
requirements:
|
64
|
-
- -
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
|
67
|
-
|
68
|
-
- 0
|
69
|
-
version: "0"
|
70
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
60
|
none: false
|
72
|
-
requirements:
|
73
|
-
- -
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
|
76
|
-
segments:
|
77
|
-
- 0
|
78
|
-
version: "0"
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
79
65
|
requirements: []
|
80
|
-
|
81
66
|
rubyforge_project: hostess
|
82
|
-
rubygems_version: 1.
|
67
|
+
rubygems_version: 1.8.23
|
83
68
|
signing_key:
|
84
69
|
specification_version: 3
|
85
70
|
summary: Manage simple apache virtual hosts
|
86
71
|
test_files: []
|
87
|
-
|