clipboard 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35bf4d71c38e0854369bfedf7b2db272f060ccd4eb6485be03d8935afbcaa200
4
- data.tar.gz: 54a3a402a33fc33f20e2f12cc0c1969ff419ca3b6d81b331b7e1425959697bb4
3
+ metadata.gz: dfc223f701d9da1f5ab36cffc1f3e9ab7cb74c9c10ef32cc1d6cfcc80eb2d226
4
+ data.tar.gz: a374f338cc2559a8b93b72f79aab9ae79d0981a289f789e437d1890d43038631
5
5
  SHA512:
6
- metadata.gz: ec0e087dc69c65e32445c2ea89f75f4b2e49578ca37db4cca7d53502004e3f51aee276c97b704d816fbb33cd93dec61940b495a4123b0fbc27b3cf8984dada42
7
- data.tar.gz: 971fb5dd754b01b350718a2111c9219a7c0af7a8bb5b4d322ddd6b667b6a348b3bc9bdaf9b33722bdb446597590fd2cfe0572052b4178140102791486decac69
6
+ metadata.gz: d29498e6c3caad52203297ebf184b214c20d49d6da7507539a9f33265f5428908d750c1356d6c368713e6859ba7475e5d4ae7689a066a240782b16a1dd4d984d
7
+ data.tar.gz: ce3afab6640d5b4285e57c1f5bde531f777eb2d777aa6be61650e418fcc0a084da0b2c3b4928e47166710d8e050101e7b34f9a0afcbe929df1c9c3c7e84bea7d
@@ -1,11 +1,12 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 1.1.2
3
+ ## 1.2.0
4
+ * Support WSL (Windows Subsystem for Linux)
4
5
 
5
- - linux: Replace calls to `which` with native check (thanks @woodruffw)
6
+ ## 1.1.2
7
+ * Linux: Replace calls to `which` with native check (thanks @woodruffw)
6
8
 
7
9
  ## 1.1.1
8
-
9
10
  * Surpress 3rd party processes' STDERR, see #26
10
11
  * Internal API changes to meet modified relaxed ruby style guidelines
11
12
 
@@ -24,12 +24,19 @@ module Clipboard
24
24
  when /linux|bsd/ then :Linux
25
25
  when /mswin|mingw/ then :Windows
26
26
  when /cygwin/ then :Cygwin
27
- # when /solaris|sunos/ then :Linux # needs testing..
28
27
  else
29
28
  raise ClipboardLoadError, "Your OS(#{ RbConfig::CONFIG['host_os'] }) is not supported, using file-based (fake) clipboard"
30
29
  end
31
30
 
32
- @implementation = Clipboard.const_get os
31
+ # Running additional check to detect if running in Microsoft WSL
32
+ if os == :Linux
33
+ require "etc"
34
+ if Etc.uname[:release] =~ /Microsoft/
35
+ os = :Wsl
36
+ end
37
+ end
38
+
39
+ @implementation = Clipboard.const_get(os)
33
40
  rescue ClipboardLoadError => e
34
41
  $stderr.puts e.message if $VERBOSE
35
42
  @implementation = Clipboard::File
@@ -1,3 +1,3 @@
1
1
  module Clipboard
2
- VERSION = "1.1.2".freeze
2
+ VERSION = "1.2.0".freeze
3
3
  end
@@ -0,0 +1,20 @@
1
+ require 'open3'
2
+
3
+ module Clipboard
4
+ module Wsl
5
+ extend self
6
+
7
+ def paste(_ = nil)
8
+ `powershell.exe -Command Get-Clipboard`
9
+ end
10
+
11
+ def copy(data)
12
+ Open3.popen3( 'clip.exe' ){ |input, _, _| input << data }
13
+ paste
14
+ end
15
+
16
+ def clear
17
+ copy ''
18
+ end
19
+ end
20
+ end
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.1.2
4
+ version: 1.2.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: 2018-05-27 00:00:00.000000000 Z
11
+ date: 2018-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -59,6 +59,7 @@ files:
59
59
  - lib/clipboard/utils.rb
60
60
  - lib/clipboard/version.rb
61
61
  - lib/clipboard/windows.rb
62
+ - lib/clipboard/wsl.rb
62
63
  - spec/clipboard_spec.rb
63
64
  - spec/spec_helper.rb
64
65
  homepage: http://github.com/janlelis/clipboard
@@ -84,7 +85,7 @@ requirements:
84
85
  install xclip'
85
86
  - On Windows, you will need the ffi gem.
86
87
  rubyforge_project:
87
- rubygems_version: 2.7.6
88
+ rubygems_version: 2.7.7
88
89
  signing_key:
89
90
  specification_version: 4
90
91
  summary: Access to the clipboard on Linux, MacOS, Windows, and Cygwin.