mattmatt-cap-ext-webistrano 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +29 -5
- data/Rakefile +1 -1
- data/VERSION.yml +1 -1
- data/lib/cap_ext_webistrano.rb +5 -1
- data/lib/cap_ext_webistrano/task.rb +11 -6
- data/test/cap_ext_webistrano_shoulda.rb +6 -0
- metadata +5 -3
data/README.markdown
CHANGED
@@ -21,11 +21,11 @@ The Webistrano extensions require a couple of configuration options that you
|
|
21
21
|
can specify in your deploy.rb. They're pretty much the standard options you'd
|
22
22
|
configure for your application with Capistrano.
|
23
23
|
|
24
|
-
set :application,
|
25
|
-
set :user,
|
26
|
-
set :password,
|
27
|
-
set :stage,
|
28
|
-
set :webistrano_home, "http://webistrano.mydomain.com
|
24
|
+
set :application, "My project" # The project as named in Webistrano
|
25
|
+
set :user, "admin"
|
26
|
+
set :password, "admin"
|
27
|
+
set :stage, "test" # specify the stage you want to deploy
|
28
|
+
set :webistrano_home, "http://webistrano.mydomain.com"
|
29
29
|
|
30
30
|
If you only have one stage in your project this should do, however with
|
31
31
|
several stages it'd be better to ask for the stage to be deployed:
|
@@ -34,6 +34,30 @@ several stages it'd be better to ask for the stage to be deployed:
|
|
34
34
|
Capistrano::CLI.ui.ask "Specify the stage to deploy: "
|
35
35
|
end
|
36
36
|
|
37
|
+
You can ask for the password too:
|
38
|
+
|
39
|
+
set :password do
|
40
|
+
Capistrano::CLI.password_prompt "Enter the deploy password: "
|
41
|
+
end
|
42
|
+
|
43
|
+
Optionally, you can specify configuration that you had setup webistrano to
|
44
|
+
prompt it:
|
45
|
+
|
46
|
+
set :prompt_config, { :password => 'mysecretpassword' }
|
47
|
+
|
48
|
+
Changes
|
49
|
+
=======
|
50
|
+
|
51
|
+
- Added support for prompt configuration (Lucas Mundim)
|
52
|
+
- Restore prefix_options hash as Active Resource lost it when reload method is called (Lucas Mundim)
|
53
|
+
- Solved "regular expression too big" exception error on large string
|
54
|
+
output (Michael Lim)
|
55
|
+
- Workaround to solve bug in @deployment.reload() not loading the site url
|
56
|
+
correctly (Michael Lim)
|
57
|
+
|
58
|
+
License
|
59
|
+
=======
|
60
|
+
|
37
61
|
(c) 2009 Mathias Meyer
|
38
62
|
|
39
63
|
Released under the MIT license.
|
data/Rakefile
CHANGED
@@ -6,7 +6,7 @@ begin
|
|
6
6
|
require 'jeweler'
|
7
7
|
Jeweler::Tasks.new do |s|
|
8
8
|
s.name = 'cap-ext-webistrano'
|
9
|
-
s.summary = 'A drop-in replacement for Capistrano to fire off Webistrano deployments transparently without losing the joy of using the cap command.'
|
9
|
+
s.summary = 'A drop-in replacement for Capistrano to fire off Webistrano deployments transparently without losing the joy of using the cap command. You need a fully configured Webistrano installation.'
|
10
10
|
s.email = 'meyer@paperplanes.de'
|
11
11
|
s.homepage = 'http://github.com/mattmatt/cap-ext-webistrano'
|
12
12
|
s.authors = ["Mathias Meyer"]
|
data/VERSION.yml
CHANGED
data/lib/cap_ext_webistrano.rb
CHANGED
@@ -38,6 +38,10 @@ Capistrano::Configuration::Execution.class_eval do
|
|
38
38
|
def find_and_execute_task(task, hooks = {})
|
39
39
|
hijack_capistrano
|
40
40
|
@callbacks = {}
|
41
|
-
|
41
|
+
begin
|
42
|
+
original_find_and_execute_task(task, {})
|
43
|
+
rescue Capistrano::NoSuchTaskError
|
44
|
+
CapExtWebistrano::Task.new(task, self).run
|
45
|
+
end
|
42
46
|
end
|
43
47
|
end
|
@@ -5,7 +5,7 @@ require 'cap_ext_webistrano/deployment'
|
|
5
5
|
module CapExtWebistrano
|
6
6
|
class Task
|
7
7
|
attr_accessor :task, :log
|
8
|
-
|
8
|
+
|
9
9
|
def initialize(task, config)
|
10
10
|
@task = task
|
11
11
|
@config = config
|
@@ -17,30 +17,35 @@ module CapExtWebistrano
|
|
17
17
|
klazz.configure(@config)
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def loop_latest_deployment
|
22
22
|
still_running = true
|
23
|
+
prefix_options = @deployment.prefix_options
|
23
24
|
while still_running
|
24
25
|
sleep 5
|
26
|
+
@deployment.prefix_options.merge!(prefix_options)
|
25
27
|
@deployment.reload
|
26
28
|
print_diff(@deployment)
|
27
29
|
still_running = false unless @deployment.completed_at.nil?
|
28
30
|
end
|
29
31
|
end
|
30
|
-
|
32
|
+
|
31
33
|
def print_diff(deployment)
|
32
34
|
if deployment.log
|
33
|
-
diff = deployment.log
|
35
|
+
diff = deployment.log
|
36
|
+
diff.slice!(log)
|
34
37
|
print diff
|
35
38
|
log << diff
|
36
39
|
end
|
37
40
|
end
|
38
|
-
|
41
|
+
|
39
42
|
def run
|
40
43
|
set_access_data
|
41
44
|
@project = Project.find_by_name(@config[:application])
|
42
45
|
@stage = @project.find_stage(@config[:stage])
|
43
|
-
|
46
|
+
params = { :task => task, :stage_id => @stage.id, :project_id => @project.id }
|
47
|
+
params.merge!(:prompt_config => @config[:prompt_config]) if @config.exists?(:prompt_config)
|
48
|
+
@deployment = Deployment.create(params)
|
44
49
|
loop_latest_deployment
|
45
50
|
end
|
46
51
|
end
|
@@ -21,5 +21,11 @@ class CapExtWebistranoTest < Test::Unit::TestCase
|
|
21
21
|
@cap.find_and_execute_task("deploy")
|
22
22
|
assert @cap.ran
|
23
23
|
end
|
24
|
+
|
25
|
+
should "just call tasks that don't exist locally" do
|
26
|
+
@cap.stubs(:original_find_and_execute_task).raises(Capistrano::NoSuchTaskError.new, "the task activate:web does not exist")
|
27
|
+
@cap.find_and_execute_task("acticate:web")
|
28
|
+
assert @cap.ran
|
29
|
+
end
|
24
30
|
end
|
25
31
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mattmatt-cap-ext-webistrano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias Meyer
|
@@ -9,11 +9,12 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-25 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: capistrano
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
@@ -23,6 +24,7 @@ dependencies:
|
|
23
24
|
version:
|
24
25
|
- !ruby/object:Gem::Dependency
|
25
26
|
name: activeresource
|
27
|
+
type: :runtime
|
26
28
|
version_requirement:
|
27
29
|
version_requirements: !ruby/object:Gem::Requirement
|
28
30
|
requirements:
|
@@ -79,6 +81,6 @@ rubyforge_project:
|
|
79
81
|
rubygems_version: 1.2.0
|
80
82
|
signing_key:
|
81
83
|
specification_version: 2
|
82
|
-
summary: A drop-in replacement for Capistrano to fire off Webistrano deployments transparently without losing the joy of using the cap command.
|
84
|
+
summary: A drop-in replacement for Capistrano to fire off Webistrano deployments transparently without losing the joy of using the cap command. You need a fully configured Webistrano installation.
|
83
85
|
test_files: []
|
84
86
|
|