clippy 2.0.0 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 10f09cb695dda60f14f2282c9618207c65e16bf9
4
+ data.tar.gz: befd330986621de496d50e70e677260b602699d8
5
+ SHA512:
6
+ metadata.gz: 1958cb28f9f6d23328d19b49f5a82157d05bef2892adbd667965ef910d7e0f8891ed790297c63fbf3c0851397fcde4dce9c78b15ec1eb78378d1b68418fe968e
7
+ data.tar.gz: 4f91b874a53064c722268e571b464cf9cb70ab890c1af3c5d30222e2bab975c1f01e49af7748870e2905fd5587a83627563e74264ba18b6d007c8fb827cd5374
data/Gemfile CHANGED
@@ -1,2 +1,9 @@
1
1
  source "https://rubygems.org"
2
2
  gemspec
3
+
4
+ group :development do
5
+ unless ENV['CI']
6
+ gem 'guard-rspec', '~> 3.0.2'
7
+ gem 'listen', :github => 'envygeeks/listen'
8
+ end
9
+ end
data/Readme.md CHANGED
@@ -4,21 +4,20 @@ Clippy is a cross-platform clipboard utility and script for Ruby.
4
4
 
5
5
  ---
6
6
  * Requirements:
7
- * Any Linux distro with xsel or xclip.
8
- * Ruby1.9+, Ruby2.0+ or JRuby in 1.9+
9
- * Any OS X version that supports pbcopy.
10
- * At least Windows Vista if you are on Windows.
7
+ * Windows: `clip`
8
+ * OS X: `pbcopy`
9
+ * Linux: `xsel` || `xclip`
11
10
 
12
- *Right now there is a bug with jRuby that causes Clippy to fail, this bug is inside of Open3.popen3 where jRuby actually short-circuits and does not meet the same guidelines as Ruby1.9+, you can see the progress of this bug at: http://jira.codehaus.org/browse/JRUBY-6409*
11
+ *Right now there is a bug with jRuby stable that causes Clippy to fail, this bug is inside of Open3.popen3 where jRuby actually short-circuits and does not meet the same guidelines as Ruby1.9+, you can see the progress of this bug at: http://jira.codehaus.org/browse/JRUBY-6409 -- this has been fixed in jRuby-head so if you plan to use Clippy please use jRuby-head until a new stable is released.*
13
12
 
14
13
  ---
15
14
  Examples:
16
15
 
17
16
  ```bash
18
- clippy --copy "#1"
17
+ clippy --copy '#1'
19
18
  clippy --paste
20
- echo "#2" |clippy --copy
21
- clippy --copy < "file#3.txt"
19
+ echo '#2' |clippy --copy
20
+ clippy --copy < 'file#3.txt'
22
21
  ```
23
22
 
