yoshinon 1.0.0 → 1.0.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: cd77e4a657ce6d189f166c1876982ebc89abb17642ce27b3e3afb3d44b482169
4
- data.tar.gz: c5616a11fac63c0d707870658961fa0a36b9d32e5fdf1095651c22fb74bdd315
3
+ metadata.gz: 75eb9e392248f008849469f3e2c70f1f2e1282cdeb9e1cbbd43edf2a1ce12b56
4
+ data.tar.gz: 49d6437d63ee6939b4c7a5cd46c913a866a42d89ee3116b7513ca4e97fc91cdf
5
5
  SHA512:
6
- metadata.gz: 53aaef6f4dedc08e66276e9f240187056b6c3aa98c274456959c3da330ec45f7fd134c31206f79f133157bd756b183b453752c3db9dd7973fdb95e3b2301a0a0
7
- data.tar.gz: d64bd704e9a9b3817bd77a7ef3da852effaf7b067d1ef9a69b7fa79695202bb6db45661bd0baef3bec76e4e58050ec833ca1ef9dacdcb82cb4268ba19263b159
6
+ metadata.gz: 853f0d841d9566d4fb346e09be21095ffe7d876e8dbc245ece6aced04238e67beed5934d5c9dd04beacc544e27c00f3b2e93d1a7a51baf62479213120e73e05e
7
+ data.tar.gz: 51b32d7603b62a8297d9105b093c1929f8aa30fd8d76b5a162400aeaad7dfc9d60cf058465554836fa96c1f322f0fc6bac06b56975a9fae17bb9dfa89c731bfb
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --require spec_helper
2
+ --format documentation
data/.rubocop.yml CHANGED
@@ -1,42 +1,14 @@
1
+ ---
1
2
  AllCops:
2
- TargetRubyVersion: 2.6
3
-
4
- Metrics/AbcSize:
5
- Max: 170
6
-
3
+ TargetRubyVersion: 3.0
7
4
  Metrics/BlockLength:
8
- Max: 250
9
-
10
- Metrics/ClassLength:
11
- Max: 1000
12
-
13
- Metrics/CyclomaticComplexity:
14
- Max: 70
15
-
5
+ Exclude:
6
+ - spec/**/*
16
7
  Metrics/MethodLength:
17
- Max: 100
18
-
19
- Metrics/ModuleLength:
20
- Max: 1000
21
-
22
- Metrics/ParameterLists:
23
- Max: 50
24
-
25
- Metrics/PerceivedComplexity:
26
- Max: 80
27
-
28
- Layout/SpaceInsideBlockBraces:
29
- EnforcedStyle: no_space
30
- SpaceBeforeBlockParameters: false
31
-
8
+ Enabled: false
32
9
  Style/Documentation:
33
10
  Enabled: false
34
-
35
11
  Style/NumericPredicate:
36
12
  EnforcedStyle: comparison
37
-
38
- Style/MultilineBlockChain:
39
- Enabled: false
40
-
41
13
  Style/SpecialGlobalVars:
42
14
  EnforcedStyle: use_perl_names
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Yoshinon
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
data/lib/yoshinon.rb CHANGED
@@ -16,12 +16,13 @@ module Yoshinon
16
16
 
17
17
  def self.define_trap(signal)
18
18
  Signal.trap(signal) do |value|
19
- @on_trap.each{|e| e.call(value)}
19
+ @on_trap.each { |e| e.call(value) }
20
+ ensure
20
21
  Thread.new do
21
22
  @mutex.synchronize do
22
23
  @cv.wait(@mutex) until @deshite_set.empty?
23
24
  end
24
- exit 130
25
+ exit(128 + value)
25
26
  end
26
27
  end
27
28
  end
@@ -0,0 +1,11 @@
1
+ module Yoshinon
2
+ class Deshite
3
+ @caller: Array[String]
4
+
5
+ attr_reader caller: Array[String]
6
+
7
+ def initialize: () -> void
8
+
9
+ def unlock: () -> void
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module Yoshinon
2
+ VERSION: String
3
+ end
data/sig/yoshinon.rbs CHANGED
@@ -1,4 +1,18 @@
1
1
  module Yoshinon
2
- VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
2
+ self.@mutex: Mutex
3
+
4
+ self.@cv: ConditionVariable
5
+
6
+ self.@deshite_set: Set[Deshite]
7
+
8
+ self.@on_trap: Array[^(Integer) -> void]
9
+
10
+ def self.on_trap: () { (Integer) -> void } -> void
11
+
12
+ def self.define_trap: (interned | Integer signal) -> void
13
+
14
+ def self.lock: () -> Deshite
15
+ | [T] () { () -> T } -> T
16
+
17
+ def self.unlock: (Deshite deshite) -> void
4
18
  end
