aw 0.1.6 → 0.1.11

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: 396995473ce2e9b2705efebc0e732579c2016976f5ee29d64c3ae374a8388b3c
4
- data.tar.gz: f1216ba5cb65ba697c64a0cc186ae6a1dc2a9df5fb34d6efa2b2f321da01f29e
3
+ metadata.gz: cef162831a9fd5958fa3123864f9db07d313f4a851b5738ce0f8bf171b12a570
4
+ data.tar.gz: 012f7e21a4a6282d4b998df713916509b7d34e4806d305c8878b1771833fc43f
5
5
  SHA512:
6
- metadata.gz: 331e42d1177b7550d73fdb665fa94fcda432513cc8fbf9484aa9909d1e21cbb3f874f4fc6135024760bb26b486d03d602dc4b02297b806c8e3ac8d3fa4275195
7
- data.tar.gz: 6e13bd1aaf2893b8807c1f5f2426e9a5ce0130f152cc90267b17a47e08d792c390fec6542eca214e09cf981294ba6ff9e63866981d08f1539c462d9e9bc1d5e7
6
+ metadata.gz: ca3c0e6bb8c8fbf4ca45dc57d966cf4b5ca738f3d17936ceb055719b4e58ede5591c4a7208878ff8f0380dfad9d587f9dfd4ceed0d7135c82a3d1d9f9ff3ab62
7
+ data.tar.gz: 56152493f8c66f8b6316d0e12bafb8aaeda33c589a0fc2723cb2fa2767c705df5c4823436beab82a284a70adee6cdb90f938561ffed9244866705b3d7d014c88
data/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2019 Cyril Kato
3
+ Copyright (c) 2015-2020 Cyril Kato
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,26 +1,15 @@
1
1
  # Aw
2
2
 
