vlad-push 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +0 -1
- data/lib/vlad/push.rb +25 -25
- data/test/test_vlad_push.rb +2 -7
- metadata +39 -64
data/Rakefile
CHANGED
data/lib/vlad/push.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'vlad'
|
2
|
+
|
2
3
|
class Vlad::Push
|
3
|
-
VERSION = "1.0.
|
4
|
+
VERSION = "1.0.2"
|
4
5
|
|
5
6
|
set :source, Vlad::Push.new
|
6
7
|
|
@@ -11,39 +12,39 @@ class Vlad::Push
|
|
11
12
|
set :ssh_flags, ""
|
12
13
|
set :release_name, ENV['RELEASE']||release_name
|
13
14
|
|
14
|
-
#@paired = false
|
15
|
-
|
16
15
|
# telling vlad not to bother running checkout
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#set :skip_scm, true
|
20
|
-
|
16
|
+
# but this doesn't seem to work, I'll probably
|
17
|
+
# moving it to the Rakefile
|
21
18
|
def checkout(revision, destination)
|
22
|
-
"echo 'skipping checkout
|
19
|
+
"echo '[vlad-push] skipping checkout, not needed without scm'"
|
23
20
|
end
|
24
21
|
|
22
|
+
# overwrite vlad export to simply copied what was
|
23
|
+
# pushed from the 'repository' location to the
|
24
|
+
# 'destination'
|
25
|
+
# * 'source' is for vlad support, but ignored
|
25
26
|
def export(source, destination)
|
26
27
|
# ignoring source
|
27
28
|
"cp -r #{repository} #{destination}"
|
28
|
-
#[ "mkdir -p #{repository}",
|
29
|
-
#"cd #{repository}",
|
30
|
-
#"tar -xzf /tmp/#{application}-#{release_name}.tgz",
|
31
|
-
#"cp -r #{repository} #{destination}"
|
32
|
-
#].join(" && ")
|
33
29
|
end
|
34
30
|
|
31
|
+
# telling vlad to use "repository" as "revision" just
|
32
|
+
# in case this method is needed
|
35
33
|
def revision(revision)
|
36
|
-
# telling vlad to use "repository" as "revision" as we have no scm
|
37
34
|
repository
|
38
35
|
end
|
39
36
|
|
37
|
+
# push extracted and compressed files to 'host'
|
38
|
+
# this should be run once for each host by
|
39
|
+
# the rake task :push
|
40
40
|
def push(host)
|
41
|
-
[ "#{push_scp} #{ssh_flags}",
|
41
|
+
[ "#{push_scp} #{ssh_flags.join(' ')}",
|
42
42
|
"/tmp/#{application}-#{release_name}.tgz",
|
43
43
|
"#{host}:/tmp/#{application}-#{release_name}.tgz"
|
44
44
|
].join(" ")
|
45
45
|
end
|
46
46
|
|
47
|
+
# extract the remote compressed file on each host
|
47
48
|
def push_extract
|
48
49
|
[ "if [ -e #{repository} ]; then rm -rf #{repository}; fi",
|
49
50
|
"mkdir -p #{repository}",
|
@@ -52,6 +53,8 @@ class Vlad::Push
|
|
52
53
|
].join(" && ")
|
53
54
|
end
|
54
55
|
|
56
|
+
# clean up old compressed archives both locally and
|
57
|
+
# remotely
|
55
58
|
def push_cleanup
|
56
59
|
[ "rm -vrf /tmp/#{application}-*.tgz",
|
57
60
|
[ "if [ -e #{repository} ]",
|
@@ -61,6 +64,8 @@ class Vlad::Push
|
|
61
64
|
].join(" && ")
|
62
65
|
end
|
63
66
|
|
67
|
+
# compress the files in the current working directory
|
68
|
+
# to be pushed to the remote server
|
64
69
|
def compress
|
65
70
|
[ "tar -czf /tmp/#{application}-#{release_name}.tgz",
|
66
71
|
'--exclude "\.git*"',
|
@@ -69,22 +74,18 @@ class Vlad::Push
|
|
69
74
|
].join(" ")
|
70
75
|
end
|
71
76
|
|
77
|
+
# using :vlad namespace to make this part
|
78
|
+
# of vlad in rake
|
72
79
|
namespace :vlad do
|
73
80
|
|
74
81
|
desc "Push current working directory to remote servers."
|
75
82
|
remote_task :push do
|
76
83
|
sh source.compress
|
77
|
-
|
84
|
+
# TODO: find a better way to ensure array for each
|
85
|
+
[domain].flatten.each do |host|
|
78
86
|
sh source.push(host)
|
79
87
|
end
|
80
88
|
run source.push_extract
|
81
|
-
#if !@paired
|
82
|
-
#puts " "
|
83
|
-
#puts "To update successfully, execute the following command:"
|
84
|
-
#puts " "
|
85
|
-
#puts " $ rake <environment> vlad:update RELEASE=#{release_name}"
|
86
|
-
#puts " "
|
87
|
-
#end
|
88
89
|
end
|
89
90
|
|
90
91
|
# Updating 'vlad:cleanup' to include post-task
|
@@ -100,13 +101,12 @@ class Vlad::Push
|
|
100
101
|
|
101
102
|
desc "Runs push and update"
|
102
103
|
task :deploy do
|
103
|
-
#@paired = true
|
104
104
|
Rake::Task["vlad:push"].invoke
|
105
105
|
Rake::Task["vlad:update"].invoke
|
106
106
|
end
|
107
107
|
|
108
108
|
end
|
109
109
|
|
110
|
-
end
|
110
|
+
end
|
111
111
|
|
112
112
|
|
data/test/test_vlad_push.rb
CHANGED
@@ -7,19 +7,14 @@ class TestVladPush < Test::Unit::TestCase
|
|
7
7
|
@source = Vlad::Push.new
|
8
8
|
set :repository, "/tmp/repo"
|
9
9
|
set :push_scp, "scp"
|
10
|
-
set :ssh_flags, [ "-i", "~/.ssh/id_rsa_example" ]
|
10
|
+
set :ssh_flags, [ "-i", "~/.ssh/id_rsa_example" ]
|
11
11
|
set :application, "testapp"
|
12
12
|
set :release_name, "12345678910"
|
13
13
|
end
|
14
14
|
|
15
|
-
def test_rake
|
16
|
-
assert system("rake -T vlad:push")
|
17
|
-
assert system("rake -T vlad:push | grep push")
|
18
|
-
end
|
19
|
-
|
20
15
|
def test_checkout
|
21
16
|
cmd = @source.checkout 'foo', 'bar'
|
22
|
-
assert_equal "echo 'skipping checkout
|
17
|
+
assert_equal "echo '[vlad-push] skipping checkout, not needed without scm'", cmd
|
23
18
|
end
|
24
19
|
|
25
20
|
def test_export
|
metadata
CHANGED
@@ -1,64 +1,48 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: vlad-push
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 1.0.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Joshua P. Mervine
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-08-03 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: vlad
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2151899840 !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
18
|
+
requirements:
|
27
19
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 2
|
32
|
-
- 0
|
33
|
-
version: "2.0"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.0'
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: hoe
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: *2151899840
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: hoe
|
27
|
+
requirement: &2151898680 !ruby/object:Gem::Requirement
|
40
28
|
none: false
|
41
|
-
requirements:
|
29
|
+
requirements:
|
42
30
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 2
|
47
|
-
- 10
|
48
|
-
version: "2.10"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.10'
|
49
33
|
type: :development
|
50
|
-
|
51
|
-
|
52
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2151898680
|
36
|
+
description: Adds support to Vlad for pushing files to a remote server without SCM.
|
37
|
+
(Really, pre 1.x didn't work as expected.)
|
38
|
+
email:
|
53
39
|
- joshua@mervine.net
|
54
40
|
executables: []
|
55
|
-
|
56
41
|
extensions: []
|
57
|
-
|
58
|
-
extra_rdoc_files:
|
42
|
+
extra_rdoc_files:
|
59
43
|
- Manifest.txt
|
60
44
|
- README.txt
|
61
|
-
files:
|
45
|
+
files:
|
62
46
|
- .autotest
|
63
47
|
- lib/vlad/push.rb
|
64
48
|
- Manifest.txt
|
@@ -66,40 +50,31 @@ files:
|
|
66
50
|
- README.txt
|
67
51
|
- test/test_vlad_push.rb
|
68
52
|
- .gemtest
|
69
|
-
has_rdoc: true
|
70
53
|
homepage: http://github.com/jmervine/vlad-push
|
71
54
|
licenses: []
|
72
|
-
|
73
55
|
post_install_message:
|
74
|
-
rdoc_options:
|
56
|
+
rdoc_options:
|
75
57
|
- --main
|
76
58
|
- README.txt
|
77
|
-
require_paths:
|
59
|
+
require_paths:
|
78
60
|
- lib
|
79
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
62
|
none: false
|
81
|
-
requirements:
|
82
|
-
- -
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
|
85
|
-
|
86
|
-
- 0
|
87
|
-
version: "0"
|
88
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
68
|
none: false
|
90
|
-
requirements:
|
91
|
-
- -
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
|
94
|
-
segments:
|
95
|
-
- 0
|
96
|
-
version: "0"
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
97
73
|
requirements: []
|
98
|
-
|
99
74
|
rubyforge_project: vlad-push
|
100
|
-
rubygems_version: 1.
|
75
|
+
rubygems_version: 1.8.5
|
101
76
|
signing_key:
|
102
77
|
specification_version: 3
|
103
78
|
summary: Adds support to Vlad for pushing files to a remote server without SCM
|
104
|
-
test_files:
|
79
|
+
test_files:
|
105
80
|
- test/test_vlad_push.rb
|