remote_cp 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Martin Chabot
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # RemoteCp [![](http://stillmaintained.com/martinos/remote_cp.png)](http://stillmaintained.com/martinos/remote_cp)
2
+ </a>
3
+ ## Description
4
+ RemoteCp is a command line tool intended to facilitate copying files accross the internet. You need to install the gem on both source and destination computers. Since it uses Amason S3, you need to create a S3 Bucket and configure the source and destination computer with the bucket keys.
5
+ ##Installation
6
+ Install the gem
7
+
8
+ $ gem install remote_cp
9
+
10
+ Add the Amazon access and private key of your S3 bucket in your .bashrc file:
11
+
12
+ export AMAZON_ACCESS_KEY_ID='MYACCESSKEY'
13
+ export AMAZON_SECRET_ACCESS_KEY='SECRET ACCESS KEY'
14
+ export REMOTE_CB_BUCKET='bucket_name'
15
+ ##Usage
16
+ To copy a file to the remote clipboard:
17
+
18
+ machineA: rt cp filename
19
+ The file can be pasted on another machine if remote_cp gem has been installed with the same bucket credentials.
20
+
21
+ machineB: rt p
22
+ You can also copy directories
23
+
24
+ machineA: rt cp dirname
25
+ To paste the file in the current directory
26
+
27
+ machineB: /home/tata>$ rt p
28
+ machineB: /home/tata>$ ls -d */
29
+ /dirname
30
+ You can copy stdin to the remote clipboard:
31
+
32
+ machineA: ls -l | rt cp
33
+ You can also dump the remote clipboard to the stdout.
34
+
35
+ machineB: rt cat
36
+ total 8
37
+ drwxr-xr-x 5 martinos staff 170 25 Mar 23:08 .
38
+ drwxr-xr-x 10 martinos staff 340 25 Mar 23:08 log
39
+ drwxr-xr-x 2 martinos staff 68 25 Mar 23:08 a_dir
40
+ -rw-r--r-- 1 martinos staff 15 25 Mar 23:07 a_file.txt
41
+ drwxr-xr-x 65 martinos staff 2210 25 Mar 23:07 ..
42
+ ## License
43
+
44
+ Released under the MIT License. See the LICENSE file for further details.
45
+
46
+
47
+
48
+
data/bin/rt CHANGED
@@ -17,7 +17,7 @@ class RemoteCp < Thor
17
17
  super
18
18
  end
19
19
 
20
- desc "cp [FILENAME]", "copy FILENAME to the cloudi. If FILENAME not given send STDIN to the cloud"
20
+ desc "cp [FILENAME]", "copy FILENAME to the cloud. If FILENAME not given send STDIN to the cloud"
21
21
  def cp(filename = nil)
22
22
  type = nil
23
23
  content_type = nil
@@ -43,15 +43,15 @@ class RemoteCp < Thor
43
43
  end
44
44
 
45
45
  # I think that all this info should be included file's metadata
46
- S3Object.store("file_name.txt", basename, 'RemoteClipboard')
47
- S3Object.store("content", content, 'RemoteClipboard', :content_type => content_type)
48
- S3Object.store("type", type, 'RemoteClipboard')
46
+ S3Object.store("file_name.txt", basename, bucket_name)
47
+ S3Object.store("content", content, bucket_name, :content_type => content_type)
48
+ S3Object.store("type", type, bucket_name)
49
49
  end
50
50
 
51
51
  desc "p", "paste from the cloud to current dir"
52
52
  def p
53
- file_name = S3Object.find("file_name.txt", 'RemoteClipboard').value
54
- type = S3Object.find("type", 'RemoteClipboard').value
53
+ file_name = S3Object.find("file_name.txt", bucket_name).value
54
+ type = S3Object.find("type", bucket_name).value
55
55
 
56
56
  if File.exist?(file_name)
57
57
  puts "#{file_name} already exist."
@@ -60,7 +60,7 @@ class RemoteCp < Thor
60
60
  return unless res == "y"
61
61
  end
62
62
 
63
- content = S3Object.find('content', 'RemoteClipboard').value
63
+ content = S3Object.find('content', bucket_name).value
64
64
  case type
65
65
  when 'file'
66
66
  File.open(file_name, "w+") {|f| f << content}
@@ -90,13 +90,17 @@ private
90
90
  :secret_access_key => ENV['AMAZON_SECRET_ACCESS_KEY']
91
91
  )
92
92
  end
93
+
94
+ def bucket_name
95
+ ENV["REMOTE_CB_BUCKET"]
96
+ end
93
97
 
94
98
  def filename
95
- S3Object.find("file_name.txt", 'RemoteClipboard').value
99
+ S3Object.find("file_name.txt", bucket_name).value
96
100
  end
97
101
 
98
102
  def rm_content
99
- S3Object.find( 'content', 'RemoteClipboard').value
103
+ S3Object.find('content', bucket_name).value
100
104
  end
101
105
  end
102
106
 
@@ -1,3 +1,3 @@
1
1
  module RemoteCp
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/remote_cp.gemspec CHANGED
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
16
16
 
17
17
  s.add_dependency "aws-s3"
18
18
  s.add_dependency "thor"
19
+ s.add_development_dependency("bundler", "~> 1.0")
19
20
  s.files = `git ls-files`.split("\n")
20
21
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
22
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
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: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Martin Chabot
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-25 00:00:00 -04:00
18
+ date: 2011-03-26 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -46,6 +46,21 @@ dependencies:
46
46
  version: "0"
47
47
  type: :runtime
48
48
  version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: bundler
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ hash: 15
58
+ segments:
59
+ - 1
60
+ - 0
61
+ version: "1.0"
62
+ type: :development
63
+ version_requirements: *id003
49
64
  description: Tools to facilitate file transfert across machine
50
65
  email:
51
66
  - chabotm@gmail.com
@@ -59,7 +74,8 @@ files:
59
74
  - .gitignore
60
75
  - Gemfile
61
76
  - Gemfile.lock
62
- - README
77
+ - LICENSE
78
+ - README.md
63
79
  - Rakefile
64
80
  - bin/rt
65
81
  - lib/remote_cp.rb
data/README DELETED
@@ -1,2 +0,0 @@
1
- # RemoteCp is a tool intended facilitate the copying of files accross the internet.
2
-