data/yoshinon.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = 'Yoshinon is a gem to guard processes from signals such as SIGTERM and SIGINT.'
12
12
  spec.description = 'Yoshinon is a gem to guard processes from signals such as SIGTERM and SIGINT.'
13
13
  spec.homepage = 'https://github.com/Ishotihadus/yoshinon'
14
- spec.required_ruby_version = '>= 2.6.0'
14
+ spec.required_ruby_version = '>= 3.0'
15
15
 
16
16
  spec.metadata['homepage_uri'] = spec.homepage
17
17
  spec.metadata['source_code_uri'] = 'https://github.com/Ishotihadus/yoshinon'
@@ -24,8 +24,10 @@ Gem::Specification.new do |spec|
24
24
  end
25
25
  end
26
26
  spec.bindir = 'exe'
27
- spec.executables = spec.files.grep(%r{\Aexe/}) {|f| File.basename(f)}
27
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ['lib']
29
29
 
30
+ spec.add_development_dependency 'rbs'
31
+ spec.add_development_dependency 'rspec'
30
32
  spec.add_development_dependency 'rubocop'
31
33
  end
metadata CHANGED
@@ -1,15 +1,42 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yoshinon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ishotihadus
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2022-06-17 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: rbs
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :development
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: rspec
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
13
40
  - !ruby/object:Gem::Dependency
14
41
  name: rubocop
15
42
  requirement: !ruby/object:Gem::Requirement
@@ -32,15 +59,9 @@ executables: []
32
59
  extensions: []
33
60
  extra_rdoc_files: []
34
61
  files:
35
- - ".idea/.gitignore"
36
- - ".idea/inspectionProfiles/Project_Default.xml"
37
- - ".idea/misc.xml"
38
- - ".idea/modules.xml"
39
- - ".idea/vcs.xml"
40
- - ".idea/yoshinon.iml"
62
+ - ".rspec"
41
63
  - ".rubocop.yml"
42
64
  - Gemfile
43
- - Gemfile.lock
44
65
  - README.md
45
66
  - Rakefile
46
67
  - lib/yoshinon.rb
@@ -49,13 +70,14 @@ files:
49
70
  - lib/yoshinon/sig/term.rb
50
71
  - lib/yoshinon/version.rb
51
72
  - sig/yoshinon.rbs
73
+ - sig/yoshinon/deshite.rbs
74
+ - sig/yoshinon/version.rbs
52
75
  - yoshinon.gemspec
53
76
  homepage: https://github.com/Ishotihadus/yoshinon
54
77
  licenses: []
55
78
  metadata:
56
79
  homepage_uri: https://github.com/Ishotihadus/yoshinon
57
80
  source_code_uri: https://github.com/Ishotihadus/yoshinon
58
- post_install_message:
59
81
  rdoc_options: []
60
82
  require_paths:
61
83
  - lib
@@ -63,15 +85,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
63
85
  requirements:
64
86
  - - ">="
65
87
  - !ruby/object:Gem::Version
66
- version: 2.6.0
88
+ version: '3.0'
67
89
  required_rubygems_version: !ruby/object:Gem::Requirement
68
90
  requirements:
69
91
  - - ">="
70
92
  - !ruby/object:Gem::Version
71
93
  version: '0'
72
94
  requirements: []
73
- rubygems_version: 3.1.4
74
- signing_key:
95
+ rubygems_version: 4.0.10
75
96
  specification_version: 4
76
97
  summary: Yoshinon is a gem to guard processes from signals such as SIGTERM and SIGINT.
77
98
  test_files: []