24
23
  ```ruby
data/bin/clippy CHANGED
@@ -1,19 +1,18 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $:.unshift(File.expand_path("../../lib", __FILE__))
4
- require "optparse"
5
- require "clippy"
3
+ require_relative '../lib/clippy'
4
+ require 'optparse'
6
5
 
7
6
  OptionParser.new do |opts|
8
7
  opts.banner = "Clippy v#{Clippy::VERSION}: Clippy [--copy [< File] ['Text']]"
9
8
 
10
- opts.on("--paste", "Paste") { $stdout.puts Clippy.paste }
11
- opts.on("--help", "This") { $stdout.puts opts }
12
- opts.on("--clear", "Clear") { exit Clippy.clear ? 0 : 1 }
13
- opts.on("--version", "Version") { $stdout.puts Clippy::VERSION }
9
+ opts.on('--paste', 'Paste') { $stdout.puts Clippy.paste }
10
+ opts.on('--help', 'This') { $stdout.puts opts }
11
+ opts.on('--clear', 'Clear') { exit Clippy.clear ? 0 : 1 }
12
+ opts.on('--version', 'Version') { $stdout.puts Clippy::VERSION }
14
13
 
15
- opts.on("--copy", "Copy a String or STDIN") do
16
- ($stdout.puts "More than one arg is not allowable" and exit 1) if ARGV.count > 1
14
+ opts.on('--copy', 'Copy a String or STDIN') do
15
+ ($stdout.puts 'More than one arg is not allowable' and exit 1) if ARGV.count > 1
17
16
  exit Clippy.copy(ARGV.count == 0 ? ARGF.readlines.join : ARGV.first.dup) ? 0 : 1
18
17
  end
19
18
  end.parse!
@@ -1,75 +1,88 @@
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
- CommandArgs = {
17
- "windows" => "",
18
- "xsel"=> {
19
- "stdin" => " -ib",
20
- "stdout" => " -ob"
16
+ COMMAND_ARGS = {
17
+ 'xsel' => {
18
+ 'stdin' => ' -ib',
19
+ 'stdout' => ' -ob'
21
20
  },
22
- "pbcopy"=> {
23
- "stdin"=> "",
24
- "stdout"=> ""
21
+
22
+ 'windows' => {
23
+ "stdin" => '',
24
+ "stdout" => ''
25
+ },
26
+
27
+ 'pbcopy' => {
28
+ 'stdin' => '',
29
+ 'stdout' => ''
25
30
  },
26
- "xclip"=> {
27
- "stdin" => " -i -selection clipboard",
28
- "stdout" => " -o -selection clipboard"
31
+
32
+ 'xclip' => {
33
+ 'stdin' => ' -i -selection clipboard',
34
+ 'stdout' => ' -o -selection clipboard'
29
35
  }
30
36
  }
31
37
 
32
38
  def windows?
33
- RbConfig::CONFIG["host_os"] =~ /mswin|mingw32/
39
+ RbConfig::CONFIG['host_os'] =~ /mswin|mingw32/
34
40
  end
35
41
 
36
42
  def copy(data)
37
- 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
38
44
  end
39
45
 
40
46
  def paste
41
47
  if windows?
42
- Win32API.new("user32", "OpenClipboard", "L", "I").call(0)
43
- data = Win32API.new("user32", "GetClipboardData", "I", "P").call(1) || ""
44
- 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
45
51
  else
46
- cmd = run_command("stdout")
52
+ cmd = run_command('stdout')
47
53
  cmd[0] == 0 ? ((cmd[1].nil? || cmd[1].empty?) ? nil : cmd[1]) : false
48
54
  end
49
55
  end
50
56
 
51
57
  def clear
52
- (copy("").nil?) ? true : false
58
+ (copy('').nil?) ? true : false
53
59
  end
54
60
 
55
61
  def binary
56
62
  @binary ||= if windows?
57
- "clip"
63
+ 'clip'
58
64
  else
59
65
  case true
60
- when system("which xclip > /dev/null 2>&1") then "xclip"
61
- when system("which xsel > /dev/null 2>&1") then "xsel"
62
- 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'
63
69
  else
64
70
  raise UnknownClipboardError
65
71
  end
66
72
  end
67
73
  end
68
74
 
69
- def run_command(type, data = "")
70
- stdin, stdout, stderr, pid = Open3.popen3(binary + CommandArgs[binary][type])
71
- type == "stdin" ? stdin.puts(data) : out = stdout.read.strip
72
- [stdin, stdout, stderr].each { |m| m.close }
73
- [pid.value, type == "stdin" ? data : out]
75
+ def run_command(type, data = '')
76
+ stdin, stdout, stderr, pid = Open3.popen3(binary + COMMAND_ARGS[binary][type])
77
+ type == 'stdin' ? stdin.puts(data) : out = stdout.read.strip
78
+
79
+ [stdin, stdout, stderr].each do |m|
80
+ m.close
81
+ end
82
+
83
+ [
84
+ pid.value,
85
+ type == 'stdin' ? data : out
86
+ ]
74
87
  end
75
88
  end
@@ -1,3 +1,3 @@
1
1
  module Clippy
2
- VERSION = "2.0.0"
2
+ VERSION = '2.0.2'
3
3
  end
metadata CHANGED
@@ -1,124 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clippy
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
5
- prerelease:
4
+ version: 2.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jordon Bedwell
9
- autorequire:
8
+ autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-10 00:00:00.000000000 Z
11
+ date: 2013-07-04 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: coveralls
16
- version_requirements: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: !binary |-
21
- MA==
22
- none: false
23
15
  requirement: !ruby/object:Gem::Requirement
24
16
  requirements:
25
- - - ">="
17
+ - - '>='
26
18
  - !ruby/object:Gem::Version
27
- version: !binary |-
28
- MA==
29
- none: false
30
- prerelease: false
19
+ version: '0'
31
20
  type: :development
32
- - !ruby/object:Gem::Dependency
33
- name: popen4
21
+ prerelease: false
34
22
  version_requirements: !ruby/object:Gem::Requirement
35
23
  requirements:
36
- - - ">="
24
+ - - '>='
37
25
  - !ruby/object:Gem::Version
38
- version: !binary |-
39
- MA==
40
- none: false
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
41
29
  requirement: !ruby/object:Gem::Requirement
42
30
  requirements:
43
- - - ">="
31
+ - - ~>
44
32
  - !ruby/object:Gem::Version
45
- version: !binary |-
46
- MA==
47
- none: false
33
+ version: 2.13.0
34
+ type: :development
48
35
  prerelease: false
49
- type: :runtime
50
- - !ruby/object:Gem::Dependency
51
- name: rake
52
36
  version_requirements: !ruby/object:Gem::Requirement
53
37
  requirements:
54
- - - ">="
38
+ - - ~>
55
39
  - !ruby/object:Gem::Version
56
- version: !binary |-
57
- MA==
58
- none: false
40
+ version: 2.13.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
59
43
  requirement: !ruby/object:Gem::Requirement
60
44
  requirements:
61
- - - ">="
45
+ - - ~>
62
46
  - !ruby/object:Gem::Version
63
- version: !binary |-
64
- MA==
65
- none: false
66
- prerelease: false
47
+ version: 10.1.0
67
48
  type: :development
68
- - !ruby/object:Gem::Dependency
69
- name: simplecov
49
+ prerelease: false
70
50
  version_requirements: !ruby/object:Gem::Requirement
71
51
  requirements:
72
- - - ">="
52
+ - - ~>
73
53
  - !ruby/object:Gem::Version
74
- version: !binary |-
75
- MA==
76
- none: false
54
+ version: 10.1.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: coveralls
77
57
  requirement: !ruby/object:Gem::Requirement
78
58
  requirements:
79
- - - ">="
59
+ - - ~>
80
60
  - !ruby/object:Gem::Version
81
- version: !binary |-
82
- MA==
83
- none: false
84
- prerelease: false
61
+ version: 0.6.7
85
62
  type: :development
86
- - !ruby/object:Gem::Dependency
87
- name: guard-rspec
63
+ prerelease: false
88
64
  version_requirements: !ruby/object:Gem::Requirement
89
65
  requirements:
90
- - - ">="
66
+ - - ~>
91
67
  - !ruby/object:Gem::Version
92
- version: !binary |-
93
- MA==
94
- none: false
68
+ version: 0.6.7
69
+ - !ruby/object:Gem::Dependency
70
+ name: luna-rspec-formatters
95
71
  requirement: !ruby/object:Gem::Requirement
96
72
  requirements:
97
- - - ">="
73
+ - - '>='
98
74
  - !ruby/object:Gem::Version
99
- version: !binary |-
100
- MA==
101
- none: false
102
- prerelease: false
75
+ version: 0.0.1
103
76
  type: :development
104
- - !ruby/object:Gem::Dependency
105
- name: luna-rspec-formatters
77
+ prerelease: false
106
78
  version_requirements: !ruby/object:Gem::Requirement
107
79
  requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: !binary |-
111
- MA==
112
- none: false
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
80
+ - - '>='
116
81
  - !ruby/object:Gem::Version
117
- version: !binary |-
118
- MA==
119
- none: false
120
- prerelease: false
121
- type: :development
82
+ version: 0.0.1
122
83
  description: A utility to access the systems clipboard.
123
84
  email:
124
85
  - envygeeks@gmail.com
@@ -131,34 +92,31 @@ files:
131
92
  - License
132
93
  - Rakefile
133
94
  - Gemfile
134
- - lib/clippy.rb
135
95
  - lib/clippy/version.rb
96
+ - lib/clippy.rb
136
97
  - bin/clippy
137
98
  homepage: https://github.com/envygeeks/clippy
138
99
  licenses:
139
100
  - MIT
140
- post_install_message:
101
+ metadata: {}
102
+ post_install_message:
141
103
  rdoc_options: []
142
104
  require_paths:
143
105
  - lib
144
106
  required_ruby_version: !ruby/object:Gem::Requirement
145
107
  requirements:
146
- - - ">="
108
+ - - '>='
147
109
  - !ruby/object:Gem::Version
148
- version: !binary |-
149
- MA==
150
- none: false
110
+ version: '0'
151
111
  required_rubygems_version: !ruby/object:Gem::Requirement
152
112
  requirements:
153
- - - ">="
113
+ - - '>='
154
114
  - !ruby/object:Gem::Version
155
- version: !binary |-
156
- MA==
157
- none: false
115
+ version: '0'
158
116
  requirements: []
159
- rubyforge_project:
160
- rubygems_version: 1.8.24
161
- signing_key:
162
- specification_version: 3
117
+ rubyforge_project:
118
+ rubygems_version: 2.0.3
119
+ signing_key:
120
+ specification_version: 4
163
121
  summary: A utility to access the systems clipboard.
164
122
  test_files: []