gofer 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Revision History
2
2
 
3
+ ### v0.2.3 21/05/2011
4
+
5
+ * Add `write` command to `Gofer::Host`
6
+
3
7
  ### v0.2.2 10/05/20011
4
8
 
5
9
  * Add `run_multiple` method to `Gofer::Host`
data/README.md CHANGED
@@ -31,6 +31,7 @@
31
31
  h.run "rm -rf 'remote_directory'"
32
32
  end
33
33
 
34
+ h.write("a string buffer", 'a_remote_file')
34
35
  puts h.read('a_remote_file')
35
36
  puts h.ls('a_remote_dir').join(", ")
36
37
 
@@ -61,7 +62,6 @@
61
62
 
62
63
  ## Planned Features
63
64
 
64
- h.write("a string buffer", 'a_remote_file')
65
65
  # constant connection (no reconnect for each action)
66
66
  Gofer::Host.new(...).open do |h|
67
67
  h.run( ... )
@@ -1,3 +1,5 @@
1
+ require 'tempfile'
2
+
1
3
  module Gofer
2
4
  class HostError < Exception # :nodoc:
3
5
  def initialize host, message
@@ -114,5 +116,14 @@ module Gofer
114
116
  def download from, to
115
117
  @ssh.download from, to, :recursive => directory?(from)
116
118
  end
119
+
120
+ # Write +data+ to a file at +to+
121
+ def write data, to
122
+ Tempfile.open "gofer_write" do |file|
123
+ file.write data
124
+ file.close
125
+ @ssh.upload(file.path, to, :recursive => false)
126
+ end
127
+ end
117
128
  end
118
129
  end
@@ -1,3 +1,3 @@
1
1
  module Gofer # :nodoc:
2
- VERSION = "0.2.2"
3
- end
2
+ VERSION = "0.2.3"
3
+ end
@@ -166,6 +166,13 @@ describe Gofer do
166
166
  end
167
167
  end
168
168
  end
169
+
170
+ describe :write do
171
+ it "should write a file to the remote server" do
172
+ @host.write("some data\n", in_tmpdir('written'))
173
+ raw_ssh("cat #{in_tmpdir 'written'}").should == "some data\n"
174
+ end
175
+ end
169
176
 
170
177
  describe :download do
171
178
  it "should download a file from the remove server" do
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gofer
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.2.2
4
+ hash: 17
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 3
10
+ version: 0.2.3
6
11
  platform: ruby
7
12
  authors:
8
13
  - Michael Pearson
@@ -10,7 +15,7 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-05-10 00:00:00 +10:00
18
+ date: 2011-05-21 00:00:00 +10:00
14
19
  default_executable:
15
20
  dependencies:
16
21
  - !ruby/object:Gem::Dependency
@@ -21,6 +26,11 @@ dependencies:
21
26
  requirements:
22
27
  - - ">="
23
28
  - !ruby/object:Gem::Version
29
+ hash: 33
30
+ segments:
31
+ - 2
32
+ - 0
33
+ - 23
24
34
  version: 2.0.23
25
35
  type: :runtime
26
36
  version_requirements: *id001
@@ -32,12 +42,19 @@ dependencies:
32
42
  requirements:
33
43
  - - ">="
34
44
  - !ruby/object:Gem::Version
45
+ hash: 31
46
+ segments:
47
+ - 1
48
+ - 0
49
+ - 4
35
50
  version: 1.0.4
36
51
  type: :runtime
37
52
  version_requirements: *id002
38
- description: "\n\
39
- Gofer provides a flexible and reliable model for performing tasks on remote\n\
40
- server using Net::SSH\n"
53
+ description: |
54
+
55
+ Gofer provides a flexible and reliable model for performing tasks on remote
56
+ server using Net::SSH
57
+
41
58
  email:
42
59
  - mipearson@gmail.com
43
60
  executables: []
@@ -74,17 +91,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
91
  requirements:
75
92
  - - ">="
76
93
  - !ruby/object:Gem::Version
94
+ hash: 3
95
+ segments:
96
+ - 0
77
97
  version: "0"
78
98
  required_rubygems_version: !ruby/object:Gem::Requirement
79
99
  none: false
80
100
  requirements:
81
101
  - - ">="
82
102
  - !ruby/object:Gem::Version
103
+ hash: 3
104
+ segments:
105
+ - 0
83
106
  version: "0"
84
107
  requirements: []
85
108
 
86
109
  rubyforge_project:
87
- rubygems_version: 1.6.2
110
+ rubygems_version: 1.3.7
88
111
  signing_key:
89
112
  specification_version: 3
90
113
  summary: run commands on remote servers using SSH