data/.idea/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- # デフォルトの無視対象ファイル
2
- /shelf/
3
- /workspace.xml
4
- # エディターベースの HTTP クライアントリクエスト
5
- /httpRequests/
6
- # Datasource local storage ignored files
7
- /dataSources/
8
- /dataSources.local.xml
@@ -1,15 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Rubocop" enabled="true" level="WARNING" enabled_by_default="true">
5
- <option name="myRunRubocopOnSave" value="true" />
6
- </inspection_tool>
7
- <inspection_tool class="RubyConvertAllHashesInFileInspections" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
8
- <inspection_tool class="RubyStringKeysInHashInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
9
- <inspection_tool class="SpellCheckingInspection" enabled="true" level="INFORMATION" enabled_by_default="true">
10
- <option name="processCode" value="true" />
11
- <option name="processLiterals" value="true" />
12
- <option name="processComments" value="true" />
13
- </inspection_tool>
14
- </profile>
15
- </component>
data/.idea/misc.xml DELETED
@@ -1,4 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectRootManager" version="2" project-jdk-name="rbenv: 2.7.2" project-jdk-type="RUBY_SDK" />
4
- </project>
data/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/yoshinon.iml" filepath="$PROJECT_DIR$/.idea/yoshinon.iml" />
6
- </modules>
7
- </component>
8
- </project>
data/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>
data/.idea/yoshinon.iml DELETED
@@ -1,54 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="RUBY_MODULE" version="4">
3
- <component name="ModuleRunConfigurationManager">
4
- <shared />
5
- </component>
6
- <component name="NewModuleRootManager">
7
- <content url="file://$MODULE_DIR$">
8
- <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
- <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
- <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
- </content>
12
- <orderEntry type="inheritedJdk" />
13
- <orderEntry type="sourceFolder" forTests="false" />
14
- <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, rbenv: 2.7.2) [gem]" level="application" />
15
- <orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, rbenv: 2.7.2) [gem]" level="application" />
16
- <orderEntry type="library" scope="PROVIDED" name="parallel (v1.22.1, rbenv: 2.7.2) [gem]" level="application" />
17
- <orderEntry type="library" scope="PROVIDED" name="parser (v3.1.2.0, rbenv: 2.7.2) [gem]" level="application" />
18
- <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, rbenv: 2.7.2) [gem]" level="application" />
19
- <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, rbenv: 2.7.2) [gem]" level="application" />
20
- <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.5.0, rbenv: 2.7.2) [gem]" level="application" />
21
- <orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, rbenv: 2.7.2) [gem]" level="application" />
22
- <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.30.1, rbenv: 2.7.2) [gem]" level="application" />
23
- <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.18.0, rbenv: 2.7.2) [gem]" level="application" />
24
- <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, rbenv: 2.7.2) [gem]" level="application" />
25
- <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.1.0, rbenv: 2.7.2) [gem]" level="application" />
26
- </component>
27
- <component name="RakeTasksCache">
28
- <option name="myRootTask">
29
- <RakeTaskImpl id="rake">
30
- <subtasks>
31
- <RakeTaskImpl description="Build yoshinon-0.1.0.gem into the pkg directory" fullCommand="build" id="build" />
32
- <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
33
- <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
34
- <RakeTaskImpl description="Build and install yoshinon-0.1.0.gem into system gems" fullCommand="install" id="install" />
35
- <RakeTaskImpl id="install">
36
- <subtasks>
37
- <RakeTaskImpl description="Build and install yoshinon-0.1.0.gem into system gems without network access" fullCommand="install:local" id="local" />
38
- </subtasks>
39
- </RakeTaskImpl>
40
- <RakeTaskImpl description="Create tag v0.1.0 and build and push yoshinon-0.1.0.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
41
- <RakeTaskImpl description="" fullCommand="default" id="default" />
42
- <RakeTaskImpl description="" fullCommand="release" id="release" />
43
- <RakeTaskImpl id="release">
44
- <subtasks>
45
- <RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
46
- <RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
47
- <RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
48
- </subtasks>
49
- </RakeTaskImpl>
50
- </subtasks>
51
- </RakeTaskImpl>
52
- </option>
53
- </component>
54
- </module>
data/Gemfile.lock DELETED
@@ -1,40 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- yoshinon (1.0.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- ast (2.4.2)
10
- parallel (1.22.1)
11
- parser (3.1.2.0)
12
- ast (~> 2.4.1)
13
- rainbow (3.1.1)
14
- rake (13.0.6)
15
- regexp_parser (2.5.0)
16
- rexml (3.2.5)
17
- rubocop (1.30.1)
18
- parallel (~> 1.10)
19
- parser (>= 3.1.0.0)
20
- rainbow (>= 2.2.2, < 4.0)
21
- regexp_parser (>= 1.8, < 3.0)
22
- rexml (>= 3.2.5, < 4.0)
23
- rubocop-ast (>= 1.18.0, < 2.0)
24
- ruby-progressbar (~> 1.7)
25
- unicode-display_width (>= 1.4.0, < 3.0)
26
- rubocop-ast (1.18.0)
27
- parser (>= 3.1.1.0)
28
- ruby-progressbar (1.11.0)
29
- unicode-display_width (2.1.0)
30
-
31
- PLATFORMS
32
- ruby
33
-
34
- DEPENDENCIES
35
- rake (~> 13.0)
36
- rubocop
37
- yoshinon!
38
-
39
- BUNDLED WITH
40
- 2.1.4