cheese 0.0.1 → 0.0.2
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/README.txt +1 -1
- data/lib/cheese/version.rb +1 -1
- data/lib/controller.rb +1 -1
- data/lib/database/mysql.rb +3 -6
- data/lib/database/postgresql.rb +3 -6
- data/lib/process.rb +0 -3
- data/lib/scm/subversion.rb +9 -6
- data/lib/verbose.rb +3 -5
- data/lib/web/domain.rb +3 -5
- data/lib/web/mongrel.rb +6 -8
- data/lib/web/nginx.rb +14 -3
- data/lib/web/proxy.rb +3 -5
- data/lib/web/virtual_host.rb +3 -5
- metadata +1 -1
data/README.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
== Cheese
|
2
2
|
|
3
|
-
Cheese is a set of ruby scripts supplied with all
|
3
|
+
Cheese is a set of ruby scripts supplied with all Written Path
|
4
4
|
Virtual Cheesey Servers but available to all under the MIT license.
|
5
5
|
They reduce the steps needed to administrate a web server.
|
6
6
|
|
data/lib/cheese/version.rb
CHANGED
data/lib/controller.rb
CHANGED
@@ -119,7 +119,7 @@ private
|
|
119
119
|
end
|
120
120
|
else
|
121
121
|
Cheese::Verbose.log_task("create the mongrel_cluster file") do
|
122
|
-
Cheese::Mongrel.create(@
|
122
|
+
Cheese::Mongrel.create(@options[:name], @added_domain.proxy.ports)
|
123
123
|
end
|
124
124
|
end
|
125
125
|
end
|
data/lib/database/mysql.rb
CHANGED
data/lib/database/postgresql.rb
CHANGED
data/lib/process.rb
CHANGED
data/lib/scm/subversion.rb
CHANGED
@@ -1,16 +1,19 @@
|
|
1
|
-
# subversion.rb
|
2
|
-
#
|
3
|
-
# Acts as a subversion repository
|
4
|
-
# This could be done with the svn ruby bindings, but it's simple
|
5
|
-
# stuff that for now will be fine using system
|
6
|
-
|
7
1
|
require 'fileutils'
|
8
2
|
|
9
3
|
module Cheese
|
10
4
|
module Subversion
|
5
|
+
#
|
6
|
+
# Represents the a subversion repository
|
7
|
+
# This could be done with the svn ruby bindings, but it's simple
|
8
|
+
# stuff that for now will be fine using system
|
9
|
+
#
|
11
10
|
class Repository
|
12
11
|
DEFAULT_ACCESS = { :anon => :none, :auth => :write }
|
13
12
|
SILENCER = ">/dev/null 2>/dev/null"
|
13
|
+
|
14
|
+
# Create a Subversion repository for the given name this
|
15
|
+
# calls create_tmp_structure to give the tags, branches and trunk
|
16
|
+
# directories
|
14
17
|
def self.create(name)
|
15
18
|
# Create the repo
|
16
19
|
%x{ svnadmin create /var/src/#{name} #{SILENCER} }
|
data/lib/verbose.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
# verbose.rb
|
2
|
-
#
|
3
|
-
# This performs tasks and spits out status depending on whether you want verbose
|
4
|
-
#
|
5
|
-
|
6
1
|
module Cheese
|
2
|
+
#
|
3
|
+
# This is a wrapper around actions that can be taken, it allows you
|
4
|
+
# to control the verbosity and also 'fake' an action on a dry run.
|
7
5
|
class Verbose
|
8
6
|
@@loud = false
|
9
7
|
@@dry_run = false
|
data/lib/web/domain.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
# domain.rb
|
2
|
-
#
|
3
|
-
# Represents an nginx domain, which encompasses the vhost and proxies
|
4
|
-
#
|
5
|
-
|
6
1
|
module Cheese
|
7
2
|
module Nginx
|
3
|
+
#
|
4
|
+
# Represents an nginx domain, which encompasses the vhost and proxies
|
5
|
+
#
|
8
6
|
class Domain
|
9
7
|
attr_reader :vhost, :proxy, :host
|
10
8
|
|
data/lib/web/mongrel.rb
CHANGED
@@ -1,15 +1,13 @@
|
|
1
|
-
# mongrel.rb
|
2
|
-
#
|
3
|
-
# deals with mongrel cluster files and saves them as temp files and filename
|
4
|
-
#
|
5
|
-
|
6
1
|
require 'tmpdir'
|
7
2
|
|
8
3
|
module Cheese
|
9
|
-
|
4
|
+
#
|
5
|
+
# Representing the Mongrel cluster config file, this will be expanded/refactored
|
6
|
+
# to include controlling mongrel too
|
10
7
|
class Mongrel
|
11
8
|
|
12
|
-
# Create a temp file
|
9
|
+
# Create a temp file which has the right config for the given host and ports
|
10
|
+
# and import it into the Subversion repository for this domain
|
13
11
|
def self.create(host, ports)
|
14
12
|
mongrel_text = IO.read(File.dirname(__FILE__) + "/../../data/templates/mongrel.inc")
|
15
13
|
count = ports.size
|
@@ -20,7 +18,7 @@ module Cheese
|
|
20
18
|
Cheese::Subversion::Repository.import(host, File.join(Dir.tmpdir, "/config"), "/trunk/config")
|
21
19
|
end
|
22
20
|
|
23
|
-
#
|
21
|
+
# Requests that Subversion deletes the given config file for a host
|
24
22
|
def self.remove(host)
|
25
23
|
Cheese::Subversion::Repository.remove_file(host, "/config/mongrel_cluster.yml")
|
26
24
|
end
|
data/lib/web/nginx.rb
CHANGED
@@ -5,6 +5,9 @@
|
|
5
5
|
|
6
6
|
module Cheese
|
7
7
|
module Nginx
|
8
|
+
|
9
|
+
# Represents the Nginx config file, giving the ability to manipulate
|
10
|
+
# the VHosts within it, and save changes.
|
8
11
|
class Config
|
9
12
|
attr_reader :filename
|
10
13
|
attr_accessor :domains
|
@@ -30,6 +33,7 @@ module Cheese
|
|
30
33
|
find_domains
|
31
34
|
end
|
32
35
|
|
36
|
+
# Add a virtual host to the Nginx config file
|
33
37
|
def add(options={})
|
34
38
|
domain = options[:name]
|
35
39
|
return false if domain.nil?
|
@@ -43,7 +47,8 @@ module Cheese
|
|
43
47
|
@domains << new_domain
|
44
48
|
return new_domain
|
45
49
|
end
|
46
|
-
|
50
|
+
|
51
|
+
# Remove a virtual host from the Nginx config file
|
47
52
|
def remove(object)
|
48
53
|
if object.is_a? Cheese::Nginx::VirtualHost
|
49
54
|
@vhosts.delete(object)
|
@@ -56,12 +61,15 @@ module Cheese
|
|
56
61
|
return object[:name]
|
57
62
|
end
|
58
63
|
end
|
59
|
-
|
64
|
+
|
65
|
+
# Replace a virtual host in the Nginx config file
|
60
66
|
def replace(options={})
|
61
67
|
self.remove options[:name]
|
62
68
|
self.add options
|
63
69
|
end
|
64
|
-
|
70
|
+
|
71
|
+
# Save any changes made to the Nginx config file, this has to specifically called
|
72
|
+
# to be sure it's not accidentally called
|
65
73
|
def save
|
66
74
|
# self.as_www do
|
67
75
|
Cheese::Verbose.log_task "Saving #{@domains.size} domains"
|
@@ -90,18 +98,21 @@ module Cheese
|
|
90
98
|
Cheese::Verbose.log_task "Saved #{@filename}"
|
91
99
|
end
|
92
100
|
|
101
|
+
# Stop the Nginx server
|
93
102
|
def stop
|
94
103
|
Cheese::Verbose.log_task "Stop nginx server" do
|
95
104
|
%x{ /etc/init.d/nginx stop }
|
96
105
|
end
|
97
106
|
end
|
98
107
|
|
108
|
+
# Start the Nginx server
|
99
109
|
def start
|
100
110
|
Cheese::Verbose.log_task "Start nginx server" do
|
101
111
|
%x{ /etc/init.d/nginx start }
|
102
112
|
end
|
103
113
|
end
|
104
114
|
|
115
|
+
# Restart the Nginx server
|
105
116
|
def restart
|
106
117
|
Cheese::Verbose.log_task "Restart nginx server" do
|
107
118
|
%x{ /etc/init.d/nginx restart }
|
data/lib/web/proxy.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
-
# proxy.rb
|
2
|
-
#
|
3
|
-
# Represents the proxies to external processes that a vhost requires
|
4
|
-
#
|
5
|
-
|
6
1
|
module Cheese
|
7
2
|
module Nginx
|
3
|
+
#
|
4
|
+
# Represents the proxies to external processes that a vhost requires
|
5
|
+
#
|
8
6
|
class Proxy
|
9
7
|
attr_reader :domain, :ports, :config
|
10
8
|
|
data/lib/web/virtual_host.rb
CHANGED
metadata
CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: cheese
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
6
|
+
version: 0.0.2
|
7
7
|
date: 2007-04-17 00:00:00 +01:00
|
8
8
|
summary: Automate the creation of web applications and accompanying pieces e.g. Nginx, Subversion, Mongrel, Monit, S3.
|
9
9
|
require_paths:
|