clippy 0.2.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock ADDED
@@ -0,0 +1,18 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ clippy (1.0.0)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ minitest (3.3.0)
10
+ rake (0.9.2.2)
11
+
12
+ PLATFORMS
13
+ ruby
14
+
15
+ DEPENDENCIES
16
+ clippy!
17
+ minitest
18
+ rake
data/License CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 Jordon Bedwell
1
+ Copyright (c) 2011-2012 Jordon Bedwell
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of
4
4
  this software and associated documentation files (the "Software"), to deal in the
data/Rakefile CHANGED
@@ -1,19 +1,14 @@
1
- require 'rubygems/package_task'
2
- require 'rake/testtask'
1
+ require "rubygems/package_task"
2
+ require "rake/testtask"
3
3
 
4
4
  task :default => [:test]
5
+ task :spec => :test
5
6
 
6
7
  Rake::TestTask.new do |tfile|
7
8
  tfile.verbose = true
8
9
  tfile.pattern = "tests/**/*.rb"
9
10
  end
10
11
 
11
- if ARGV.include?('features')
12
- require 'cucumber'
13
- require 'cucumber/rake/task'
14
- Cucumber::Rake::Task.new(:features)
15
- end
16
-
17
- Gem::PackageTask.new(eval(IO.read('clippy.gemspec'))) do |pkg|
12
+ Gem::PackageTask.new(eval(IO.read("clippy.gemspec"))) do |pkg|
18
13
  pkg.need_tar, pkg.need_zip = true
19
14
  end
data/Readme.md CHANGED
@@ -1,33 +1,39 @@
1
1
  Clippy is a cross-platform clipboard utility and script for Ruby.
2
2
 
3
+ [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/envygeeks/clippy)
4
+
3
5
  ---
4
6
  * Requirements:
5
- * Ruby1.9+ or jRuby in 1.9 (Windows)
6
- * Ruby1.8.6+ (For Unix and Linux))
7
- * All platforms support jRuby in 1.8 or 1.9 mode except Windows.
7
+ * Ruby1.9+ or JRuby in 1.9+
8
+ * Any Linux distro with xsel or xclip.
9
+ * Any OS X version that supports pbcopy.
10
+ * At least Windows Vista if you are on Windows.
8
11
  * Development:
9
- * Cucumber
10
12
  * Rake
11
13
  * Minitest
12
- * RSPEC-Expectations
13
14
 
14
- All other distros should work with 1.8+
15
+ ---
16
+ Examples:
17
+
18
+ ```bash
19
+ clippy --copy "#1"
20
+ clippy --paste
21
+ echo "#2" |clippy --copy
22
+ clippy --copy < "file#3.txt"
23
+ ```
24
+
25
+ ```ruby
26
+ require 'clippy'
27
+ Clippy.copy('#1')
28
+ Clippy.paste and Clippy.clear
29
+ ```
15
30
 
16
- # Shell (Linux and Windows)
17
- clippy --copy '#1'
18
- echo '#2' |clippy --copy
19
- clipy --copy < 'file#3.txt'
20
-
21
- # Ruby1.8+
22
- require 'clippy'
23
- Clippy.copy('#1')
24
- Clippy.paste and Clippy.clear
25
- <br />
26
31
  <pre>
27
- Clippy v0.1 by Envygeeks
28
- --paste Paste
29
- --help This
30
- --clear Clear
31
- --copy Copy
32
- --version Version
32
+ Clippy v1.0.0 by Envygeeks
33
+ --no-encoding Encoding
34
+ --paste Paste
35
+ --help This
36
+ --clear Clear
37
+ --copy Copy
38
+ --version Version
33
39
  </pre>
data/bin/clippy CHANGED
@@ -1,34 +1,29 @@
1
1
  #!/usr/bin/env ruby
2
- $:.unshift('../lib')
3
- require 'optparse'
4
- require 'clippy'
5
2
 
6
- ##
7
- # Opts.
3
+ $:.unshift(File.expand_path("../../lib", __FILE__))
4
+ require "optparse"
5
+ require "clippy"
6
+
8
7
  do_return = nil
9
8
  did_cmd = nil
10
9
  OptionParser.new do |opts|
11
10
  opts.banner = "Clippy v#{Clippy.version} by Envygeeks"
