sbfaulkner-astrovan 0.5.7 → 0.5.8
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/README.rdoc +4 -0
- data/VERSION.yml +1 -1
- data/lib/astrovan/session.rb +2 -0
- data/lib/astrovan/transfer.rb +30 -0
- data/test/exec_test.rb +1 -1
- data/test/transfer_test.rb +33 -0
- data/test/util_test.rb +0 -1
- metadata +4 -15
- data/test/deployment/github/TODO +0 -0
- data/test/deployment/heroku/TODO +0 -0
- data/test/deployment/jekyll/TODO +0 -0
- data/test/deployment/rails/TODO +0 -0
- data/test/deployment/sinatra/TODO +0 -0
- data/test/deployment/static/TODO +0 -0
data/README.rdoc
CHANGED
@@ -28,6 +28,9 @@ This is my attempt.
|
|
28
28
|
|
29
29
|
== CHANGES
|
30
30
|
|
31
|
+
=== 0.5.8
|
32
|
+
- add put and upload file transfer methods
|
33
|
+
|
31
34
|
=== 0.5.7
|
32
35
|
- fix bug when symlink to directory already exists
|
33
36
|
|
@@ -42,6 +45,7 @@ This is my attempt.
|
|
42
45
|
|
43
46
|
== TODO
|
44
47
|
|
48
|
+
- prevent/allow overwrite by put/upload
|
45
49
|
- stdin handling for exec
|
46
50
|
- stdout/stderr handling for exec
|
47
51
|
- other commands (all using exec)
|
data/VERSION.yml
CHANGED
data/lib/astrovan/session.rb
CHANGED
@@ -2,6 +2,7 @@ require 'astrovan/deploy'
|
|
2
2
|
require 'astrovan/exec'
|
3
3
|
require 'astrovan/util'
|
4
4
|
require 'astrovan/rake'
|
5
|
+
require 'astrovan/transfer'
|
5
6
|
require 'astrovan/update'
|
6
7
|
|
7
8
|
module Astrovan
|
@@ -11,6 +12,7 @@ module Astrovan
|
|
11
12
|
include Astrovan::Exec
|
12
13
|
include Astrovan::Util
|
13
14
|
include Astrovan::Rake
|
15
|
+
include Astrovan::Transfer
|
14
16
|
include Astrovan::Update
|
15
17
|
|
16
18
|
#:stopdoc:
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'net/scp'
|
2
|
+
|
3
|
+
module Astrovan
|
4
|
+
module Transfer
|
5
|
+
# Write to a file on the remote servers.
|
6
|
+
#
|
7
|
+
# Options:
|
8
|
+
# * +to+ - the path to the new file
|
9
|
+
def put(data, options = {})
|
10
|
+
upload StringIO.new(data), options
|
11
|
+
end
|
12
|
+
|
13
|
+
# Upload a file to the remote servers.
|
14
|
+
#
|
15
|
+
# Options:
|
16
|
+
# * +to+ - the path to the new file
|
17
|
+
def upload(from, options = {})
|
18
|
+
raise ArgumentError, "You must provide a target using the :to option" unless to = options.delete(:to)
|
19
|
+
session = session_for(options.delete(:on))
|
20
|
+
begin
|
21
|
+
session.server_list.each do |server|
|
22
|
+
server.session(true).scp.upload(from, to)
|
23
|
+
end
|
24
|
+
session.loop
|
25
|
+
ensure
|
26
|
+
session.close if session != self.session
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/test/exec_test.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
class TransferTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@path = "/tmp/astrovan.#{Time.now.to_i}"
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
system "rm -rf #{@path}.from #{@path}.to"
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_should_put_data_into_file
|
15
|
+
data = Time.now.utc.to_s
|
16
|
+
to = "#{@path}.to"
|
17
|
+
using 'astrovan.local', :password => ENV['PASSWORD'], :data => data, :to => to do
|
18
|
+
put data, :to => to
|
19
|
+
end
|
20
|
+
assert_equal data, File.open(to) { |f| f.gets.chomp }
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_should_upload_file
|
24
|
+
data = Time.now.utc.to_s
|
25
|
+
from = "#{@path}.from"
|
26
|
+
to = "#{@path}.to"
|
27
|
+
File.open(from, "w") { |f| f.puts data }
|
28
|
+
using 'astrovan.local', :password => ENV['PASSWORD'], :from => from, :to => to do
|
29
|
+
upload from, :to => to
|
30
|
+
end
|
31
|
+
assert_equal data, File.open(to) { |f| f.gets.chomp }
|
32
|
+
end
|
33
|
+
end
|
data/test/util_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sbfaulkner-astrovan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- S. Brent Faulkner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-02-
|
12
|
+
date: 2009-02-24 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -29,29 +29,18 @@ files:
|
|
29
29
|
- lib/astrovan/exec.rb
|
30
30
|
- lib/astrovan/rake.rb
|
31
31
|
- lib/astrovan/session.rb
|
32
|
+
- lib/astrovan/transfer.rb
|
32
33
|
- lib/astrovan/update.rb
|
33
34
|
- lib/astrovan/util.rb
|
34
35
|
- lib/astrovan.rb
|
35
36
|
- test/astrovan_test.rb
|
36
37
|
- test/deploy_test.rb
|
37
|
-
- test/deployment
|
38
|
-
- test/deployment/github
|
39
|
-
- test/deployment/github/TODO
|
40
|
-
- test/deployment/heroku
|
41
|
-
- test/deployment/heroku/TODO
|
42
|
-
- test/deployment/jekyll
|
43
|
-
- test/deployment/jekyll/TODO
|
44
|
-
- test/deployment/rails
|
45
|
-
- test/deployment/rails/TODO
|
46
|
-
- test/deployment/sinatra
|
47
|
-
- test/deployment/sinatra/TODO
|
48
|
-
- test/deployment/static
|
49
|
-
- test/deployment/static/TODO
|
50
38
|
- test/exec_test.rb
|
51
39
|
- test/rake_test.rake
|
52
40
|
- test/rake_test.rb
|
53
41
|
- test/session_test.rb
|
54
42
|
- test/test_helper.rb
|
43
|
+
- test/transfer_test.rb
|
55
44
|
- test/update_test.rb
|
56
45
|
- test/util_test.rb
|
57
46
|
has_rdoc: true
|
data/test/deployment/github/TODO
DELETED
File without changes
|
data/test/deployment/heroku/TODO
DELETED
File without changes
|
data/test/deployment/jekyll/TODO
DELETED
File without changes
|
data/test/deployment/rails/TODO
DELETED
File without changes
|
File without changes
|
data/test/deployment/static/TODO
DELETED
File without changes
|