process-path 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d3f58ece4d9a8e00e0dd8698b74a7b8eabc96d6c36bb4bb1a75867c7e8174b8d
4
- data.tar.gz: 4dc83eabcbbfd01144a040511ea53b38296ceccf0228b3d143da805a98f13c21
3
+ metadata.gz: 3ea8831fb4f10f35b0fa04184b69735be2daee543543bd59ff01304fb6fb3b44
4
+ data.tar.gz: d3b0a919b430ca380e38e831e45c3aca84e98321cb43cd3c35edb1d0c4688af4
5
5
  SHA512:
6
- metadata.gz: cb0997a5e3ed2397db32dd0841e8d9e50633bd2b21bcbe6c5244a42035056c40d188f8677e267b87f336d89b0a031c1b18d3ccf924e48c86d4f4b117d2d45336
7
- data.tar.gz: 22858822b17571493644d17e7b72b63bce5e4b56aa07002b8f56d3cebc9277a88f6ea692bb9117965f665d69f1ad3f6872346b884fc7589d164d82ee063d486c
6
+ metadata.gz: b9ef090fd8e00a38a6cb3973824383440a3d8bd7c38634b58eaec68a6e15b067bfa03b3efa0deeba641059c48e99927317be9081318ea3b0ae6a88bcc66abc26
7
+ data.tar.gz: dff3da68725d71d10c0954347782227abe29f7f8cbdd58debf4dd1766293624c43ab4b63035639a0aec3b91ca76a265aa3a6589b5ad5fc47e8cb1ca0f61cedca
@@ -0,0 +1,12 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
+ patreon: yagihiro
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ otechie: # Replace with a single Otechie username
12
+ custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1,41 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ os: [ubuntu, macos]
22
+ ruby: [2.6, 2.7]
23
+ runs-on: ${{ matrix.os }}-latest
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: ${{ matrix.ruby }}
29
+ - name: Setup Code Climate test-reporter
30
+ if: ${{ matrix.os == 'ubuntu' && matrix.ruby == '2.6' }}
31
+ run: |
32
+ curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
33
+ chmod +x ./cc-test-reporter
34
+ ./cc-test-reporter before-build
35
+ - run: bundle install --jobs 4 --retry 3
36
+ - run: bundle exec rake
37
+ - name: Publish code coverage
38
+ if: ${{ matrix.os == 'ubuntu' && matrix.ruby == '2.6' }}
39
+ run: |
40
+ export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
41
+ ./cc-test-reporter after-build -r ${{secrets.CC_TEST_REPORTER_ID}}
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- process-path (0.1.0)
4
+ process-path (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Process::Path
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/process-path.svg)](https://badge.fury.io/rb/process-path)
4
+ ![Ruby](https://github.com/yagihiro/process-path/workflows/Ruby/badge.svg)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/39b1c2e07668d7354cdb/maintainability)](https://codeclimate.com/github/yagihiro/process-path/maintainability)
6
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/39b1c2e07668d7354cdb/test_coverage)](https://codeclimate.com/github/yagihiro/process-path/test_coverage)
7
+
3
8
  Process::Path is a small library to get the path of the currently running process.
4
9
 
5
10
  ## Installation
@@ -7,35 +7,15 @@ require_relative 'path/version'
7
7
  module Process
8
8
  # Process::Path module
9
9
  module Path
10
- # @!visibility private
11
- # Process::Path::OSXImpl module
12
- module OSXImpl
13
- extend Fiddle::Importer
14
- dlload 'libSystem.B.dylib'
15
- extern 'int proc_pidpath(int, void *, unsigned int)'
16
-
17
- def self.path
18
- s = ' ' * 4096
19
- proc_pidpath(Process.pid, s, 4096)
20
- s.unpack1('Z*')
21
- end
22
- end
23
-
24
- # @!visibility private
25
- # Process::Path::LinuxImpl module
26
- module LinuxImpl
27
- def self.path
28
- `readlink -f /proc/#{Process.pid}/exe`
29
- end
30
- end
31
-
32
10
  # Returns the path to the current ruby running as a string.
33
11
  # @return [String] The path to the current ruby running as a string.
34
12
  # @note Currently only osx and linux are supported.
35
13
  def self.path
36
14
  if Process::Path::OS.mac?
15
+ require_relative 'path/osx'
37
16
  Process::Path::OSXImpl.path
38
17
  elsif Process::Path::OS.linux?
18
+ require_relative 'path/linux'
39
19
  Process::Path::LinuxImpl.path
40
20
  else
41
21
  raise 'Not implemented'
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Process
4
+ module Path
5
+ # @!visibility private
6
+ # Process::Path::LinuxImpl module
7
+ module LinuxImpl
8
+ def self.path
9
+ `readlink -f /proc/#{Process.pid}/exe`
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fiddle/import'
4
+
5
+ module Process
6
+ module Path
7
+ # @!visibility private
8
+ # Process::Path::OSXImpl module
9
+ module OSXImpl
10
+ extend Fiddle::Importer
11
+ dlload 'libSystem.B.dylib'
12
+ extern 'int proc_pidpath(int, void *, unsigned int)'
13
+
14
+ def self.path
15
+ s = ' ' * 4096
16
+ proc_pidpath(Process.pid, s, 4096)
17
+ s.unpack1('Z*')
18
+ end
19
+ end
20
+ end
21
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Process
4
4
  module Path
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: process-path
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroki Yagita
@@ -18,6 +18,8 @@ executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
+ - ".github/FUNDING.yml"
22
+ - ".github/workflows/ruby.yml"
21
23
  - ".gitignore"
22
24
  - ".rspec"
23
25
  - ".rubocop.yml"
@@ -33,7 +35,9 @@ files:
33
35
  - bin/console
34
36
  - bin/setup
35
37
  - lib/process/path.rb
38
+ - lib/process/path/linux.rb
36
39
  - lib/process/path/os.rb
40
+ - lib/process/path/osx.rb
37
41
  - lib/process/path/version.rb
38
42
  - process-path.gemspec
39
43
  homepage: https://github.com/yagihiro/process-path