win32-clipboard 0.4.2 → 0.4.3
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/CHANGES +7 -1
- data/MANIFEST +8 -11
- data/README +35 -29
- data/Rakefile +22 -0
- data/lib/win32/clipboard.rb +6 -5
- data/test/tc_clipboard.rb +5 -10
- data/win32-clipboard.gemspec +2 -2
- metadata +5 -4
- data/install.rb +0 -10
data/CHANGES
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 0.4.3 - 25-Jul-2007
|
2
|
+
* Changed ClipboardError to Clipboard::Error
|
3
|
+
* Added a Rakefile with tasks for testing and installation.
|
4
|
+
* Removed the install.rb file since installation is now handled by the Rakefile.
|
5
|
+
* Updates to the README and MANIFEST.
|
6
|
+
|
1
7
|
== 0.4.2 - 27-Jan-2007
|
2
8
|
* Fixes for the clipboard_test.rb example program setup code. Thanks go to
|
3
9
|
Harold Hausman for the spot.
|
@@ -44,4 +50,4 @@
|
|
44
50
|
* Moved the sample script to doc/examples.
|
45
51
|
|
46
52
|
== 0.1.0 - 19-Nov-2003
|
47
|
-
* Initial release
|
53
|
+
* Initial release
|
data/MANIFEST
CHANGED
@@ -1,11 +1,8 @@
|
|
1
|
-
MANIFEST
|
2
|
-
CHANGES
|
3
|
-
README
|
4
|
-
|
5
|
-
win32-clipboard.gemspec
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
lib/win32/clipboard.rb
|
10
|
-
|
11
|
-
test/tc_clipboard.rb
|
1
|
+
* MANIFEST
|
2
|
+
* CHANGES
|
3
|
+
* README
|
4
|
+
* Rakefile
|
5
|
+
* win32-clipboard.gemspec
|
6
|
+
* examples/clipboard_test.rb
|
7
|
+
* lib/win32/clipboard.rb
|
8
|
+
* test/tc_clipboard.rb
|
data/README
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
== Description
|
2
2
|
win32-clipboard - a Ruby package for interacting with the Win32 clipboard.
|
3
3
|
|
4
|
+
== Installation
|
5
|
+
rake test (optional)
|
6
|
+
rake install (non-gem) or rake install_gem (gem)
|
7
|
+
|
4
8
|
== Synopsis
|
5
|
-
require
|
9
|
+
require 'win32/clipboard'
|
6
10
|
include Win32
|
7
11
|
|
8
12
|
puts "Data on clipboard: " + Clipboard.data
|
@@ -18,8 +22,7 @@
|
|
18
22
|
|
19
23
|
== Class Methods
|
20
24
|
Clipboard.data(format=nil)
|
21
|
-
|
22
|
-
Returns the data currently in the clipboard. If 'format' is
|
25
|
+
Returns the data currently in the clipboard. If +format+ is
|
23
26
|
specified, it will attempt to retrieve the data in that format. The
|
24
27
|
default is Clipboard::TEXT. See the 'Constants' section for
|
25
28
|
the supported formats.
|
@@ -31,43 +34,46 @@ Clipboard.empty
|
|
31
34
|
Empty the contents of the clipboard
|
32
35
|
|
33
36
|
Clipboard.format_available?(format_number)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
+
Returns true if 'format_number' is currently available on the clipboard,
|
38
|
+
false otherwise.
|
39
|
+
|
37
40
|
Clipboard.format_name(format_number)
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
+
Returns the corresponding name for the given 'format_number', or nil
|
42
|
+
if it does not exist.
|
43
|
+
|
41
44
|
Clipboard.formats
|
42
|
-
|
43
|
-
|
45
|
+
Returns a hash of all the current formats, with the format number as the
|
46
|
+
key and the format name as the value for that key.
|
47
|
+
|
48
|
+
Clipboard.get_data(format=nil)
|
49
|
+
Alias for Clipboard.data.
|
44
50
|
|
45
51
|
Clipboard.num_formats
|
46
52
|
Returns the number of different data formats currently on the clipboard.
|
47
53
|
|
48
54
|
Clipboard.register_format(format)
|
49
|
-
|
50
|
-
|
55
|
+
Registers the given 'format' (a String) as a clipboard format, which
|
56
|
+
can then be used as a valid clipboard format.
|
51
57
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
58
|
+
If a registered format with the specified name already exists, a new
|
59
|
+
format is not registered and the return value identifies the existing
|
60
|
+
format. This enables more than one application to copy and paste data
|
61
|
+
using the same registered clipboard format. Note that the format name
|
62
|
+
comparison is case-insensitive.
|
63
|
+
|
64
|
+
Registered clipboard formats are identified by values in the range 0xC000
|
65
|
+
through 0xFFFF.
|
57
66
|
|
58
|
-
Registered clipboard formats are identified by values in the range 0xC000
|
59
|
-
through 0xFFFF.
|
60
|
-
|
61
67
|
Clipboard.set_data(data, format=nil)
|
62
68
|
Sets the clipboard contents to the data that you specify. You may
|
63
|
-
optionally specify a clipboard format.
|
69
|
+
optionally specify a clipboard format. The default is Clipboard::TEXT.
|
64
70
|
|
65
71
|
See the 'Constants' section for a list of the supported formats.
|
66
|
-
|
72
|
+
|
67
73
|
== Error Classes
|
68
|
-
|
69
|
-
|
70
|
-
|
74
|
+
Clipboard::Error
|
75
|
+
Typically only raised if the clipboard fails to open or if you attempt to
|
76
|
+
register an invalid format.
|
71
77
|
|
72
78
|
== Constants
|
73
79
|
=== Standard Constants
|
@@ -97,10 +103,10 @@ Clipboard::UNICODETEXT
|
|
97
103
|
Ruby's
|
98
104
|
|
99
105
|
== Copyright
|
100
|
-
(C) 2003-
|
106
|
+
(C) 2003-2007 Daniel J. Berger
|
101
107
|
All Rights Reserved
|
102
108
|
|
103
109
|
== Author
|
104
110
|
Daniel J. Berger
|
105
|
-
djberg96 at gmail dot com
|
106
|
-
imperator
|
111
|
+
djberg96 at nospame gmail dot com
|
112
|
+
imperator on IRC (irc.freenode.org)
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
|
4
|
+
desc "Install the win32-clipboard package (non-gem)"
|
5
|
+
task :install do
|
6
|
+
dest = File.join(Config::CONFIG['sitelibdir'], 'win32')
|
7
|
+
Dir.mkdir(dest) unless File.exists? dest
|
8
|
+
cp 'lib/win32/clipboard.rb', dest, :verbose => true
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "Install the win32-clipboard package as a gem"
|
12
|
+
task :install_gem do
|
13
|
+
ruby 'win32-clipboard.gemspec'
|
14
|
+
file = Dir["*.gem"].first
|
15
|
+
sh "gem install #{file}"
|
16
|
+
end
|
17
|
+
|
18
|
+
Rake::TestTask.new do |t|
|
19
|
+
t.libs << 'lib'
|
20
|
+
t.warning = true
|
21
|
+
t.test_files = FileList['test/tc*']
|
22
|
+
end
|
data/lib/win32/clipboard.rb
CHANGED
@@ -3,8 +3,9 @@ require 'windows/memory'
|
|
3
3
|
require 'windows/error'
|
4
4
|
|
5
5
|
module Win32
|
6
|
-
class ClipboardError < StandardError; end
|
7
6
|
class Clipboard
|
7
|
+
class Error < StandardError; end
|
8
|
+
|
8
9
|
include Windows::Clipboard
|
9
10
|
include Windows::Memory
|
10
11
|
include Windows::Error
|
@@ -12,7 +13,7 @@ module Win32
|
|
12
13
|
extend Windows::Memory
|
13
14
|
extend Windows::Error
|
14
15
|
|
15
|
-
VERSION = '0.4.
|
16
|
+
VERSION = '0.4.3'
|
16
17
|
|
17
18
|
# Clipboard data types
|
18
19
|
TEXT = CF_TEXT
|
@@ -46,7 +47,7 @@ module Win32
|
|
46
47
|
error = get_last_error
|
47
48
|
GlobalFree(hmem)
|
48
49
|
self.close
|
49
|
-
raise
|
50
|
+
raise Error, "SetClipboardData() failed: #{error}"
|
50
51
|
end
|
51
52
|
|
52
53
|
GlobalFree(hmem)
|
@@ -149,7 +150,7 @@ module Win32
|
|
149
150
|
def self.register_format(format)
|
150
151
|
if RegisterClipboardFormat(format) == 0
|
151
152
|
error = "RegisterClipboardFormat() call failed: " + get_last_error
|
152
|
-
raise
|
153
|
+
raise Error, error
|
153
154
|
end
|
154
155
|
end
|
155
156
|
|
@@ -157,7 +158,7 @@ module Win32
|
|
157
158
|
|
158
159
|
def self.open
|
159
160
|
if 0 == OpenClipboard(0)
|
160
|
-
raise
|
161
|
+
raise Error, "OpenClipboard() failed: " + get_last_error
|
161
162
|
end
|
162
163
|
end
|
163
164
|
|
data/test/tc_clipboard.rb
CHANGED
@@ -4,21 +4,16 @@
|
|
4
4
|
# Test suite for the win32-clipboard package. This will copy and remove
|
5
5
|
# data from your clipboard. If your current clipboard data is crucial to
|
6
6
|
# you, please save it first.
|
7
|
+
#
|
8
|
+
# You should run this test case via the 'rake test' task.
|
7
9
|
###########################################################################
|
8
|
-
|
9
|
-
|
10
|
-
Dir.chdir('..') if base == 'test'
|
11
|
-
$LOAD_PATH.unshift(Dir.pwd + '/lib')
|
12
|
-
Dir.chdir('test') if base =~ /win32-clipboard/
|
13
|
-
end
|
14
|
-
|
15
|
-
require "win32/clipboard"
|
16
|
-
require "test/unit"
|
10
|
+
require 'win32/clipboard'
|
11
|
+
require 'test/unit'
|
17
12
|
include Win32
|
18
13
|
|
19
14
|
class TC_Win32ClipBoard < Test::Unit::TestCase
|
20
15
|
def test_version
|
21
|
-
assert_equal('0.4.
|
16
|
+
assert_equal('0.4.3', Clipboard::VERSION)
|
22
17
|
end
|
23
18
|
|
24
19
|
def test_data
|
data/win32-clipboard.gemspec
CHANGED
@@ -2,7 +2,7 @@ require "rubygems"
|
|
2
2
|
|
3
3
|
spec = Gem::Specification.new do |gem|
|
4
4
|
gem.name = "win32-clipboard"
|
5
|
-
gem.version = "0.4.
|
5
|
+
gem.version = "0.4.3"
|
6
6
|
gem.author = "Daniel J. Berger"
|
7
7
|
gem.email = "djberg96@gmail.com"
|
8
8
|
gem.homepage = "http://www.rubyforge.org/projects/win32utils"
|
@@ -12,7 +12,7 @@ spec = Gem::Specification.new do |gem|
|
|
12
12
|
gem.test_file = "test/tc_clipboard.rb"
|
13
13
|
gem.has_rdoc = true
|
14
14
|
gem.require_path = "lib"
|
15
|
-
gem.extra_rdoc_files = [
|
15
|
+
gem.extra_rdoc_files = ['CHANGES', 'README', 'MANIFEST']
|
16
16
|
gem.rubyforge_project = "win32utils"
|
17
17
|
gem.add_dependency("windows-pr", ">= 0.4.1")
|
18
18
|
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.2
|
3
3
|
specification_version: 1
|
4
4
|
name: win32-clipboard
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.4.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.4.3
|
7
|
+
date: 2007-07-25 00:00:00 -06:00
|
8
8
|
summary: A package for interacting with the Windows clipboard
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -34,9 +34,9 @@ files:
|
|
34
34
|
- test/tc_clipboard.rb
|
35
35
|
- CHANGES
|
36
36
|
- examples
|
37
|
-
- install.rb
|
38
37
|
- lib
|
39
38
|
- MANIFEST
|
39
|
+
- Rakefile
|
40
40
|
- README
|
41
41
|
- test
|
42
42
|
- win32-clipboard.gemspec
|
@@ -47,6 +47,7 @@ rdoc_options: []
|
|
47
47
|
extra_rdoc_files:
|
48
48
|
- CHANGES
|
49
49
|
- README
|
50
|
+
- MANIFEST
|
50
51
|
executables: []
|
51
52
|
|
52
53
|
extensions: []
|
data/install.rb
DELETED