fpauser-vlad 2.2.0
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/.autotest +25 -0
 - data/Gemfile +1 -0
 - data/Gemfile.lock +21 -0
 - data/History.txt +206 -0
 - data/Manifest.txt +23 -0
 - data/README.txt +78 -0
 - data/Rakefile +37 -0
 - data/considerations.txt +91 -0
 - data/doco/deploying-merb-with-vlad.txt +155 -0
 - data/doco/deploying-sinatra-with-vlad.txt +119 -0
 - data/doco/faq.txt +136 -0
 - data/doco/getting_started.txt +61 -0
 - data/doco/migration.txt +43 -0
 - data/doco/perforce.txt +5 -0
 - data/doco/variables.txt +79 -0
 - data/lib/vlad.rb +78 -0
 - data/lib/vlad/apache.rb +37 -0
 - data/lib/vlad/core.rb +195 -0
 - data/lib/vlad/maintenance.rb +20 -0
 - data/lib/vlad/passenger.rb +8 -0
 - data/lib/vlad/rails.rb +34 -0
 - data/lib/vlad/subversion.rb +35 -0
 - data/test/test_vlad.rb +209 -0
 - data/test/test_vlad_subversion.rb +26 -0
 - data/vladdemo.sh +97 -0
 - metadata +116 -0
 
    
        data/lib/vlad/rails.rb
    ADDED
    
    | 
         @@ -0,0 +1,34 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            namespace :vlad do
         
     | 
| 
      
 2 
     | 
    
         
            +
              set :rails_env,      "production"
         
     | 
| 
      
 3 
     | 
    
         
            +
              set :migrate_args,   ""
         
     | 
| 
      
 4 
     | 
    
         
            +
              set :migrate_target, :latest
         
     | 
| 
      
 5 
     | 
    
         
            +
              set :mkdirs,         %w(tmp db)
         
     | 
| 
      
 6 
     | 
    
         
            +
              set :shared_paths, {
         
     | 
| 
      
 7 
     | 
    
         
            +
                'log'    => 'log',
         
     | 
| 
      
 8 
     | 
    
         
            +
                'system' => 'public/system',
         
     | 
| 
      
 9 
     | 
    
         
            +
                'pids'   => 'tmp/pids',
         
     | 
| 
      
 10 
     | 
    
         
            +
              }
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              desc "Run the migrate rake task for the the app. By default this is run in
         
     | 
| 
      
 13 
     | 
    
         
            +
                the latest app directory.  You can run migrations for the current app
         
     | 
| 
      
 14 
     | 
    
         
            +
                directory by setting :migrate_target to :current.  Additional environment
         
     | 
| 
      
 15 
     | 
    
         
            +
                variables can be passed to rake via the migrate_env variable.".cleanup
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              # No application files are on the DB machine, also migrations should only be
         
     | 
| 
      
 18 
     | 
    
         
            +
              # run once.
         
     | 
| 
      
 19 
     | 
    
         
            +
              remote_task :migrate, :roles => :app do
         
     | 
| 
      
 20 
     | 
    
         
            +
                break unless target_host == Rake::RemoteTask.hosts_for(:app).first
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                directory = case migrate_target.to_sym
         
     | 
| 
      
 23 
     | 
    
         
            +
                            when :current then current_path
         
     | 
| 
      
 24 
     | 
    
         
            +
                            when :latest  then current_release
         
     | 
| 
      
 25 
     | 
    
         
            +
                            else
         
     | 
| 
      
 26 
     | 
    
         
            +
                              raise(ArgumentError,
         
     | 
| 
      
 27 
     | 
    
         
            +
                                    "unknown migration target #{migrate_target.inspect}")
         
     | 
| 
      
 28 
     | 
    
         
            +
                            end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                run ["cd #{directory}",
         
     | 
| 
      
 31 
     | 
    
         
            +
                     "#{rake_cmd} RAILS_ENV=#{rails_env} db:migrate #{migrate_args}"
         
     | 
| 
      
 32 
     | 
    
         
            +
                    ].join(" && ")
         
     | 
| 
      
 33 
     | 
    
         
            +
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Vlad::Subversion
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              set :source, Vlad::Subversion.new
         
     | 
| 
      
 4 
     | 
    
         
            +
              set :svn_cmd, "svn"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              ##
         
     | 
| 
      
 7 
     | 
    
         
            +
              # Returns the command that will check out +revision+ from the repository
         
     | 
| 
      
 8 
     | 
    
         
            +
              # into directory +destination+
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              def checkout(revision, destination)
         
     | 
