Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #737 from celluloid/simplify-dependencies
Simplify dependencies: merge 'essentials' and 'culture' repos
- Loading branch information
Showing
62 changed files
with
2,306 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,22 @@ | ||
inherit_from: | ||
- culture/rubocop/rubocop.yml | ||
AllCops: | ||
DisplayCopNames: true | ||
|
||
# | ||
# Style | ||
# | ||
|
||
LineLength: | ||
Max: 128 | ||
|
||
Style/StringLiterals: | ||
EnforcedStyle: double_quotes | ||
|
||
# | ||
# Metrics | ||
# | ||
|
||
Metrics/ClassLength: | ||
Max: 200 | ||
|
||
Metrics/MethodLength: | ||
Max: 50 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.3.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
require File.expand_path("../culture/sync", __FILE__) | ||
Celluloid::Sync::Gemfile[self] | ||
source "https://rubygems.org" | ||
|
||
gemspec | ||
|
||
group :development do | ||
gem "pry" | ||
end | ||
|
||
group :development, :test do | ||
gem "rake", "~> 11", require: false | ||
gem "rspec", "~> 3", require: false | ||
gem "rspec-retry", "~> 0.5", require: false | ||
gem "rubocop", "= 0.45.0", require: false | ||
gem "coveralls", ">= 0.8", require: false | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,29 @@ | ||
# -*- encoding: utf-8 -*- | ||
# frozen_string_literal: true | ||
|
||
require File.expand_path("../culture/sync", __FILE__) | ||
lib = File.expand_path("../lib", __FILE__) | ||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
require "celluloid/version" | ||
|
||
Gem::Specification.new do |gem| | ||
gem.name = "celluloid" | ||
gem.version = Celluloid::VERSION | ||
gem.platform = Gem::Platform::RUBY | ||
gem.licenses = ["MIT"] | ||
gem.authors = ["Tony Arcieri", "Donovan Keme"] | ||
gem.email = ["bascule@gmail.com", "code@extremist.digital"] | ||
gem.homepage = "https://github.com/celluloid/celluloid" | ||
gem.summary = "Actor-based concurrent object framework for Ruby" | ||
gem.description = <<-DESCRIPTION.strip.gsub(/\s+/, " ") | ||
Gem::Specification.new do |spec| | ||
spec.name = "celluloid" | ||
spec.version = Celluloid::VERSION | ||
spec.platform = Gem::Platform::RUBY | ||
spec.licenses = ["MIT"] | ||
spec.authors = ["Tony Arcieri", "Donovan Keme"] | ||
spec.email = ["bascule@gmail.com", "code@extremist.digital"] | ||
spec.homepage = "https://github.com/celluloid/celluloid" | ||
spec.summary = "Actor-based concurrent object framework for Ruby" | ||
spec.description = <<-DESCRIPTION.strip.gsub(/\s+/, " ") | ||
Celluloid enables people to build concurrent programs out of concurrent objects just as easily | ||
as they build sequential programs out of sequential objects | ||
DESCRIPTION | ||
|
||
gem.required_ruby_version = ">= 2.2.6" | ||
gem.required_rubygems_version = ">= 2.0.0" | ||
spec.require_path = "lib" | ||
spec.files = Dir["*.md", "*.txt", "lib/**/*", "spec/**/*", "examples/*"] | ||
spec.required_ruby_version = ">= 2.2.6" | ||
spec.required_rubygems_version = ">= 2.0.0" | ||
|
||
gem.files = Dir[ | ||
"README.md", | ||
"CHANGES.md", | ||
"LICENSE.txt", | ||
"culture/**/*", | ||
"lib/**/*", | ||
"spec/**/*", | ||
"examples/*" | ||
] | ||
|
||
gem.require_path = "lib" | ||
|
||
Celluloid::Sync::Gemspec[gem] | ||
spec.add_runtime_dependency "timers", "~> 4" | ||
spec.add_runtime_dependency "celluloid-supervision", "~> 0.20" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
require "celluloid" | ||
|
||
Celluloid.start | ||
|
||
unless defined?($CELLULOID_TEST) && $CELLULOID_TEST | ||
Celluloid.register_shutdown | ||
Celluloid.init | ||
end | ||
Celluloid.boot | ||
Celluloid.register_shutdown unless defined?($CELLULOID_TEST) && $CELLULOID_TEST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Celluloid | ||
module Internals | ||
class CallChain | ||
def self.current_id=(value) | ||
Thread.current[:celluloid_chain_id] = value | ||
task = Thread.current[:celluloid_task] | ||
task.chain_id = value if task | ||
end | ||
|
||
def self.current_id | ||
Thread.current[:celluloid_chain_id] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
module Celluloid | ||
module Internals | ||
module CPUCounter | ||
class << self | ||
def cores | ||
@cores ||= count_cores | ||
end | ||
|
||
private unless $CELLULOID_TEST | ||
|
||
def count_cores | ||
from_result(from_env || from_sysdev || from_java || from_proc || from_win32ole || from_sysctl) || 1 | ||
end | ||
|
||
def from_env | ||
result = ENV["NUMBER_OF_PROCESSORS"] | ||
result if result && !result.empty? | ||
rescue | ||
end | ||
|
||
def from_sysdev | ||
::IO.read("/sys/devices/system/cpu/present").split("-").last.to_i + 1 | ||
rescue Errno::ENOENT | ||
begin | ||
result = Dir["/sys/devices/system/cpu/cpu*"].count { |n| n =~ /cpu\d+/ } | ||
result unless result.zero? | ||
rescue | ||
end | ||
rescue | ||
end | ||
|
||
def from_java | ||
Java::Java.lang.Runtime.getRuntime.availableProcessors if defined? Java::Java | ||
rescue | ||
end | ||
|
||
def from_proc | ||
File.read("/proc/cpuinfo").scan(/^processor\s*:/).size if File.exist?("/proc/cpuinfo") | ||
rescue | ||
end | ||
|
||
def from_win32ole | ||
require "win32ole" | ||
WIN32OLE.connect("winmgmts://").ExecQuery("select * from Win32_ComputerSystem").NumberOfProcessors | ||
rescue LoadError | ||
rescue | ||
end | ||
|
||
def from_sysctl | ||
Integer `sysctl -n hw.ncpu 2>/dev/null` | ||
rescue | ||
end | ||
|
||
def from_result(result) | ||
if result | ||
i = Integer(result.to_s[/\d+/], 10) | ||
return i if i > 0 | ||
end | ||
rescue | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
require "set" | ||
|
||
module Celluloid | ||
module Internals | ||
class Handlers | ||
def initialize | ||
@handlers = Set.new | ||
end | ||
|
||
def handle(*patterns, &block) | ||
patterns.each do |pattern| | ||
handler = Handler.new pattern, block | ||
@handlers << handler | ||
end | ||
end | ||
|
||
# Handle incoming messages | ||
def handle_message(message) | ||
handler = @handlers.find { |h| h.match(message) } | ||
handler.call message if handler | ||
handler | ||
end | ||
end | ||
|
||
# Methods blocking on a call to receive | ||
class Handler | ||
def initialize(pattern, block) | ||
@pattern = pattern | ||
@block = block | ||
end | ||
|
||
# Match a message with this receiver's block | ||
def match(message) | ||
@pattern === message | ||
end | ||
|
||
def call(message) | ||
@block.call message | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.