clippy 2.0.7 → 2.0.8

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
  SHA1:
3
- metadata.gz: 2878358d10427f115412a5b089b2563f2b38044f
4
- data.tar.gz: 5adafdbd0ab3c9e30dbf826f43804f109f494352
3
+ metadata.gz: 7c00c52bc78c01fd0eb59cfc5ddb26729a9e0dc2
4
+ data.tar.gz: 62d4bb2f9e8c60064c8e2de5acee932cedef4e3d
5
5
  SHA512:
6
- metadata.gz: 8f26ccf3cb4c2756e9be68b3190564d9f1b8381097f3a101bd252089f8e38511029ca642e3b7bdcbabf5ab068101605f685d54b623a82d56f683f06dd95d29c0
7
- data.tar.gz: fb0ee85af8dc4f05744fcc7e6dee465188211f23acfd8e336abf8fd521ff3e76534675b15614a48013ec6402682a922af7ae87b53176764aa240c5b40dad8fa2
6
+ metadata.gz: 9551db53c413d90235f4b5b931ec97163b87d406c7d80f09b456b9798d043ae6406b21e557fdcb6bc90dedf4c6ac00bfcdfeeb75a702743c1d92a37e2df121af
7
+ data.tar.gz: b28994927786f62c93e567130e32894dd0a7094e77bdd7681352c3f45e8688215df2dafd80fd8312c03d5ca07f2254ee0430d17fef99766f85d19da57d70ec14
data/Gemfile CHANGED
@@ -1,9 +1,12 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
  gemspec
3
3
 
4
4
  group :development do
5
- gem 'luna-rspec-formatters'
6
- gem 'rake'
7
- gem 'pry'
8
- gem 'envygeeks-coveralls', :github => 'envygeeks/envygeeks-coveralls'
5
+ unless ENV["CI"]
6
+ gem "pry"
7
+ end
8
+
9
+ gem "rake"
10
+ gem "envygeeks-coveralls"
11
+ gem "luna-rspec-formatters"
9
12
  end
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- require 'rspec/core/rake_task'
1
+ require "rspec/core/rake_task"
2
2
 
3
3
  task :default => [:spec]
4
4
  task :test => :spec
@@ -1,71 +1,71 @@
1
- require_relative 'clippy/version'
2
- require 'rbconfig'
3
- require 'open3'
1
+ require_relative "clippy/version"
2
+ require "rbconfig"
3
+ require "open3"
4
4
 
5
- if RbConfig::CONFIG['host_os'] =~ /mswin|mingw32/
6
- require 'Win32API'
5
+ if RbConfig::CONFIG["host_os"] =~ /mswin|mingw32/
6
+ require "Win32API"
7
7
  end
8
8
 
9
9
  module Clippy module_function
10
10
  class UnknownClipboardError < StandardError
11
11
  def initialize
12
- super 'Unknown clipboard. Clippy requires xclip, xsel or pbcopy'
12
+ super "Unknown clipboard. Clippy requires xclip, xsel or pbcopy"
13
13
  end
14
14
  end
15
15
 
16
16
  COMMAND_ARGS = {
17
- 'xsel' => {
18
- 'stdin' => ' -ib',
19
- 'stdout' => ' -ob'
17
+ "xsel" => {
18
+ "stdin" => " -ib",
19
+ "stdout" => " -ob"
20
20
  },
21
21
 
22
- 'windows' => {
23
- "stdin" => '',
24
- "stdout" => ''
22
+ "windows" => {
23
+ "stdin" => "",
24
+ "stdout" => ""
25
25
  },
26
26
 
27
- 'pbcopy' => {
28
- 'stdin' => '',
29
- 'stdout' => ''
27
+ "pbcopy" => {
28
+ "stdin" => "",
29
+ "stdout" => ""
30
30
  },
31
31
 
32
- 'xclip' => {
33
- 'stdin' => ' -i -selection clipboard',
34
- 'stdout' => ' -o -selection clipboard'
32
+ "xclip" => {
33
+ "stdin" => " -i -selection clipboard",
34
+ "stdout" => " -o -selection clipboard"
35
35
  }
36
36
  }
37
37
 
38
38
  def windows?
39
- RbConfig::CONFIG['host_os'] =~ /mswin|mingw32/
39
+ RbConfig::CONFIG["host_os"] =~ /mswin|mingw32/
40
40
  end
41
41
 
42
42
  def copy(data)
43
- run_command('stdin', $/ != "\r\n" ? data.to_s.gsub($/, "\r\n") : data)[0] == 0 ? true : false
43
+ run_command("stdin", $/ != "\r\n" ? data.to_s.gsub($/, "\r\n") : data)[0] == 0 ? true : false
44
44
  end
45
45
 
46
46
  def paste
47
47
  if windows?
48
- Win32API.new('user32', 'OpenClipboard', 'L', 'I').call(0)
49
- data = Win32API.new('user32', "GetClipboardData", 'I', 'P').call(1) || ''
50
- Win32API.new('user32', 'CloseClipboard', [], 'I').call
48
+ Win32API.new("user32", "OpenClipboard", "L", "I").call(0)
49
+ data = Win32API.new("user32", "GetClipboardData", "I", "P").call(1) || ""
50
+ Win32API.new("user32", "CloseClipboard", [], "I").call
51
51
  else
52
- cmd = run_command('stdout')
52
+ cmd = run_command("stdout")
53
53
  cmd[0] == 0 ? ((cmd[1].nil? || cmd[1].empty?) ? nil : cmd[1]) : false
54
54
  end
55
55
  end
56
56
 
57
57
  def clear
58
- (copy('').nil?) ? true : false
58
+ (copy("").nil?) ? true : false
59
59
  end
60
60
 
61
61
  def binary
62
62
  @binary ||= if windows?
63
- 'clip'
63
+ "clip"
64
64
  else
65
65
  case true
66
- when system('which xclip > /dev/null 2>&1') then 'xclip'
67
- when system('which xsel > /dev/null 2>&1') then 'xsel'
68
- when system('which pbcopy > /dev/null 2>&1') then 'pbcopy'
66
+ when system("which xclip > /dev/null 2>&1") then "xclip"
67
+ when system("which xsel > /dev/null 2>&1") then "xsel"
68
+ when system("which pbcopy > /dev/null 2>&1") then "pbcopy"
69
69
  else
70
70
  raise UnknownClipboardError
71
71
  end
@@ -74,7 +74,7 @@ module Clippy module_function
74
74
 
75
75
  def run_command(type, data = '')
76
76
  stdin, stdout, stderr, pid = Open3.popen3(binary + COMMAND_ARGS[binary][type])
77
- type == 'stdin' ? stdin.puts(data) : out = stdout.read.strip
77
+ type == "stdin" ? stdin.puts(data) : out = stdout.read.strip
78
78
 
79
79
  [stdin, stdout, stderr].each do |m|
80
80
  m.close
@@ -82,7 +82,7 @@ module Clippy module_function
82
82
 
83
83
  [
84
84
  pid.value,
85
- type == 'stdin' ? data : out
85
+ type == "stdin" ? data : out
86
86
  ]
87
87
  end
88
88
  end
@@ -1,3 +1,3 @@
1
1
  module Clippy
2
- VERSION = '2.0.7'
2
+ VERSION = "2.0.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clippy
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.7
4
+ version: 2.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordon Bedwell