diff options
Diffstat (limited to 'switchtower')
-rw-r--r-- | switchtower/CHANGELOG | 2 | ||||
-rw-r--r-- | switchtower/lib/switchtower/configuration.rb | 4 | ||||
-rw-r--r-- | switchtower/lib/switchtower/recipes/standard.rb | 2 | ||||
-rw-r--r-- | switchtower/lib/switchtower/scm/base.rb | 2 | ||||
-rw-r--r-- | switchtower/lib/switchtower/scm/cvs.rb | 2 | ||||
-rw-r--r-- | switchtower/lib/switchtower/scm/darcs.rb | 3 | ||||
-rw-r--r-- | switchtower/lib/switchtower/scm/subversion.rb | 2 |
7 files changed, 11 insertions, 6 deletions
diff --git a/switchtower/CHANGELOG b/switchtower/CHANGELOG index f8d05cb8dc..935ef01f99 100644 --- a/switchtower/CHANGELOG +++ b/switchtower/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Specify the revision to release via the :revision variable (defaults to latest revision) + * Allow variables to be set via the cli using the -s switch * Log checkouts to a "revisions.log" file diff --git a/switchtower/lib/switchtower/configuration.rb b/switchtower/lib/switchtower/configuration.rb index c6ddff5568..6f00841636 100644 --- a/switchtower/lib/switchtower/configuration.rb +++ b/switchtower/lib/switchtower/configuration.rb @@ -44,12 +44,14 @@ module SwitchTower set :user, nil set :password, nil - set :deploy_to, Proc.new { "/u/apps/#{application}" } + set :deploy_to, Proc.new { "/u/apps/#{application}" } set :version_dir, DEFAULT_VERSION_DIR_NAME set :current_dir, DEFAULT_CURRENT_DIR_NAME set :shared_dir, DEFAULT_SHARED_DIR_NAME set :scm, :subversion + + set :revision, Proc.new { source.latest_revision } end # Set a variable to the given value. diff --git a/switchtower/lib/switchtower/recipes/standard.rb b/switchtower/lib/switchtower/recipes/standard.rb index fe57c0f65e..91e67b0a97 100644 --- a/switchtower/lib/switchtower/recipes/standard.rb +++ b/switchtower/lib/switchtower/recipes/standard.rb @@ -71,7 +71,7 @@ symlinks and deleting the current release from all servers. DESC task :rollback_code do if releases.length < 2 - raise "could not rollback the code because there is no previous version" + raise "could not rollback the code because there is no prior release" else run <<-CMD ln -nfs #{previous_release} #{current_path} && diff --git a/switchtower/lib/switchtower/scm/base.rb b/switchtower/lib/switchtower/scm/base.rb index 4e325aa155..4ca42132f2 100644 --- a/switchtower/lib/switchtower/scm/base.rb +++ b/switchtower/lib/switchtower/scm/base.rb @@ -22,7 +22,7 @@ module SwitchTower command = <<-STR if [[ ! -d #{configuration.release_path} ]]; then #{guts} - echo `date +"%Y-%m-%d %H:%M:%S"` $USER #{latest_revision} #{directory} >> #{log}; + echo `date +"%Y-%m-%d %H:%M:%S"` $USER #{configuration.revision} #{directory} >> #{log}; chmod 666 #{log}; fi STR diff --git a/switchtower/lib/switchtower/scm/cvs.rb b/switchtower/lib/switchtower/scm/cvs.rb index 794a3b5212..cb13987026 100644 --- a/switchtower/lib/switchtower/scm/cvs.rb +++ b/switchtower/lib/switchtower/scm/cvs.rb @@ -45,7 +45,7 @@ module SwitchTower command = <<-CMD cd #{configuration.releases_path}; - CVS_RSH="#{cvs_rsh}" #{cvs} -d #{configuration.repository} -Q co -D "#{latest_revision}" -d #{File.basename(actor.release_path)} #{actor.application}; + CVS_RSH="#{cvs_rsh}" #{cvs} -d #{configuration.repository} -Q co -D "#{configuration.revision}" -d #{File.basename(actor.release_path)} #{actor.application}; CMD run_checkout(actor, command) do |ch, stream, out| diff --git a/switchtower/lib/switchtower/scm/darcs.rb b/switchtower/lib/switchtower/scm/darcs.rb index ebc2f02549..8c02f3f99b 100644 --- a/switchtower/lib/switchtower/scm/darcs.rb +++ b/switchtower/lib/switchtower/scm/darcs.rb @@ -18,7 +18,8 @@ module SwitchTower # revision. Uses the given actor instance to execute the command. def checkout(actor) darcs = configuration[:darcs] ? configuration[:darcs] : "darcs" - run_checkout(actor, "#{darcs} get -q --set-scripts-executable #{configuration.repository} #{actor.release_path};") + revision = configuration[:revision] ? %(--to-match "#{configuration.revision}") : "" + run_checkout(actor, "#{darcs} get -q --set-scripts-executable #{revision} #{configuration.repository} #{actor.release_path};") end end diff --git a/switchtower/lib/switchtower/scm/subversion.rb b/switchtower/lib/switchtower/scm/subversion.rb index 7656cfe3f8..7d95dbeb47 100644 --- a/switchtower/lib/switchtower/scm/subversion.rb +++ b/switchtower/lib/switchtower/scm/subversion.rb @@ -42,7 +42,7 @@ module SwitchTower def checkout(actor) svn = configuration[:svn] ? configuration[:svn] : "svn" - command = "#{svn} co -q -r#{latest_revision} #{configuration.repository} #{actor.release_path};" + command = "#{svn} co -q -r#{configuration.revision} #{configuration.repository} #{actor.release_path};" run_checkout(actor, command) do |ch, stream, out| prefix = "#{stream} :: #{ch[:host]}" |