nwcopy 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 +3 -0
- data/Gemfile +4 -0
- data/README.rdoc +32 -0
- data/Rakefile +2 -0
- data/bin/nwcopy +6 -0
- data/bin/nwpaste +6 -0
- data/lib/nwcopy.rb +43 -0
- data/lib/nwcopy/version.rb +3 -0
- data/nwcopy.gemspec +21 -0
- metadata +77 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
= nwcopy/nwpaste
|
2
|
+
|
3
|
+
The fool proof network copy & paste program. Well, maybe someday.
|
4
|
+
|
5
|
+
= Usage
|
6
|
+
|
7
|
+
> nwcopy
|
8
|
+
Copied clipboard to /Users/josh/Dropbox/nwcopy/f314eee55161b14f140ee07b358ba63ef54112ac
|
9
|
+
> nwpaste
|
10
|
+
Clipboard now contains
|
11
|
+
https://github.com/j05h/nwcopy
|
12
|
+
|
13
|
+
|
14
|
+
= Description
|
15
|
+
|
16
|
+
nwcopy takes whatever is in the clipboard and copies it to a file in your Dropbox folder ~/Dropbox/nwcopy/<sha1>
|
17
|
+
|
18
|
+
nwpaste takes the contents of the most recent file and puts it in the clipboard.
|
19
|
+
|
20
|
+
= WTF?
|
21
|
+
|
22
|
+
How in the world is this useful?
|
23
|
+
|
24
|
+
I constantly want to copy and paste between machines which cannot directly talk to one another. However, they do both have Dropbox installed. My solution was simple, and this is it.
|
25
|
+
|
26
|
+
= Is that all?
|
27
|
+
|
28
|
+
Is that all? Well, yeah, right now. This is the initial version, and it works! However, here are my plans:
|
29
|
+
|
30
|
+
* Integrate with github/pastebin so that you don't need a Dropbox account.
|
31
|
+
* Add a server component which can be easily used with curl.
|
32
|
+
* Have some delicious brisket.
|
data/Rakefile
ADDED
data/bin/nwcopy
ADDED
data/bin/nwpaste
ADDED
data/lib/nwcopy.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'digest/sha1'
|
2
|
+
|
3
|
+
module Nwcopy
|
4
|
+
|
5
|
+
def self.dropbox_dir
|
6
|
+
File.expand_path '~/Dropbox'
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.nwcopy_dir
|
10
|
+
File.join dropbox_dir, 'nwcopy'
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.init
|
14
|
+
unless File.exists? dropbox_dir
|
15
|
+
$stderr << "You must have Dropbox installed to use this version of nwcopy. (http://getdropbox.com/)\n"
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
|
19
|
+
unless File.exists? nwcopy_dir
|
20
|
+
puts "Creating nwcopy directory at #{nwcopy_dir}"
|
21
|
+
Dir.mkdir nwcopy_dir
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.copy clipboard = `pbpaste`
|
26
|
+
digest = Digest::SHA1.hexdigest clipboard
|
27
|
+
nwcopy_file = File.join nwcopy_dir, digest
|
28
|
+
File.open(nwcopy_file, 'w+') do |f|
|
29
|
+
f << clipboard
|
30
|
+
end
|
31
|
+
nwcopy_file
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.paste
|
35
|
+
files = Dir.glob(File.join(nwcopy_dir,'*')).sort do |file1, file2|
|
36
|
+
File.new(file2).mtime <=> File.new(file1).mtime
|
37
|
+
end
|
38
|
+
|
39
|
+
clipboard = File.new(files.first).read
|
40
|
+
`echo #{clipboard} | pbcopy`
|
41
|
+
clipboard
|
42
|
+
end
|
43
|
+
end
|
data/nwcopy.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "nwcopy/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "nwcopy"
|
7
|
+
s.version = Nwcopy::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Josh Kleinpeter"]
|
10
|
+
s.email = ["josh@kleinpeter.org"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{network copy & paste.}
|
13
|
+
s.description = %q{Uses your Dropbox folder to facilitate copy and pasting between machines. More awesomesauce to come.}
|
14
|
+
|
15
|
+
s.rubyforge_project = "nwcopy"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nwcopy
|
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
|
+
- Josh Kleinpeter
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-01-31 00:00:00 -06:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: Uses your Dropbox folder to facilitate copy and pasting between machines. More awesomesauce to come.
|
23
|
+
email:
|
24
|
+
- josh@kleinpeter.org
|
25
|
+
executables:
|
26
|
+
- nwcopy
|
27
|
+
- nwpaste
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files: []
|
31
|
+
|
32
|
+
files:
|
33
|
+
- .gitignore
|
34
|
+
- Gemfile
|
35
|
+
- README.rdoc
|
36
|
+
- Rakefile
|
37
|
+
- bin/nwcopy
|
38
|
+
- bin/nwpaste
|
39
|
+
- lib/nwcopy.rb
|
40
|
+
- lib/nwcopy/version.rb
|
41
|
+
- nwcopy.gemspec
|
42
|
+
has_rdoc: true
|
43
|
+
homepage: ""
|
44
|
+
licenses: []
|
45
|
+
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
version: "0"
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
hash: 3
|
66
|
+
segments:
|
67
|
+
- 0
|
68
|
+
version: "0"
|
69
|
+
requirements: []
|
70
|
+
|
71
|
+
rubyforge_project: nwcopy
|
72
|
+
rubygems_version: 1.3.7
|
73
|
+
signing_key:
|
74
|
+
specification_version: 3
|
75
|
+
summary: network copy & paste.
|
76
|
+
test_files: []
|
77
|
+
|