| 
      
 11 
     | 
    
         
            +
                "#{svn_cmd} co -r #{revision} #{repository} #{destination}"
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              ##
         
     | 
| 
      
 15 
     | 
    
         
            +
              # Returns the command that will export +revision+ from the repository into
         
     | 
| 
      
 16 
     | 
    
         
            +
              # the directory +destination+.
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              def export(revision_or_source, destination)
         
     | 
| 
      
 19 
     | 
    
         
            +
                "#{svn_cmd} #{deploy_via} " +
         
     | 
| 
      
 20 
     | 
    
         
            +
                  if revision_or_source =~ /^(\d+|head)$/i then
         
     | 
| 
      
 21 
     | 
    
         
            +
                    "-r #{revision_or_source} #{repository} #{destination}"
         
     | 
| 
      
 22 
     | 
    
         
            +
                  else
         
     | 
| 
      
 23 
     | 
    
         
            +
                    "#{revision_or_source} #{destination}"
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              ##
         
     | 
| 
      
 28 
     | 
    
         
            +
              # Returns a command that maps human-friendly revision identifier +revision+
         
     | 
| 
      
 29 
     | 
    
         
            +
              # into a subversion revision specification.
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
              def revision(revision)
         
     | 
| 
      
 32 
     | 
    
         
            +
                "`#{svn_cmd} info #{repository} | grep 'Revision:' | cut -f2 -d\\ `"
         
     | 
| 
      
 33 
     | 
    
         
            +
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
            end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
    
        data/test/test_vlad.rb
    ADDED
    
    | 
         @@ -0,0 +1,209 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rake/test_case'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            $TESTING = true
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            class TestVlad < Rake::TestCase
         
     | 
| 
      
 6 
     | 
    
         
            +
              def test_all_hosts
         
     | 
| 
      
 7 
     | 
    
         
            +
                util_set_hosts
         
     | 
| 
      
 8 
     | 
    
         
            +
                assert_equal %w[app.example.com db.example.com], @rake.all_hosts
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              def test_fetch
         
     | 
| 
      
 12 
     | 
    
         
            +
                set :foo, 5
         
     | 
| 
      
 13 
     | 
    
         
            +
                assert_equal 5, @rake.fetch(:foo)
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              def test_fetch_with_default
         
     | 
| 
      
 17 
     | 
    
         
            +
                assert_equal 5, @rake.fetch(:not_here, 5)
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              def test_host
         
     | 
| 
      
 21 
     | 
    
         
            +
                @rake.host "test.example.com", :app, :db
         
     | 
| 
      
 22 
     | 
    
         
            +
                expected = {"test.example.com" => {}}
         
     | 
| 
      
 23 
     | 
    
         
            +
                assert_equal expected, @rake.roles[:app]
         
     | 
| 
      
 24 
     | 
    
         
            +
                assert_equal expected, @rake.roles[:db]
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              def test_host_invalid
         
     | 
| 
      
 28 
     | 
    
         
            +
                assert_raises(ArgumentError) { @rake.host nil, :web }
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
              def test_host_multiple_hosts
         
     | 
| 
      
 32 
     | 
    
         
            +
                @rake.host "test.example.com", :app, :db
         
     | 
| 
      
 33 
     | 
    
         
            +
                @rake.host "yarr.example.com", :app, :db, :no_release => true
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                expected = {
         
     | 
| 
      
 36 
     | 
    
         
            +
                  "test.example.com" => {},
         
     | 
| 
      
 37 
     | 
    
         
            +
                  "yarr.example.com" => {:no_release => true}
         
     | 
| 
      
 38 
     | 
    
         
            +
                }
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                assert_equal expected, @rake.roles[:app]
         
     | 
| 
      
 41 
     | 
    
         
            +
                assert_equal expected, @rake.roles[:db]
         
     | 
| 
      
 42 
     | 
    
         
            +
                refute_equal(@rake.roles[:db]["test.example.com"].object_id,
         
     | 
| 
      
 43 
     | 
    
         
            +
                             @rake.roles[:app]["test.example.com"].object_id)
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
              def test_hosts_for_array_of_roles
         
     | 
| 
      
 47 
     | 
    
         
            +
                util_set_hosts
         
     | 
| 
      
 48 
     | 
    
         
            +
                assert_equal %w[app.example.com db.example.com], @rake.hosts_for([:app, :db])
         
     | 
| 
      
 49 
     | 
    
         
            +
              end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
              def test_hosts_for_one_role
         
     | 
| 
      
 52 
     | 
    
         
            +
                util_set_hosts
         
     | 
| 
      
 53 
     | 
    
         
            +
                @rake.host "app2.example.com", :app
         
     | 
| 
      
 54 
     | 
    
         
            +
                assert_equal %w[app.example.com app2.example.com], @rake.hosts_for(:app)
         
     | 
| 
      
 55 
     | 
    
         
            +
              end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
              def test_hosts_for_multiple_roles
         
     | 
| 
      
 58 
     | 
    
         
            +
                util_set_hosts
         
     | 
| 
      
 59 
     | 
    
         
            +
                assert_equal %w[app.example.com db.example.com], @rake.hosts_for(:app, :db)
         
     | 
| 
      
 60 
     | 
    
         
            +
              end
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
              def test_hosts_for_unique
         
     | 
| 
      
 63 
     | 
    
         
            +
                util_set_hosts
         
     | 
| 
      
 64 
     | 
    
         
            +
                @rake.host "app.example.com", :web
         
     | 
| 
      
 65 
     | 
    
         
            +
                assert_equal %w[app.example.com db.example.com], @rake.hosts_for(:app, :db, :web)
         
     | 
| 
      
 66 
     | 
    
         
            +
              end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
              def test_initialize
         
     | 
| 
      
 69 
     | 
    
         
            +
                @rake.set_defaults # ensure these three are virginal
         
     | 
| 
      
 70 
     | 
    
         
            +
                assert_raises(Rake::ConfigurationError) { @rake.repository }
         
     | 
| 
      
 71 
     | 
    
         
            +
                assert_raises(Rake::ConfigurationError) { @rake.deploy_to }
         
     | 
| 
      
 72 
     | 
    
         
            +
                assert_raises(Rake::ConfigurationError) { @rake.domain }
         
     | 
| 
      
 73 
     | 
    
         
            +
              end
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
              def test_role
         
     | 
| 
      
 76 
     | 
    
         
            +
                @rake.role :app, "test.example.com"
         
     | 
| 
      
 77 
     | 
    
         
            +
                expected = {"test.example.com" => {}}
         
     | 
| 
      
 78 
     | 
    
         
            +
                assert_equal expected, @rake.roles[:app]
         
     | 
| 
      
 79 
     | 
    
         
            +
              end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
              def test_role_multiple_hosts
         
     | 
| 
      
 82 
     | 
    
         
            +
                @rake.role :app, "test.example.com"
         
     | 
| 
      
 83 
     | 
    
         
            +
                @rake.role :app, "yarr.example.com", :no_release => true
         
     | 
| 
      
 84 
     | 
    
         
            +
                expected = {
         
     | 
| 
      
 85 
     | 
    
         
            +
                  "test.example.com" => {},
         
     | 
| 
      
 86 
     | 
    
         
            +
                  "yarr.example.com" => {:no_release => true}
         
     | 
| 
      
 87 
     | 
    
         
            +
                }
         
     | 
| 
      
 88 
     | 
    
         
            +
                assert_equal expected, @rake.roles[:app]
         
     | 
| 
      
 89 
     | 
    
         
            +
              end
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
              def test_role_multiple_roles
         
     | 
| 
      
 92 
     | 
    
         
            +
                @rake.role :app, "test.example.com", :primary => true
         
     | 
| 
      
 93 
     | 
    
         
            +
                @rake.role :db, "yarr.example.com", :no_release => true
         
     | 
| 
      
 94 
     | 
    
         
            +
                expected_db = { "yarr.example.com" => {:no_release => true} }
         
     | 
| 
      
 95 
     | 
    
         
            +
                assert_equal expected_db, @rake.roles[:db]
         
     | 
| 
      
 96 
     | 
    
         
            +
                expected_app = { "test.example.com" => {:primary => true} }
         
     | 
| 
      
 97 
     | 
    
         
            +
                assert_equal expected_app, @rake.roles[:app]
         
     | 
| 
      
 98 
     | 
    
         
            +
              end
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
              def test_remote_task
         
     | 
| 
      
 101 
     | 
    
         
            +
                t = @rake.remote_task(:test_task) { 5 }
         
     | 
| 
      
 102 
     | 
    
         
            +
                assert_equal @task_count + 1, Rake.application.tasks.size
         
     | 
| 
      
 103 
     | 
    
         
            +
                assert_equal({ :roles => [] }, t.options)
         
     | 
| 
      
 104 
     | 
    
         
            +
              end
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
              def test_remote_task_all_hosts_by_default
         
     | 
| 
      
 107 
     | 
    
         
            +
                util_set_hosts
         
     | 
| 
      
 108 
     | 
    
         
            +
                t = @rake.remote_task(:test_task) { 5 }
         
     | 
| 
      
 109 
     | 
    
         
            +
                assert_equal %w[app.example.com db.example.com], t.target_hosts
         
     | 
| 
      
 110 
     | 
    
         
            +
              end
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
              def test_remote_task_environment_override
         
     | 
| 
      
 113 
     | 
    
         
            +
                old_env_hosts = ENV["HOSTS"]
         
     | 
| 
      
 114 
     | 
    
         
            +
                ENV["HOSTS"] = 'other1.example.com,   other2.example.com'
         
     | 
| 
      
 115 
     | 
    
         
            +
                util_set_hosts
         
     | 
| 
      
 116 
     | 
    
         
            +
                t = @rake.remote_task(:test_task) { 5 }
         
     | 
| 
      
 117 
     | 
    
         
            +
                assert_equal %w[other1.example.com other2.example.com], t.target_hosts
         
     | 
| 
      
 118 
     | 
    
         
            +
              ensure
         
     | 
| 
      
 119 
     | 
    
         
            +
                ENV["HOSTS"] = old_env_hosts
         
     | 
| 
      
 120 
     | 
    
         
            +
              end
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
              def test_remote_task_body_set
         
     | 
| 
      
 123 
     | 
    
         
            +
                set(:some_variable, 5)
         
     | 
| 
      
 124 
     | 
    
         
            +
                @rake.host 'www.example.com', :app
         
     | 
| 
      
 125 
     | 
    
         
            +
                @rake.remote_task(:some_task) do $some_task_result = some_variable end
         
     | 
| 
      
 126 
     | 
    
         
            +
             
     | 
| 
      
 127 
     | 
    
         
            +
                Rake::Task['some_task'].execute nil
         
     | 
| 
      
 128 
     | 
    
         
            +
                assert_equal @rake.fetch(:some_variable), $some_task_result
         
     | 
| 
      
 129 
     | 
    
         
            +
              end
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
              def test_remote_task_with_options
         
     | 
| 
      
 132 
     | 
    
         
            +
                t = @rake.remote_task :test_task, :roles => [:app, :db] do
         
     | 
| 
      
 133 
     | 
    
         
            +
                  fail "should not run"
         
     | 
| 
      
 134 
     | 
    
         
            +
                end
         
     | 
| 
      
 135 
     | 
    
         
            +
                assert_equal({:roles => [:app, :db]}, t.options)
         
     | 
| 
      
 136 
     | 
    
         
            +
              end
         
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
      
 138 
     | 
    
         
            +
              def test_remote_task_before_host_declaration
         
     | 
| 
      
 139 
     | 
    
         
            +
                t = @rake.remote_task :test_task, :roles => :web do 5 end
         
     | 
| 
      
 140 
     | 
    
         
            +
                @rake.host 'www.example.com', :web
         
     | 
| 
      
 141 
     | 
    
         
            +
                assert_equal %w[www.example.com], t.target_hosts
         
     | 
| 
      
 142 
     | 
    
         
            +
              end
         
     | 
| 
      
 143 
     | 
    
         
            +
             
     | 
| 
      
 144 
     | 
    
         
            +
              def test_remote_task_role_override
         
     | 
| 
      
 145 
     | 
    
         
            +
                host "db1", :db
         
     | 
| 
      
 146 
     | 
    
         
            +
                host "db2", :db
         
     | 
| 
      
 147 
     | 
    
         
            +
                host "db3", :db
         
     | 
| 
      
 148 
     | 
    
         
            +
                host "master", :master_db
         
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
      
 150 
     | 
    
         
            +
                remote_task(:migrate_the_db, :roles => [:db]) { flunk "bad!" }
         
     | 
| 
      
 151 
     | 
    
         
            +
                task = Rake::Task["migrate_the_db"]
         
     | 
| 
      
 152 
     | 
    
         
            +
                assert_equal %w[db1 db2 db3], task.target_hosts
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
                task.options[:roles] = :master_db
         
     | 
| 
      
 155 
     | 
    
         
            +
                assert_equal %w[master], task.target_hosts
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
                task.options[:roles] = [:master_db]
         
     | 
| 
      
 158 
     | 
    
         
            +
                assert_equal %w[master], task.target_hosts
         
     | 
| 
      
 159 
     | 
    
         
            +
              end
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
              def test_set
         
     | 
| 
      
 162 
     | 
    
         
            +
                set :win, 5
         
     | 
| 
      
 163 
     | 
    
         
            +
                assert_equal 5, @rake.win
         
     | 
| 
      
 164 
     | 
    
         
            +
              end
         
     | 
| 
      
 165 
     | 
    
         
            +
             
     | 
| 
      
 166 
     | 
    
         
            +
              def test_set_lazy_block_evaluation
         
     | 
| 
      
 167 
     | 
    
         
            +
                set(:lose) { raise "lose" }
         
     | 
| 
      
 168 
     | 
    
         
            +
                assert_raises(RuntimeError) { @rake.lose }
         
     | 
| 
      
 169 
     | 
    
         
            +
              end
         
     | 
| 
      
 170 
     | 
    
         
            +
             
     | 
| 
      
 171 
     | 
    
         
            +
              def test_set_with_block
         
     | 
| 
      
 172 
     | 
    
         
            +
                x = 1
         
     | 
| 
      
 173 
     | 
    
         
            +
                set(:win) { x += 2 }
         
     | 
| 
      
 174 
     | 
    
         
            +
             
     | 
| 
      
 175 
     | 
    
         
            +
                assert_equal 3, @rake.win
         
     | 
| 
      
 176 
     | 
    
         
            +
                assert_equal 3, @rake.win
         
     | 
| 
      
 177 
     | 
    
         
            +
              end
         
     | 
| 
      
 178 
     | 
    
         
            +
             
     | 
| 
      
 179 
     | 
    
         
            +
              def test_set_with_reference
         
     | 
| 
      
 180 
     | 
    
         
            +
                @rake.instance_eval do
         
     | 
| 
      
 181 
     | 
    
         
            +
                  set(:var_one) { var_two }
         
     | 
| 
      
 182 
     | 
    
         
            +
                  set(:var_two) { var_three }
         
     | 
| 
      
 183 
     | 
    
         
            +
                  set(:var_three) { 5 }
         
     | 
| 
      
 184 
     | 
    
         
            +
                end
         
     | 
| 
      
 185 
     | 
    
         
            +
             
     | 
| 
      
 186 
     | 
    
         
            +
                assert_equal 5, @rake.var_one
         
     | 
| 
      
 187 
     | 
    
         
            +
              end
         
     | 
| 
      
 188 
     | 
    
         
            +
             
     | 
| 
      
 189 
     | 
    
         
            +
              def test_set_with_block_and_value
         
     | 
| 
      
 190 
     | 
    
         
            +
                e = assert_raises(ArgumentError) do
         
     | 
| 
      
 191 
     | 
    
         
            +
                  set(:loser, 5) { 6 }
         
     | 
| 
      
 192 
     | 
    
         
            +
                end
         
     | 
| 
      
 193 
     | 
    
         
            +
                assert_equal "cannot provide both a value and a block", e.message
         
     | 
| 
      
 194 
     | 
    
         
            +
              end
         
     | 
| 
      
 195 
     | 
    
         
            +
             
     | 
| 
      
 196 
     | 
    
         
            +
              def test_set_with_nil
         
     | 
| 
      
 197 
     | 
    
         
            +
                set(:win, nil)
         
     | 
| 
      
 198 
     | 
    
         
            +
                assert_equal nil, @rake.win
         
     | 
| 
      
 199 
     | 
    
         
            +
              end
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
      
 201 
     | 
    
         
            +
              def test_set_with_reserved_name
         
     | 
| 
      
 202 
     | 
    
         
            +
                $TESTING = false
         
     | 
| 
      
 203 
     | 
    
         
            +
                e = assert_raises(ArgumentError) { set(:all_hosts, []) }
         
     | 
| 
      
 204 
     | 
    
         
            +
                assert_equal "cannot set reserved name: 'all_hosts'", e.message
         
     | 
| 
      
 205 
     | 
    
         
            +
              ensure
         
     | 
| 
      
 206 
     | 
    
         
            +
                $TESTING = true
         
     | 
| 
      
 207 
     | 
    
         
            +
              end
         
     | 
| 
      
 208 
     | 
    
         
            +
            end
         
     | 
| 
      
 209 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'vlad'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'vlad/subversion'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            class TestVladSubversion < MiniTest::Unit::TestCase
         
     | 
| 
      
 5 
     | 
    
         
            +
              def setup
         
     | 
| 
      
 6 
     | 
    
         
            +
                super
         
     | 
| 
      
 7 
     | 
    
         
            +
                @scm = Vlad::Subversion.new
         
     | 
| 
      
 8 
     | 
    
         
            +
                set :repository, "svn+ssh://repo/myproject"
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              def test_checkout
         
     | 
| 
      
 12 
     | 
    
         
            +
                cmd = @scm.checkout 'HEAD', '/the/place'
         
     | 
| 
      
 13 
     | 
    
         
            +
                assert_equal 'svn co -r HEAD svn+ssh://repo/myproject /the/place', cmd
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              def test_export
         
     | 
| 
      
 17 
     | 
    
         
            +
                cmd = @scm.export 'HEAD', '/the/place'
         
     | 
| 
      
 18 
     | 
    
         
            +
                assert_equal 'svn export -r HEAD svn+ssh://repo/myproject /the/place', cmd
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              def test_revision
         
     | 
| 
      
 22 
     | 
    
         
            +
                cmd = @scm.revision('HEAD')
         
     | 
| 
      
 23 
     | 
    
         
            +
                expected = "`svn info svn+ssh://repo/myproject | grep 'Revision:' | cut -f2 -d\\ `"
         
     | 
| 
      
 24 
     | 
    
         
            +
                assert_equal expected, cmd
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
    
        data/vladdemo.sh
    ADDED
    
    | 
         @@ -0,0 +1,97 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/bin/bash
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            N=$1; shift
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            killall mongrel svnserve 2> /dev/null
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            rm -rf ~/demo
         
     | 
| 
      
 8 
     | 
    
         
            +
            mkdir ~/demo
         
     | 
| 
      
 9 
     | 
    
         
            +
            cd ~/demo
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            pause() {
         
     | 
| 
      
 12 
     | 
    
         
            +
              echo -n "waiting... hit return... "
         
     | 
| 
      
 13 
     | 
    
         
            +
              read
         
     | 
| 
      
 14 
     | 
    
         
            +
              echo
         
     | 
| 
      
 15 
     | 
    
         
            +
            }
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            echo "Starting demo from scratch"
         
     | 
| 
      
 18 
     | 
    
         
            +
            echo "  This step creates a subversion repository and imports a new rails app"
         
     | 
| 
      
 19 
     | 
    
         
            +
            echo "  It modifies the Rakefile to load Vlad and creates config/deploy.rb"
         
     | 
| 
      
 20 
     | 
    
         
            +
            echo
         
     | 
| 
      
 21 
     | 
    
         
            +
            pause
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            svnadmin create svnrepo
         
     | 
| 
      
 24 
     | 
    
         
            +
            echo "anon-access = write" >> svnrepo/conf/svnserve.conf
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            svnserve -d --foreground -r svnrepo --listen-host localhost &
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            echo "cd ~/demo
         
     | 
| 
      
 29 
     | 
    
         
            +
            rm -rf website_*
         
     | 
| 
      
 30 
     | 
    
         
            +
            svnserve -d --foreground -r svnrepo --listen-host localhost &
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            cd mydemoapp
         
     | 
| 
      
 33 
     | 
    
         
            +
            ruby -I ~/Work/p4/zss/src/vlad/dev/lib -S rake -t vlad:setup vlad:update
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            kill %1" > go.sh
         
     | 
| 
      
 36 
     | 
    
         
            +
            chmod u+x go.sh
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            rails mydemoapp
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            cd mydemoapp
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            echo "require 'rubygems'
         
     | 
| 
      
 43 
     | 
    
         
            +
            require 'vlad'
         
     | 
| 
      
 44 
     | 
    
         
            +
            Vlad.load" >> Rakefile
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            echo "set :repository, 'svn://localhost/blah'
         
     | 
| 
      
 47 
     | 
    
         
            +
            set :domain, 'localhost'
         
     | 
| 
      
 48 
     | 
    
         
            +
            set :web_command, 'sudo apachectl'" > config/deploy.rb
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            # TODO: add a knob
         
     | 
| 
      
 51 
     | 
    
         
            +
            if [ -n "$N" ]; then
         
     | 
| 
      
 52 
     | 
    
         
            +
                echo "set(:deploy_to, :per_thread) {
         
     | 
| 
      
 53 
     | 
    
         
            +
              File.expand_path(\"~/demo/website_#{target_host}\")
         
     | 
| 
      
 54 
     | 
    
         
            +
            }
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            %w(current_path current_release latest_release
         
     | 
| 
      
 57 
     | 
    
         
            +
               previous_release releases_path release_path
         
     | 
| 
      
 58 
     | 
    
         
            +
               scm_path shared_path).each do |name|
         
     | 
