railsmachine 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,42 @@
1
+ require 'fileutils'
2
+ Capistrano.configuration(:must_exist).load do
3
+
4
+ desc "Setup svn repository"
5
+ task :setup_svn, :roles => :scm do
6
+ dir = "#{deploy_to}/repos"
7
+ run "mkdir -p #{dir}"
8
+ run "chmod 770 #{dir}"
9
+ run "svnadmin create #{dir}"
10
+ end
11
+
12
+ desc "Import code into svn repository."
13
+ task :import_svn do
14
+ new_path = "../#{application}_machine"
15
+ tags = repository.sub("trunk", "tags")
16
+ branches = repository.sub("trunk", "branches")
17
+ puts "Adding branches and tags"
18
+ system "svn mkdir -m 'Adding tags and branches directories' #{tags} #{branches}"
19
+ puts "Importing application."
20
+ system "svn import #{repository} -m 'Import'"
21
+ puts "Checking out to new directory."
22
+ system "svn co #{repository} #{new_path}"
23
+ cwd = Dir.getwd
24
+ Dir.chdir new_path
25
+ puts "removing log directory contents from svn"
26
+ system "svn remove log/*"
27
+ puts "ignoring log directory"
28
+ system "svn propset svn:ignore '*.log' log/"
29
+ system "svn update log/"
30
+ puts "removing tmp directory from svn"
31
+ system "svn remove tmp/"
32
+ puts "ignoring tmp directory"
33
+ system "svn propset svn:ignore '*' tmp/"
34
+ system "svn update tmp/"
35
+ puts "committing changes"
36
+ system "svn commit -m 'Removed and ignored log files and tmp'"
37
+ Dir.chdir cwd
38
+ puts "Your repository is: #{repository}"
39
+ puts "Please change to your new working directory: #{new_path}"
40
+ end
41
+
42
+ end
@@ -0,0 +1,74 @@
1
+ <VirtualHost <%= apache_ssl_ip %>:443>
2
+
3
+ ServerName <%= apache_server_name %>
4
+ <% apache_server_aliases_array.each do |a| %>
5
+ ServerAlias <%= "#{a}" %>
6
+ <% end %>
7
+ DocumentRoot <%= "#{current_path}/public" %>
8
+
9
+ <Directory <%= "#{current_path}/public" %>>
10
+ Options FollowSymLinks
11
+ AllowOverride None
12
+ Order allow,deny
13
+ Allow from all
14
+ </Directory>
15
+
16
+ # Configure mongrel_cluster
17
+ <Proxy balancer://<%= "#{application}_cluster" %>>
18
+ <% start_port = apache_proxy_port %>
19
+ <% end_port = apache_proxy_port + apache_proxy_servers - 1 %>
20
+ <% start_port.upto(end_port) do |port| %>
21
+ BalancerMember http://<%= "#{apache_proxy_address}:#{port.to_s}" %>
22
+ <% end %>
23
+ </Proxy>
24
+
25
+ RewriteEngine On
26
+
27
+ # Prevent access to .svn directories
28
+ RewriteRule ^(.*/)?\.svn/ - [F,L]
29
+ ErrorDocument 403 "Access Forbidden"
30
+
31
+ # Check for maintenance file and redirect all requests
32
+ RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
33
+ RewriteCond %{SCRIPT_FILENAME} !maintenance.html
34
+ RewriteRule ^.*$ /system/maintenance.html [L]
35
+
36
+ # Rewrite index to check for static
37
+ RewriteRule ^/$ /index.html [QSA]
38
+
39
+ # Rewrite to check for Rails cached page
40
+ RewriteRule ^([^.]+)$ $1.html [QSA]
41
+
42
+ # Redirect all non-static requests to cluster
43
+ RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
44
+ # Add header for Mongrel to set HTTPS environment for Rails
45
+ RequestHeader set X-Forwarded-Proto "https"
46
+ RewriteRule ^/(.*)$ balancer://<%= "#{application}_cluster" %>%{REQUEST_URI} [P,QSA,L]
47
+
48
+ # Deflate
49
+ AddOutputFilterByType DEFLATE text/html text/plain text/xml
50
+ BrowserMatch ^Mozilla/4 gzip-only-text/html
51
+ BrowserMatch ^Mozilla/4\.0[678] no-gzip
52
+ BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
53
+
54
+ # SSL Engine Switch
55
+ SSLEngine on
56
+
57
+ # SSL Cipher Suite:
58
+ SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
59
+
60
+ # Server Certificate
61
+ SSLCertificateFile /etc/httpd/conf/ssl.crt/<%= domain %>.crt
62
+
63
+ # Server Private Key
64
+ SSLCertificateKeyFile /etc/httpd/conf/ssl.key/<%= domain %>.key
65
+
66
+ BrowserMatch ".*MSIE.*" \
67
+ nokeepalive ssl-unclean-shutdown \
68
+ downgrade-1.0 force-response-1.0
69
+
70
+ ErrorLog logs/<%= domain %>-error_log
71
+ CustomLog logs/<%= domain %>-access_log combined
72
+ CustomLog logs/<%= domain %>-ssl_log \
73
+ "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
74
+ </VirtualHost>
@@ -0,0 +1,63 @@
1
+
2
+
3
+ <VirtualHost <%= apache_ssl_enabled ? apache_ssl_ip : "*" %>:80>
4
+ ServerName <%= apache_server_name %>
5
+ <% apache_server_aliases_array.each do |a| %>
6
+ ServerAlias <%= "#{a}" %>
7
+ <% end %>
8
+ DocumentRoot <%= "#{current_path}/public" %>
9
+
10
+ <Directory <%= "#{current_path}/public" %>>
11
+ Options FollowSymLinks
12
+ AllowOverride None
13
+ Order allow,deny
14
+ Allow from all
15
+ </Directory>
16
+
17
+ # Configure mongrel_cluster
18
+ <Proxy balancer://<%= "#{application}_cluster" %>>
19
+ <% start_port = apache_proxy_port %>
20
+ <% end_port = apache_proxy_port + apache_proxy_servers - 1 %>
21
+ <% start_port.upto(end_port) do |port| %>
22
+ BalancerMember http://<%= "#{apache_proxy_address}:#{port.to_s}" %>
23
+ <% end %>
24
+ </Proxy>
25
+
26
+ RewriteEngine On
27
+
28
+ <% if apache_ssl_enabled && apache_ssl_forward_all %>
29
+ RewriteRule ^(.*)$ https://<%= domain %>$1
30
+ <% end %>
31
+
32
+ # Prevent access to .svn directories
33
+ RewriteRule ^(.*/)?\.svn/ - [F,L]
34
+ ErrorDocument 403 "Access Forbidden"
35
+
36
+ # Check for maintenance file and redirect all requests
37
+ RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
38
+ RewriteCond %{SCRIPT_FILENAME} !maintenance.html
39
+ RewriteRule ^.*$ /system/maintenance.html [L]
40
+
41
+ # Rewrite index to check for static
42
+ RewriteRule ^/$ /index.html [QSA]
43
+
44
+ # Rewrite to check for Rails cached page
45
+ RewriteRule ^([^.]+)$ $1.html [QSA]
46
+
47
+ # Redirect all non-static requests to cluster
48
+ RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
49
+ RewriteRule ^/(.*)$ balancer://<%= "#{application}_cluster" %>%{REQUEST_URI} [P,QSA,L]
50
+
51
+ # Deflate
52
+ AddOutputFilterByType DEFLATE text/html text/plain text/xml
53
+ BrowserMatch ^Mozilla/4 gzip-only-text/html
54
+ BrowserMatch ^Mozilla/4\.0[678] no-gzip
55
+ BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
56
+
57
+ ErrorLog logs/<%= domain %>-error_log
58
+ CustomLog logs/<%= domain %>-access_log combined
59
+ </VirtualHost>
60
+
61
+ <% if apache_ssl_enabled %>
62
+ Include "<%= apache_ssl_config %>"
63
+ <% end %>
@@ -0,0 +1,3 @@
1
+ ---
2
+ :debug: false
3
+
@@ -0,0 +1,18 @@
1
+ User "nobody"
2
+ Group "nobody"
3
+
4
+ ListenHTTP
5
+ Address <%= ip_address %>
6
+ Port 80
7
+
8
+ Service
9
+ Backend
10
+ Address 127.0.0.1
11
+ Port 8000
12
+ End
13
+ Backend
14
+ Address 127.0.0.1
15
+ Port 8001
16
+ End
17
+ End
18
+ End
data/tools/rakehelp.rb ADDED
@@ -0,0 +1,105 @@
1
+
2
+ def make(makedir)
3
+ Dir.chdir(makedir) do
4
+ sh(PLATFORM =~ /win32/ ? 'nmake' : 'make')
5
+ end
6
+ end
7
+
8
+
9
+ def extconf(dir)
10
+ Dir.chdir(dir) do ruby "extconf.rb" end
11
+ end
12
+
13
+
14
+ def setup_tests
15
+ Rake::TestTask.new do |t|
16
+ t.libs << "test"
17
+ t.test_files = FileList['test/test*.rb']
18
+ t.verbose = true
19
+ end
20
+ end
21
+
22
+
23
+ def setup_clean otherfiles
24
+ files = ['build/*', '**/*.o', '**/*.so', '**/*.a', 'lib/*-*', '**/*.log'] + otherfiles
25
+ CLEAN.include(files)
26
+ end
27
+
28
+
29
+ def setup_rdoc files
30
+ Rake::RDocTask.new do |rdoc|
31
+ rdoc.rdoc_dir = 'doc/rdoc'
32
+ rdoc.options << '--line-numbers'
33
+ rdoc.rdoc_files.add(files)
34
+ end
35
+ end
36
+
37
+
38
+ def setup_extension(dir, extension)
39
+ ext = "ext/#{dir}"
40
+ ext_so = "#{ext}/#{extension}.#{Config::CONFIG['DLEXT']}"
41
+ ext_files = FileList[
42
+ "#{ext}/*.c",
43
+ "#{ext}/*.h",
44
+ "#{ext}/extconf.rb",
45
+ "#{ext}/Makefile",
46
+ "lib"
47
+ ]
48
+
49
+ task "lib" do
50
+ directory "lib"
51
+ end
52
+
53
+ desc "Builds just the #{extension} extension"
54
+ task extension.to_sym => ["#{ext}/Makefile", ext_so ]
55
+
56
+ file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do
57
+ extconf "#{ext}"
58
+ end
59
+
60
+ file ext_so => ext_files do
61
+ make "#{ext}"
62
+ cp ext_so, "lib"
63
+ end
64
+ end
65
+
66
+
67
+ def base_gem_spec(pkg_name, pkg_version)
68
+ pkg_version = pkg_version
69
+ pkg_name = pkg_name
70
+ pkg_file_name = "#{pkg_name}-#{pkg_version}"
71
+ Gem::Specification.new do |s|
72
+ s.name = pkg_name
73
+ s.version = pkg_version
74
+ s.platform = Gem::Platform::RUBY
75
+ s.has_rdoc = true
76
+ s.extra_rdoc_files = [ "README" ]
77
+
78
+ s.files = %w(COPYING LICENSE README Rakefile) +
79
+ Dir.glob("{bin,doc/rdoc,test,lib}/**/*") +
80
+ Dir.glob("ext/**/*.{h,c,rb}") +
81
+ Dir.glob("examples/**/*.rb") +
82
+ Dir.glob("tools/*.rb")
83
+
84
+ s.require_path = "lib"
85
+ s.extensions = FileList["ext/**/extconf.rb"].to_a
86
+ s.bindir = "bin"
87
+ end
88
+ end
89
+
90
+ def setup_gem(pkg_name, pkg_version)
91
+ spec = base_gem_spec(pkg_name, pkg_version)
92
+ yield spec if block_given?
93
+
94
+ Rake::GemPackageTask.new(spec) do |p|
95
+ p.gem_spec = spec
96
+ p.need_tar = true
97
+ end
98
+ end
99
+
100
+ def setup_win32_gem(pkg_name, pkg_version)
101
+ spec = base_gem_spec(pkg_name, pkg_version)
102
+ yield spec if block_given?
103
+
104
+ Gem::Builder.new(spec).build
105
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.11
3
+ specification_version: 1
4
+ name: railsmachine
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.1.0
7
+ date: 2006-06-19 00:00:00 -04:00
8
+ summary: The Rails Machine task library
9
+ require_paths:
10
+ - lib
11
+ email:
12
+ homepage:
13
+ rubyforge_project:
14
+ description: The Rails Machine task library
15
+ autorequire:
16
+ default_executable: railsmachine
17
+ bindir: bin
18
+ has_rdoc: false
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ authors:
29
+ - Bradley Taylor
30
+ files:
31
+ - COPYING
32
+ - LICENSE
33
+ - README
34
+ - Rakefile
35
+ - bin/railsmachine
36
+ - lib/railsmachine
37
+ - lib/railsmachine/generators
38
+ - lib/railsmachine/recipes
39
+ - lib/railsmachine/recipes.rb
40
+ - lib/railsmachine/generators/loader.rb
41
+ - lib/railsmachine/generators/railsmachine
42
+ - lib/railsmachine/generators/railsmachine/railsmachine_generator.rb
43
+ - lib/railsmachine/generators/railsmachine/templates
44
+ - lib/railsmachine/generators/railsmachine/USAGE
45
+ - lib/railsmachine/generators/railsmachine/templates/deploy.rb
46
+ - lib/railsmachine/recipes/apache.rb
47
+ - lib/railsmachine/recipes/mongrel.rb
48
+ - lib/railsmachine/recipes/mysql.rb
49
+ - lib/railsmachine/recipes/svn.rb
50
+ - lib/railsmachine/recipes/templates
51
+ - lib/railsmachine/recipes/templates/httpd-ssl.conf
52
+ - lib/railsmachine/recipes/templates/httpd.conf
53
+ - tools/rakehelp.rb
54
+ - resources/defaults.yaml
55
+ - resources/pound.conf
56
+ test_files: []
57
+
58
+ rdoc_options: []
59
+
60
+ extra_rdoc_files:
61
+ - README
62
+ executables:
63
+ - railsmachine
64
+ extensions: []
65
+
66
+ requirements: []
67
+
68
+ dependencies:
69
+ - !ruby/object:Gem::Dependency
70
+ name: capistrano
71
+ version_requirement:
72
+ version_requirements: !ruby/object:Gem::Version::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 1.1.0
77
+ version:
78
+ - !ruby/object:Gem::Dependency
79
+ name: mongrel_cluster
80
+ version_requirement:
81
+ version_requirements: !ruby/object:Gem::Version::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 0.2.0
86
+ version: