clipboard 1.0.6 → 1.1.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44d254172766eccb8380131b4a5a08ec01eb57c6
4
- data.tar.gz: 304975e97da154b601a0567ad0445d0ae1d7dff3
3
+ metadata.gz: daabcc7f7c52f9aeff9e0163f00c3ecbdfc494d8
4
+ data.tar.gz: 8b3a8aeb00f65797735f604a7c5ba5472e14e0d4
5
5
  SHA512:
6
- metadata.gz: 2b22b5d1a9e0ef54e29d9156e0ae3e3d78d0b0e619eaf5fa12e6d5e5dc1fdc123b1d98083714b0007eab5907c77b7b151459ca8af787d0e01f6025e9ab6220af
7
- data.tar.gz: 5304e58c2fce95c5e7b6852a7be23dfe01cf2beca55ee08a08e18693e30209c4cd3dc9aaedb49724e6545d142cfbd17caab8de96a979b36effda325cc308247d
6
+ metadata.gz: 9c65bda01e0b1917fa33cf88e87bc47a8f4be01934cb6a506d9da694c674fd9110c9e059dd3c7a1605ef3e609f96cfdede4414b95186ec84578a9fa285035d03
7
+ data.tar.gz: 9b57863507792943da2402fb711f0756b588d70dcf2eb24e32cd79ce52a13b5697ffd8232e84b9c137a1eb70c37320fff202bef281473718e288e9668ceb1c49
@@ -1,40 +1,48 @@
1
- == 1.0.6
1
+ # CHANGELOG
2
+
3
+ ## 1.1.0
4
+ * Remove support for 1.8
5
+ * Windows: Fix that the gem tries to convert encoding of pasted strings, leave this to user
6
+ * Support Cygwin's clipboard
7
+
8
+ ## 1.0.6
2
9
  * Improve Linux xsel support #17
3
10
 
4
- == 1.0.5
11
+ ## 1.0.5
5
12
  * Windows 1.9 multibyte support
6
13
 
7
- == 1.0.4
14
+ ## 1.0.4
8
15
  * Restore 1.8 Support
9
16
 
10
- == 1.0.3
17
+ ## 1.0.3
11
18
  * Don't load current version from file (gh#15)
12
19
 
13
- == 1.0.2
20
+ ## 1.0.2
14
21
  * Add missing require 'rbconfig'
15
22
  * File backend: File only accessible by owner
16
23
  * Small tweaks
17
24
 
18
- == 1.0.1
25
+ ## 1.0.1
19
26
  * Fix permissions in packaged rubygem
20
27
 
21
- == 1.0.0
28
+ ## 1.0.0
22
29
  * Add basic java clipboard support
23
30
 
24
- == 0.9.9
31
+ ## 0.9.9
25
32
  * Allow Ocra packing
26
33
 
27
- == 0.9.8
34
+ ## 0.9.8
28
35
  * Fix a Windows bug
29
36
 
30
- == 0.9.6 / 0.9.7
37
+ ## 0.9.6 / 0.9.7
31
38
  * Support rubygems-test ("gem test clipboard" if rubygems-test is installed)
32
39
 
33
- == 0.9.5
40
+ ## 0.9.5
34
41
  * Fallback to Clipboard::File, if no other clipboard is available
35
42
  * Also check for xsel if using linux implementation
36
43
  * Fix for jruby copying
37
- * You can directly use a specific implementation, e.g.: require 'clipboard/file' # gives you Clipboard::File
44
+ * You can directly use a specific implementation, e.g.: require
45
+ 'clipboard/file' # gives you Clipboard::File
38
46
 
