nwcopy 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +10 -8
- data/README.rdoc +14 -10
- data/lib/nwcopy.rb +31 -12
- data/lib/nwcopy/version.rb +1 -1
- data/nwcopy.gemspec +1 -0
- metadata +17 -3
data/Gemfile.lock
CHANGED
@@ -1,21 +1,23 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nwcopy (0.0.
|
5
|
-
|
4
|
+
nwcopy (0.0.7)
|
5
|
+
gist
|
6
|
+
json
|
7
|
+
multipart-post
|
6
8
|
|
7
9
|
GEM
|
8
10
|
remote: http://rubygems.org/
|
9
11
|
specs:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
tilt (~> 1.2)
|
14
|
-
tilt (1.2.2)
|
12
|
+
gist (2.0.0)
|
13
|
+
json (1.4.6)
|
14
|
+
multipart-post (1.1.0)
|
15
15
|
|
16
16
|
PLATFORMS
|
17
17
|
ruby
|
18
18
|
|
19
19
|
DEPENDENCIES
|
20
|
+
gist
|
21
|
+
json
|
22
|
+
multipart-post
|
20
23
|
nwcopy!
|
21
|
-
sinatra
|
data/README.rdoc
CHANGED
@@ -4,40 +4,44 @@ The fool proof network copy & paste program. Well, maybe someday.
|
|
4
4
|
|
5
5
|
= Usage
|
6
6
|
|
7
|
-
|
7
|
+
Copy data from the clipboard (pbpaste).
|
8
|
+
> nwcopy -p
|
8
9
|
/Users/josh/Dropbox/nwcopy/f314eee55161b14f140ee07b358ba63ef54112ac
|
10
|
+
Pastes to disk
|
9
11
|
> nwpaste
|
10
|
-
|
12
|
+
<Contents of clipboard>
|
11
13
|
|
14
|
+
Copy contents of a file to the clipboard (works with binaries)
|
12
15
|
> nwcopy /path/to/file
|
13
16
|
/Users/josh/Dropbox/nwcopy/e1c1675f009e65d8571bbab9243660da20a3b2a2
|
17
|
+
Paste the file to disk
|
14
18
|
> nwpaste
|
15
|
-
|
19
|
+
Pasted to file
|
16
20
|
|
21
|
+
Pipe arbitrary whatever to the clipboard
|
17
22
|
> echo 'pipes work' | nwcopy
|
18
23
|
/Users/josh/Dropbox/nwcopy/5293e79627710caf507fb9b841df51356650c78d
|
24
|
+
Paste it back
|
19
25
|
> nwpaste
|
20
26
|
pipes work
|
21
27
|
|
22
28
|
= Description
|
23
29
|
|
24
|
-
nwcopy takes whatever is in the clipboard (or pipe or filename) and copies it to a file in your Dropbox folder ~/Dropbox/nwcopy/<sha1>
|
30
|
+
nwcopy takes whatever is in the clipboard (or pipe or filename) and copies it to http://nwcopy.net. If you don't have nwcopy.net configured, it will copy to a file in your Dropbox folder ~/Dropbox/nwcopy/<sha1>
|
25
31
|
|
26
|
-
nwpaste takes the contents of the most recent file, prints it to STDIN and puts it in the clipboard.
|
32
|
+
nwpaste takes the contents of the most recent file (from nwcopy.net or your Dropbox), prints it to STDIN and puts it in the clipboard.
|
27
33
|
|
28
34
|
= WTF?
|
29
35
|
|
30
36
|
How in the world is this useful?
|
31
37
|
|
32
|
-
I constantly want to copy and paste between machines which cannot directly talk to one another.
|
38
|
+
I constantly want to copy and paste between machines which cannot directly talk to one another. My solution was simple, and this is it. It also happens to be really easy to use.
|
33
39
|
|
34
40
|
= Is that all?
|
35
41
|
|
36
42
|
Is that all? Well, yeah, right now. This is the initial version, and it works! However, here are my plans:
|
37
43
|
|
38
|
-
* Write some tests
|
39
44
|
* Support multiple files with globbing and whatnot.
|
40
|
-
* When files are supplied, they should be pasted back with their original filename (tarball?)
|
41
|
-
*
|
42
|
-
* Add a server component which can be easily used with curl.
|
45
|
+
* When multiple files are supplied, they should be pasted back with their original filename (tarball?)
|
46
|
+
* Whatever folks deem useful.
|
43
47
|
* Have some delicious brisket.
|
data/lib/nwcopy.rb
CHANGED
@@ -13,18 +13,20 @@ module Nwcopy
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.copy
|
16
|
-
data =
|
16
|
+
data = data_from_options
|
17
|
+
|
17
18
|
unavailable = []
|
18
19
|
plugins.each do |plugin|
|
19
20
|
if plugin.available?
|
20
21
|
return plugin.copy data
|
21
22
|
else
|
22
|
-
STDERR << plugin.unavailable_message
|
23
|
+
STDERR << plugin.unavailable_message + "\n"
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
27
28
|
def self.paste
|
29
|
+
data_from_options
|
28
30
|
unavailable = []
|
29
31
|
plugins.each do |plugin|
|
30
32
|
if plugin.available?
|
@@ -33,24 +35,41 @@ module Nwcopy
|
|
33
35
|
return clipboard
|
34
36
|
end
|
35
37
|
else
|
36
|
-
STDERR << plugin.unavailable_message
|
38
|
+
STDERR << plugin.unavailable_message + "\n"
|
37
39
|
end
|
38
40
|
end
|
39
41
|
end
|
40
42
|
|
41
43
|
private
|
42
|
-
def self.
|
43
|
-
if
|
44
|
-
|
44
|
+
def self.data_from_options
|
45
|
+
if ARGV.empty?
|
46
|
+
nodata = ARGF.read_nonblock(1) rescue true
|
45
47
|
else
|
46
|
-
|
48
|
+
nodata = false
|
47
49
|
end
|
48
|
-
|
49
|
-
|
50
|
-
|
50
|
+
|
51
|
+
if nodata || ARGV.include?('--help')
|
52
|
+
puts 'nwcopy: network copy and paste.'
|
53
|
+
puts 'Sign up at http://nwcopy.net.' unless Nwcopy::Client.available?
|
54
|
+
puts "nwcopy.net account: #{Nwcopy::Client.credentials.first}" if Nwcopy::Client.available? rescue ''
|
55
|
+
puts
|
56
|
+
puts ' nwcopy <file>'
|
57
|
+
puts ' Copies the file to nwcopy.net'
|
58
|
+
puts ' nwcopy -p'
|
59
|
+
puts ' Copies the contents of the clipboard (MacOS) to nwcopy.net'
|
60
|
+
puts ' command | nwcopy'
|
61
|
+
puts ' Copies the results of the piped command to nwcopy.net'
|
62
|
+
puts
|
63
|
+
puts ' nwpaste'
|
64
|
+
puts ' Pastes the last thing you copied to nwcopy.net'
|
65
|
+
puts ' If it is a file, it will be put into that file name.'
|
66
|
+
puts ' Any piped input or clipboard will be printed to STDOUT.'
|
67
|
+
puts
|
68
|
+
exit
|
69
|
+
elsif ARGV.include?('-p')
|
70
|
+
StringIO.new `pbpaste`
|
51
71
|
else
|
52
|
-
|
72
|
+
ARGF
|
53
73
|
end
|
54
74
|
end
|
55
|
-
|
56
75
|
end
|
data/lib/nwcopy/version.rb
CHANGED
data/nwcopy.gemspec
CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.add_dependency 'multipart-post'
|
16
16
|
s.add_dependency 'gist'
|
17
|
+
s.add_dependency 'json'
|
17
18
|
s.files = `git ls-files`.split("\n")
|
18
19
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
20
|
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: nwcopy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 8
|
10
|
+
version: 0.0.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Josh Kleinpeter
|
@@ -46,6 +46,20 @@ dependencies:
|
|
46
46
|
version: "0"
|
47
47
|
type: :runtime
|
48
48
|
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: json
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :runtime
|
62
|
+
version_requirements: *id003
|
49
63
|
description: Uses your Dropbox folder to facilitate copy and pasting between machines. More awesomesauce to come.
|
50
64
|
email:
|
51
65
|
- josh@kleinpeter.org
|