railsmachine 1.0.1 → 1.0.3
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/COPYING +1 -1
 - data/LICENSE +1 -1
 - data/README +76 -16
 - data/Rakefile +6 -4
 - data/lib/railsmachine/generators/railsmachine/USAGE +1 -1
 - data/lib/railsmachine/generators/railsmachine/templates/deploy.rb +21 -11
 - data/lib/railsmachine/recipes.rb +150 -62
 - data/lib/railsmachine/recipes/app/deploy.rb +28 -0
 - data/lib/railsmachine/recipes/{mongrel.rb → app/mongrel.rb} +19 -26
 - data/lib/railsmachine/recipes/app/passenger.rb +20 -0
 - data/lib/railsmachine/recipes/{mysql.rb → db/mysql.rb} +1 -1
 - data/lib/railsmachine/recipes/{pgsql.rb → db/postgresql.rb} +1 -1
 - data/lib/railsmachine/recipes/db/sqlite3.rb +14 -0
 - data/lib/railsmachine/recipes/scm/git.rb +44 -0
 - data/lib/railsmachine/recipes/scm/subversion.rb +47 -0
 - data/lib/railsmachine/recipes/{apache.rb → web/apache.rb} +26 -15
 - data/lib/railsmachine/recipes/{templates → web/templates/mongrel}/httpd-ssl.conf +14 -8
 - data/lib/railsmachine/recipes/{templates → web/templates/mongrel}/httpd.conf +14 -10
 - data/lib/railsmachine/recipes/web/templates/passenger/httpd-ssl.conf +60 -0
 - data/lib/railsmachine/recipes/web/templates/passenger/httpd.conf +40 -0
 - metadata +31 -19
 - data/lib/railsmachine/generators/railsmachine/templates/deploy.rb~ +0 -95
 - data/lib/railsmachine/recipes/svn.rb +0 -46
 
| 
         @@ -0,0 +1,40 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <VirtualHost *:80>
         
     | 
| 
      
 2 
     | 
    
         
            +
              ServerName <%=  apache_server_name %>
         
     | 
| 
      
 3 
     | 
    
         
            +
              <% apache_server_aliases_array.each do |a| %>
         
     | 
| 
      
 4 
     | 
    
         
            +
              ServerAlias <%= "#{a}" %>
         
     | 
| 
      
 5 
     | 
    
         
            +
              <% end %>
         
     | 
| 
      
 6 
     | 
    
         
            +
              DocumentRoot <%= "#{current_path}/public" %>
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              <Directory <%= "#{current_path}/public" %>>
         
     | 
| 
      
 9 
     | 
    
         
            +
                Options FollowSymLinks
         
     | 
| 
      
 10 
     | 
    
         
            +
                AllowOverride None
         
     | 
| 
      
 11 
     | 
    
         
            +
                Order allow,deny
         
     | 
| 
      
 12 
     | 
    
         
            +
                Allow from all
         
     | 
| 
      
 13 
     | 
    
         
            +
              </Directory>
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            	# set the environment 
         
     | 
| 
      
 16 
     | 
    
         
            +
              RailsEnv <%= rails_env.to_s %>
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            <% if use_mod_rewrite %>
         
     | 
| 
      
 19 
     | 
    
         
            +
              RailsAllowModRewrite on
         
     | 
| 
      
 20 
     | 
    
         
            +
              RewriteEngine On
         
     | 
| 
      
 21 
     | 
    
         
            +
              
         
     | 
| 
      
 22 
     | 
    
         
            +
              # Prevent access to .svn directories
         
     | 
| 
      
 23 
     | 
    
         
            +
              RewriteRule ^(.*/)?\.svn/ - [F,L]
         
     | 
| 
      
 24 
     | 
    
         
            +
              ErrorDocument 403 "Access Forbidden"
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              # Check for maintenance file and redirect all requests
         
     | 
| 
      
 27 
     | 
    
         
            +
              RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
         
     | 
| 
      
 28 
     | 
    
         
            +
              RewriteCond %{SCRIPT_FILENAME} !maintenance.html
         
     | 
