capistrano 2.5.14 → 2.5.15

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.
@@ -1,3 +1,11 @@
1
+ == 2.5.15 / 14 Febuary 2010
2
+
3
+ Fixes a feature request not to overwrite roles when using the ROLES environmental variable.
4
+
5
+ * #126 - The option to not overwriting the roles which are defined in the task definition.
6
+ * Removed the `upgrade` file as it has been a couple of years since 1.x was in the wild.
7
+ * Slight internal re-factor of the way we calculate the `version`
8
+
1
9
  == 2.5.14 / 18 January 2010
2
10
 
3
11
  Fixes a low-value bug, thanks to Chris G for the well submitted patch:
File without changes
data/Rakefile CHANGED
@@ -5,6 +5,7 @@ begin
5
5
  Jeweler::Tasks.new do |gem|
6
6
  gem.version
7
7
  gem.name = "capistrano"
8
+ gem.executables = %W(capify cap)
8
9
  gem.summary = %Q{Capistrano – Welcome to easy deployment with Ruby over SSH}
9
10
  gem.description = %Q{Capistrano is a utility and framework for executing commands in parallel on multiple remote machines, via SSH.}
10
11
  gem.homepage = "http://github.com/capistrano/capistrano"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.5.14
1
+ 2.5.15
@@ -24,6 +24,7 @@ module Capistrano
24
24
  config = instantiate_configuration(options)
25
25
  config.debug = options[:debug]
26
26
  config.dry_run = options[:dry_run]
27
+ config.preserve_roles = options[:preserve_roles]
27
28
  config.logger.level = options[:verbose]
28
29
 
29
30
  set_pre_vars(config)
@@ -79,6 +79,10 @@ module Capistrano
79
79
  "Make the output as quiet as possible."
80
80
  ) { options[:verbose] = 0 }
81
81
 
82
+ opts.on("-r", "--preserve-roles",
83
+ "Preserve task roles"
84
+ ) { options[:preserve_roles] = true }
85
+
82
86
  opts.on("-S", "--set-before NAME=VALUE",
83
87
  "Set a variable before the recipes are loaded."
84
88
  ) do |pair|
@@ -112,7 +116,7 @@ module Capistrano
112
116
  "Display the Capistrano version, and exit."
113
117
  ) do
114
118
  require 'capistrano/version'
115
- puts "Capistrano v#{Capistrano::Version::STRING}"
119
+ puts "Capistrano v#{Capistrano::Version}"
116
120
  exit
117
121
  end
118
122
 
@@ -19,11 +19,12 @@ module Capistrano
19
19
  # define roles, and set configuration variables.
20
20
  class Configuration
21
21
  # The logger instance defined for this configuration.
22
- attr_accessor :debug, :logger, :dry_run
22
+ attr_accessor :debug, :logger, :dry_run, :preserve_roles
23
23
 
24
24
  def initialize(options={}) #:nodoc:
25
25
  @debug = false
26
26
  @dry_run = false
27
+ @preserve_roles = false
27
28
  @logger = Logger.new(options)
28
29
  end
29
30
 
@@ -48,7 +48,9 @@ module Capistrano
48
48
  filter_server_list(hosts.uniq)
49
49
  end
50
50
  else
51
- roles = role_list_from(ENV['ROLES'] || options[:roles] || self.roles.keys)
51
+ roles = role_list_from(ENV['ROLES'] || options[:roles] || self.roles.keys)
52
+ roles = roles & Array(options[:roles]) if preserve_roles && !options[:roles].nil?
53
+
52
54
  only = options[:only] || {}
53
55
  except = options[:except] || {}
54
56
 
@@ -93,4 +95,4 @@ module Capistrano
93
95
  end
94
96
  end
95
97
  end
96
- end
98
+ end
@@ -45,14 +45,13 @@ _cset :version_dir, "releases"
45
45
  _cset :shared_dir, "shared"
46
46
  _cset :shared_children, %w(system log pids)
47
47
  _cset :current_dir, "current"
48
+ _cset :restart_method "apache"
48
49
 
49
50
  _cset(:releases_path) { File.join(deploy_to, version_dir) }
50
51
  _cset(:shared_path) { File.join(deploy_to, shared_dir) }
51
52
  _cset(:current_path) { File.join(deploy_to, current_dir) }
52
53
  _cset(:release_path) { File.join(releases_path, release_name) }
53
54
 
