aw 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b989077c98d685045ebcd45c69269ee14a3ad99b
4
+ data.tar.gz: b18c0443dba7d1b745b0b65b4b3355930dd9c0f1
5
+ SHA512:
6
+ metadata.gz: 21a889ae65582f1419f5ee12728b80d3ed20ec46bb3825d2685ce69e554c3fb1fdb7e1e955db9a1b0633074b1eff8cde027ae1a31e0c6c540a859eb3ef87ac1f
7
+ data.tar.gz: e09e4098017342039cf9b948e14c05e0d7c73ee42a6650b69403235c666fb48a8fdb984283f55c43b2b0b8ac10487fe6f03f3ae8f22fc6aecef91edfb2323d13
@@ -0,0 +1 @@
1
+ �G*.���Γ�Ƨ�
Binary file
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.ruby-version
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
@@ -0,0 +1,15 @@
1
+ language: ruby
2
+ sudo: false
3
+ cache: bundler
4
+ script: 'bundle exec rake test:coverage --trace'
5
+ before_install:
6
+ - gem install bundler
7
+ rvm:
8
+ - 1.9.3
9
+ - 2.0
10
+ - 2.1
11
+ - 2.2
12
+ - ruby-head
13
+ - jruby
14
+ - jruby-head
15
+ - rbx-2
@@ -0,0 +1 @@
1
+ - README.md
@@ -0,0 +1,13 @@
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 ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Cyril Wack
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,85 @@
1
+ # Aw
2
+
3
+ [![Build Status](https://travis-ci.org/fixrb/aw.svg?branch=master)][travis]
4
+ [![Gem Version](https://badge.fury.io/rb/aw.svg)][gem]
5
+ [![Inline docs](http://inch-ci.org/github/fixrb/aw.svg?branch=master)][inchpages]
6
+ [![Documentation](http://img.shields.io/:yard-docs-38c800.svg)][rubydoc]
7
+
8
+ > Aw, fork!
9
+
10
+ Creates a subprocess to execute a block inside.
11
+
12
+ ## Contact
13
+
14
+ * Home page: https://github.com/fixrb/aw
15
+ * Bugs/issues: https://github.com/fixrb/aw/issues
16
+ * Support: https://stackoverflow.com/questions/tagged/aw
17
+
18
+ ## Rubies
19
+
20
+ * [MRI](https://www.ruby-lang.org/)
21
+ * [Rubinius](http://rubini.us/)
22
+ * [JRuby](http://jruby.org/)
23
+
24
+ ## Installation
25
+
26
+ __Aw__ is cryptographically signed.
27
+
28
+ To be sure the gem you install hasn't been tampered with, add my public key
29
+ (if you haven't already) as a trusted certificate:
30
+
31
+ $ gem cert --add <(curl -Ls https://raw.github.com/fixrb/aw/master/certs/gem-fixrb-public_cert.pem)
32
+ $ gem install aw -P HighSecurity
33
+
34
+ The `HighSecurity` trust profile will verify all gems. All of __Aw__'s
35
+ dependencies are signed.
36
+
37
+ Or add this line to your application's Gemfile:
38
+
39
+ ```ruby
40
+ gem 'aw'
41
+ ```
42
+
43
+ And then execute:
44
+
45
+ $ bundle
46
+
47
+ ## Usage
48
+
49
+ ```ruby
50
+ Aw.fork! { 6 * 7 } # => 42
51
+ ```
52
+
53
+ ## Security
54
+
55
+ As a basic form of security __Aw__ provides a set of SHA512 checksums for
56
+ every Gem release. These checksums can be found in the `checksum/` directory.
57
+ Although these checksums do not prevent malicious users from tampering with a
58
+ built Gem they can be used for basic integrity verification purposes.
59
+
60
+ The checksum of a file can be checked using the `sha512sum` command. For
61
+ example:
62
+
63
+ $ sha512sum pkg/aw-0.1.0.gem
64
+ 548d9f669ded4e622182791a5390aaceae0bf2e557b0864f05a842b0be2c65e10e1fb8499f49a3b9efd0e8eaeb691351b1c670d6316ce49965a99683b1071389 pkg/aw-0.1.0.gem
65
+
66
+ ## Versioning
67
+
68
+ __Aw__ follows [Semantic Versioning 2.0](http://semver.org/).
69
+
70
+ ## Contributing
71
+
72
+ 1. [Fork it](https://github.com/fixrb/aw/fork)
73
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
74
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
75
+ 4. Push to the branch (`git push origin my-new-feature`)
76
+ 5. Create a new Pull Request
77
+
78
+ ## License
79
+
80
+ See `LICENSE.md` file.
81
+
82
+ [gem]: https://rubygems.org/gems/aw
83
+ [travis]: https://travis-ci.org/fixrb/aw
84
+ [inchpages]: http://inch-ci.org/github/fixrb/aw/
85
+ [rubydoc]: http://rubydoc.info/gems/aw/frames
@@ -0,0 +1,20 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+ require 'rubocop/rake_task'
4
+
5
+ RuboCop::RakeTask.new
6
+
7
+ Rake::TestTask.new do |t|
8
+ t.verbose = true
9
+ t.warning = true
10
+ end
11
+
12
+ namespace :test do
13
+ task :coverage do
14
+ ENV['COVERAGE'] = 'true'
15
+ Rake::Task['test'].invoke
16
+ end
17
+ end
18
+
19
+ task(:doc_stats) { ruby '-S yard stats' }
20
+ task default: [:test, :doc_stats, :rubocop]
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,26 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = 'aw'
3
+ spec.version = File.read('VERSION.semver').chomp
4
+ spec.authors = ['Cyril Wack']
5
+ spec.email = ['contact@cyril.email']
6
+
7
+ spec.summary = 'Aw, fork!'
8
+ spec.description = 'Creates a subprocess to execute a block inside.'
9
+ spec.homepage = 'https://github.com/fixrb/aw'
10
+ spec.license = 'MIT'
11
+
12
+ spec.files =
13
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^test/}) }
14
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
15
+ spec.require_paths = ['lib']
16
+
17
+ spec.add_development_dependency 'bundler', '~> 1.10'
18
+ spec.add_development_dependency 'rake', '~> 10.4'
19
+ spec.add_development_dependency 'yard', '~> 0.8'
20
+ spec.add_development_dependency 'simplecov', '~> 0.10'
21
+ spec.add_development_dependency 'rubocop', '~> 0.34'
22
+
23
+ spec.cert_chain = ['certs/gem-fixrb-public_cert.pem']
24
+ private_key = File.expand_path('~/.ssh/gem-fixrb-private_key.pem')
25
+ spec.signing_key = private_key if File.exist?(private_key)
26
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'aw'
5
+
6
+ require 'irb'
7
+ IRB.start
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
@@ -0,0 +1,21 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDdDCCAlygAwIBAgIBATANBgkqhkiG9w0BAQUFADBAMRAwDgYDVQQDDAdjb250
3
+ YWN0MRUwEwYKCZImiZPyLGQBGRYFY3lyaWwxFTATBgoJkiaJk/IsZAEZFgVlbWFp
4
+ bDAeFw0xNTA3MzExMjExMDZaFw0xNjA3MzAxMjExMDZaMEAxEDAOBgNVBAMMB2Nv
5
+ bnRhY3QxFTATBgoJkiaJk/IsZAEZFgVjeXJpbDEVMBMGCgmSJomT8ixkARkWBWVt
6
+ YWlsMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6hUEYoxnn1mtoaiK
7
+ NiwjzVPqPgQCR9ZeYdWjLJ3UUG2h5Q6awJCnbaGr8LGGcKtveCDbOJRjtdKNuOTH
8
+ O2FLTkf46nrMGiF+6/j//qh8o0EQHBRKIVMYkxZxZe4Fcqtdf1bWNMZuXeyoDjdt
9
+ 4yiGfizbbTOu0gBf7Yrsv5DsL0a5CU/We7zxMfgGXCVb9PYkD+OWUMcTARYDKfYa
10
+ nN9ECI7CFm/yXcsof/eIQA5EmJNmQnhx8B+8L6jDqQeSUAUrBZnC9CdloKOoqmEL
11
+ weqM2g6LM932Ba74rEl4QlFRYDcs8kjr71UcvseHRCUkFr36j26OU8+gKelsTNdO
12
+ 7OZNKQIDAQABo3kwdzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU
13
+ LSJTN9h29D6bqOhp+vyvhyM0AF4wHgYDVR0RBBcwFYETY29udGFjdEBjeXJpbC5l
14
+ bWFpbDAeBgNVHRIEFzAVgRNjb250YWN0QGN5cmlsLmVtYWlsMA0GCSqGSIb3DQEB
15
+ BQUAA4IBAQArqCC1rUyGJlF0DF9ZhUOgggyROvO0/WroSI5zWgzdB8EU7RJpsDIV
16
+ caGnpji7h0rQIGWQuJ6TL2fTFLfeGRFdIzRZwWC7TeXhcXngJHZxSjDBt2OpfM8A
17
+ P5eElSQS9iJCetBGGMyt354PfgZkg3URaC+JA6mdEisdtEdo64ElnMsLg9shCqye
18
+ JSR3BbejbyPVva0/MHKD+dR6RswlcM9KMiYOXQml7a/kH6huOHvVq9gj5xC2ih8W
19
+ dzJvWzQ1+dJU6WQv75E9ddSkaQrK3nhdgQVu+/wgvGSrsMvOGNz+LXaSDxQqZuwX
20
+ 0KNQFuIukfrdk8URwRnHoAnvx4U93iUw
21
+ -----END CERTIFICATE-----
@@ -0,0 +1,18 @@
1
+ # Namespace for the Aw library.
2
+ #
3
+ # @api public
4
+ #
5
+ # @example Fork and return 42 from 6 * 7.
6
+ # Aw.fork! { 6 * 7 } # => 42
7
+ module Aw
8
+ # Run the block inside a subprocess, and return the value.
9
+ #
10
+ # @param block [Proc] The code to run in a subprocess.
11
+ #
12
+ # @return [#object_id] The result.
13
+ def self.fork!(&block)
14
+ Fork.new(*IO.pipe).call(&block)
15
+ end
16
+ end
17
+
18
+ require_relative File.join 'aw', 'fork'
@@ -0,0 +1,42 @@
1
+ module Aw
2
+ # The Fork class.
3
+ class Fork
4
+ # Initialize the class.
5
+ #
6
+ # @param read [IO] The read endpoint.
7
+ # @param write [IO] The write endpoint.
8
+ def initialize(read, write)
9
+ @read = read
10
+ @write = write
11
+ end
12
+
13
+ # @!attribute [r] read
14
+ #
15
+ # @return [IO] The read endpoint.
16
+ attr_reader :read
17
+
18
+ # @!attribute [r] write
19
+ #
20
+ # @return [IO] The write endpoint.
21
+ attr_reader :write
22
+
23
+ # Run the block inside a subprocess, and return the value.
24
+ #
25
+ # @param block [Proc] The code to run in a subprocess.
26
+ #
27
+ # @return [#object_id] The result.
28
+ def call(&block)
29
+ pid = fork do
30
+ read.close
31
+ result = block.call
32
+ Marshal.dump(result, write)
33
+ exit!(0)
34
+ end
35
+
36
+ write.close
37
+ result = read.read
38
+ Process.wait(pid)
39
+ Marshal.load(result)
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'digest/sha2'
4
+
5
+ gemname = :aw
6
+ ARGV[0] = File.read('VERSION.semver').chomp if ARGV[0].nil?
7
+ built_gem_path = "pkg/#{gemname}-#{ARGV[0]}.gem"
8
+ checksum = Digest::SHA512.new.hexdigest(File.read(built_gem_path))
9
+ checksum_path = "checksum/#{gemname}-#{ARGV[0]}.gem.sha512"
10
+
11
+ File.open(checksum_path, 'w') { |f| f.write("#{checksum}\n") }
metadata ADDED
@@ -0,0 +1,153 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aw
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Cyril Wack
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDdDCCAlygAwIBAgIBATANBgkqhkiG9w0BAQUFADBAMRAwDgYDVQQDDAdjb250
14
+ YWN0MRUwEwYKCZImiZPyLGQBGRYFY3lyaWwxFTATBgoJkiaJk/IsZAEZFgVlbWFp
15
+ bDAeFw0xNTA3MzExMjExMDZaFw0xNjA3MzAxMjExMDZaMEAxEDAOBgNVBAMMB2Nv
16
+ bnRhY3QxFTATBgoJkiaJk/IsZAEZFgVjeXJpbDEVMBMGCgmSJomT8ixkARkWBWVt
17
+ YW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/object:Gem::Dependency
36
+ name: bundler
37
+ requirement: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.10'
42
+ type: :development
43
+ prerelease: false
44
+ version_requirements: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '1.10'
49
+ - !ruby/object:Gem::Dependency
50
+ name: rake
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '10.4'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '10.4'
63
+ - !ruby/object:Gem::Dependency
64
+ name: yard
65
+ requirement: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '0.8'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '0.8'
77
+ - !ruby/object:Gem::Dependency
78
+ name: simplecov
79
+ requirement: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '0.10'
84
+ type: :development
85
+ prerelease: false
86
+ version_requirements: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '0.10'
91
+ - !ruby/object:Gem::Dependency
92
+ name: rubocop
93
+ requirement: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '0.34'
98
+ type: :development
99
+ prerelease: false
100
+ version_requirements: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '0.34'
105
+ description: Creates a subprocess to execute a block inside.
106
+ email:
107
+ - contact@cyril.email
108
+ executables: []
109
+ extensions: []
110
+ extra_rdoc_files: []
111
+ files:
112
+ - ".gitignore"
113
+ - ".travis.yml"
114
+ - ".yardopts"
115
+ - CODE_OF_CONDUCT.md
116
+ - Gemfile
117
+ - LICENSE.md
118
+ - README.md
119
+ - Rakefile
120
+ - VERSION.semver
121
+ - aw.gemspec
122
+ - bin/console
123
+ - bin/setup
124
+ - certs/gem-fixrb-public_cert.pem
125
+ - lib/aw.rb
126
+ - lib/aw/fork.rb
127
+ - pkg_checksum
128
+ homepage: https://github.com/fixrb/aw
129
+ licenses:
130
+ - MIT
131
+ metadata: {}
132
+ post_install_message:
133
+ rdoc_options: []
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubyforge_project:
148
+ rubygems_version: 2.4.5.1
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: Aw, fork!
152
+ test_files: []
153
+ has_rdoc:
Binary file