| 
      
 29 
     | 
    
         
            +
              RewriteRule ^.*$ /system/maintenance.html [L]
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 32 
     | 
    
         
            +
              # Deflate
         
     | 
| 
      
 33 
     | 
    
         
            +
              AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript
         
     | 
| 
      
 34 
     | 
    
         
            +
              BrowserMatch ^Mozilla/4 gzip-only-text/html
         
     | 
| 
      
 35 
     | 
    
         
            +
              BrowserMatch ^Mozilla/4\.0[678] no-gzip
         
     | 
| 
      
 36 
     | 
    
         
            +
              BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
              ErrorLog logs/<%= domain %>-error_log
         
     | 
| 
      
 39 
     | 
    
         
            +
              CustomLog logs/<%= domain %>-access_log combined
         
     | 
| 
      
 40 
     | 
    
         
            +
            </VirtualHost>
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: railsmachine
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
       7 
     | 
    
         
            -
            -  
     | 
| 
      
 7 
     | 
    
         
            +
            - Rails Machine
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            date: 2008- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2008-12-18 00:00:00 -05:00
         
     | 
| 
       13 
13 
     | 
    
         
             
            default_executable: railsmachine
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -20,10 +20,10 @@ dependencies: 
     | 
|
| 
       20 
20 
     | 
    
         
             
                requirements: 
         
     | 
| 
       21 
21 
     | 
    
         
             
                - - ">="
         
     | 
| 
       22 
22 
     | 
    
         
             
                  - !ruby/object:Gem::Version 
         
     | 
| 
       23 
     | 
    
         
            -
                    version: 2. 
     | 
| 
      
 23 
     | 
    
         
            +
                    version: 2.1.0
         
     | 
| 
       24 
24 
     | 
    
         
             
                version: 
         
     | 
| 
       25 
25 
     | 
    
         
             
            description: The Rails Machine task library
         
     | 
| 
       26 
     | 
    
         
            -
            email: 
         
     | 
| 
      
 26 
     | 
    
         
            +
            email: support@railsmachine.com
         
     | 
| 
       27 
27 
     | 
    
         
             
            executables: 
         
     | 
| 
       28 
28 
     | 
    
         
             
            - railsmachine
         
     | 
| 
       29 
29 
     | 
    
         
             
            extensions: []
         
     | 
| 
         @@ -36,29 +36,41 @@ files: 
     | 
|
| 
       36 
36 
     | 
    
         
             
            - README
         
     | 
| 
       37 
37 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       38 
38 
     | 
    
         
             
            - bin/railsmachine
         
     | 
| 
      
 39 
     | 
    
         
            +
            - test/cli
         
     | 
| 
       39 
40 
     | 
    
         
             
            - lib/railsmachine
         
     | 
| 
       40 
41 
     | 
    
         
             
            - lib/railsmachine/generators
         
     | 
| 
       41 
42 
     | 
    
         
             
            - lib/railsmachine/generators/loader.rb
         
     | 
| 
       42 
43 
     | 
    
         
             
            - lib/railsmachine/generators/railsmachine
         
     | 
| 
      
 44 
     | 
    
         
            +
            - lib/railsmachine/generators/railsmachine/railsmachine_generator.rb
         
     | 
| 
       43 
45 
     | 
    
         
             
            - lib/railsmachine/generators/railsmachine/templates
         
     | 
| 
       44 
46 
     | 
    
         
             
            - lib/railsmachine/generators/railsmachine/templates/deploy.rb
         
     | 
| 
       45 
     | 
    
         
            -
            - lib/railsmachine/generators/railsmachine/templates/deploy.rb~
         
     | 
| 
       46 
     | 
    
         
            -
            - lib/railsmachine/generators/railsmachine/railsmachine_generator.rb
         
     | 
| 
       47 
47 
     | 
    
         
             
            - lib/railsmachine/generators/railsmachine/USAGE
         
     | 
| 
       48 
     | 
    
         
            -
            - lib/railsmachine/recipes.rb
         
     | 
| 
       49 
48 
     | 
    
         
             
            - lib/railsmachine/recipes
         
     | 
| 
       50 
     | 
    
         
            -
            - lib/railsmachine/recipes/ 
     | 