54
- # re: https://capistrano.lighthouseapp.com/projects/8716/tickets/88-getting-the-newest-directory
55
- # remove system inconsistencies with ls and let ruby sort the releases
56
55
  _cset(:releases) { capture("ls -x #{releases_path}").split.sort }
57
56
  _cset(:current_release) { File.join(releases_path, releases.last) }
58
57
  _cset(:previous_release) { releases.length > 1 ? File.join(releases_path, releases[-2]) : nil }
@@ -1,18 +1,15 @@
1
- require 'net/ssh/version'
2
-
3
1
  module Capistrano
4
2
 
5
- # Describes the current version of Capistrano.
6
- class Version < Net::SSH::Version
7
- MAJOR = 2
8
- MINOR = 5
9
- TINY = 14
3
+ class Version
4
+
5
+ CURRENT = File.read(File.dirname(__FILE__) + '/../../VERSION')
10
6
 
11
- # The current version, as a Version instance
12
- CURRENT = new(MAJOR, MINOR, TINY)
7
+ STRING = CURRENT.to_s
13
8
 
14
- # The current version, as a String instance
15
- STRING = CURRENT.to_s
9
+ def self.to_s
10
+ CURRENT
11
+ end
12
+
16
13
  end
17
14
 
18
15
  end
@@ -15,7 +15,7 @@ class CLIExecuteTest < Test::Unit::TestCase
15
15
  def setup
16
16
  @cli = MockCLI.new
17
17
  @logger = stub_everything
18
- @config = stub(:logger => @logger, :debug= => nil, :dry_run= => nil)
18
+ @config = stub(:logger => @logger, :debug= => nil, :dry_run= => nil, :preserve_roles= => nil)
19
19
  @config.stubs(:set)
20
20
  @config.stubs(:load)
21
21
  @config.stubs(:trigger)
@@ -129,4 +129,4 @@ class CLIExecuteTest < Test::Unit::TestCase
129
129
  MockCLI.expects(:parse).with(ARGV).returns(cli)
130
130
  MockCLI.execute
131
131
  end
132
- end
132
+ end
@@ -93,6 +93,18 @@ class CLIOptionsTest < Test::Unit::TestCase
93
93
  assert_equal 0, @cli.options[:verbose]
94
94
  end
95
95
 
96
+ def test_parse_options_with_r_should_set_preserve_roles_option
97
+ @cli.args << "-r"
98
+ @cli.parse_options!
99
+ assert @cli.options[:preserve_roles]
100
+ end
101
+
102
+ def test_parse_options_with_preserve_roles_should_set_preserve_roles_option
103
+ @cli.args << "--preserve-roles"
104
+ @cli.parse_options!
105
+ assert @cli.options[:preserve_roles]
106
+ end
107
+
96
108
  def test_parse_options_with_S_should_set_pre_vars
97
109
  @cli.args << "-S" << "foo=bar"
98
110
  @cli.parse_options!
@@ -6,6 +6,7 @@ class ConfigurationActionsInvocationTest < Test::Unit::TestCase
6
6
  attr_reader :options
7
7
  attr_accessor :debug
8
8
  attr_accessor :dry_run
9
+ attr_accessor :preserve_roles
9
10
 
10
11
  def initialize
11
12
  @options = {}
@@ -5,9 +5,11 @@ require 'capistrano/configuration/servers'
5
5
  class ConfigurationServersTest < Test::Unit::TestCase
6
6
  class MockConfig
7
7
  attr_reader :roles
8
+ attr_accessor :preserve_roles
8
9
 
9
10
  def initialize
10
11
  @roles = {}
12
+ @preserve_roles = false
11
13
  end
12
14
 
13
15
  include Capistrano::Configuration::Servers
@@ -62,6 +64,33 @@ class ConfigurationServersTest < Test::Unit::TestCase
62
64
  ENV.delete('ROLES')
63
65
  end
64
66
 