12
- opts.on('--no-encoding', 'Encoding') { Clippy.encode = false }
13
- opts.on('--paste', 'Paste') { do_return = Clippy.paste }
14
- opts.on('--help', 'This') { do_return = opts }
15
- opts.on('--clear', 'Clear') { did_cmd = Clippy.clear }
11
+ opts.on("--no-encoding", "Encoding") { Clippy.encode = false }
12
+ opts.on("--paste", "Paste") { do_return = Clippy.paste }
13
+ opts.on("--help", "This") { do_return = opts }
14
+ opts.on("--clear", "Clear") { did_cmd = Clippy.clear }
16
15
 
17
- opts.on('--copy', 'Copy') do
18
- unless ARGV.count > 0
19
- text = ARGF.readlines.join
20
- else
21
- if ARGV.count > 1
22
- raise(RuntimeError, 'More than one arg.', 'Clippy')
23
- else
24
- text = ARGV.first.dup
25
- end
16
+ opts.on("--copy", "Copy") do
17
+ if ARGV.count > 1
18
+ raise RuntimeError, "More than one arg is not allowable.", "Clippy"
26
19
  end
27
20
 
21
+ text = ARGF.readlines.join if ARGV.count == 0
22
+ text = ARGV.first.dup if ARGV.count == 1
28
23
  did_cmd = Clippy.copy(text)
29
24
  end
30
25
 
31
- opts.on('--version', 'version') { do_return = Clippy.version }
26
+ opts.on("--version", "version") { do_return = Clippy.version }
32
27
  end.parse!
33
28
 
34
29
  if do_return.nil? and did_cmd.nil?
data/clippy.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ $:.unshift(File.expand_path("../lib", __FILE__))
2
+ require "clippy"
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.license = "MIT"
6
+ spec.name = "clippy"
7
+ spec.has_rdoc = false
8
+ spec.version = Clippy.version
9
+ spec.require_paths = ["lib"]
10
+ spec.executables = ["clippy"]
11
+ spec.add_development_dependency("minitest")
12
+ spec.add_development_dependency("rake")
13
+ spec.authors = ["Jordon Bedwell"]
14
+ spec.email = ["jordon@envygeeks.com"]
15
+ spec.homepage = "https://github.com/envygeeks/clippy"
16
+ spec.summary = "A utility to access the systems clipboard."
17
+ spec.description = "A utility to access the systems clipboard."
18
+ spec.files = Dir["**/*"]
19
+ if RUBY_PLATFORM =~ /mswin/
20
+ spec.required_ruby_version = '>= 1.9.1'
21
+ end
22
+ end
data/fix_git.sh ADDED
@@ -0,0 +1,11 @@
1
+ git filter-branch --commit-filter '
2
+ if [ "$GIT_AUTHOR_EMAIL" = "jordon@gryffindor.(none)" ];
3
+ then
4
+ GIT_COMMITTER_NAME="Jordon Bedwell";
5
+ GIT_AUTHOR_NAME="Jordon Bedwell";
6
+ GIT_COMMITTER_EMAIL="jordon@envygeeks.com";
7
+ GIT_AUTHOR_EMAIL="jordon@envygeeks.com";
8
+ git commit-tree "$@";
9
+ else
10
+ git commit-tree "$@";
11
+ fi' HEAD
data/lib/clippy.rb CHANGED
@@ -1,9 +1,21 @@
1
- require 'rbconfig' unless defined?(RbConfig)
2
- unless RbConfig::CONFIG['host_os'] =~ /mswin/ || RbConfig::CONFIG['host_os'] == 'mingw32'
3
- require 'open3'
1
+ require "rbconfig"
2
+
3
+ if RbConfig::CONFIG["host_os"] !~ /mswin|mingw32/
4
+ require "open3"
4
5
  else
5
- require 'Win32API'
6
- require 'tempfile'
6
+ require "Win32API"
7
+ require "tempfile"
8
+ end
9
+
10
+ class Object
11
+ ##
12
+ # ---
13
+ # Hood jacked from Rails.
14
+ ##
15
+
16
+ def blank?
17
+ (respond_to?(:empty?)) ? (empty?) : (!self)
18
+ end
7
19
  end
8
20
 
9
21
  class Clippy
@@ -15,34 +27,42 @@ class Clippy
15
27
  end
16
28
 
17
29
  class << self
18
-
19
- ##
20
- # Version.
30
+ VERSION = "1.0.0"
21
31
  def version
22
- '0.2.4'
32
+ VERSION
23
33
  end
24
34
 
25
- def binary_exist?(bin)
26
- system("which #{bin} > /dev/null 2>&1")
35
+ ##
36
+ # ---
37
+ # Doesn't work on Windows.
38
+ ##
39
+
40
+ def binary_exist?(bin = nil)
41
+ if bin
42
+ system("which #{bin} > /dev/null 2>&1")
43
+ end
27
44
  end
28
45
 
29
46
  def encode=(value)
30
- @@encode = value if [TrueClass, FalseClass].include?(value.class)
47
+ if [TrueClass, FalseClass].include?(value.class)
48
+ @@encode = value
49
+ end
31
50
  end
32
51
 
33
- ##
34
- # Copy
35
52
  def copy(data)
36
- # Just convert it ourselves right now.....
37
- data = data.to_s unless data.is_a?(String)
38
-
39
53
  ##
40
- # For shit like Pidgin..
54
+ # ---
55
+ # Always convert to a string and convert \n to \r\n because shit like
56
+ # Pidgin, Empathy, aMSN and other fucking clients have no idea what the
57
+ # hell \n is for, that or they just ignore it like jackasses, jackasses.
58
+
59
+ data = data.to_s unless data.is_a?(String)
41
60
  data.gsub!(/\n/, "\r\n")
42
- if RbConfig::CONFIG['host_os'] =~ /mswin/ || RbConfig::CONFIG['host_os'] == 'mingw32'
43
- if system('clip /? > NUL')
61
+
62
+ if RbConfig::CONFIG["host_os"] =~ /mswin|mingw32/
63
+ if system("clip /? > NUL")
44
64
  begin
45
- tmpfile = Tempfile.new('clippy')
65
+ tmpfile = Tempfile.new("clippy")
46
66
  tmpfile.write(data)
47
67
  tmpfile.flush
48
68
  system("clip < #{tmpfile.path}")
@@ -50,105 +70,147 @@ class Clippy
50
70
  tmpfile.close(true)
51
71
  end
52
72
  else
53
- raise(UnsupportedOS, 'Your Windows version is too old.')
73
+ raise(UnsupportedOS, "Your Windows version is too old.", "Clippy")
54
74
  end
55
75
  else
76
+ status = 0
56
77
  case true
57
- when binary_exist?('xsel')
58
- ['-p', '-b', '-s'].each do |opt|
59
- Open3.popen3("xsel -i #{opt}") do |stdin, _, _|
60
- stdin << data
78
+ ##
79
+ # ---
80
+ # xsel is a Linux utility.
81
+ # apt-get install xsel.
82
+
83
+ when binary_exist?("xsel")
84
+ ["-p", "-b", "-s"].each do |opt|
85
+ Open3.popen3("xsel -i #{opt}") do |stdin, _, _, thread|
86
+ stdin << data
87
+ stdin.close
88
+ status = thread.value
89
+ end
61
90
  end
62
- end
63
- when binary_exist?('pbcopy')
64
- Open3.popen3('pbcopy') do |stdin|
65
- stdin << data
66
- end
67
- when binary_exist?('xclip')
68
- ['primary', 'secondary', 'clipboard'].each do |opt|
69
- Open3.popen3("xclip -i -selection #{opt}") do |stdin, _, _|
91
+
92
+ ##
93
+ # ---
94
+ # pbpaste is for Mac's though it could change.
95
+ # I don't know if it has multiple-boards.
96
+ ##
97
+
98
+ when binary_exist?("pbcopy")
99
+ Open3.popen3("pbcopy") do |stdin, _, _, thread|
70
100
  stdin << data
101
+ stdin.close
102
+ status = thread.value
103
+ end
104
+
105
+ ##
106
+ # ---
107
+ # xclip is a Linux utitily.
108
+ # apt-get install xclip.
109
+ ##
110
+
111
+ when binary_exist?("xclip")
112
+ ["primary", "secondary", "clipboard"].each do |opt|
113
+ Open3.popen3("xclip -i -selection #{opt}") do
114
+ |stdin, _, _, thread|
115
+ stdin << data
116
+ stdin.close
117
+ status = thread.value
118
+ end
71
119
  end
72
- end
73
120
  else
74
- raise(UnknownClipboard, 'Clippy requires xsel, xclip or pbcopy.')
121
+ raise(UnknownClipboard, "Clippy requires xsel, xclip or pbcopy.")
75
122
  end
76
123
  end
77
124
 
78
- ((data.nil? or data.empty?)?(false):(data))
125
+ (status != 0) ? (false) : (data)
79
126
  end
80
127
 
81
- ##
82
- # Paste
83
128
  def paste(encoding = nil, which = nil)
84
- if encoding
85
- if %w(clipboard primary secondary).include?(encoding)
86
- which, encoding = encoding, nil
87
- else
88
- if @@encode && defined?(Encoding)
89
- unless Encoding.list.map(&:to_s).include?(encoding)
90
- raise(InvalidEncoding, 'The encoding you selected is unsupported')
91
- end
92
- else
93
- encoding = nil
94
- warn('Encoding library wasn\'t found, skipping the encode') unless !@@encode
129
+ which = "clipboard" if encoding.blank? && which.blank?
130
+ if %w(clipboard primary secondary).include?(encoding)
131
+ which, encoding = encoding, nil
132
+ else
133
+ if encoding && @@encode && defined?(Encoding)
134
+ unless Encoding.list.map(&:to_s).include?(encoding)
135
+ raise InvalidEncoding, "Unsupported encoding selected", "Clippy"
95
136
  end
96
137
  end
97
138
  end
98
139
 
99
- if RbConfig::CONFIG['host_os'] =~ /mswin/
100
- Win32API.new('user32', 'OpenClipboard', 'L', 'I').call(0)
101
- data = Win32API.new('user32', 'GetClipboardData', 'I', 'P').call(1) || ''
102
- Win32API.new('user32', 'CloseClipboard', [], 'I').call
140
+ if RbConfig::CONFIG["host_os"] =~ /mswin|mingw32/
141
+ Win32API.new("user32", "OpenClipboard", "L", "I").call(0)
142
+ data = Win32API.new("user32", "GetClipboardData", "I", "P").call(1) || ""
143
+ Win32API.new("user32", "CloseClipboard", [], "I").call
103
144
  else
104
145
  case true
105
- when binary_exist?('xsel')
106
- cmd = 'xsel -o'
146
+ ##
147
+ # ---
148
+ # xsel is a Linux utility.
149
+ # apt-get install xsel.
150
+
151
+ when binary_exist?("xsel")
152
+ cmd, data = "xsel -o", ""
153
+
154
+ case which
155
+ when "clipboard" then cmd+= " -b"
156
+ when "primary" then cmd+= " -p"
157
+ when "secondary" then cmd+= " -s"
158
+ end
107
159
 
108
- case which
109
- when 'clipboard' then cmd+= ' -b'
110
- when 'primary' then cmd+= ' -p'
111
- when 'secondary' then cmd+= ' -s'
112
- end
160
+ Open3.popen3(cmd) { |_, stdout, _|
161
+ data = stdout.read }
113
162
 
114
- Open3.popen3(cmd) do |_, stdout, _|
115
- data = stdout.read
116
- end
117
- when binary_exist?('pbpaste')
118
- Open3.popen('pbpaste') do |_, stdout, _|
119
- data = stdout.read || ''
120
- end
121
- when binary_exist?('xclip')
122
- cmd = 'xclip -o'
163
+ ##
164
+ # ---
165
+ # pbpaste is for Mac's though it could change.
166
+ # I don't know if it has multiple-boards.
167
+ ##
123
168
 
124
- case which
125
- when 'clipboard' then cmd+= ' clipboard'
126
- when 'primary' then cmd+= ' primary'
127
- when 'secondary' then cmd+= ' secondary'
128
- end
169
+ when binary_exist?("pbpaste")
170
+ data = ""
129
171
 
130
- Open3.popen3(cmd) do |_, stdout, _|
131
- data = stdout.read || ''
132
- end
172
+ Open3.popen("pbpaste") { |_, stdout, _|
173
+ data = stdout.read || "" }
174
+
175
+ ##
176
+ # ---
177
+ # xclip is a Linux utitily.
178
+ # apt-get install xclip.
179
+ ##
180
+
181
+ when binary_exist?("xclip")
182
+ cmd, data = "xclip -o -selection", ""
183
+
184
+ case which
185
+ when "clipboard" then cmd+= " clipboard"
186
+ when "primary" then cmd+= " primary"
187
+ when "secondary" then cmd+= " secondary"
188
+ end
189
+
190
+ Open3.popen3(cmd) do |_, stdout, _|
191
+ data = stdout.read || ""
192
+ end
193
+ else
194
+ raise RuntimeError, "Unable to find a supported clipboard", "Clippy"
133
195
  end
134
196
  end
135
197
 
136
- if @@encode && defined?(Encoding)
198
+ if @@encode && defined?(Encoding) && encoding
137
199
  if data.encoding.name != Encoding.default_external
138
- data.encode(encoding ? encoding : Encoding.default_external)
200
+ data.encode(encoding)
139
201
  end
140
202
  end
141
203
 
142
- ((data.nil? or data.empty?)?(false):(data))
204
+ (data.blank?) ? (nil) : (data)
143
205
  end
144
206
 
145
207
  def clear
146
- if RbConfig::CONFIG['host_os'] =~ /mswin/ || RbConfig::CONFIG['host_os'] == 'mingw32'
147
- Win32API.new('user32', 'OpenClipboard', 'L', 'I').call(0)
148
- Win32API.new('user32', 'EmptyClipboard', [], 'I').call
149
- Win32API.new('user32', 'CloseClipboard', [], 'I').call
208
+ if RbConfig::CONFIG["host_os"] =~ /mswin|mingw32/
209
+ Win32API.new("user32", "OpenClipboard", "L", "I").call(0)
210
+ Win32API.new("user32", "EmptyClipboard", [], "I").call
211
+ Win32API.new("user32", "CloseClipboard", [], "I").call
150
212
  else
151
- if copy('')
213
+ if copy("")
152
214
  return true
153
215
  end
154
216
  end
data/tests/clippy.rb ADDED
@@ -0,0 +1,60 @@
1
+ $:.unshift(File.expand_path("../../lib", __FILE__))
2
+ require "minitest/autorun"
3
+ require "minitest/pride"
4
+ require "minitest/spec"
5
+ require "clippy"
6
+
7
+ describe Clippy do subject { Clippy }
8
+ it "must have a proper version" do
9
+ Clippy.version.split(".").delete_if { |val|
10
+ val =~ /pre\d+/ }.length.must_equal(3)
11
+ end
12
+
13
+ describe ".copy" do
14
+ it "must be able to copy" do
15
+ subject.clear.must_equal(true)
16
+ subject.copy("example").must_equal("example")
17
+ end
18
+
19
+ it "it must copy from the binary" do
20
+ subject.clear.must_equal(true)
21
+ data, status = "example", 1
22
+ Open3.popen3(File.expand_path("../../bin/clippy --copy", __FILE__)) do
23
+ |stdin, _, _, thread|
24
+ stdin << data
25
+ stdin.close
26
+ status = thread.value
27
+ end
28
+
29
+ status.must_equal(0)
30
+ subject.paste.must_equal("example")
31
+ end
32
+ end
33
+
34
+ describe ".paste" do
35
+ it "must be able to paste" do
36
+ subject.clear.must_equal(true)
37
+ subject.copy("example")
38
+ subject.paste.must_equal("example")
39
+ end
40
+
41
+ it "must be able to paste from the binary" do
42
+ subject.clear.must_equal(true)
43
+ data, status = "", 1
44
+ subject.copy("example").must_equal("example")
45
+ Open3.popen3(File.expand_path("../../bin/clippy --paste", __FILE__)) {
46
+ |_, stdout, _, thread|
47
+ data = stdout.read; status = thread.value }
48
+
49
+ status.must_equal(0)
50
+ data.strip.must_equal("example")
51
+ end
52
+ end
53
+
54
+ describe ".clear" do
55
+ it "should be able to clear the clipboard" do
56
+ subject.copy("example")
57
+ subject.clear.must_equal(true)
58
+ end
59
+ end
60
+ end
metadata CHANGED
@@ -1,49 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clippy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jordon Bedwell
9
- - Nathaniel Davidson
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2012-08-08 00:00:00.000000000 Z
12
+ date: 2012-10-10 00:00:00.000000000 Z
14
13
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: rspec-expectations
17
- requirement: !ruby/object:Gem::Requirement
18
- none: false
19
- requirements:
20
- - - ! '>='
21
- - !ruby/object:Gem::Version
22
- version: '0'
23
- type: :development
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
28
- - - ! '>='
29
- - !ruby/object:Gem::Version
30
- version: '0'
31
- - !ruby/object:Gem::Dependency
32
- name: rake
33
- requirement: !ruby/object:Gem::Requirement
34
- none: false
35
- requirements:
36
- - - ! '>='
37
- - !ruby/object:Gem::Version
38
- version: '0'
39
- type: :development
40
- prerelease: false
41
- version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - ! '>='
45
- - !ruby/object:Gem::Version
46
- version: '0'
47
14
  - !ruby/object:Gem::Dependency