| 
       51 
     | 
    
         
            -
            - lib/railsmachine/recipes/ 
     | 
| 
       52 
     | 
    
         
            -
            - lib/railsmachine/recipes/ 
     | 
| 
       53 
     | 
    
         
            -
            - lib/railsmachine/recipes/ 
     | 
| 
       54 
     | 
    
         
            -
            - lib/railsmachine/recipes/ 
     | 
| 
       55 
     | 
    
         
            -
            - lib/railsmachine/recipes/ 
     | 
| 
       56 
     | 
    
         
            -
            - lib/railsmachine/recipes/ 
     | 
| 
       57 
     | 
    
         
            -
            - lib/railsmachine/recipes/ 
     | 
| 
      
 49 
     | 
    
         
            +
            - lib/railsmachine/recipes/app
         
     | 
| 
      
 50 
     | 
    
         
            +
            - lib/railsmachine/recipes/app/deploy.rb
         
     | 
| 
      
 51 
     | 
    
         
            +
            - lib/railsmachine/recipes/app/mongrel.rb
         
     | 
| 
      
 52 
     | 
    
         
            +
            - lib/railsmachine/recipes/app/passenger.rb
         
     | 
| 
      
 53 
     | 
    
         
            +
            - lib/railsmachine/recipes/db
         
     | 
| 
      
 54 
     | 
    
         
            +
            - lib/railsmachine/recipes/db/mysql.rb
         
     | 
| 
      
 55 
     | 
    
         
            +
            - lib/railsmachine/recipes/db/postgresql.rb
         
     | 
| 
      
 56 
     | 
    
         
            +
            - lib/railsmachine/recipes/db/sqlite3.rb
         
     | 
| 
      
 57 
     | 
    
         
            +
            - lib/railsmachine/recipes/scm
         
     | 
| 
      
 58 
     | 
    
         
            +
            - lib/railsmachine/recipes/scm/git.rb
         
     | 
| 
      
 59 
     | 
    
         
            +
            - lib/railsmachine/recipes/scm/subversion.rb
         
     | 
| 
      
 60 
     | 
    
         
            +
            - lib/railsmachine/recipes/web
         
     | 
| 
      
 61 
     | 
    
         
            +
            - lib/railsmachine/recipes/web/apache.rb
         
     | 
| 
      
 62 
     | 
    
         
            +
            - lib/railsmachine/recipes/web/templates
         
     | 
| 
      
 63 
     | 
    
         
            +
            - lib/railsmachine/recipes/web/templates/mongrel
         
     | 
| 
      
 64 
     | 
    
         
            +
            - lib/railsmachine/recipes/web/templates/mongrel/httpd-ssl.conf
         
     | 
| 
      
 65 
     | 
    
         
            +
            - lib/railsmachine/recipes/web/templates/mongrel/httpd.conf
         
     | 
| 
      
 66 
     | 
    
         
            +
            - lib/railsmachine/recipes/web/templates/passenger
         
     | 
| 
      
 67 
     | 
    
         
            +
            - lib/railsmachine/recipes/web/templates/passenger/httpd-ssl.conf
         
     | 
| 
      
 68 
     | 
    
         
            +
            - lib/railsmachine/recipes/web/templates/passenger/httpd.conf
         
     | 
| 
      
 69 
     | 
    
         
            +
            - lib/railsmachine/recipes.rb
         
     | 
| 
       58 
70 
     | 
    
         
             
            - tools/rakehelp.rb
         
     | 
| 
       59 
71 
     | 
    
         
             
            - resources/defaults.yaml
         
     | 
| 
       60 
72 
     | 
    
         
             
            has_rdoc: false
         
     | 
| 
       61 
     | 
    
         
            -
            homepage: 
         
     | 
| 
      
 73 
     | 
    
         
            +
            homepage: http://railsmachine.com/
         
     | 
| 
       62 
74 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       63 
75 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       64 
76 
     | 
    
         | 
| 
         @@ -78,8 +90,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       78 
90 
     | 
    
         
             
              version: 
         
     | 
| 
       79 
91 
     | 
    
         
             
            requirements: []
         
     | 