| 
      
 59 
     | 
    
         
            +
              Rake::RemoteTask.per_thread[name] = true
         
     | 
| 
      
 60 
     | 
    
         
            +
            end
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
            (1..$N).each do |n|
         
     | 
| 
      
 63 
     | 
    
         
            +
              host 'localhost%02d' % n, :web, :app
         
     | 
| 
      
 64 
     | 
    
         
            +
            end" >> config/deploy.rb
         
     | 
| 
      
 65 
     | 
    
         
            +
            else
         
     | 
| 
      
 66 
     | 
    
         
            +
                echo "set :deploy_to, File.expand_path('~/demo/website')" >> config/deploy.rb
         
     | 
| 
      
 67 
     | 
    
         
            +
            fi
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
            svn import -m Added . svn://localhost/blah
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
            echo
         
     | 
| 
      
 72 
     | 
    
         
            +
            echo "Here is your config:"
         
     | 
| 
      
 73 
     | 
    
         
            +
            cat config/deploy.rb
         
     | 
| 
      
 74 
     | 
    
         
            +
            echo
         
     | 
| 
      
 75 
     | 
    
         
            +
            echo "Here are the tasks available:"
         
     | 
| 
      
 76 
     | 
    
         
            +
            echo
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
            ruby -I ~/Work/p4/zss/src/vlad/dev/lib -S rake -T vlad
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
            echo
         
     | 
| 
      
 81 
     | 
    
         
            +
            echo "The next step deploys and fires up the application"
         
     | 
| 
      
 82 
     | 
    
         
            +
            echo
         
     | 
| 
      
 83 
     | 
    
         
            +
            pause
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
            ruby -I ~/Work/p4/zss/src/vlad/dev/lib -S rake -t vlad:setup vlad:update vlad:start
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
            open http://localhost:8000/
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            echo
         
     | 
| 
      
 90 
     | 
    
         
            +
            echo "done! check it out"
         
     | 
| 
      
 91 
     | 
    
         
            +
            echo
         
     | 
| 
      
 92 
     | 
    
         
            +
            pause
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
            ruby -I ~/Work/p4/zss/src/vlad/dev/lib -S rake vlad:stop
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
            kill %1
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,116 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: fpauser-vlad
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.2.0
         
     | 
| 
      
 5 
     | 
    
         
            +
              prerelease: 
         
     | 
| 
      
 6 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 7 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 8 
     | 
    
         
            +
            - Ryan Davis
         
     | 
| 
      
 9 
     | 
    
         
            +
            - Eric Hodel
         
     | 
| 
      
 10 
     | 
    
         
            +
            - Wilson Bilkovich
         
     | 
| 
      
 11 
     | 
    
         
            +
            - Falk Pauser
         
     | 
| 
      
 12 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 13 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 14 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 15 
     | 
    
         
            +
            date: 2011-06-22 00:00:00.000000000 +02:00
         
     | 
| 
      
 16 
     | 
    
         
            +
            default_executable: 
         
     | 
| 
      
 17 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 18 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 19 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 20 
     | 
    
         
            +
              requirement: &7940880 !ruby/object:Gem::Requirement
         
     | 
| 
      
 21 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 22 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 23 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 24 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 25 
     | 
    
         
            +
                    version: 0.8.0
         
     | 
| 
      
 26 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 27 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 28 
     | 
    
         
            +
              version_requirements: *7940880
         
     | 
| 
      
 29 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 30 
     | 
    
         
            +
              name: open4
         
     | 
| 
      
 31 
     | 
    
         
            +
              requirement: &7940380 !ruby/object:Gem::Requirement
         
     | 
| 
      
 32 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 33 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 34 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 35 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 36 
     | 
    
         
            +
                    version: 0.9.0
         
     | 
| 
      
 37 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 38 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 39 
     | 
    
         
            +
              version_requirements: *7940380
         
     | 
| 
      
 40 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 41 
     | 
    
         
            +
              name: fpauser-rake-remote_task
         
     | 
| 
      
 42 
     | 
    
         
            +
              requirement: &7939820 !ruby/object:Gem::Requirement
         
     | 
| 
      
 43 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: 2.0.3
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: *7939820
         
     | 
| 
      
 51 
     | 
    
         
            +
            description: ! "\n    Vlad the Deployer is pragmatic application deployment automation,
         
     | 
