getargv 0.2.0-universal-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.standard.yml +3 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile +19 -0
- data/Gemfile.lock +107 -0
- data/LICENSE.txt +29 -0
- data/README.md +38 -0
- data/Rakefile +52 -0
- data/checksums/getargv-0.1.0-x86_64-darwin-21.gem.sha512 +1 -0
- data/ext/getargv_ruby/extconf.rb +31 -0
- data/ext/getargv_ruby/getargv_ruby.c +99 -0
- data/ext/getargv_ruby/getargv_ruby.h +10 -0
- data/getargv_ruby.gemspec +57 -0
- data/lib/getargv_ruby/version.rb +7 -0
- data/lib/getargv_ruby.rb +9 -0
- data/logo.svg +1 -0
- data/sig/getargv_ruby.rbs +4 -0
- metadata +81 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: aa9f9e33b353a325306f9a0e9043e2a5ef348009400f35a7fdef753c5def98f2
|
4
|
+
data.tar.gz: d9bbd3910bc582adbc2e51d0b0f69e3af4455ae40608ca5f8ba42f277544cc29
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e1725bda93c4a1164efaae25abb777ebb280516199e5a818a3b09aed577b839e325c1db482be76e56b5fc5b860f04bab28faf0b1970e5a85ea3d174931044a81
|
7
|
+
data.tar.gz: 9cd95a25e29d1a05b7ef5affdf5c430a1aeb195a7521e8bcea7793007bf5a92305f3a8ee93bc08513299df97cccb3ccd1b0c9da08d72cae20382a2012ce167a0
|
data/.standard.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in getargv_ruby.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "rake", "~> 13.0"
|
9
|
+
|
10
|
+
gem "rake-compiler"
|
11
|
+
|
12
|
+
gem "minitest", "~> 5.0"
|
13
|
+
|
14
|
+
gem "standard", "~> 1.3"
|
15
|
+
|
16
|
+
group :development do
|
17
|
+
gem "solargraph"
|
18
|
+
gem "sdoc"
|
19
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
getargv (0.2.0-universal-darwin)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.2)
|
10
|
+
backport (1.2.0)
|
11
|
+
benchmark (0.2.1)
|
12
|
+
diff-lcs (1.5.0)
|
13
|
+
e2mmap (0.1.0)
|
14
|
+
jaro_winkler (1.5.4)
|
15
|
+
json (2.6.3)
|
16
|
+
kramdown (2.4.0)
|
17
|
+
rexml
|
18
|
+
kramdown-parser-gfm (1.1.0)
|
19
|
+
kramdown (~> 2.0)
|
20
|
+
language_server-protocol (3.17.0.2)
|
21
|
+
minitest (5.17.0)
|
22
|
+
nokogiri (1.13.10-arm64-darwin)
|
23
|
+
racc (~> 1.4)
|
24
|
+
nokogiri (1.13.10-x86_64-darwin)
|
25
|
+
racc (~> 1.4)
|
26
|
+
parallel (1.22.1)
|
27
|
+
parser (3.2.0.0)
|
28
|
+
ast (~> 2.4.1)
|
29
|
+
psych (5.0.1)
|
30
|
+
stringio
|
31
|
+
racc (1.6.2)
|
32
|
+
rainbow (3.1.1)
|
33
|
+
rake (13.0.6)
|
34
|
+
rake-compiler (1.2.1)
|
35
|
+
rake
|
36
|
+
rdoc (6.5.0)
|
37
|
+
psych (>= 4.0.0)
|
38
|
+
regexp_parser (2.6.1)
|
39
|
+
reverse_markdown (2.1.1)
|
40
|
+
nokogiri
|
41
|
+
rexml (3.2.5)
|
42
|
+
rubocop (1.42.0)
|
43
|
+
json (~> 2.3)
|
44
|
+
parallel (~> 1.10)
|
45
|
+
parser (>= 3.1.2.1)
|
46
|
+
rainbow (>= 2.2.2, < 4.0)
|
47
|
+
regexp_parser (>= 1.8, < 3.0)
|
48
|
+
rexml (>= 3.2.5, < 4.0)
|
49
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
50
|
+
ruby-progressbar (~> 1.7)
|
51
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
52
|
+
rubocop-ast (1.24.1)
|
53
|
+
parser (>= 3.1.1.0)
|
54
|
+
rubocop-performance (1.15.2)
|
55
|
+
rubocop (>= 1.7.0, < 2.0)
|
56
|
+
rubocop-ast (>= 0.4.0)
|
57
|
+
ruby-progressbar (1.11.0)
|
58
|
+
sdoc (2.5.0)
|
59
|
+
rdoc (>= 5.0)
|
60
|
+
solargraph (0.48.0)
|
61
|
+
backport (~> 1.2)
|
62
|
+
benchmark
|
63
|
+
bundler (>= 1.17.2)
|
64
|
+
diff-lcs (~> 1.4)
|
65
|
+
e2mmap
|
66
|
+
jaro_winkler (~> 1.5)
|
67
|
+
kramdown (~> 2.3)
|
68
|
+
kramdown-parser-gfm (~> 1.1)
|
69
|
+
parser (~> 3.0)
|
70
|
+
reverse_markdown (>= 1.0.5, < 3)
|
71
|
+
rubocop (>= 0.52)
|
72
|
+
thor (~> 1.0)
|
73
|
+
tilt (~> 2.0)
|
74
|
+
yard (~> 0.9, >= 0.9.24)
|
75
|
+
standard (1.21.1)
|
76
|
+
language_server-protocol (~> 3.17.0.2)
|
77
|
+
rubocop (= 1.42.0)
|
78
|
+
rubocop-performance (= 1.15.2)
|
79
|
+
stringio (3.0.4)
|
80
|
+
thor (1.2.1)
|
81
|
+
tilt (2.0.11)
|
82
|
+
unicode-display_width (2.4.2)
|
83
|
+
webrick (1.7.0)
|
84
|
+
yard (0.9.28)
|
85
|
+
webrick (~> 1.7.0)
|
86
|
+
|
87
|
+
PLATFORMS
|
88
|
+
arm64-darwin-19
|
89
|
+
arm64-darwin-20
|
90
|
+
arm64-darwin-21
|
91
|
+
arm64-darwin-22
|
92
|
+
x86_64-darwin-19
|
93
|
+
x86_64-darwin-20
|
94
|
+
x86_64-darwin-21
|
95
|
+
x86_64-darwin-22
|
96
|
+
|
97
|
+
DEPENDENCIES
|
98
|
+
getargv!
|
99
|
+
minitest (~> 5.0)
|
100
|
+
rake (~> 13.0)
|
101
|
+
rake-compiler
|
102
|
+
sdoc
|
103
|
+
solargraph
|
104
|
+
standard (~> 1.3)
|
105
|
+
|
106
|
+
BUNDLED WITH
|
107
|
+
2.3.26
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
BSD 3-Clause License
|
2
|
+
|
3
|
+
Copyright (c) 2022, 2023
|
4
|
+
Camden Narzt <getargv@narzt.cam>. All rights reserved.
|
5
|
+
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
8
|
+
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
10
|
+
list of conditions and the following disclaimer.
|
11
|
+
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
14
|
+
and/or other materials provided with the distribution.
|
15
|
+
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
17
|
+
contributors may be used to endorse or promote products derived from
|
18
|
+
this software without specific prior written permission.
|
19
|
+
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
<h1><img src="logo.svg" width="200" alt="getargv"></h1>
|
2
|
+
|
3
|
+
[![Ruby](https://github.com/getargv/getargv_ruby/actions/workflows/main.yml/badge.svg)](https://github.com/getargv/getargv_ruby/actions/workflows/main.yml)
|
4
|
+
|
5
|
+
This gem allows you to query the arguments of other processes on macOS.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Install the gem and add to the application's Gemfile by executing:
|
10
|
+
|
11
|
+
$ bundle add getargv
|
12
|
+
|
13
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
|
+
|
15
|
+
$ gem install getargv
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
Getargv.get_argv_of_pid_as_string(some_process_id) #=> "arg0\x00arg1"
|
21
|
+
Getargv.get_argv_of_pid_as_array(some_process_id) #=> ["arg0","arg1"]
|
22
|
+
```
|
23
|
+
|
24
|
+
## Development
|
25
|
+
|
26
|
+
In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/getargv_ruby`. To experiment with that code, run `bin/console` for an interactive prompt.
|
27
|
+
|
28
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
29
|
+
|
30
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/getargv/getargv_ruby.
|
35
|
+
|
36
|
+
## License
|
37
|
+
|
38
|
+
The gem is available as open source under the terms of the [BSD 3-clause License](https://opensource.org/licenses/BSD-3-Clause).
|
data/Rakefile
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << "test"
|
8
|
+
t.libs << "lib"
|
9
|
+
t.test_files = FileList["test/**/test_*.rb"]
|
10
|
+
end
|
11
|
+
|
12
|
+
require "standard/rake"
|
13
|
+
|
14
|
+
require "rake/extensiontask"
|
15
|
+
|
16
|
+
task build: :compile
|
17
|
+
|
18
|
+
Rake::ExtensionTask.new("getargv_ruby") do |ext|
|
19
|
+
ext.lib_dir = "lib/getargv_ruby"
|
20
|
+
end
|
21
|
+
|
22
|
+
task default: %i[clobber compile test standard]
|
23
|
+
|
24
|
+
require "sdoc"
|
25
|
+
require "rdoc/task"
|
26
|
+
|
27
|
+
RDoc::Task.new do |rdoc|
|
28
|
+
rdoc.main = "README.md"
|
29
|
+
rdoc.rdoc_dir = "doc"
|
30
|
+
rdoc.options << "--format=sdoc"
|
31
|
+
rdoc.template = "rails"
|
32
|
+
rdoc.rdoc_files.include("ext/*/*.c", "lib/*/*.rb", "lib/*.rb")
|
33
|
+
end
|
34
|
+
|
35
|
+
namespace :dev do
|
36
|
+
desc "generate a Makefile"
|
37
|
+
task :makefile do
|
38
|
+
ruby "ext/getargv_ruby/extconf.rb"
|
39
|
+
end
|
40
|
+
CLOBBER << "Makefile"
|
41
|
+
|
42
|
+
compilation_db_path = "ext/getargv_ruby/compile_commands.json"
|
43
|
+
desc "generate compilation database for language server"
|
44
|
+
task database: :makefile do
|
45
|
+
system "bear", "--output", compilation_db_path, "--", "make", "getargv_ruby.o"
|
46
|
+
end
|
47
|
+
CLOBBER << compilation_db_path
|
48
|
+
end
|
49
|
+
|
50
|
+
CLEAN.concat ["ext/getargv_ruby/.cache",
|
51
|
+
"getargv_ruby.o",
|
52
|
+
"mkmf.log"]
|
@@ -0,0 +1 @@
|
|
1
|
+
a30f97e66431fa309d3f47e1d2241368de0a59332018c03e7c466120a96d1066dda83d322e01e0728fd3441290e3a3b34b32773d28c07297dd434cc8439004b8
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
temporary_hack = "delete this line when https://github.com/testdouble/standard/pull/498 lands in a release" # rubocop:disable Lint/UselessAssignment
|
4
|
+
|
5
|
+
def darwin_check
|
6
|
+
require "pathname"
|
7
|
+
src = $srcdir || __dir__ # standard:disable Style/GlobalVars
|
8
|
+
require_relative Pathname.new("#{src}/../../lib/getargv_ruby/version.rb").realpath.to_s
|
9
|
+
abort <<EOF unless RUBY_PLATFORM.include?("darwin")
|
10
|
+
|
11
|
+
getargv can only work on macOS, fix your Gemfile like this:
|
12
|
+
|
13
|
+
gem "getargv", "~> #{Getargv::VERSION}", platforms: :ruby, install_if: RbConfig::CONFIG["host_os"].include?("darwin")
|
14
|
+
|
15
|
+
EOF
|
16
|
+
end
|
17
|
+
|
18
|
+
darwin_check
|
19
|
+
arch_dir = RbConfig::CONFIG["rubyarchhdrdir"]
|
20
|
+
# `xcode-select --print-path`/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/Current/Headers/ruby.h
|
21
|
+
unless File.exist?(arch_dir)
|
22
|
+
arch_dir.sub!(RUBY_PLATFORM.split("-").last, Dir.entries(File.dirname(arch_dir)).reject { |d| d.start_with?(".", "ruby") }.first.split("-").last)
|
23
|
+
end
|
24
|
+
|
25
|
+
require "mkmf"
|
26
|
+
|
27
|
+
unless have_library("getargv", "get_argv_of_pid", "libgetargv.h")
|
28
|
+
abort "libgetargv is missing, please install libgetargv."
|
29
|
+
end
|
30
|
+
|
31
|
+
create_makefile("getargv_ruby/getargv_ruby")
|
@@ -0,0 +1,99 @@
|
|
1
|
+
#include "getargv_ruby.h"
|
2
|
+
|
3
|
+
VALUE rb_mGetargv;
|
4
|
+
|
5
|
+
/*
|
6
|
+
* call-seq:
|
7
|
+
* Getargv.get_argv_of_pid(pid) -> String
|
8
|
+
* Getargv.get_argv_of_pid_as_string(pid) -> String
|
9
|
+
* Getargv.get_argv_of_pid(pid, nuls) -> String
|
10
|
+
* Getargv.get_argv_of_pid_as_string(pid, nuls) -> String
|
11
|
+
* Getargv.get_argv_of_pid(pid, nuls, skip) -> String
|
12
|
+
* Getargv.get_argv_of_pid_as_string(pid, nuls, skip) -> String
|
13
|
+
*
|
14
|
+
* Returns the arguments for the given process id as a string. If the second
|
15
|
+
* arg is true: replace nul separators with spaces for human consumption. If
|
16
|
+
* the third arg is provided, skip ahead the returned string by the given
|
17
|
+
* number of leading arguments.
|
18
|
+
*
|
19
|
+
* Getargv::get_argv_of_pid_as_string is an alias for Getargv::get_argv_of_pid.
|
20
|
+
*
|
21
|
+
* Examples
|
22
|
+
*
|
23
|
+
* Getargv.get_argv_of_pid(Process.pid) #=> "ruby\x00-e..."
|
24
|
+
* Getargv.get_argv_of_pid(Process.pid(),true) #=> "ruby -e..."
|
25
|
+
* Getargv.get_argv_of_pid(Process.pid(),false,1) #=> "-e..."
|
26
|
+
*/
|
27
|
+
static VALUE ruby_get_argv_of_pid(int argc, VALUE *argv, VALUE self) {
|
28
|
+
rb_check_arity(argc, 1, 3);
|
29
|
+
Check_Type(argv[0], T_FIXNUM);
|
30
|
+
rb_pid_t pid = NUM2PIDT(argv[0]);
|
31
|
+
bool nuls = false;
|
32
|
+
uint skip = 0;
|
33
|
+
|
34
|
+
if (argc > 1)
|
35
|
+
nuls = RB_TEST(argv[1]);
|
36
|
+
if (argc > 2 && !NIL_P(argv[2])) {
|
37
|
+
Check_Type(argv[2], T_FIXNUM);
|
38
|
+
skip = NUM2UINT(argv[2]);
|
39
|
+
}
|
40
|
+
|
41
|
+
struct GetArgvOptions options = {.pid = pid, .skip = skip, .nuls = nuls};
|
42
|
+
struct ArgvResult result;
|
43
|
+
if (!get_argv_of_pid(&options, &result)) {
|
44
|
+
rb_sys_fail(0); // uses errno
|
45
|
+
}
|
46
|
+
|
47
|
+
// assemble result ruby string, this copies :(
|
48
|
+
VALUE retVal = rb_str_new(result.start_pointer,
|
49
|
+
1 + result.end_pointer - result.start_pointer);
|
50
|
+
free(result.buffer); // ruby copied data, can free buffer now
|
51
|
+
|
52
|
+
return retVal;
|
53
|
+
}
|
54
|
+
|
55
|
+
/*
|
56
|
+
* call-seq:
|
57
|
+
* Getargv.get_argv_and_argc_of_pid(pid) -> [String]
|
58
|
+
* Getargv.get_argv_of_pid_as_array(pid) -> [String]
|
59
|
+
*
|
60
|
+
* Returns the arguments for the given process id as an array of strings.
|
61
|
+
*
|
62
|
+
* Getargv::get_argv_of_pid_as_array is an alias for Getargv::get_argv_and_argc_of_pid.
|
63
|
+
*
|
64
|
+
* Examples
|
65
|
+
*
|
66
|
+
* Getargv.get_argv_and_argc_of_pid(Process.pid) #=> ["ruby,"-e",...]
|
67
|
+
*/
|
68
|
+
static VALUE ruby_get_argv_and_argc_of_pid(VALUE self, VALUE rPid) {
|
69
|
+
Check_Type(rPid, T_FIXNUM);
|
70
|
+
rb_pid_t pid = NUM2PIDT(rPid);
|
71
|
+
|
72
|
+
struct ArgvArgcResult result;
|
73
|
+
if (!get_argv_and_argc_of_pid(pid, &result)) {
|
74
|
+
rb_sys_fail(0); // uses errno
|
75
|
+
}
|
76
|
+
|
77
|
+
VALUE ary = rb_ary_new_capa(result.argc);
|
78
|
+
for (size_t i = 0; i < result.argc; i++) {
|
79
|
+
// assemble result ruby string, this copies :(
|
80
|
+
rb_ary_push(ary, rb_str_new_cstr(result.argv[i]));
|
81
|
+
}
|
82
|
+
// ruby copied data, can free buffers now
|
83
|
+
free(result.argv);
|
84
|
+
free(result.buffer);
|
85
|
+
|
86
|
+
return ary;
|
87
|
+
}
|
88
|
+
|
89
|
+
void Init_getargv_ruby(void) {
|
90
|
+
rb_mGetargv = rb_define_module("Getargv");
|
91
|
+
|
92
|
+
rb_define_module_function(rb_mGetargv, "get_argv_of_pid", ruby_get_argv_of_pid, -1);
|
93
|
+
// Getargv::get_argv_of_pid_as_string is an alias for Getargv::get_argv_of_pid.
|
94
|
+
rb_define_alias(rb_singleton_class(rb_mGetargv), "get_argv_of_pid_as_string", "get_argv_of_pid");
|
95
|
+
|
96
|
+
rb_define_module_function(rb_mGetargv, "get_argv_and_argc_of_pid", ruby_get_argv_and_argc_of_pid, 1);
|
97
|
+
// Getargv::get_argv_of_pid_as_array is an alias for Getargv::get_argv_and_argc_of_pid.
|
98
|
+
rb_define_alias(rb_singleton_class(rb_mGetargv), "get_argv_of_pid_as_array", "get_argv_and_argc_of_pid");
|
99
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "yaml"
|
4
|
+
require_relative "lib/getargv_ruby/version"
|
5
|
+
ruby_version = YAML.load_file(".standard.yml")["ruby_version"]
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "getargv"
|
9
|
+
spec.version = Getargv::VERSION
|
10
|
+
spec.authors = ["Camden Narzt"]
|
11
|
+
spec.email = ["getargv@narzt.cam"]
|
12
|
+
|
13
|
+
spec.summary = "This gem allows you to query the arguments of other processes on macOS."
|
14
|
+
spec.description = <<-EOF
|
15
|
+
Getargv is a gem that allows you to query the arguments of other processes as
|
16
|
+
an array or string. This gem only supports macOS because the KERN_PROCARGS2
|
17
|
+
sysctl only exists in xnu kernels, BSD or Linux users should just read
|
18
|
+
/proc/$PID/cmdline which is much easier and faster, Solaris users should use
|
19
|
+
pargs.
|
20
|
+
EOF
|
21
|
+
spec.homepage = "https://getargv.narzt.cam/"
|
22
|
+
spec.license = "BSD-3-Clause"
|
23
|
+
spec.required_ruby_version = ">= #{ruby_version}.0"
|
24
|
+
|
25
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
26
|
+
spec.metadata["source_code_uri"] = "https://github.com/getargv/getargv_ruby"
|
27
|
+
spec.metadata["changelog_uri"] = "https://github.com/getargv/getargv_ruby/blob/CHANGELOG.md"
|
28
|
+
spec.metadata["bug_tracker_uri"] = "https://github.com/getargv/getargv_ruby/issues"
|
29
|
+
spec.metadata["funding_uri"] = "https://github.com/sponsors/CamJN"
|
30
|
+
spec.metadata["documentation_uri"] = "https://rubydoc.info/gems/getargv/Getargv"
|
31
|
+
|
32
|
+
# Specify which files should be added to the gem when it is released.
|
33
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
34
|
+
spec.files = Dir.chdir(__dir__) do
|
35
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
36
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
|
37
|
+
end
|
38
|
+
end
|
39
|
+
spec.bindir = "exe"
|
40
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
41
|
+
spec.require_paths = ["lib", "ext"]
|
42
|
+
spec.extensions = ["ext/getargv_ruby/extconf.rb"]
|
43
|
+
spec.platform = "universal-darwin"
|
44
|
+
|
45
|
+
spec.extra_rdoc_files = Dir["README.md", "ext/*/*.c", "lib/*/*.rb", "lib/*.rb"]
|
46
|
+
spec.rdoc_options << "-o" << "doc"
|
47
|
+
spec.rdoc_options << "-T" << "rails"
|
48
|
+
# spec.rdoc_options << "-T" << "direct"
|
49
|
+
# spec.rdoc_options << "-T" << "shtml"
|
50
|
+
spec.rdoc_options << "--format=sdoc"
|
51
|
+
|
52
|
+
# Uncomment to register a new dependency of your gem
|
53
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
54
|
+
|
55
|
+
# For more information and examples about making a new gem, check out our
|
56
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
57
|
+
end
|
data/lib/getargv_ruby.rb
ADDED