| 
       80 
92 
     | 
    
         | 
| 
       81 
     | 
    
         
            -
            rubyforge_project: 
         
     | 
| 
       82 
     | 
    
         
            -
            rubygems_version: 1. 
     | 
| 
      
 93 
     | 
    
         
            +
            rubyforge_project: railsmachine
         
     | 
| 
      
 94 
     | 
    
         
            +
            rubygems_version: 1.3.1
         
     | 
| 
       83 
95 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       84 
96 
     | 
    
         
             
            specification_version: 2
         
     | 
| 
       85 
97 
     | 
    
         
             
            summary: The Rails Machine task library
         
     | 
| 
         @@ -1,95 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'railsmachine/recipes'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            # This defines a deployment "recipe" that you can feed to capistrano
         
     | 
| 
       4 
     | 
    
         
            -
            # (http://manuals.rubyonrails.com/read/book/17). It allows you to automate
         
     | 
| 
       5 
     | 
    
         
            -
            # (among other things) the deployment of your application.
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
            # =============================================================================
         
     | 
| 
       8 
     | 
    
         
            -
            # REQUIRED VARIABLES
         
     | 
| 
       9 
     | 
    
         
            -
            # =============================================================================
         
     | 
| 
       10 
     | 
    
         
            -
            # You must always specify the application and repository for every recipe. The
         
     | 
| 
       11 
     | 
    
         
            -
            # repository must be the URL of the repository you want this recipe to
         
     | 
| 
       12 
     | 
    
         
            -
            # correspond to. The deploy_to path must be the path on each machine that will
         
     | 
| 
       13 
     | 
    
         
            -
            # form the root of the application path.
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
            # The name of your application. Used for directory and file names associated with
         
     | 
| 
       16 
     | 
    
         
            -
            # the application.
         
     | 
| 
       17 
     | 
    
         
            -
            set :application, "<%= singular_name %>"
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
            # Target directory for the application on the web and app servers.
         
     | 
| 
       20 
     | 
    
         
            -
            set :deploy_to, "/var/www/apps/#{application}"
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
            # Primary domain name of your application. Used as a default for all server roles.
         
     | 
| 
       23 
     | 
    
         
            -
            set :domain, "<%= domain_name %>"
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
            # Login user for ssh.
         
     | 
| 
       26 
     | 
    
         
            -
            set :user, "deploy"
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
            # URL of your source repository.
         
     | 
| 
       29 
     | 
    
         
            -
            set :repository, "svn+ssh://#{user}@#{domain}#{deploy_to}/repos/trunk"
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
            # Rails environment. Used by application setup tasks and migrate tasks.
         
     | 
| 
       32 
     | 
    
         
            -
            set :rails_env, "production"
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
            # Automatically symlink these directories from curent/public to shared/public.
         
     | 
| 
       35 
     | 
    
         
            -
            # set :app_symlinks, %w{photo document asset}
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
            # =============================================================================
         
     | 
| 
       38 
     | 
    
         
            -
            # ROLES
         
     | 
| 
       39 
     | 
    
         
            -
            # =============================================================================
         
     | 
| 
       40 
     | 
    
         
            -
            # You can define any number of roles, each of which contains any number of
         
     | 
| 
       41 
     | 
    
         
            -
            # machines. Roles might include such things as :web, or :app, or :db, defining
         
     | 
| 
       42 
     | 
    
         
            -
            # what the purpose of each machine is. You can also specify options that can
         
     | 
| 
       43 
     | 
    
         
            -
            # be used to single out a specific subset of boxes in a particular role, like
         
     | 
| 
       44 
     | 
    
         
            -
            # :primary => true.
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
            # Modify these values to execute tasks on a different server.
         
     | 
| 
       47 
     | 
    
         
            -
            role :web, domain
         
     | 
| 
       48 
     | 
    
         
            -
            role :app, domain
         
     | 
| 
       49 
     | 
    
         
            -
            role :db,  domain, :primary => true
         
     | 
| 
       50 
     | 
    
         
            -
            role :scm, domain
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
            # =============================================================================
         
     | 
