clipboard 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/clipboard.rb ADDED
@@ -0,0 +1,53 @@
1
+ require 'zucker/os'
2
+ require 'zucker/alias_for'
3
+
4
+ require File.expand_path '../../version', __FILE__
5
+
6
+ class << Clipboard ||= Module.new
7
+ case # OS
8
+ when OS.linux? || OS.mac? || OS.bsd? || OS.posix?
9
+ require 'open3'
10
+
11
+ if OS.mac?
12
+ WriteCommand = 'pbcopy'
13
+ ReadCommand = 'pbpaste'
14
+ else # linuX
15
+ WriteCommand = 'xclip'
16
+ ReadCommand = 'xclip -o'
17
+ end
18
+
19
+ def write(data)
20
+ Open3.popen3( WriteCommand ){ |input, _, _| input << data }
21
+ read # or true or nil?
22
+ end
23
+
24
+ def read
25
+ %x[#{ ReadCommand }]
26
+ end
27
+
28
+ def clear
29
+ write ''
30
+ end
31
+ when OS.windows?
32
+ require 'win32/clipboard'
33
+
34
+ def write(data)
35
+ Win32::Clipboard.set_data( data )
36
+ Win32::Clipboard.data
37
+ end
38
+
39
+ def read
40
+ Win32::Clipboard.data
41
+ end
42
+
43
+ def clear
44
+ Win32::Clipboard.empty
45
+ Win32::Clipboard.data
46
+ end
47
+ end#case
48
+
49
+ alias_for :write, :copy
50
+ alias_for :read, :paste
51
+ end
52
+
53
+ # J-_-L
data/version.rb ADDED
@@ -0,0 +1,3 @@
1
+ module Clipboard
2
+ VERSION = File.read File.expand_path '../VERSION', __FILE__
3
+ end
metadata ADDED
@@ -0,0 +1,130 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: clipboard
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 6
8
+ - 0
9
+ version: 0.6.0
10
+ platform: ruby
11
+ authors:
12
+ - Jan Lelis
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-10-01 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: jeweler
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :development
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: zucker
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 4
43
+ version: "4"
44
+ type: :runtime
45
+ version_requirements: *id002
46
+ description: Access the clipboard on all systems (Clipboard.write & Clipboard.read)
47
+ email: mail@janlelis.de
48
+ executables: []
49
+
50
+ extensions: []
51
+
52
+ extra_rdoc_files:
53
+ - LICENSE
54
+ - README.rdoc
55
+ files:
56
+ - .document
57
+ - .gitignore
58
+ - Gemfile
59
+ - LICENSE
60
+ - README.rdoc
61
+ - Rakefile
62
+ - VERSION
63
+ - clipboard.gemspec
64
+ - doc/Clipboard||= Module.new.html
65
+ - doc/README_rdoc.html
66
+ - doc/created.rid
67
+ - doc/images/brick.png
68
+ - doc/images/brick_link.png
69
+ - doc/images/bug.png
70
+ - doc/images/bullet_black.png
71
+ - doc/images/bullet_toggle_minus.png
72
+ - doc/images/bullet_toggle_plus.png
73
+ - doc/images/date.png
74
+ - doc/images/find.png
75
+ - doc/images/loadingAnimation.gif
76
+ - doc/images/macFFBgHack.png
77
+ - doc/images/package.png
78
+ - doc/images/page_green.png
79
+ - doc/images/page_white_text.png
80
+ - doc/images/page_white_width.png
81
+ - doc/images/plugin.png
82
+ - doc/images/ruby.png
83
+ - doc/images/tag_green.png
84
+ - doc/images/wrench.png
85
+ - doc/images/wrench_orange.png
86
+ - doc/images/zoom.png
87
+ - doc/index.html
88
+ - doc/js/darkfish.js
89
+ - doc/js/jquery.js
90
+ - doc/js/quicksearch.js
91
+ - doc/js/thickbox-compressed.js
92
+ - doc/lib/clipboard_rb.html
93
+ - doc/rdoc.css
94
+ - lib/clipboard.rb
95
+ - version.rb
96
+ has_rdoc: true
97
+ homepage: http://github.com/janlelis/clipboard
98
+ licenses: []
99
+
100
+ post_install_message:
101
+ rdoc_options:
102
+ - --charset=UTF-8
103
+ require_paths:
104
+ - lib
105
+ required_ruby_version: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ segments:
111
+ - 0
112
+ version: "0"
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ none: false
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ segments:
119
+ - 0
120
+ version: "0"
121
+ requirements:
122
+ - To use this gem on linux (or other X), you need xclip
123
+ - To use this gem on windows, you need the win32-clipboard gem
124
+ rubyforge_project:
125
+ rubygems_version: 1.3.7
126
+ signing_key:
127
+ specification_version: 3
128
+ summary: Access the clipboard on all systems
129
+ test_files: []
130
+