getargv 0.2.0-universal-darwin → 0.3.2-universal-darwin

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
  SHA256:
3
- metadata.gz: aa9f9e33b353a325306f9a0e9043e2a5ef348009400f35a7fdef753c5def98f2
4
- data.tar.gz: d9bbd3910bc582adbc2e51d0b0f69e3af4455ae40608ca5f8ba42f277544cc29
3
+ metadata.gz: 3e96a8e966aba77c4866aa2b4b5bfb2510649104e2d1f420177756a03537f114
4
+ data.tar.gz: 2439eb33bc7b2a88151452ba304a1e5e60dec8759bb44bdbdf5b6276e0509094
5
5
  SHA512:
6
- metadata.gz: e1725bda93c4a1164efaae25abb777ebb280516199e5a818a3b09aed577b839e325c1db482be76e56b5fc5b860f04bab28faf0b1970e5a85ea3d174931044a81
7
- data.tar.gz: 9cd95a25e29d1a05b7ef5affdf5c430a1aeb195a7521e8bcea7793007bf5a92305f3a8ee93bc08513299df97cccb3ccd1b0c9da08d72cae20382a2012ce167a0
6
+ metadata.gz: '08b15f84a44de63fa95d6f7bf4ba1ae30f31088ea125461e850e018502f444a6b6cba5fbd4752ad2314c6c45c366b83217900e0aa6ad90ca292bd0c2d54c3f57'
7
+ data.tar.gz: 5e244ee6ba33536dff1ac56730aa324e31a735e9ba7e06700a8b459350847a6310c428414cf0d0b0e54035517bea986bfd03b2d2c0fef555b4282d31bd4b1f28
data/CHANGELOG.md CHANGED
@@ -1,4 +1,14 @@
1
- ## [Unreleased]
1
+ ## [0.3.1] - Unreleased
2
+
3
+ - Fix type signatures that changed in 0.3.0.
4
+
5
+ ## [0.3.0] - 2023-03-08
6
+
7
+ - Add RBS type signatures.
8
+ - Use libgetargv-provided free_* functions to protect against alternate compilers.
9
+ - Require user to pass in encoding for string-producing functions.
10
+
11
+ ## [0.2.0] - 2023-01-05
2
12
 
3
13
  - Adjust platform in gemspec to allow any darwin plaftorm
4
14
 
data/Gemfile CHANGED
@@ -4,16 +4,3 @@ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in getargv_ruby.gemspec
6
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 CHANGED
@@ -1,107 +1,123 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- getargv (0.2.0-universal-darwin)
4
+ getargv (0.3.2-universal-darwin)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  ast (2.4.2)
10
10
  backport (1.2.0)
11
- benchmark (0.2.1)
11
+ benchmark (0.3.0)
12
+ bump (0.10.0)
12
13
  diff-lcs (1.5.0)
13
14
  e2mmap (0.1.0)
14
- jaro_winkler (1.5.4)
15
- json (2.6.3)
15
+ jaro_winkler (1.5.6)
16
+ json (2.7.1)
16
17
  kramdown (2.4.0)
17
18
  rexml
18
19
  kramdown-parser-gfm (1.1.0)
19
20
  kramdown (~> 2.0)
20
- language_server-protocol (3.17.0.2)
21
- minitest (5.17.0)
22
- nokogiri (1.13.10-arm64-darwin)
21
+ language_server-protocol (3.17.0.3)
22
+ lint_roller (1.1.0)
23
+ minitest (5.20.0)
24
+ nokogiri (1.16.0-arm64-darwin)
23
25
  racc (~> 1.4)
24
- nokogiri (1.13.10-x86_64-darwin)
26
+ nokogiri (1.16.0-x86_64-darwin)
25
27
  racc (~> 1.4)
26
- parallel (1.22.1)
27
- parser (3.2.0.0)
28
+ parallel (1.24.0)
29
+ parser (3.2.2.4)
28
30
  ast (~> 2.4.1)
29
- psych (5.0.1)
31
+ racc
32
+ psych (5.1.2)
30
33
  stringio
31
- racc (1.6.2)
34
+ racc (1.7.3)
32
35
  rainbow (3.1.1)
33
- rake (13.0.6)
34
- rake-compiler (1.2.1)
36
+ rake (13.1.0)
37
+ rake-compiler (1.2.5)
35
38
  rake
36
- rdoc (6.5.0)
39
+ rbs (2.8.4)
40
+ rdoc (6.6.2)
37
41
  psych (>= 4.0.0)
38
- regexp_parser (2.6.1)
42
+ regexp_parser (2.8.3)
39
43
  reverse_markdown (2.1.1)
40
44
  nokogiri
41
- rexml (3.2.5)
42
- rubocop (1.42.0)
45
+ rexml (3.2.6)
46
+ rubocop (1.59.0)
43
47
  json (~> 2.3)
48
+ language_server-protocol (>= 3.17.0)
44
49
  parallel (~> 1.10)
45
- parser (>= 3.1.2.1)
50
+ parser (>= 3.2.2.4)
46
51
  rainbow (>= 2.2.2, < 4.0)
47
52
  regexp_parser (>= 1.8, < 3.0)
48
53
  rexml (>= 3.2.5, < 4.0)
49
- rubocop-ast (>= 1.24.1, < 2.0)
54
+ rubocop-ast (>= 1.30.0, < 2.0)
50
55
  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)
56
+ unicode-display_width (>= 2.4.0, < 3.0)
57
+ rubocop-ast (1.30.0)
58
+ parser (>= 3.2.1.0)
59
+ rubocop-performance (1.20.1)
60
+ rubocop (>= 1.48.1, < 2.0)
61
+ rubocop-ast (>= 1.30.0, < 2.0)
62
+ ruby-progressbar (1.13.0)
63
+ sdoc (2.6.1)
59
64
  rdoc (>= 5.0)
60
- solargraph (0.48.0)
65
+ solargraph (0.50.0)
61
66
  backport (~> 1.2)
62
67
  benchmark
63
- bundler (>= 1.17.2)
68
+ bundler (~> 2.0)
64
69
  diff-lcs (~> 1.4)
65
70
  e2mmap
66
71
  jaro_winkler (~> 1.5)
67
72
  kramdown (~> 2.3)
68
73
  kramdown-parser-gfm (~> 1.1)
69
74
  parser (~> 3.0)
70
- reverse_markdown (>= 1.0.5, < 3)
71
- rubocop (>= 0.52)
75
+ rbs (~> 2.0)
76
+ reverse_markdown (~> 2.0)
77
+ rubocop (~> 1.38)
72
78
  thor (~> 1.0)
73
79
  tilt (~> 2.0)
74
80
  yard (~> 0.9, >= 0.9.24)
75
- standard (1.21.1)
81
+ standard (1.33.0)
76
82
  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)
83
+ lint_roller (~> 1.0)
84
+ rubocop (~> 1.59.0)
85
+ standard-custom (~> 1.0.0)
86
+ standard-performance (~> 1.3)
87
+ standard-custom (1.0.2)
88
+ lint_roller (~> 1.0)
89
+ rubocop (~> 1.50)
90
+ standard-performance (1.3.0)
91
+ lint_roller (~> 1.1)
92
+ rubocop-performance (~> 1.20.1)
93
+ stringio (3.1.0)
94
+ thor (1.3.0)
95
+ tilt (2.3.0)
96
+ unicode-display_width (2.5.0)
97
+ yard (0.9.34)
86
98
 
87
99
  PLATFORMS
88
100
  arm64-darwin-19
89
101
  arm64-darwin-20
90
102
  arm64-darwin-21
91
103
  arm64-darwin-22
104
+ arm64-darwin-23
92
105
  x86_64-darwin-19
93
106
  x86_64-darwin-20
94
107
  x86_64-darwin-21
95
108
  x86_64-darwin-22
109
+ x86_64-darwin-23
96
110
 
97
111
  DEPENDENCIES
112
+ bump (~> 0.10)
98
113
  getargv!
99
- minitest (~> 5.0)
100
- rake (~> 13.0)
114
+ minitest (~> 5.20)
115
+ rake (~> 13.1)
101
116
  rake-compiler
117
+ rbs
102
118
  sdoc
103
119
  solargraph
104
- standard (~> 1.3)
120
+ standard (~> 1.33)
105
121
 
106
122
  BUNDLED WITH