| 
       53 
     | 
    
         
            -
            # APACHE OPTIONS
         
     | 
| 
       54 
     | 
    
         
            -
            # =============================================================================
         
     | 
| 
       55 
     | 
    
         
            -
            # set :apache_server_name, domain
         
     | 
| 
       56 
     | 
    
         
            -
            # set :apache_server_aliases, %w{alias1 alias2}
         
     | 
| 
       57 
     | 
    
         
            -
            # set :apache_default_vhost, true # force use of apache_default_vhost_config
         
     | 
| 
       58 
     | 
    
         
            -
            # set :apache_default_vhost_conf, "/etc/httpd/conf/default.conf"
         
     | 
| 
       59 
     | 
    
         
            -
            # set :apache_conf, "/etc/httpd/conf/apps/#{application}.conf"
         
     | 
| 
       60 
     | 
    
         
            -
            # set :apache_ctl, "/etc/init.d/httpd"
         
     | 
| 
       61 
     | 
    
         
            -
            # set :apache_proxy_port, 8000
         
     | 
| 
       62 
     | 
    
         
            -
            # set :apache_proxy_servers, 2
         
     | 
| 
       63 
     | 
    
         
            -
            # set :apache_proxy_address, "127.0.0.1"
         
     | 
| 
       64 
     | 
    
         
            -
            # set :apache_ssl_enabled, false
         
     | 
| 
       65 
     | 
    
         
            -
            # set :apache_ssl_ip, "127.0.0.1"
         
     | 
| 
       66 
     | 
    
         
            -
            # set :apache_ssl_forward_all, false
         
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
            # =============================================================================
         
     | 
| 
       69 
     | 
    
         
            -
            # MONGREL OPTIONS
         
     | 
| 
       70 
     | 
    
         
            -
            # =============================================================================
         
     | 
| 
       71 
     | 
    
         
            -
            # set :mongrel_servers, apache_proxy_servers
         
     | 
| 
       72 
     | 
    
         
            -
            # set :mongrel_port, apache_proxy_port
         
     | 
| 
       73 
     | 
    
         
            -
            # set :mongrel_address, apache_proxy_address
         
     | 
| 
       74 
     | 
    
         
            -
            # set :mongrel_environment, "production"
         
     | 
| 
       75 
     | 
    
         
            -
            # set :mongrel_pid_file, "/var/run/mongrel_cluster/#{application}.pid"
         
     | 
| 
       76 
     | 
    
         
            -
            # set :mongrel_conf, "/etc/mongrel_cluster/#{application}.conf"
         
     | 
| 
       77 
     | 
    
         
            -
            # set :mongrel_user, user
         
     | 
| 
       78 
     | 
    
         
            -
            # set :mongrel_group, group
         
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
            # =============================================================================
         
     | 
| 
       81 
     | 
    
         
            -
            # SCM OPTIONS
         
     | 
| 
       82 
     | 
    
         
            -
            # =============================================================================
         
     | 
| 
       83 
     | 
    
         
            -
            #set :scm,"subversion"
         
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
            # =============================================================================
         
     | 
| 
       86 
     | 
    
         
            -
            # SSH OPTIONS
         
     | 
| 
       87 
     | 
    
         
            -
            # =============================================================================
         
     | 
| 
       88 
     | 
    
         
            -
            # ssh_options[:keys] = %w(/path/to/my/key /path/to/another/key)
         
     | 
| 
       89 
     | 
    
         
            -
            # ssh_options[:port] = 25
         
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
            # =============================================================================
         
     | 
| 
       92 
     | 
    
         
            -
            # CAPISTRANO OPTIONS
         
     | 
| 
       93 
     | 
    
         
            -
            # =============================================================================
         
     | 
| 
       94 
     | 
    
         
            -
            # default_run_options[:pty] = true
         
     | 
| 
       95 
     | 
    
         
            -
            # set :keep_releases, 3
         
     | 
| 
         @@ -1,46 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'fileutils'
         
     | 
| 
       2 
     | 
    
         
            -
            Capistrano::Configuration.instance(:must_exist).load do
         
     | 
| 
       3 
     | 
    
         
            -
             
         
     | 
