remote_cp 0.0.13 → 0.1.0

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/Gemfile.lock CHANGED
@@ -1,25 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- remote_cp (0.0.13)
5
- aws-s3
4
+ remote_cp (0.1.0)
6
5
  minitar
7
6
  rake
7
+ right_aws
8
8
  thor
9
9
 
10
10
  GEM
11
11
  remote: http://rubygems.org/
12
12
  specs:
13
- aws-s3 (0.6.2)
14
- builder
15
- mime-types
16
- xml-simple
17
- builder (3.0.0)
18
- mime-types (1.16)
19
13
  minitar (0.5.3)
20
14
  rake (0.9.2)
15
+ right_aws (2.1.0)
16
+ right_http_connection (>= 1.2.5)
17
+ right_http_connection (1.3.0)
21
18
  thor (0.14.6)
22
- xml-simple (1.1.0)
23
19
 
24
20
  PLATFORMS
25
21
  ruby
data/README.rdoc CHANGED
@@ -15,24 +15,24 @@ Setup your remote cp by editing ~/.remote_cp config file:
15
15
  == Usage
16
16
  To copy a file to the remote clipboard:
17
17
 
18
- machineA: rt cp filename
18
+ machineA> rt cp filename
19
19
  The file can be pasted on another machine if remote_cp gem has been installed with the same bucket credentials.
20
20
 
21
- machineB: rt p
21
+ machineB> rt p
22
22
  You can also copy directories
23
23
 
24
- machineA: rt cp dirname
24
+ machineA> rt cp dirname
25
25
  To paste the copied directory in the current directory
26
26
 
27
- machineB: /home/tata>$ rt p
28
- machineB: /home/tata>$ ls -d */
27
+ machineB> /home/tata>$ rt p
28
+ machineB> /home/tata>$ ls -d */
29
29
  /dirname
30
30
  You can copy stdin to the remote clipboard:
31
31
 
32
- machineA: ls -l | rt cp
32
+ machineA> ls -l | rt cp
33
33
  You can also dump the remote clipboard to the stdout.
34
34
 
35
- machineB: rt cat
35
+ machineB> rt cat
36
36
  total 8
37
37
  drwxr-xr-x 5 martinos staff 170 25 Mar 23:08 .
38
38
  drwxr-xr-x 10 martinos staff 340 25 Mar 23:08 log
@@ -1,3 +1,3 @@
1
1
  module RemoteCp
2
- VERSION = "0.0.13"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/remote_cp.rb CHANGED
@@ -2,29 +2,24 @@ require 'rubygems'
2
2
  require 'zlib'
3
3
  require 'archive/tar/minitar'
4
4
  require 'thor'
5
- require 'aws/s3'
6
5
  require 'remote_cp/core_ext'
7
-
8
- include AWS::S3
6
+ require 'aws/s3'
7
+ require 'right_aws'
8
+ require 'logger'
9
9
 
10
10
  module RemoteCp
11
11
  class Clipboard
12
- include AWS::S3
12
+ include RightAws
13
13
  attr_accessor :content_object, :filename_object, :type_object
14
14
 
15
15
  def initialize
16
16
  connect
17
- @bucket = Bucket.find(bucket_name)
18
- @content_object = @bucket['content'] || create_obj("content", "")
19
- @filename_object = @bucket['file_name.txt'] || create_obj("file_name.txt", "")
20
- @type_object = @bucket['type'] || create_obj("type", "")
17
+ @bucket = @s3.buckets.detect{|a| a.full_name == "RemoteClipboard"}
18
+ @content_object = @bucket.key('content', true)
21
19
  end
22
20
 
23
21
  def connect
24
- AWS::S3::Base.establish_connection!(
25
- :access_key_id => config[:access_key_id],
26
- :secret_access_key => config[:secret_access_key]
27
- )
22
+ @s3 = RightAws::S3.new(config[:access_key_id], config[:secret_access_key], :logger => Logger.new('/dev/null'))
28
23
  end
29
24
 
30
25
  def config
@@ -52,21 +47,15 @@ module RemoteCp
52
47
  # str : content to copy
53
48
  # type : :file, :directory
54
49
  def push(str, filename = "anomymous", type = :file, content_type = nil)
55
- # I think that all this info should be included file's metadata
56
- # AWS::S3 does not support metadata setting on creation.
57
- @filename_object.value = filename
58
- @filename_object.save
59
-
60
- @content_object.value = str
61
- @content_object.content_type = content_type
62
- @content_object.save
63
-
64
- @type_object.value = type.to_s
65
- @type_object.save
50
+ metadata = { "filename" => filename, "type" => type.to_s}
51
+
52
+ @content_object.meta_headers = metadata
53
+ @content_object.data = str
54
+ @content_object.put
66
55
  end
67
56
 
68
57
  def pull
69
- @content_object.value
58
+ @content_object.get
70
59
  end
71
60
 
72
61
  def bucket_name
@@ -74,15 +63,15 @@ module RemoteCp
74
63
  end
75
64
 
76
65
  def filetype
77
- @type_object.value
66
+ @content_object.meta_headers["type"]
78
67
  end
79
68
 
80
69
  def content
81
- @bucket['content'].value
70
+ @content_object.data
82
71
  end
83
72
 
84
73
  def filename
85
- @filename_object.value
74
+ @content_object.meta_headers["filename"]
86
75
  end
87
76
 
88
77
  def create_obj(key, value)
data/remote_cp.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.rubyforge_project = "remote_cp"
16
16
 
17
- s.add_dependency "aws-s3"
17
+ s.add_dependency "right_aws"
18
18
  s.add_dependency "thor"
19
19
  s.add_dependency "minitar"
20
20
  s.add_dependency "rake"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remote_cp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 13
10
- version: 0.0.13
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Martin Chabot
@@ -15,11 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-21 00:00:00 -04:00
19
- default_executable:
18
+ date: 2011-08-11 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
- name: aws-s3
21
+ name: right_aws
23
22
  prerelease: false
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
@@ -110,7 +109,6 @@ files:
110
109
  - lib/remote_cp/core_ext.rb
111
110
  - lib/remote_cp/version.rb
112
111
  - remote_cp.gemspec
113
- has_rdoc: true
114
112
  homepage: http://github.com/martinos/remote_cp
115
113
  licenses: []
116
114
 
@@ -140,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
138
  requirements: []
141
139
 
142
140
  rubyforge_project: remote_cp
143
- rubygems_version: 1.6.2
141
+ rubygems_version: 1.8.6
144
142
  signing_key:
145
143
  specification_version: 3
146
144
  summary: Tools to facilitate file transfert across machine