107
- 2.3.26
123
+ 2.5.3
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  <h1><img src="logo.svg" width="200" alt="getargv"></h1>
2
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)
3
+ [![Ruby](https://github.com/getargv/getargv.rb/actions/workflows/main.yml/badge.svg)](https://github.com/getargv/getargv.rb/actions/workflows/main.yml)
4
+ [![Gem Version](https://badge.fury.io/rb/getargv.svg)](https://badge.fury.io/rb/getargv)
4
5
 
5
6
  This gem allows you to query the arguments of other processes on macOS.
6
7
 
@@ -23,15 +24,15 @@ Getargv.get_argv_of_pid_as_array(some_process_id) #=> ["arg0","arg1"]
23
24
 
24
25
  ## Development
25
26
 
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
27
  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
28
 
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).
29
+ Ruby code goes in the dir `lib/getargv_ruby`, C code goes in the dir `ext/getargv_ruby`. To experiment with that code, run `bin/console` for an interactive prompt.
30
+
31
+ 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[origin]`, 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
 
32
33
  ## Contributing
33
34
 
34
- Bug reports and pull requests are welcome on GitHub at https://github.com/getargv/getargv_ruby.
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/getargv/getargv.rb.
35
36
 
36
37
  ## License
37
38
 
data/Rakefile CHANGED
@@ -1,7 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "bump/tasks"
3
4
  require "bundler/gem_tasks"
5
+ require "rake/extensiontask"
4
6
  require "rake/testtask"
7
+ require "rdoc/task"
8
+ require "sdoc"
9
+ require "standard/rake"
5
10
 
6
11
  Rake::TestTask.new(:test) do |t|
7
12
  t.libs << "test"
@@ -9,21 +14,13 @@ Rake::TestTask.new(:test) do |t|
9
14
  t.test_files = FileList["test/**/test_*.rb"]
10
15
  end
11
16
 
12
- require "standard/rake"
13
-
14
- require "rake/extensiontask"
15
-
17
+ task default: %i[clobber compile test standard]
16
18
  task build: :compile
17
19
 
18
20
  Rake::ExtensionTask.new("getargv_ruby") do |ext|
19
21
  ext.lib_dir = "lib/getargv_ruby"
20
22
  end
21
23
 
22
- task default: %i[clobber compile test standard]
23
-
24
- require "sdoc"
25
- require "rdoc/task"
26
-
27
24
  RDoc::Task.new do |rdoc|
28
25
  rdoc.main = "README.md"
29
26
  rdoc.rdoc_dir = "doc"
@@ -0,0 +1 @@
1
+ d7dcae33d1dfb95fd4d27f42ee8b6cadafc4f33ccd3d4e35141e7f76f8c5e93bf9aa4180221646f39b802ab23ed4e979aeb6b23b67ca9e0be6813568de828838
@@ -0,0 +1 @@
1
+ 524fbd05c61b71c10687ace7b88d4bee13be100fe8465e2483c63beabfa68ec9d790833e3de90dd5d94a6b88d9a40e0c760a38f94b266e86de18ce2f82a61c5d
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
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
3
  def darwin_check
6
4
  require "pathname"
7
5
  src = $srcdir || __dir__ # standard:disable Style/GlobalVars
@@ -1,41 +1,44 @@
1
1
  #include "getargv_ruby.h"
2
2
 
3
+ // https://ruby-doc.org/3.2.0/extension_rdoc.html
4
+
3
5
  VALUE rb_mGetargv;
4
6
 
5
7
  /*
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
8
+ * call-seq:
9
+ * Getargv.get_argv_of_pid(pid, enc) -> String
10
+ * Getargv.get_argv_of_pid_as_string(pid, enc) -> String
11
+ * Getargv.get_argv_of_pid(pid, enc, nuls) -> String
12
+ * Getargv.get_argv_of_pid_as_string(pid, enc, nuls) -> String
13
+ * Getargv.get_argv_of_pid(pid, enc, nuls, skip) -> String
14
+ * Getargv.get_argv_of_pid_as_string(pid, enc, nuls, skip) -> String
13
15
  *
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.
16
+ * Returns the arguments for the given process id as a string with the
17
+ * specified encoding. If the third arg is +true+: replace +nul+ separators with
18
+ * +space+ for human consumption. If the fourth arg is provided, skip ahead the
19
+ * returned string by the given number of leading arguments.
18
20
  *
19
- * Getargv::get_argv_of_pid_as_string is an alias for Getargv::get_argv_of_pid.
21
+ * Getargv::get_argv_of_pid_as_string is an alias for Getargv::get_argv_of_pid.
20
22
  *
21
- * Examples
23
+ * === Examples:
22
24
  *
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..."
25
+ * Getargv.get_argv_of_pid(Process.pid, Encoding.default_external) #=> "ruby\x00-e..."
26
+ * Getargv.get_argv_of_pid(Process.pid, Encoding.default_external, true) #=> "ruby -e..."
27
+ * Getargv.get_argv_of_pid(Process.pid, Encoding.default_external, false, 1) #=> "-e..."
26
28
  */
27
29
  static VALUE ruby_get_argv_of_pid(int argc, VALUE *argv, VALUE self) {
28
- rb_check_arity(argc, 1, 3);
30
+ rb_check_arity(argc, 2, 4);
29
31
  Check_Type(argv[0], T_FIXNUM);
30
32
  rb_pid_t pid = NUM2PIDT(argv[0]);
31
33
  bool nuls = false;
32
34
  uint skip = 0;
35
+ rb_encoding *encoding = rb_to_encoding(argv[1]);
33
36
 
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]);
37
+ if (argc > 2)
38
+ nuls = RB_TEST(argv[2]);
39
+ if (argc > 3 && !NIL_P(argv[3])) {
40
+ Check_Type(argv[3], T_FIXNUM);
41
+ skip = NUM2UINT(argv[3]);
39
42
  }
40
43
 
41
44
  struct GetArgvOptions options = {.pid = pid, .skip = skip, .nuls = nuls};
@@ -45,30 +48,33 @@ static VALUE ruby_get_argv_of_pid(int argc, VALUE *argv, VALUE self) {
45
48
  }
46
49
 
47
50
  // 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
+ VALUE retVal =
52
+ rb_enc_str_new(result.start_pointer,
53
+ 1 + result.end_pointer - result.start_pointer, encoding);
54
+ free_ArgvResult(&result); // ruby copied data, can free buffer now
51
55
 
52
56
  return retVal;
53
57
  }
54
58
 
55
59
  /*
56
- * call-seq:
57
- * Getargv.get_argv_and_argc_of_pid(pid) -> [String]
58
- * Getargv.get_argv_of_pid_as_array(pid) -> [String]
60
+ * call-seq:
61
+ * Getargv.get_argv_and_argc_of_pid(pid, enc) -> [String]
62
+ * Getargv.get_argv_of_pid_as_array(pid, enc) -> [String]
59
63
  *
60
- * Returns the arguments for the given process id as an array of strings.
64
+ * Returns the arguments for the given process id as an array of strings with the specified encoding.
61
65
  *
62
- * Getargv::get_argv_of_pid_as_array is an alias for Getargv::get_argv_and_argc_of_pid.
66
+ * Getargv::get_argv_of_pid_as_array is an alias for Getargv::get_argv_and_argc_of_pid.
63
67
  *
64
- * Examples
68
+ * === Examples:
65
69
  *
66
- * Getargv.get_argv_and_argc_of_pid(Process.pid) #=> ["ruby,"-e",...]
70
+ * Getargv.get_argv_and_argc_of_pid(Process.pid, Encoding.default_external) #=> ["ruby,"-e",...]
67
71
  */
68
- static VALUE ruby_get_argv_and_argc_of_pid(VALUE self, VALUE rPid) {
72
+ static VALUE ruby_get_argv_and_argc_of_pid(VALUE self, VALUE rPid, VALUE enc) {
69
73
  Check_Type(rPid, T_FIXNUM);
70
74
  rb_pid_t pid = NUM2PIDT(rPid);
71
75
 
76
+ rb_encoding *encoding = rb_to_encoding(enc);
77
+
72
78
  struct ArgvArgcResult result;
73
79
  if (!get_argv_and_argc_of_pid(pid, &result)) {
74
80
  rb_sys_fail(0); // uses errno
@@ -77,11 +83,10 @@ static VALUE ruby_get_argv_and_argc_of_pid(VALUE self, VALUE rPid) {
77
83
  VALUE ary = rb_ary_new_capa(result.argc);
78
84
  for (size_t i = 0; i < result.argc; i++) {
79
85
  // assemble result ruby string, this copies :(
80
- rb_ary_push(ary, rb_str_new_cstr(result.argv[i]));
86
+ rb_ary_push(ary, rb_enc_str_new_cstr(result.argv[i], encoding));
81
87
  }
82
88
  // ruby copied data, can free buffers now
83
- free(result.argv);
84
- free(result.buffer);
89
+ free_ArgvArgcResult(&result);
85
90
 
86
91
  return ary;
87
92
  }
@@ -90,10 +95,12 @@ void Init_getargv_ruby(void) {
90
95
  rb_mGetargv = rb_define_module("Getargv");
91
96
 
92
97
  rb_define_module_function(rb_mGetargv, "get_argv_of_pid", ruby_get_argv_of_pid, -1);
98
+
93
99
  // 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");
100
+ rb_define_alias(rb_singleton_class(rb_mGetargv), "get_argv_of_pid_as_string", "get_argv_of_pid");
101
+
102
+ rb_define_module_function(rb_mGetargv, "get_argv_and_argc_of_pid", ruby_get_argv_and_argc_of_pid, 2);
95
103
 
96
- rb_define_module_function(rb_mGetargv, "get_argv_and_argc_of_pid", ruby_get_argv_and_argc_of_pid, 1);
97
104
  // 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");
105
+ rb_define_alias(rb_singleton_class(rb_mGetargv), "get_argv_of_pid_as_array", "get_argv_and_argc_of_pid");
99
106
  }
@@ -2,7 +2,7 @@
2
2
  #define GETARGV_RUBY_H 1
3
3
 
4
4
  #include "ruby.h"
5
- #include "ruby/intern.h"
5
+ #include "ruby/encoding.h"
6
6
  #include <libgetargv.h>
7
7
  #include <stddef.h>
8
8
  #include <sys/errno.h>
data/getargv_ruby.gemspec CHANGED
@@ -12,20 +12,26 @@ Gem::Specification.new do |spec|
12
12
 
13
13
  spec.summary = "This gem allows you to query the arguments of other processes on macOS."
14
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.
15
+ Getargv is a gem that allows you to query the arguments of other processes as an array or string.
16
+
17
+ This gem only supports macOS because the KERN_PROCARGS2 sysctl only exists in xnu kernels, BSD or Linux users should just read /proc/$PID/cmdline which is much easier and faster, Solaris users should use pargs.
18
+
19
+ This gem requires you have [libgetargv](https://getargv.narzt.cam/) installed.
20
+
21
+ To limit the getargv gem to Apple OSs add it to your Gemfile like so:
22
+
23
+ gem "getargv", "~> #{Getargv::VERSION}", platforms: :ruby, install_if: RbConfig::CONFIG["host_os"].include?("darwin")
20
24
  EOF
21
25
  spec.homepage = "https://getargv.narzt.cam/"
22
26
  spec.license = "BSD-3-Clause"
23
27
  spec.required_ruby_version = ">= #{ruby_version}.0"
28
+ spec.requirements << "macOS"
29
+ spec.requirements << "libgetargv installed"
24
30
 
25
31
  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"
32
+ spec.metadata["source_code_uri"] = "https://github.com/getargv/getargv.rb"
33
+ spec.metadata["changelog_uri"] = "https://github.com/getargv/getargv.rb/blob/CHANGELOG.md"
34
+ spec.metadata["bug_tracker_uri"] = "https://github.com/getargv/getargv.rb/issues"
29
35
  spec.metadata["funding_uri"] = "https://github.com/sponsors/CamJN"
30
36
  spec.metadata["documentation_uri"] = "https://rubydoc.info/gems/getargv/Getargv"
31
37
 
@@ -43,11 +49,21 @@ Gem::Specification.new do |spec|
43
49
  spec.platform = "universal-darwin"
44
50
 
45
51
  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"
52
+ spec.rdoc_options << "--output" << "doc"
50
53
  spec.rdoc_options << "--format=sdoc"
54
+ spec.rdoc_options << "--template=rails"
55
+ spec.rdoc_options << "--line-numbers"
56
+ spec.rdoc_options << "--inline-source"
57
+ spec.rdoc_options << "--exclude=ext/*/extconf.rb"
58
+
59
+ spec.add_development_dependency "bump", "~> 0.10"
60
+ spec.add_development_dependency "minitest", "~> 5.20"
61
+ spec.add_development_dependency "rake", "~> 13.1"
62
+ spec.add_development_dependency "rake-compiler"
63
+ spec.add_development_dependency "rbs"
64
+ spec.add_development_dependency "sdoc"
65
+ spec.add_development_dependency "solargraph"
66
+ spec.add_development_dependency "standard", "~> 1.33"
51
67
 
52
68
  # Uncomment to register a new dependency of your gem
53
69
  # spec.add_dependency "example-gem", "~> 1.0"
@@ -3,5 +3,5 @@
3
3
  module Getargv
4
4
  ##
5
5
  # The version of the gem
6
- VERSION = "0.2.0"
6
+ VERSION = "0.3.2"
7
7
  end
data/sig/getargv_ruby.rbs CHANGED
@@ -1,4 +1,8 @@
1
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
1
2
  module Getargv
2
3
  VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ public def get_argv_and_argc_of_pid: (Integer pid, Encoding enc) -> Array[String]
5
+ alias get_argv_of_pid_as_array get_argv_and_argc_of_pid
6
+ public def get_argv_of_pid: (Integer pid, Encoding enc, ?boolish nuls, ?Integer skip) -> String
7
+ alias get_argv_of_pid_as_string get_argv_of_pid
4
8
  end
metadata CHANGED
@@ -1,21 +1,137 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: getargv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.2
5
5
  platform: universal-darwin
6
6
  authors:
7
7
  - Camden Narzt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-05 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2023-12-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bump
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.20'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.20'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '13.1'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '13.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake-compiler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rbs
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: sdoc
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: solargraph
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: standard
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.33'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.33'
13
125
  description: |2
14
- Getargv is a gem that allows you to query the arguments of other processes as
15
- an array or string. This gem only supports macOS because the KERN_PROCARGS2
16
- sysctl only exists in xnu kernels, BSD or Linux users should just read
17
- /proc/$PID/cmdline which is much easier and faster, Solaris users should use
18
- pargs.
126
+ Getargv is a gem that allows you to query the arguments of other processes as an array or string.
127
+
128
+ This gem only supports macOS because the KERN_PROCARGS2 sysctl only exists in xnu kernels, BSD or Linux users should just read /proc/$PID/cmdline which is much easier and faster, Solaris users should use pargs.
129
+
130
+ This gem requires you have [libgetargv](https://getargv.narzt.cam/) installed.
131
+
132
+ To limit the getargv gem to Apple OSs add it to your Gemfile like so:
133
+
134
+ gem "getargv", "~> 0.3.2", platforms: :ruby, install_if: RbConfig::CONFIG["host_os"].include?("darwin")
19
135
  email:
20
136
  - getargv@narzt.cam
21
137
  executables: []
@@ -35,6 +151,8 @@ files:
35
151
  - README.md
36
152
  - Rakefile
37
153
  - checksums/getargv-0.1.0-x86_64-darwin-21.gem.sha512
154
+ - checksums/getargv-0.2.0-universal-darwin.gem.sha512
155
+ - checksums/getargv-0.3.0-universal-darwin.gem.sha512
38
156
  - ext/getargv_ruby/extconf.rb
39
157
  - ext/getargv_ruby/getargv_ruby.c
40
158
  - ext/getargv_ruby/getargv_ruby.h
@@ -48,18 +166,20 @@ licenses:
48
166
  - BSD-3-Clause
49
167
  metadata:
50
168
  homepage_uri: https://getargv.narzt.cam/
51
- source_code_uri: https://github.com/getargv/getargv_ruby
52
- changelog_uri: https://github.com/getargv/getargv_ruby/blob/CHANGELOG.md
53
- bug_tracker_uri: https://github.com/getargv/getargv_ruby/issues
169
+ source_code_uri: https://github.com/getargv/getargv.rb
170
+ changelog_uri: https://github.com/getargv/getargv.rb/blob/CHANGELOG.md
171
+ bug_tracker_uri: https://github.com/getargv/getargv.rb/issues
54
172
  funding_uri: https://github.com/sponsors/CamJN
55
173
  documentation_uri: https://rubydoc.info/gems/getargv/Getargv
56
174
  post_install_message:
57
175
  rdoc_options:
58
- - "-o"
176
+ - "--output"
59
177
  - doc
60
- - "-T"
61
- - rails
62
178
  - "--format=sdoc"
179
+ - "--template=rails"
180
+ - "--line-numbers"
181
+ - "--inline-source"
182
+ - "--exclude=ext/*/extconf.rb"
63
183
  require_paths:
64
184
  - lib
65
185
  - ext
@@ -73,8 +193,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
193
  - - ">="
74
194
  - !ruby/object:Gem::Version
75
195
  version: '0'
76
- requirements: []
77
- rubygems_version: 3.1.6
196
+ requirements:
197
+ - macOS
198
+ - libgetargv installed
199
+ rubygems_version: 3.5.3
78
200
  signing_key:
79
201
  specification_version: 4
80
202
  summary: This gem allows you to query the arguments of other processes on macOS.