| 
       4 
     | 
    
         
            -
             namespace :svn do
         
     | 
| 
       5 
     | 
    
         
            -
             
         
     | 
| 
       6 
     | 
    
         
            -
               desc "Setup svn repository"
         
     | 
| 
       7 
     | 
    
         
            -
               task :setup, :roles => :scm do
         
     | 
| 
       8 
     | 
    
         
            -
                 dir = "#{deploy_to}/repos"
         
     | 
| 
       9 
     | 
    
         
            -
                 run "mkdir -p #{dir}"
         
     | 
| 
       10 
     | 
    
         
            -
                 run "chmod 770 #{dir}"
         
     | 
| 
       11 
     | 
    
         
            -
                 run "svnadmin create #{dir}"
         
     | 
| 
       12 
     | 
    
         
            -
               end
         
     | 
| 
       13 
     | 
    
         
            -
               
         
     | 
| 
       14 
     | 
    
         
            -
               desc "Import code into svn repository."
         
     | 
| 
       15 
     | 
    
         
            -
               task :import  do
         
     | 
| 
       16 
     | 
    
         
            -
                 new_path = Dir.pwd + "_machine"
         
     | 
| 
       17 
     | 
    
         
            -
                 tags = repository.sub("trunk", "tags")
         
     | 
| 
       18 
     | 
    
         
            -
                 branches = repository.sub("trunk", "branches")
         
     | 
| 
       19 
     | 
    
         
            -
                 puts "Adding branches and tags"
         
     | 
| 
       20 
     | 
    
         
            -
                 system "svn mkdir -m 'Adding tags and branches directories' #{tags} #{branches}"
         
     | 
| 
       21 
     | 
    
         
            -
                 puts "Importing application."
         
     | 
| 
       22 
     | 
    
         
            -
                 system "svn import #{repository} -m 'Import'"
         
     | 
| 
       23 
     | 
    
         
            -
                 puts "Checking out to new directory."
         
     | 
| 
       24 
     | 
    
         
            -
                 system "svn co #{repository} #{new_path}"
         
     | 
| 
       25 
     | 
    
         
            -
                 cwd = Dir.getwd
         
     | 
| 
       26 
     | 
    
         
            -
                 Dir.chdir new_path
         
     | 
| 
       27 
     | 
    
         
            -
                 puts "removing log directory contents from svn"
         
     | 
| 
       28 
     | 
    
         
            -
                 system "svn remove log/*"
         
     | 
| 
       29 
     | 
    
         
            -
                 puts "ignoring log directory"
         
     | 
| 
       30 
     | 
    
         
            -
                 system "svn propset svn:ignore '*.log' log/"
         
     | 
| 
       31 
     | 
    
         
            -
                 system "svn update log/"
         
     | 
| 
       32 
     | 
    
         
            -
                 puts "removing tmp directory from svn"
         
     | 
| 
       33 
     | 
    
         
            -
                 system "svn remove tmp/"
         
     | 
| 
       34 
     | 
    
         
            -
                 puts "ignoring tmp directory"
         
     | 
| 
       35 
     | 
    
         
            -
                 system "svn propset svn:ignore '*' tmp/"
         
     | 
| 
       36 
     | 
    
         
            -
                 system "svn update tmp/"
         
     | 
| 
       37 
     | 
    
         
            -
                 puts "committing changes"
         
     | 
| 
       38 
     | 
    
         
            -
                 system "svn commit -m 'Removed and ignored log files and tmp'"
         
     | 
| 
       39 
     | 
    
         
            -
                 Dir.chdir cwd
         
     | 
| 
       40 
     | 
    
         
            -
                 puts "Your repository is: #{repository}" 
         
     | 
| 
       41 
     | 
    
         
            -
                 puts "Please change to your new working directory: #{new_path}"
         
     | 
| 
       42 
     | 
    
         
            -
               end
         
     | 
| 
       43 
     | 
    
         
            -
             
         
     | 
| 
       44 
     | 
    
         
            -
             end
         
     | 
| 
       45 
     | 
    
         
            -
             
         
     | 
| 
       46 
     | 
    
         
            -
            end
         
     |