67
+ def test_task_with_roles_as_environment_variable_and_preserve_roles_should_apply_only_to_existant_task_role
68
+ ENV['ROLES'] = "app,file"
69
+ @config.preserve_roles = true
70
+ task = new_task(:testing,@config, :roles => :app)
71
+ assert_equal %w(app1 app2 app3).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
72
+ ensure
73
+ ENV.delete('ROLES')
74
+ end
75
+
76
+ def test_task_with_roles_as_environment_variable_and_preserve_roles_should_apply_only_to_existant_task_roles
77
+ ENV['ROLES'] = "app,file,web"
78
+ @config.preserve_roles = true
79
+ task = new_task(:testing,@config, :roles => [ :app,:file ])
80
+ assert_equal %w(app1 app2 app3 file).sort, @config.find_servers_for_task(task).map { |s| s.host }.sort
81
+ ensure
82
+ ENV.delete('ROLES')
83
+ end
84
+
85
+ def test_task_with_roles_as_environment_variable_and_preserve_roles_should_not_apply_if_not_exists_those_task_roles
86
+ ENV['ROLES'] = "file,web"
87
+ @config.preserve_roles = true
88
+ task = new_task(:testing,@config, :roles => [ :app ])
89
+ assert_equal [], @config.find_servers_for_task(task).map { |s| s.host }.sort
90
+ ensure
91
+ ENV.delete('ROLES')
92
+ end
93
+
65
94
  def test_task_with_hosts_as_environment_variable_should_apply_only_to_those_hosts
66
95
  ENV['HOSTS'] = "foo,bar"
67
96
  task = new_task(:testing)
@@ -126,4 +155,4 @@ class ConfigurationServersTest < Test::Unit::TestCase
126
155
  assert_equal %w(app1 app2 app3), @config.find_servers(:roles => lambda { :app }).map { |s| s.host }.sort
127
156
  assert_equal %w(app2 file), @config.find_servers(:roles => lambda { [:report, :file] }).map { |s| s.host }.sort
128
157
  end
129
- end
158
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.14
4
+ version: 2.5.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamis Buck
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2010-01-19 00:00:00 +01:00
13
+ date: 2010-02-14 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -78,18 +78,17 @@ email:
78
78
  - jamis@jamisbuck.org
79
79
  - lee.hambley@gmail.com
80
80
  executables:
81
- - cap
82
81
  - capify
82
+ - cap
83
83
  extensions: []
84
84
 
85
85
  extra_rdoc_files:
86
- - README.rdoc
86
+ - README
87
87
  files:
88
88
  - .gitignore
89
- - CHANGELOG.rdoc
90
- - README.rdoc
89
+ - CHANGELOG
90
+ - README
91
91
  - Rakefile
92
- - TESTING.md
93
92
  - VERSION
94
93
  - bin/cap
95
94
  - bin/capify
@@ -144,7 +143,6 @@ files:
144
143
  - lib/capistrano/recipes/deploy/templates/maintenance.rhtml
145
144
  - lib/capistrano/recipes/standard.rb
146
145
  - lib/capistrano/recipes/templates/maintenance.rhtml
147
- - lib/capistrano/recipes/upgrade.rb
148
146
  - lib/capistrano/role.rb
149
147
  - lib/capistrano/server_definition.rb
150
148
  - lib/capistrano/shell.rb
data/TESTING.md DELETED
@@ -1,16 +0,0 @@
1
- Testing Capistrano
2
- ==================
3
-
4
- 1. Install the Following Gem Dependencies
5
-
6
- `# gem install mocha echoe`
7
-
8
- 2. Run the following
9
-
10
- `$ rake test`
11
-
12
- 3. Output Should Resemble
13
-
14
- `Finished in 0.859017 seconds.`
15
- `523 tests, 1271 assertions, 0 failures, 0 errors`
16
-
@@ -1,33 +0,0 @@
1
- # Tasks to aid the migration of an established Capistrano 1.x installation to
2
- # Capistrano 2.x.
3
-
4
- namespace :upgrade do
5
- desc <<-DESC
6
- Migrate from the revisions log to REVISION. Capistrano 1.x recorded each \
7
- deployment to a revisions.log file. Capistrano 2.x is cleaner, and just \
8
- puts a REVISION file in the root of the deployed revision. This task \
9
- migrates from the revisions.log used in Capistrano 1.x, to the REVISION \
10
- tag file used in Capistrano 2.x. It is non-destructive and may be safely \
11
- run any number of times.
12
- DESC
13
- task :revisions, :except => { :no_release => true } do
14
- revisions = capture("cat #{deploy_to}/revisions.log")
15
-
16
- mapping = {}
17
- revisions.each do |line|
18
- revision, directory = line.chomp.split[-2,2]
19
- mapping[directory] = revision
20
- end
21
-
22
- commands = mapping.keys.map do |directory|
23
- "echo '.'; test -d #{directory} && echo '#{mapping[directory]}' > #{directory}/REVISION"
24
- end
25
-
26
- command = commands.join(";")
27
-
28
- run "cd #{releases_path}; #{command}; true" do |ch, stream, out|
29
- STDOUT.print(".")
30
- STDOUT.flush
31
- end
32
- end
33
- end