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 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
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 5
4
- :patch: 7
4
+ :patch: 8
@@ -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
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/test_helper'
2
2
 
3
- class SessionTest < Test::Unit::TestCase
3
+ class ExecTest < Test::Unit::TestCase
4
4
  def test_should_exec
5
5
  using 'astrovan.local', :password => ENV['PASSWORD'] do
6
6
  exec 'hostname'
@@ -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
@@ -1,7 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/test_helper'
2
2
 
3
3
  class UtilTest < Test::Unit::TestCase
4
- include
5
4
  def setup
6
5
  @path = "/tmp/astrovan.#{Time.now.to_i}"
7
6
  super
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.7
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-23 00:00:00 -08:00
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes