pbcopy-ruby 0.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 +7 -0
- data/CHANGELOG.md +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +61 -0
- data/bin/setup +8 -0
- data/lib/pbcopy-ruby/version.rb +5 -0
- data/lib/pbcopy-ruby.rb +22 -0
- data/pbcopy-ruby.gemspec +27 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 52fb9f97d1a2c653a031e16d45b76e6349ee277a642d40c38fcaf4a67dd6d923
|
4
|
+
data.tar.gz: 0f1bc46b5c7ddb69693aaefafe681a3fcefd68d59b8fe8b747520eb6768b29fb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d05976298de842543145ab7e58ec1703925bc8d03eb97e2f304a0896c3f3e80c759d881f2febf5a828fc578587062bf99b686d140b26f5f683aa615f32d1c67d
|
7
|
+
data.tar.gz: 637bf1fd9a1af3dac9da3697b1ea02a65a33dddf5e9b9ff73dffb85ae61d83390a34ca7747d6fee990e5041696203b57342fa18eda6f68d0e1ecbaba163cca49
|
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 pbcopy-ruby contributors
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# pbcopy-ruby
|
2
|
+
|
3
|
+
> **🔔 Disclaimer**: This gem was "vibe-coded" - meaning it was completely written with AI prompts. No human brains were harmed in the making of this software.
|
4
|
+
|
5
|
+
A simple Ruby gem that makes a global `pbcopy` function available to copy text to the system clipboard.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'pbcopy-ruby'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
```
|
18
|
+
$ bundle install
|
19
|
+
```
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
```
|
24
|
+
$ gem install pbcopy-ruby
|
25
|
+
```
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
After installing the gem, you can use the `pbcopy` function anywhere in your Ruby code:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
require 'pbcopy-ruby'
|
33
|
+
|
34
|
+
# Copy a string to clipboard
|
35
|
+
pbcopy("Hello, clipboard!")
|
36
|
+
|
37
|
+
# Also works with other objects that respond to to_s
|
38
|
+
pbcopy(123)
|
39
|
+
pbcopy([:a, :b, :c])
|
40
|
+
|
41
|
+
# You can chain it in expressions as it returns the input
|
42
|
+
puts pbcopy("This text is copied and printed")
|
43
|
+
```
|
44
|
+
|
45
|
+
## Note
|
46
|
+
|
47
|
+
This gem requires the `pbcopy` command, which is available by default on macOS. It will not work on other operating systems without additional configuration.
|
48
|
+
|
49
|
+
## Development
|
50
|
+
|
51
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
52
|
+
|
53
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
54
|
+
|
55
|
+
## Contributing
|
56
|
+
|
57
|
+
Bug reports and pull requests are welcome on GitHub.
|
58
|
+
|
59
|
+
## License
|
60
|
+
|
61
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/bin/setup
ADDED
data/lib/pbcopy-ruby.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "pbcopy-ruby/version"
|
4
|
+
|
5
|
+
# Provides a global function to copy text to the system clipboard
|
6
|
+
module PbcopyRuby
|
7
|
+
class Error < StandardError; end
|
8
|
+
|
9
|
+
# Copy the given text to the system clipboard using pbcopy
|
10
|
+
#
|
11
|
+
# @param text [String] the text to copy to clipboard
|
12
|
+
# @return [String] the text that was copied
|
13
|
+
def pbcopy(text)
|
14
|
+
IO.popen("pbcopy", "w") { |io| io.write(text.to_s) }
|
15
|
+
text
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# Extend Object to make pbcopy globally available
|
20
|
+
class Object
|
21
|
+
include PbcopyRuby
|
22
|
+
end
|
data/pbcopy-ruby.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "pbcopy-ruby"
|
5
|
+
spec.version = "0.1.0"
|
6
|
+
spec.authors = ["Unathi Chonco"]
|
7
|
+
spec.email = ["dev@unathichonco.com"]
|
8
|
+
|
9
|
+
spec.summary = "A simple gem to copy text to clipboard using pbcopy"
|
10
|
+
spec.description = "Provides a global pbcopy function to copy text to the system clipboard using the macOS pbcopy command"
|
11
|
+
spec.homepage = "https://github.com/choncou/pbcopy-ruby"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
14
|
+
|
15
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
16
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
17
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
|
18
|
+
|
19
|
+
# Specify which files should be added to the gem when it is released.
|
20
|
+
spec.files = Dir.glob(%w[lib/**/*.rb bin/* *.gemspec README.md LICENSE.txt CHANGELOG.md])
|
21
|
+
spec.bindir = "bin"
|
22
|
+
spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ["lib"]
|
24
|
+
|
25
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
26
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pbcopy-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Unathi Chonco
|
8
|
+
bindir: bin
|
9
|
+
cert_chain: []
|
10
|
+
date: 2025-04-02 00:00:00.000000000 Z
|
11
|
+
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: minitest
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '5.0'
|
19
|
+
type: :development
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - "~>"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '5.0'
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rake
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '13.0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '13.0'
|
40
|
+
description: Provides a global pbcopy function to copy text to the system clipboard
|
41
|
+
using the macOS pbcopy command
|
42
|
+
email:
|
43
|
+
- dev@unathichonco.com
|
44
|
+
executables:
|
45
|
+
- setup
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- CHANGELOG.md
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- bin/setup
|
53
|
+
- lib/pbcopy-ruby.rb
|
54
|
+
- lib/pbcopy-ruby/version.rb
|
55
|
+
- pbcopy-ruby.gemspec
|
56
|
+
homepage: https://github.com/choncou/pbcopy-ruby
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata:
|
60
|
+
homepage_uri: https://github.com/choncou/pbcopy-ruby
|
61
|
+
source_code_uri: https://github.com/choncou/pbcopy-ruby
|
62
|
+
changelog_uri: https://github.com/choncou/pbcopy-ruby/blob/main/CHANGELOG.md
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 2.4.0
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubygems_version: 3.6.2
|
78
|
+
specification_version: 4
|
79
|
+
summary: A simple gem to copy text to clipboard using pbcopy
|
80
|
+
test_files: []
|