| 
      
 52 
     | 
    
         
            +
              without mercy.\n    Much like Capistrano, but with 1/10th the complexity. Vlad integrates
         
     | 
| 
      
 53 
     | 
    
         
            +
              seamlessly\n    with Rake, and uses familiar and standard tools like ssh and rsync.
         
     | 
| 
      
 54 
     | 
    
         
            +
              Impale your\n    application on the heartless spike of the Deployer.\n  "
         
     | 
| 
      
 55 
     | 
    
         
            +
            email:
         
     | 
| 
      
 56 
     | 
    
         
            +
            - ryand-ruby@zenspider.com
         
     | 
| 
      
 57 
     | 
    
         
            +
            - drbrain@segment7.net
         
     | 
| 
      
 58 
     | 
    
         
            +
            - wilson@supremetyrant.com
         
     | 
| 
      
 59 
     | 
    
         
            +
            - falk.pauser@gmail.com
         
     | 
| 
      
 60 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 61 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 62 
     | 
    
         
            +
            extra_rdoc_files:
         
     | 
| 
      
 63 
     | 
    
         
            +
            - README.txt
         
     | 
| 
      
 64 
     | 
    
         
            +
            files:
         
     | 
| 
      
 65 
     | 
    
         
            +
            - .autotest
         
     | 
| 
      
 66 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 67 
     | 
    
         
            +
            - Gemfile.lock
         
     | 
| 
      
 68 
     | 
    
         
            +
            - History.txt
         
     | 
| 
      
 69 
     | 
    
         
            +
            - Manifest.txt
         
     | 
| 
      
 70 
     | 
    
         
            +
            - README.txt
         
     | 
| 
      
 71 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 72 
     | 
    
         
            +
            - considerations.txt
         
     | 
| 
      
 73 
     | 
    
         
            +
            - doco/deploying-merb-with-vlad.txt
         
     | 
| 
      
 74 
     | 
    
         
            +
            - doco/deploying-sinatra-with-vlad.txt
         
     | 
| 
      
 75 
     | 
    
         
            +
            - doco/faq.txt
         
     | 
| 
      
 76 
     | 
    
         
            +
            - doco/getting_started.txt
         
     | 
| 
      
 77 
     | 
    
         
            +
            - doco/migration.txt
         
     | 
| 
      
 78 
     | 
    
         
            +
            - doco/perforce.txt
         
     | 
| 
      
 79 
     | 
    
         
            +
            - doco/variables.txt
         
     | 
| 
      
 80 
     | 
    
         
            +
            - lib/vlad.rb
         
     | 
| 
      
 81 
     | 
    
         
            +
            - lib/vlad/apache.rb
         
     | 
| 
      
 82 
     | 
    
         
            +
            - lib/vlad/core.rb
         
     | 
| 
      
 83 
     | 
    
         
            +
            - lib/vlad/maintenance.rb
         
     | 
| 
      
 84 
     | 
    
         
            +
            - lib/vlad/passenger.rb
         
     | 
| 
      
 85 
     | 
    
         
            +
            - lib/vlad/rails.rb
         
     | 
| 
      
 86 
     | 
    
         
            +
            - lib/vlad/subversion.rb
         
     | 
| 
      
 87 
     | 
    
         
            +
            - test/test_vlad.rb
         
     | 
| 
      
 88 
     | 
    
         
            +
            - test/test_vlad_subversion.rb
         
     | 
| 
      
 89 
     | 
    
         
            +
            - vladdemo.sh
         
     | 
| 
      
 90 
     | 
    
         
            +
            has_rdoc: true
         
     | 
| 
      
 91 
     | 
    
         
            +
            homepage: http://github.com/fpauser/vlad
         
     | 
| 
      
 92 
     | 
    
         
            +
            licenses: []
         
     | 
| 
      
 93 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 94 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 95 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 96 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 97 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 98 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 99 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 100 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 101 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 102 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 103 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 104 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 105 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 106 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 107 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 108 
     | 
    
         
            +
                  version: 1.3.6
         
     | 
| 
      
 109 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 110 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 111 
     | 
    
         
            +
            rubygems_version: 1.6.2
         
     | 
| 
      
 112 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 113 
     | 
    
         
            +
            specification_version: 3
         
     | 
| 
      
 114 
     | 
    
         
            +
            summary: Vlad the Deployer is pragmatic application deployment automation, without
         
     | 
| 
      
 115 
     | 
    
         
            +
              mercy.
         
     | 
| 
      
 116 
     | 
    
         
            +
            test_files: []
         
     |