remote_cp 0.0.1

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/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in remote_cp.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,14 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ remote_cp (0.0.1)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+
10
+ PLATFORMS
11
+ ruby
12
+
13
+ DEPENDENCIES
14
+ remote_cp!
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,3 @@
1
+ module RemoteCp
2
+ VERSION = "0.0.1"
3
+ end
data/lib/remote_cp.rb ADDED
@@ -0,0 +1,57 @@
1
+ module RemoteCp
2
+ def rmcp(filename = nil)
3
+ if filename == nil
4
+ basename = "anonymous"
5
+ content = $stdin.read
6
+ else
7
+ full_path = File.expand_path(filename)
8
+ basename = File.basename(full_path)
9
+ content = File.open(full_path)
10
+ end
11
+ s3_connect
12
+ S3Object.store("file_name.txt", basename, 'RemoteClipboard')
13
+ S3Object.store("content", content, 'RemoteClipboard')
14
+ end
15
+
16
+ def rmp
17
+ s3_connect
18
+ file_name = S3Object.find("file_name.txt", 'RemoteClipboard').value
19
+ if File.exist?(file_name)
20
+ puts "#{file_name} already exist."
21
+ print "Do you want to replace it (y/n)? "
22
+ res = $stdin.gets.chomp
23
+ return unless res == "y"
24
+ end
25
+ content = S3Object.find('content', 'RemoteClipboard').value
26
+ File.open(file_name, "w+") {|f| f << content}
27
+ puts "#{file_name} copied."
28
+ end
29
+
30
+ def rmfn
31
+ rm_filename
32
+ end
33
+
34
+ def rmcat
35
+ rm_content
36
+ end
37
+
38
+ private
39
+ def s3_connect
40
+ require 'aws/s3'
41
+ include AWS::S3
42
+ AWS::S3::Base.establish_connection!(
43
+ :access_key_id => ENV['AMAZON_ACCESS_KEY_ID'],
44
+ :secret_access_key => ENV['AMAZON_SECRET_ACCESS_KEY']
45
+ )
46
+ end
47
+
48
+ def rm_filename
49
+ s3_connect
50
+ file_name = S3Object.find("file_name.txt", 'RemoteClipboard').value
51
+ end
52
+
53
+ def rm_content
54
+ s3_connect
55
+ content = S3Object.find( 'content', 'RemoteClipboard').value
56
+ end
57
+ end
data/remote_cp.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "remote_cp/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "remote_cp"
7
+ s.version = RemoteCp::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Martin Chabot"]
10
+ s.email = ["chabotm@gmail.com"]
11
+ s.homepage = "http://github.com/martinos/remote_cp"
12
+ s.summary = %q{Tools to facilitate file transfert across machine}
13
+ s.description = %q{Tools to facilitate file transfert across machine}
14
+
15
+ s.rubyforge_project = "remote_cp"
16
+
17
+ s.add_dependency "aws-s3"
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: remote_cp
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Martin Chabot
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-01-29 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: aws-s3
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: Tools to facilitate file transfert across machine
36
+ email:
37
+ - chabotm@gmail.com
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - .gitignore
46
+ - Gemfile
47
+ - Gemfile.lock
48
+ - Rakefile
49
+ - lib/remote_cp.rb
50
+ - lib/remote_cp/version.rb
51
+ - remote_cp.gemspec
52
+ has_rdoc: true
53
+ homepage: http://github.com/martinos/remote_cp
54
+ licenses: []
55
+
56
+ post_install_message:
57
+ rdoc_options: []
58
+
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ hash: 3
67
+ segments:
68
+ - 0
69
+ version: "0"
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ requirements: []
80
+
81
+ rubyforge_project: remote_cp
82
+ rubygems_version: 1.3.7
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: Tools to facilitate file transfert across machine
86
+ test_files: []
87
+