48
15
  name: minitest
49
16
  requirement: !ruby/object:Gem::Requirement
@@ -61,7 +28,7 @@ dependencies:
61
28
  - !ruby/object:Gem::Version
62
29
  version: '0'
63
30
  - !ruby/object:Gem::Dependency
64
- name: cucumber
31
+ name: rake
65
32
  requirement: !ruby/object:Gem::Requirement
66
33
  none: false
67
34
  requirements:
@@ -79,22 +46,21 @@ dependencies:
79
46
  description: A utility to access the systems clipboard.
80
47
  email:
81
48
  - jordon@envygeeks.com
82
- - nathaniel.davidson@gmail.com
83
49
  executables:
84
50
  - clippy
85
51
  extensions: []
86
52
  extra_rdoc_files: []
87
53
  files:
54
+ - clippy.gemspec
55
+ - fix_git.sh
88
56
  - lib/clippy.rb
89
- - bin/clippy
90
- - features/step_definitions/clippy_steps.rb
91
- - features/clippy.feature
92
- - features/support/global.rb
93
- - Readme.md
94
- - License
57
+ - Gemfile.lock
95
58
  - Rakefile
59
+ - tests/clippy.rb
60
+ - Readme.md
96
61
  - Gemfile
97
- - changelog.md
62
+ - License
63
+ - bin/clippy
98
64
  homepage: https://github.com/envygeeks/clippy
99
65
  licenses:
100
66
  - MIT
data/changelog.md DELETED
@@ -1,9 +0,0 @@
1
- * 0.2.1 and 0.2.2
2
- * Fix an issue with '\n$' on Ruby 1.9.3 by removing it.
3
- * No longer require open3 for Windows users.
4
- * Add an option for users to disable encoding.
5
- * Fix an issue with frozen argv by duping.
6
- * Micro-optimise the encoding checks a bit.
7
- * Update the readme to use Markdown.
8
- * Other various fixes that might not be mentioned.
9
- * Avoid shitty Gem pkg problems by forcing permissions.
@@ -1,8 +0,0 @@
1
- Feature: Clippy
2
- Background:
3
- Sometimes you would like to copy and paste from a Ruby script. In order to
4
- that though we will need a small little class called Clippy that can copy,
5
- paste and also clear the clipboard on Windows, Linux and Mac.
6
-
7
- Given Clippy exist and it has a version.
8
- Then Copy, Paste and Clear should exist.
@@ -1,10 +0,0 @@
1
- Given 'Clippy exist and it has a version.' do
2
- should be_defined Clippy
3
- should be_defined Clippy.version
4
- end
5
-
6
- Then 'Copy, Paste and Clear should exist.' do
7
- [:copy, :paste, :clear].each do |service|
8
- true.should == Clippy.respond_to?(service)
9
- end
10
- end
@@ -1,9 +0,0 @@
1
- $:.unshift(File.join(File.dirname(__FILE__), '../../lib'))
2
- require 'rspec/expectations'
3
- require 'clippy'
4
-
5
- RSpec::Matchers.define :be_defined do
6
- match do |defyned|
7
- defined? defyned
8
- end
9
- end