39
- == < 0.9.4
47
+ ## < 0.9.4
40
48
  See https://github.com/janlelis/clipboard/commits/0.9.4
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at opensource@janlelis.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010-2015 Jan Lelis
1
+ Copyright (c) 2010-2016 Jan Lelis
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # Ruby Clipboard [![version](https://badge.fury.io/rb/clipboard.svg)](https://badge.fury.io/rb/clipboard) [<img src="https://travis-ci.org/janlelis/clipboard.png" />](https://travis-ci.org/janlelis/clipboard)
2
+
3
+ Lets you access the clipboard on Linux, MacOS, Windows and Cygwin.
4
+
5
+ ## Usage
6
+
7
+ * `Clipboard.copy`
8
+ * `Clipboard.paste`
9
+ * `Clipboard.clear`
10
+
11
+ ## Setup
12
+
13
+ Add to `Gemfile`:
14
+
15
+ ```ruby
16
+ gem 'clipboard'
17
+ gem 'ffi', :platforms => [:mswin, :mingw]
18
+ ```
19
+
20
+ - **Linux**: You will need the `xclip` or `xsel` program. On debian/ubuntu
21
+ this is: `sudo apt-get install xclip`
22
+
23
+ ## Remarks
24
+ ### Multiple Clipboards
25
+
26
+ On Linux, you can choose from which clipboard you want to `paste` from by
27
+ passing it as an argumument. The default is CLIPBOARD.
28
+
29
+ `copy` copies to all clipboards in `Clipboard::Linux::CLIPBOARDS`.
30
+
31
+ ### Windows Encoding
32
+
33
+ Windows uses [UTF-16LE](https://en.wikipedia.org/wiki/UTF-16) as its default
34
+ encoding, so pasted strings will always come in UTF-16LE. You can manually
35
+ convert them to your desired encoding (e.g. UTF-8) using the
36
+ [String#encode](ruby-doc.org/core-2.3.0/String.html#method-i-encode) method:
37
+
38
+ ```ruby
39
+ Clipboard.paste.encode('UTF-8')
40
+ ```
41
+
42
+ ### SSH
43
+
44
+ To use the clipboard through ssh, you need to install `xauth` on your server
45
+ and connect via `ssh -X` or `ssh -Y`. Please note that some server settings
46
+ restrict this feature.
47
+
48
+ ### Java
49
+
50
+ There is a Java implementation included (`Clipboard::Java`) as an option for
51
+ JRuby. On Linux, it always operates only on the CLIPBOARD clipboard.
52
+
53
+ ### TODO
54
+
55
+ * Native support on X (don't depend on `xclip`/`xsel`) would be great
56
+
57
+ ### blip
58
+
59
+ **blip** is a handy commandline wrapper that lets you quickly copy file
60
+ content to your clipboard: [blip](http://rubygems.org/gems/blip)!
61
+
62
+ ### Copyright
63
+
64
+ Copyright (c) 2010-2016 Jan Lelis <http://janlelis.com> released under the MIT
65
+ license. Contributions by and thanks to Michael Grosser and [all the other
66
+ contributors!](https://github.com/janlelis/clipboard/graphs/contributors)
data/clipboard.gemspec CHANGED
@@ -9,13 +9,18 @@ Gem::Specification.new do |s|
9
9
  s.version = Clipboard::VERSION
10
10
 
11
11
  s.authors = ["Jan Lelis"]
12
- s.summary = 'Easy access to the clipboard on Linux, MacOS and Windows.'
13
- s.description = 'Easy access to the clipboard on Linux, MacOS and Windows (Clipboard.copy & Clipboard.paste).'
14
- s.email = 'mail@janlelis.de'
15
- s.homepage = %q{http://github.com/janlelis/clipboard}
16
- s.requirements = ["On Linux (or other X), you will need xclip. You can install it on debian/ubuntu with: sudo apt-get install xclip"]
17
- s.requirements += ["On Windows, you will need the ffi gem."]
18
- s.files = Dir.glob(%w[{lib,spec}/**/*.rb [A-Z]* [A-Z]*.rdoc]) + %w{clipboard.gemspec}
12
+ s.summary = "Access to the clipboard on Linux, MacOS, Windows, and Cygwin."
13
+ s.description = "Access to the clipboard on Linux, MacOS, Windows, and Cygwin: Clipboard.copy, Clipboard.paste, Clipboard.clear"
14
+ s.email = "mail@janlelis.de"
15
+ s.homepage = "http://github.com/janlelis/clipboard"
16
+ s.license = "MIT"
17
+ s.requirements = [
18
+ "On Linux (or other X), you will need xclip. On debian/ubuntu this is: sudo apt-get install xclip",
19
+ "On Windows, you will need the ffi gem.",
20
+ ]
21
+ s.files = Dir.glob(%w[{lib,spec}/**/*.rb [A-Z]*.txt [A-Z]*.md]) + %w{clipboard.gemspec}
22
+
23
+ s.required_ruby_version = '>= 1.9.3'
19
24
  s.add_development_dependency 'rake'
20
25
  s.add_development_dependency 'rspec', '>=2'
21
26
  end
data/lib/clipboard.rb CHANGED
@@ -11,6 +11,7 @@ module Clipboard
11
11
  autoload :Linux, 'clipboard/linux'
12
12
  autoload :Mac, 'clipboard/mac'
13
13
  autoload :Java, 'clipboard/java'
14
+ autoload :Cygwin, 'clipboard/cygwin'
14
15
  end
15
16
  autoload :Windows, 'clipboard/windows'
16
17
  autoload :File, 'clipboard/file'
@@ -20,8 +21,9 @@ module Clipboard
20
21
 
21
22
  os = case RbConfig::CONFIG['host_os']
22
23
  when /mac|darwin/ then :Mac
23
- when /linux|bsd|cygwin/ then :Linux
24
+ when /linux|bsd/ then :Linux
24
25
  when /mswin|mingw/ then :Windows
26
+ when /cygwin/ then :Cygwin
25
27
  # when /solaris|sunos/ then :Linux # needs testing..
26
28
  else
27
29
  raise ClipboardLoadError, "Your OS(#{ RbConfig::CONFIG['host_os'] }) is not supported, using file-based (fake) clipboard"
@@ -0,0 +1,18 @@
1
+ module Clipboard; end
2
+
3
+ module Clipboard::Cygwin
4
+ extend self
5
+
6
+ def paste(_ = nil)
7
+ File.read("/dev/clipboard")
8
+ end
9
+
10
+ def copy(data)
11
+ File.open("/dev/clipboard", "w"){ |f| f.write(data) }
12
+ paste
13
+ end
14
+
15
+ def clear
16
+ copy ''
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module Clipboard
2
- VERSION = "1.0.6"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -41,29 +41,20 @@ module Clipboard::Windows
41
41
 
42
42
  # see http://www.codeproject.com/KB/clipboard/archerclipboard1.aspx
43
43
  def paste(_ = nil)
44
- ret = ""
45
- if 0 != User32.open( 0 )
46
- hclip = User32.get( CF_UNICODETEXT )
47
- if hclip && 0 != hclip
48
- pointer_to_data = Kernel32.lock( hclip )
49
- data = ""
50
- # Windows Unicode is ended by to null bytes, so get the whole string
51
- size = Kernel32.size( hclip )
52
- data << pointer_to_data.get_bytes( 0, size - 2 )
53
- if RUBY_VERSION >= '1.9'
54
- ret = data.force_encoding("UTF-16LE").encode(Encoding.default_external) # TODO catch bad encodings
55
- else # 1.8: fallback to simple CP850 encoding
56
- require 'iconv'
57
- utf8 = Iconv.iconv( "UTF-8", "UTF-16LE", data)[0]
58
- ret = Iconv.iconv( "CP850", "UTF-8", utf8)[0]
59
- end
60
- if data && 0 != data
61
- Kernel32.unlock( hclip )
62
- end
44
+ data = ""
45
+ if 0 != User32.open( 0 )
46
+ hclip = User32.get( CF_UNICODETEXT )
47
+ if hclip && 0 != hclip
48
+ pointer_to_data = Kernel32.lock( hclip )
49
+ # Windows Unicode is ended by two null bytes, so get the whole string
50
+ size = Kernel32.size( hclip )
51
+ data << pointer_to_data.get_bytes( 0, size - 2 )
52
+ data.force_encoding("UTF-16LE")
53
+ Kernel32.unlock( hclip )
63
54
  end
64
55
  User32.close( )
65
56
  end
66
- ret || ""
57
+ data
67
58
  end
68
59
 
69
60
  def clear
@@ -75,7 +66,7 @@ module Clipboard::Windows
75
66
  end
76
67
 
77
68
  def copy(data_to_copy)
78
- if ( RUBY_VERSION >= '1.9' ) && 0 != User32.open( 0 )
69
+ if 0 != User32.open( 0 )
79
70
  User32.empty( )
80
71
  data = data_to_copy.encode("UTF-16LE") # TODO catch bad encodings
81
72
  data << 0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clipboard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Lelis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-18 00:00:00.000000000 Z
11
+ date: 2016-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -38,21 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2'
41
- description: Easy access to the clipboard on Linux, MacOS and Windows (Clipboard.copy
42
- & Clipboard.paste).
41
+ description: 'Access to the clipboard on Linux, MacOS, Windows, and Cygwin: Clipboard.copy,
42
+ Clipboard.paste, Clipboard.clear'
43
43
  email: mail@janlelis.de
44
44
  executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - CHANGELOG.rdoc
49
- - Gemfile
50
- - Gemfile.lock
51
- - LICENSE
52
- - README.rdoc
53
- - Rakefile
48
+ - CHANGELOG.md
49
+ - CODE_OF_CONDUCT.md
50
+ - MIT-LICENSE.txt
51
+ - README.md
54
52
  - clipboard.gemspec
55
53
  - lib/clipboard.rb
54
+ - lib/clipboard/cygwin.rb
56
55
  - lib/clipboard/file.rb
57
56
  - lib/clipboard/java.rb
58
57
  - lib/clipboard/linux.rb
@@ -62,7 +61,8 @@ files:
62
61
  - spec/clipboard_spec.rb
63
62
  - spec/spec_helper.rb
64
63
  homepage: http://github.com/janlelis/clipboard
65
- licenses: []
64
+ licenses:
65
+ - MIT
66
66
  metadata: {}
67
67
  post_install_message:
68
68
  rdoc_options: []
@@ -72,19 +72,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 1.9.3
76
76
  required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - ">="
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  requirements:
82
- - 'On Linux (or other X), you will need xclip. You can install it on debian/ubuntu
83
- with: sudo apt-get install xclip'
82
+ - 'On Linux (or other X), you will need xclip. On debian/ubuntu this is: sudo apt-get
83
+ install xclip'
84
84
  - On Windows, you will need the ffi gem.
85
85
  rubyforge_project:
86
- rubygems_version: 2.4.5
86
+ rubygems_version: 2.5.1
87
87
  signing_key:
88
88
  specification_version: 4
89
- summary: Easy access to the clipboard on Linux, MacOS and Windows.
89
+ summary: Access to the clipboard on Linux, MacOS, Windows, and Cygwin.
90
90
  test_files: []
data/Gemfile DELETED
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- platforms :rbx do
6
- gem 'rubysl-singleton', '~> 2.0'
7
- end
data/Gemfile.lock DELETED
@@ -1,33 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- clipboard (1.0.6)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- diff-lcs (1.2.5)
10
- rake (10.4.2)
11
- rspec (3.2.0)
12
- rspec-core (~> 3.2.0)
13
- rspec-expectations (~> 3.2.0)
14
- rspec-mocks (~> 3.2.0)
15
- rspec-core (3.2.0)
16
- rspec-support (~> 3.2.0)
17
- rspec-expectations (3.2.0)
18
- diff-lcs (>= 1.2.0, < 2.0)
19
- rspec-support (~> 3.2.0)
20
- rspec-mocks (3.2.0)
21
- diff-lcs (>= 1.2.0, < 2.0)
22
- rspec-support (~> 3.2.0)
23
- rspec-support (3.2.1)
24
- rubysl-singleton (2.0.0)
25
-
26
- PLATFORMS
27
- ruby
28
-
29
- DEPENDENCIES
30
- clipboard!
31
- rake
32
- rspec (>= 2)
33
- rubysl-singleton (~> 2.0)
data/README.rdoc DELETED
@@ -1,42 +0,0 @@
1
- = clipboard {<img src="https://travis-ci.org/janlelis/clipboard.png" />}[https://travis-ci.org/janlelis/clipboard]
2
- Lets you access the clipboard on Linux, MacOS or Windows.
3
-
4
- === Usage
5
- * <tt>Clipboard.copy</tt>
6
- * <tt>Clipboard.paste</tt>
7
- * <tt>Clipboard.clear</tt>
8
-
9
- == Remarks
10
-
11
- === Non-gem Requirements
12
- * *Linux*: +xclip+ or +xsel+, you can install it on debian/ubuntu with <tt>sudo apt-get install xclip</tt>
13
-
14
- ==== ffi Dependency
15
- This gem depends on the *ffi* gem to support the Windows clipboard. Since *ffi* requires native support, it cannot be installed on evevry platform and is not a hard dependency. If you need Windows support, you will need to put the *ffi* gem into your Gemfile.
16
-
17
- ==== Multiple Clipboards
18
- On Linux, you can choose from which clipboard you want to +paste+ by passing it as an argumument. The default is CLIPBOARD.
19
-
20
- +copy+ copies to all clipboards in Clipboard::CLIPBOARDS.
21
-
22
- ==== Windows Encoding
23
- If you paste with 1.9, the clipboard encoding will be translated to your <tt>Encoding.default_external</tt>.
24
-
25
- If you paste with 1.8, it will fallback to CP850 encoding.
26
- Copying with 1.8 will fallback to the +clip+ utility, which is installed by default since Vista
27
-
28
- ==== SSH
29
- To use the clipboard through ssh, you need to install <tt>xauth</tt> on your server and connect via <tt>ssh -X</tt> or <tt>ssh -Y</tt>. Please note that some server settings restrict this feature.
30
-
31
- ==== Java
32
- There is a Java implementation included (<tt>Clipboard::Java</tt>) as an option for JRuby. However, on Linux, it always operates only on the CLIPBOARD clipboard.
33
-
34
- === TODO
35
- * Don't depend on +xclip+/+xsel+ (no plans to implement it, though)
36
-
37
- === blip
38
-
39
- *blip* is a handy commandline wrapper that lets you quickly copy file content to your clipboard: {blip}[http://rubygems.org/gems/blip]!
40
-
41
- === Copyright
42
- Copyright (c) 2010-2015 Jan Lelis <http://janlelis.de> released under the MIT license. Contributions by and thanks to Michael Grosser and {all the other contributors!}[https://github.com/janlelis/clipboard/graphs/contributors]
data/Rakefile DELETED
@@ -1,37 +0,0 @@
1
- require 'rake'
2
- require 'fileutils'
3
- require "rspec/core/rake_task"
4
-
5
- task :test => :spec
6
- task :default => :spec
7
- RSpec::Core::RakeTask.new(:spec) do |t|
8
- t.rspec_opts = '--backtrace --color'
9
- end
10
-
11
- def gemspec
12
- @gemspec ||= eval(File.read('clipboard.gemspec'), binding, 'clipboard.gemspec')
13
- end
14
-
15
- desc "Build the gem"
16
- task :gem => :gemspec do
17
- sh "gem build clipboard.gemspec"
18
- FileUtils.mkdir_p 'pkg'
19
- FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", 'pkg'
20
- end
21
-
22
- desc "Install the gem locally (without docs)"
23
- task :install => :gem do
24
- sh %{gem install pkg/#{gemspec.name}-#{gemspec.version}.gem --no-rdoc --no-ri}
25
- end
26
-
27
- desc "Generate the gemspec"
28
- task :generate do
29
- puts gemspec.to_ruby
30
- end
31
-
32
- desc "Validate the gemspec"
33
- task :gemspec do
34
- require 'rubygems/user_interaction' # rubygems 1.5.0
35
- gemspec.validate
36
- end
37
-