3
- [![Build Status](https://travis-ci.org/fixrb/aw.svg?branch=master)][travis]
3
+ [![Build Status](https://api.travis-ci.org/fixrb/aw.svg?branch=master)][travis]
4
4
  [![Code Climate](https://codeclimate.com/github/fixrb/aw/badges/gpa.svg)][codeclimate]
5
5
  [![Gem Version](https://badge.fury.io/rb/aw.svg)][gem]
6
- [![Inline docs](http://inch-ci.org/github/fixrb/aw.svg?branch=master)][inchpages]
7
- [![Documentation](http://img.shields.io/:yard-docs-38c800.svg)][rubydoc]
6
+ [![Inline docs](https://inch-ci.org/github/fixrb/aw.svg?branch=master)][inchpages]
7
+ [![Documentation](https://img.shields.io/:yard-docs-38c800.svg)][rubydoc]
8
8
 
9
- > Aw, fork!
9
+ > Aw, fork! 😬
10
10
 
11
11
  Creates a subprocess to execute a block inside.
12
12
 
13
- ## Contact
14
-
15
- * Home page: https://github.com/fixrb/aw
16
- * Bugs/issues: https://github.com/fixrb/aw/issues
17
- * Support: https://stackoverflow.com/questions/tagged/fixrb
18
-
19
- ## Rubies
20
-
21
- * [MRI](https://www.ruby-lang.org/)
22
- * [Rubinius](https://rubinius.com/)
23
-
24
13
  ## Installation
25
14
 
26
15
  Add this line to your application's Gemfile:
@@ -55,43 +44,41 @@ Aw.fork! { arr << 'FUU' } # => ["foo", "FUU"]
55
44
  arr # => ["foo"]
56
45
  ```
57
46
 
58
- ## Security
47
+ Exceptions raised within the block are propagated:
59
48
 
60
- As a basic form of security __Aw__ provides a set of SHA512 checksums for
61
- every Gem release. These checksums can be found in the `checksum/` directory.
62
- Although these checksums do not prevent malicious users from tampering with a
63
- built Gem they can be used for basic integrity verification purposes.
49
+ ```ruby
50
+ Aw.fork! { nil + 1 } # => NoMethodError (undefined method `+' for nil:NilClass)
51
+ ```
64
52
 
65
- The checksum of a file can be checked using the `sha512sum` command. For
66
- example:
53
+ ## Contact
67
54
 
68
- $ sha512sum pkg/aw-0.1.0.gem
69
- 548d9f669ded4e622182791a5390aaceae0bf2e557b0864f05a842b0be2c65e10e1fb8499f49a3b9efd0e8eaeb691351b1c670d6316ce49965a99683b1071389 pkg/aw-0.1.0.gem
55
+ * Home page: https://github.com/fixrb/aw
56
+ * Bugs/issues: https://github.com/fixrb/aw/issues
57
+
58
+ ## Rubies
59
+
60
+ * [MRI](https://www.ruby-lang.org/)
61
+ * [Rubinius](https://rubinius.com/)
70
62
 
71
63
  ## Versioning
72
64
 
73
65
  __Aw__ follows [Semantic Versioning 2.0](https://semver.org/).
74
66
 
75
- ## Contributing
67
+ ## License
76
68
 
77
- 1. [Fork it](https://github.com/fixrb/aw/fork)
78
- 2. Create your feature branch (`git checkout -b my-new-feature`)
79
- 3. Commit your changes (`git commit -am 'Add some feature'`)
80
- 4. Push to the branch (`git push origin my-new-feature`)
81
- 5. Create a new Pull Request
69
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
82
70
 
83
- ## License
71
+ ***
84
72
 
85
- See `LICENSE.md` file.
73
+ <p>
74
+ This project is sponsored by:<br />
75
+ <a href="https://sashite.com/"><img
76
+ src="https://github.com/fixrb/aw/raw/master/img/sashite.png"
77
+ alt="Sashite" /></a>
78
+ </p>
86
79
 
87
80
  [gem]: https://rubygems.org/gems/aw
88
81
  [travis]: https://travis-ci.org/fixrb/aw
89
82
  [codeclimate]: https://codeclimate.com/github/fixrb/aw
90
- [inchpages]: http://inch-ci.org/github/fixrb/aw
91
- [rubydoc]: http://rubydoc.info/gems/aw/frames
92
-
93
- ***
94
-
95
- This project is sponsored by:
96
-
97
- [![Sashite](https://sashite.com/img/sashite.png)](https://sashite.com/)
83
+ [inchpages]: https://inch-ci.org/github/fixrb/aw
84
+ [rubydoc]: https://rubydoc.info/gems/aw
data/lib/aw.rb CHANGED
@@ -13,8 +13,8 @@ module Aw
13
13
  #
14
14
  # @return [#object_id] The result.
15
15
  def self.fork!(&block)
16
- Fork.new(*IO.pipe).call(&block)
16
+ Fork.new(*::IO.pipe).call(&block)
17
17
  end
18
18
  end
19
19
 
20
- require_relative File.join 'aw', 'fork'
20
+ require_relative File.join('aw', 'fork')
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'English'
4
+
3
5
  module Aw
4
6
  # The Fork class.
5
7
  class Fork
@@ -9,7 +11,7 @@ module Aw
9
11
  # @param write [IO] The write endpoint.
10
12
  def initialize(read, write)
11
13
  # Currently, not available on all platforms.
12
- raise 'fork() unimplemented' unless Process.respond_to?(:fork)
14
+ raise ::NotImplementedError, 'fork()' unless ::Process.respond_to?(:fork)
13
15
 
14
16
  @read = read
15
17
  @write = write
@@ -32,11 +34,13 @@ module Aw
32
34
  pid = fork_and_return_pid(&block)
33
35
  write.close
34
36
  result = read.read
35
- Process.wait(pid)
37
+ ::Process.wait(pid)
36
38
 
37
- # rubocop:disable MarshalLoad
38
- Marshal.load(result)
39
- # rubocop:enable MarshalLoad
39
+ # rubocop:disable Security/MarshalLoad
40
+ ::Marshal.load(result).tap do |r|
41
+ raise r if r.is_a?(::Exception)
42
+ end
43
+ # rubocop:enable Security/MarshalLoad
40
44
  end
41
45
 
42
46
  private
@@ -44,9 +48,17 @@ module Aw
44
48
  def fork_and_return_pid
45
49
  fork do
46
50
  read.close
47
- result = yield
48
- Marshal.dump(result, write)
49
- exit!(0)
51
+
52
+ # rubocop:disable Lint/RescueException
53
+ begin
54
+ result = yield
55
+ rescue ::Exception
56
+ result = $ERROR_INFO
57
+ end
58
+ # rubocop:enable Lint/RescueException
59
+
60
+ ::Marshal.dump(result, write)
61
+ exit!(true)
50
62
  end
51
63
  end
52
64
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aw
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Kato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-12 00:00:00.000000000 Z
11
+ date: 2020-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,56 +16,70 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: '2.1'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: '2.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '12.3'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '12.3'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubocop
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.67'
47
+ version: '0.79'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.67'
54
+ version: '0.79'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop-performance
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'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: simplecov
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '0.16'
75
+ version: '0.17'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '0.16'
82
+ version: '0.17'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: yard
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -81,33 +95,15 @@ dependencies:
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0.9'
83
97
  description: Creates a subprocess to execute a block inside.
84
- email:
85
- - contact@cyril.email
98
+ email: contact@cyril.email
86
99
  executables: []
87
100
  extensions: []
88
101
  extra_rdoc_files: []
89
102
  files:
90
- - ".gitignore"
91
- - ".travis.yml"
92
- - ".yardopts"
93
- - CODE_OF_CONDUCT.md
94
- - Gemfile
95
103
  - LICENSE.md
96
104
  - README.md
97
- - Rakefile
98
- - VERSION.semver
99
- - aw.gemspec
100
- - bin/console
101
- - bin/setup
102
- - checksum/aw-0.1.0.gem.sha512
103
- - checksum/aw-0.1.1.gem.sha512
104
- - checksum/aw-0.1.2.gem.sha512
105
- - checksum/aw-0.1.3.gem.sha512
106
- - checksum/aw-0.1.4.gem.sha512
107
- - checksum/aw-0.1.5.gem.sha512
108
105
  - lib/aw.rb
109
106
  - lib/aw/fork.rb
110
- - pkg_checksum
111
107
  homepage: https://github.com/fixrb/aw
112
108
  licenses:
113
109
  - MIT
@@ -127,8 +123,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
123
  - !ruby/object:Gem::Version
128
124
  version: '0'
129
125
  requirements: []
130
- rubygems_version: 3.0.1
126
+ rubygems_version: 3.1.2
131
127
  signing_key:
132
128
  specification_version: 4
133
- summary: Aw, fork!
129
+ summary: "Aw, fork! \U0001F62C"
134
130
  test_files: []
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- /.bundle/
2
- /.ruby-version
3
- /.yardoc
4
- /Gemfile.lock
5
- /_yardoc/
6
- /coverage/
7
- /doc/
8
- /pkg/
9
- /spec/reports/
10
- /tmp/
@@ -1,28 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- cache: bundler
4
- before_install:
5
- - gem install bundler
6
- script:
7
- - bundle exec rake test
8
- rvm:
9
- - 2.2
10
- - 2.3
11
- - 2.4
12
- - 2.5
13
- - 2.6.1
14
- - ruby-head
15
- - jruby-head
16
- - rbx-3
17
- matrix:
18
- allow_failures:
19
- - rvm: ruby-head
20
- - rvm: jruby-head
21
- - rvm: rbx-3
22
- notifications:
23
- webhooks:
24
- urls:
25
- - https://webhooks.gitter.im/e/a44b19cc5cf6db25fa87
26
- on_success: change
27
- on_failure: always
28
- on_start: never
data/.yardopts DELETED
@@ -1 +0,0 @@
1
- - README.md
@@ -1,13 +0,0 @@
1
- # Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
-
5
- We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
-
7
- Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
-
9
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
-
11
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
-
13
- This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile DELETED
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gemspec
data/Rakefile DELETED
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rake/testtask'
5
- require 'rubocop/rake_task'
6
-
7
- RuboCop::RakeTask.new
8
-
9
- Rake::TestTask.new do |t|
10
- t.verbose = true
11
- t.warning = true
12
- end
13
-
14
- namespace :test do
15
- task :coverage do
16
- ENV['COVERAGE'] = 'true'
17
- Rake::Task['test'].invoke
18
- end
19
- end
20
-
21
- task(:doc_stats) { ruby '-S yard stats' }
22
- task default: %i[test doc_stats rubocop]
@@ -1 +0,0 @@
1
- 0.1.6
data/aw.gemspec DELETED
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = 'aw'
5
- spec.version = File.read('VERSION.semver').chomp
6
- spec.authors = ['Cyril Kato']
7
- spec.email = ['contact@cyril.email']
8
-
9
- spec.summary = 'Aw, fork!'
10
- spec.description = 'Creates a subprocess to execute a block inside.'
11
- spec.homepage = 'https://github.com/fixrb/aw'
12
- spec.license = 'MIT'
13
-
14
- spec.files =
15
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^test/}) }
16
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
17
- spec.require_paths = ['lib']
18
-
19
- spec.add_development_dependency 'bundler', '~> 2.0'
20
- spec.add_development_dependency 'rake', '~> 12.3'
21
- spec.add_development_dependency 'rubocop', '~> 0.67'
22
- spec.add_development_dependency 'simplecov', '~> 0.16'
23
- spec.add_development_dependency 'yard', '~> 0.9'
24
- end
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'bundler/setup'
5
- require 'aw'
6
-
7
- require 'irb'
8
- IRB.start
data/bin/setup DELETED
@@ -1,6 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -euo pipefail
4
- IFS=$'\n\t'
5
-
6
- bundle install
@@ -1 +0,0 @@
1
- d346779ca7a2cba2429db9e6342f8caebd12ccc3a647d75ad6eac28836bb683330ecdc0b74b81d95d55f8d2954ad5d5bd5f933b022c89b0b7e0f92cf2565d525
@@ -1 +0,0 @@
1
- 8e091e9aa3602e755d40656672571a61607e02a5fa8cdf97b10495539b6fbef17f855e515d1bfa21a9713a6e80eec9b1d05f2808ba11273bc49914ebab03fd0e
@@ -1 +0,0 @@
1
- 7a43c3de3e6980c036ff0079ea9337e7d8f90776a25449b8d316f6ee197deca53197068cf84e5d0acad3b06e338e46c11708616fb8d1cd1bea8dba06dbfb006e
@@ -1 +0,0 @@
1
- 294ce3632dde78870391b104bfbf52e60c95f95d897bb35a1085aa0d6ca5d335db360fdb231c7901a5f3a4e552888929a7f4b8472cf5f0d9c2f0e86f0a50389c
@@ -1 +0,0 @@
1
- 45e77c7139991cb235955cd2815afbab237a73208cf066446e09f182af401d6b9c3770034c05bdf9caded95351c0508f869b0ff2496681c914f9f80d167d838f
@@ -1 +0,0 @@
1
- ab4cd0b855ea49e690d67b742793dee8d31682cd0aa570bc0a15651217d87b32e7dc5a41cab7dddf56d492afe5f7ea85e5cd1982361b77686ece29abdd770df0
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'digest/sha2'
5
-
6
- gemname = :aw
7
- ARGV[0] = File.read('VERSION.semver').chomp if ARGV[0].nil?
8
- built_gem_path = "pkg/#{gemname}-#{ARGV[0]}.gem"
9
- checksum = Digest::SHA512.new.hexdigest(File.read(built_gem_path))
10
- checksum_path = "checksum/#{gemname}-#{ARGV[0]}.gem.sha512"
11
-
12
- File.open(checksum_path, 'w') { |f| f.write("#{checksum}\n") }