repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/spec/lib/terraforming/resource/security_group_spec.rb | spec/lib/terraforming/resource/security_group_spec.rb | require "spec_helper"
module Terraforming
module Resource
describe SecurityGroup do
let(:client) do
Aws::EC2::Client.new(stub_responses: true)
end
let(:security_groups) do
[
{
owner_id: "012345678901",
group_name: "hoge",
group_id: ... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/spec/lib/terraforming/resource/route53_record_spec.rb | spec/lib/terraforming/resource/route53_record_spec.rb | require "spec_helper"
module Terraforming
module Resource
describe Route53Record do
let(:client) do
Aws::Route53::Client.new(stub_responses: true)
end
let(:hosted_zones) do
[
{
id: "/hostedzone/ABCDEFGHIJKLMN",
name: "hoge.net.",
ca... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/spec/lib/terraforming/resource/iam_group_policy_spec.rb | spec/lib/terraforming/resource/iam_group_policy_spec.rb | require "spec_helper"
module Terraforming
module Resource
describe IAMGroupPolicy do
let(:client) do
Aws::IAM::Client.new(stub_responses: true)
end
let(:groups) do
[
{
path: "/",
group_name: "hoge",
group_id: "ABCDEFGHIJKLMN1234567"... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming.rb | lib/terraforming.rb | require "aws-sdk-autoscaling"
require "aws-sdk-cloudwatch"
require "aws-sdk-dynamodb"
require "aws-sdk-ec2"
require "aws-sdk-efs"
require "aws-sdk-elasticache"
require "aws-sdk-elasticloadbalancing"
require "aws-sdk-elasticloadbalancingv2"
require "aws-sdk-iam"
require "aws-sdk-kms"
require "aws-sdk-rds"
require "aws-s... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/version.rb | lib/terraforming/version.rb | module Terraforming
VERSION = "0.18.0"
end
| ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/cli.rb | lib/terraforming/cli.rb | module Terraforming
class CLI < Thor
class_option :merge, type: :string, desc: "tfstate file to merge"
class_option :overwrite, type: :boolean, desc: "Overwrite existing tfstate"
class_option :tfstate, type: :boolean, desc: "Generate tfstate"
class_option :profile, type: :string, desc: "AWS credential... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/util.rb | lib/terraforming/util.rb | module Terraforming
module Util
def apply_template(client, erb)
ERB.new(open(template_path(erb)).read, nil, "-").result(binding)
end
def name_from_tag(resource, default_name)
name_tag = resource.tags.find { |tag| tag.key == "Name" }
name_tag ? name_tag.value : default_name
end
... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/subnet.rb | lib/terraforming/resource/subnet.rb | module Terraforming
module Resource
class Subnet
include Terraforming::Util
def self.tf(client: Aws::EC2::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::EC2::Client.new)
self.new(client).tfstate
end
def initialize(client)
@client = ... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/sqs.rb | lib/terraforming/resource/sqs.rb | module Terraforming
module Resource
class SQS
include Terraforming::Util
def self.tf(client: Aws::SQS::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::SQS::Client.new)
self.new(client).tfstate
end
def initialize(client)
@client = cli... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/db_parameter_group.rb | lib/terraforming/resource/db_parameter_group.rb | module Terraforming
module Resource
class DBParameterGroup
include Terraforming::Util
def self.tf(client: Aws::RDS::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::RDS::Client.new)
self.new(client).tfstate
end
def initialize(client)
... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/iam_instance_profile.rb | lib/terraforming/resource/iam_instance_profile.rb | module Terraforming
module Resource
class IAMInstanceProfile
include Terraforming::Util
def self.tf(client: Aws::IAM::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::IAM::Client.new)
self.new(client).tfstate
end
def initialize(client)
... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/route53_record.rb | lib/terraforming/resource/route53_record.rb | module Terraforming
module Resource
class Route53Record
include Terraforming::Util
def self.tf(client: Aws::Route53::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::Route53::Client.new)
self.new(client).tfstate
end
def initialize(client)
... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/iam_role.rb | lib/terraforming/resource/iam_role.rb | module Terraforming
module Resource
class IAMRole
include Terraforming::Util
def self.tf(client: Aws::IAM::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::IAM::Client.new)
self.new(client).tfstate
end
def initialize(client)
@client =... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/internet_gateway.rb | lib/terraforming/resource/internet_gateway.rb | module Terraforming
module Resource
class InternetGateway
include Terraforming::Util
def self.tf(client: Aws::EC2::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::EC2::Client.new)
self.new(client).tfstate
end
def initialize(client)
@... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/vpc.rb | lib/terraforming/resource/vpc.rb | module Terraforming
module Resource
class VPC
include Terraforming::Util
def self.tf(client: Aws::EC2::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::EC2::Client.new)
self.new(client).tfstate
end
def initialize(client)
@client = cli... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/auto_scaling_group.rb | lib/terraforming/resource/auto_scaling_group.rb | module Terraforming
module Resource
class AutoScalingGroup
include Terraforming::Util
def self.tf(client: Aws::AutoScaling::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::AutoScaling::Client.new)
self.new(client).tfstate
end
def initialize(... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/efs_file_system.rb | lib/terraforming/resource/efs_file_system.rb | module Terraforming
module Resource
class EFSFileSystem
include Terraforming::Util
def self.tf(client: Aws::EFS::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::EFS::Client.new)
self.new(client).tfstate
end
def initialize(client)
@cl... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/cloud_watch_alarm.rb | lib/terraforming/resource/cloud_watch_alarm.rb | module Terraforming
module Resource
class CloudWatchAlarm
include Terraforming::Util
def self.tf(client: Aws::CloudWatch::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::CloudWatch::Client.new)
self.new(client).tfstate
end
def initialize(cli... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/vpn_gateway.rb | lib/terraforming/resource/vpn_gateway.rb | module Terraforming
module Resource
class VPNGateway
include Terraforming::Util
def self.tf(client: Aws::EC2::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::EC2::Client.new)
self.new(client).tfstate
end
def initialize(client)
@clien... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/elasti_cache_cluster.rb | lib/terraforming/resource/elasti_cache_cluster.rb | module Terraforming
module Resource
class ElastiCacheCluster
include Terraforming::Util
def self.tf(client: Aws::ElastiCache::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::ElastiCache::Client.new)
self.new(client).tfstate
end
def initializ... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/iam_policy.rb | lib/terraforming/resource/iam_policy.rb | module Terraforming
module Resource
class IAMPolicy
include Terraforming::Util
def self.tf(client: Aws::IAM::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::IAM::Client.new)
self.new(client).tfstate
end
def initialize(client)
@client... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/iam_policy_attachment.rb | lib/terraforming/resource/iam_policy_attachment.rb | module Terraforming
module Resource
class IAMPolicyAttachment
include Terraforming::Util
def self.tf(client: Aws::IAM::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::IAM::Client.new)
self.new(client).tfstate
end
def initialize(client)
... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/network_interface.rb | lib/terraforming/resource/network_interface.rb | module Terraforming
module Resource
class NetworkInterface
include Terraforming::Util
def self.tf(client: Aws::EC2::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::EC2::Client.new)
self.new(client).tfstate
end
def initialize(client)
... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/db_subnet_group.rb | lib/terraforming/resource/db_subnet_group.rb | module Terraforming
module Resource
class DBSubnetGroup
include Terraforming::Util
def self.tf(client: Aws::RDS::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::RDS::Client.new)
self.new(client).tfstate
end
def initialize(client)
@cl... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/iam_role_policy.rb | lib/terraforming/resource/iam_role_policy.rb | module Terraforming
module Resource
class IAMRolePolicy
include Terraforming::Util
def self.tf(client: Aws::IAM::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::IAM::Client.new)
self.new(client).tfstate
end
def initialize(client)
@cl... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/security_group.rb | lib/terraforming/resource/security_group.rb | module Terraforming
module Resource
class SecurityGroup
include Terraforming::Util
def self.tf(client: Aws::EC2::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::EC2::Client.new)
self.new(client).tfstate
end
def initialize(client)
@cl... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/route_table_association.rb | lib/terraforming/resource/route_table_association.rb | module Terraforming
module Resource
class RouteTableAssociation
include Terraforming::Util
def self.tf(client: Aws::EC2::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::EC2::Client.new)
self.new(client).tfstate
end
def initialize(client)
... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/kms_key.rb | lib/terraforming/resource/kms_key.rb | module Terraforming
module Resource
class KMSKey
include Terraforming::Util
def self.tf(client: Aws::KMS::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::KMS::Client.new)
self.new(client).tfstate
end
def initialize(client)
@client = ... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/redshift.rb | lib/terraforming/resource/redshift.rb | module Terraforming
module Resource
class Redshift
include Terraforming::Util
def self.tf(client: Aws::Redshift::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::Redshift::Client.new)
self.new(client).tfstate
end
def initialize(client)
... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/sns_topic_subscription.rb | lib/terraforming/resource/sns_topic_subscription.rb | module Terraforming
module Resource
class SNSTopicSubscription
include Terraforming::Util
def self.tf(client: Aws::SNS::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::SNS::Client.new)
self.new(client).tfstate
end
def initialize(client)
... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/iam_user_policy.rb | lib/terraforming/resource/iam_user_policy.rb | module Terraforming
module Resource
class IAMUserPolicy
include Terraforming::Util
def self.tf(client: Aws::IAM::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::IAM::Client.new)
self.new(client).tfstate
end
def initialize(client)
@cl... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/elasti_cache_subnet_group.rb | lib/terraforming/resource/elasti_cache_subnet_group.rb | module Terraforming
module Resource
class ElastiCacheSubnetGroup
include Terraforming::Util
def self.tf(client: Aws::ElastiCache::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::ElastiCache::Client.new)
self.new(client).tfstate
end
def initi... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/iam_user.rb | lib/terraforming/resource/iam_user.rb | module Terraforming
module Resource
class IAMUser
include Terraforming::Util
def self.tf(client: Aws::IAM::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::IAM::Client.new)
self.new(client).tfstate
end
def initialize(client)
@client =... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/rds.rb | lib/terraforming/resource/rds.rb | module Terraforming
module Resource
class RDS
include Terraforming::Util
def self.tf(client: Aws::RDS::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::RDS::Client.new)
self.new(client).tfstate
end
def initialize(client)
@client = cli... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/launch_configuration.rb | lib/terraforming/resource/launch_configuration.rb | module Terraforming
module Resource
class LaunchConfiguration
include Terraforming::Util
def self.tf(client: Aws::AutoScaling::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::AutoScaling::Client.new)
self.new(client).tfstate
end
def initiali... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/s3.rb | lib/terraforming/resource/s3.rb | module Terraforming
module Resource
class S3
include Terraforming::Util
def self.tf(client: Aws::S3::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::S3::Client.new)
self.new(client).tfstate
end
def initialize(client)
@client = client... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/db_security_group.rb | lib/terraforming/resource/db_security_group.rb | module Terraforming
module Resource
class DBSecurityGroup
include Terraforming::Util
def self.tf(client: Aws::RDS::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::RDS::Client.new)
self.new(client).tfstate
end
def initialize(client)
@... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/ec2.rb | lib/terraforming/resource/ec2.rb | module Terraforming
module Resource
class EC2
include Terraforming::Util
def self.tf(client: Aws::EC2::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::EC2::Client.new)
self.new(client).tfstate
end
def initialize(client)
@client = cli... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/eip.rb | lib/terraforming/resource/eip.rb | module Terraforming
module Resource
class EIP
include Terraforming::Util
def self.tf(client: Aws::EC2::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::EC2::Client.new)
self.new(client).tfstate
end
def initialize(client)
@client = cli... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/elb.rb | lib/terraforming/resource/elb.rb | module Terraforming
module Resource
class ELB
include Terraforming::Util
def self.tf(client: Aws::ElasticLoadBalancing::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::ElasticLoadBalancing::Client.new)
self.new(client).tfstate
end
def initia... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/iam_group_policy.rb | lib/terraforming/resource/iam_group_policy.rb | module Terraforming
module Resource
class IAMGroupPolicy
include Terraforming::Util
def self.tf(client: Aws::IAM::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::IAM::Client.new)
self.new(client).tfstate
end
def initialize(client)
@c... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/route_table.rb | lib/terraforming/resource/route_table.rb | module Terraforming
module Resource
class RouteTable
include Terraforming::Util
def self.tf(client: Aws::EC2::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::EC2::Client.new)
self.new(client).tfstate
end
def initialize(client)
@clien... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/network_acl.rb | lib/terraforming/resource/network_acl.rb | module Terraforming
module Resource
class NetworkACL
include Terraforming::Util
def self.tf(client: Aws::EC2::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::EC2::Client.new)
self.new(client).tfstate
end
def initialize(client)
@clien... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/dynamo_db.rb | lib/terraforming/resource/dynamo_db.rb | module Terraforming
module Resource
class DynamoDB
include Terraforming::Util
def self.tf(client: Aws::DynamoDB::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::DynamoDB::Client.new)
self.new(client).tfstate
end
def initialize(client)
... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/route53_zone.rb | lib/terraforming/resource/route53_zone.rb | module Terraforming
module Resource
class Route53Zone
include Terraforming::Util
def self.tf(client: Aws::Route53::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::Route53::Client.new)
self.new(client).tfstate
end
def initialize(client)
... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/nat_gateway.rb | lib/terraforming/resource/nat_gateway.rb | module Terraforming
module Resource
class NATGateway
include Terraforming::Util
def self.tf(client: Aws::EC2::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::EC2::Client.new)
self.new(client).tfstate
end
def initialize(client)
@clien... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/alb.rb | lib/terraforming/resource/alb.rb | module Terraforming
module Resource
class ALB
include Terraforming::Util
def self.tf(client: Aws::ElasticLoadBalancingV2::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::ElasticLoadBalancingV2::Client.new)
self.new(client).tfstate
end
def in... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/sns_topic.rb | lib/terraforming/resource/sns_topic.rb | module Terraforming
module Resource
class SNSTopic
include Terraforming::Util
def self.tf(client: Aws::SNS::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::SNS::Client.new)
self.new(client).tfstate
end
def initialize(client)
@client ... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/iam_group.rb | lib/terraforming/resource/iam_group.rb | module Terraforming
module Resource
class IAMGroup
include Terraforming::Util
def self.tf(client: Aws::IAM::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::IAM::Client.new)
self.new(client).tfstate
end
def initialize(client)
@client ... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/iam_group_membership.rb | lib/terraforming/resource/iam_group_membership.rb | module Terraforming
module Resource
class IAMGroupMembership
include Terraforming::Util
def self.tf(client: Aws::IAM::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::IAM::Client.new)
self.new(client).tfstate
end
def initialize(client)
... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
dtan4/terraforming | https://github.com/dtan4/terraforming/blob/ab6486872952b61c4dca24d51a8a11f189f91573/lib/terraforming/resource/kms_alias.rb | lib/terraforming/resource/kms_alias.rb | module Terraforming
module Resource
class KMSAlias
include Terraforming::Util
def self.tf(client: Aws::KMS::Client.new)
self.new(client).tf
end
def self.tfstate(client: Aws::KMS::Client.new)
self.new(client).tfstate
end
def initialize(client)
@client ... | ruby | MIT | ab6486872952b61c4dca24d51a8a11f189f91573 | 2026-01-04T15:46:47.062437Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/parallel_spec.rb | spec/parallel_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Parallel do
worker_types = ["threads"]
worker_types << "processes" if Process.respond_to?(:fork)
worker_types << "ractors" if defined?(Ractor)
def time_taken
t = Time.now.to_f
yield
RUBY_ENGINE == "jruby" ? 0 : Time.now.to_f - t # jruby ... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require 'parallel'
require 'benchmark'
require 'timeout'
RSpec.configure do |config|
config.expect_with(:rspec) { |c| c.syntax = :should }
config.mock_with(:rspec) { |c| c.syntax = :should }
config.around { |example| Timeout.timeout(30, &example) }
config.include(
Module.new d... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/map_with_index.rb | spec/cases/map_with_index.rb | # frozen_string_literal: true
require './spec/cases/helper'
result = Parallel.map_with_index(['a', 'b']) do |x, i|
"#{x}#{i}"
end
print result * ''
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/parallel_sleeping_2.rb | spec/cases/parallel_sleeping_2.rb | # frozen_string_literal: true
require './spec/cases/helper'
Parallel.in_processes(5) do
sleep 2
end
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/parallel_start_and_kill.rb | spec/cases/parallel_start_and_kill.rb | # frozen_string_literal: true
require './spec/cases/helper'
method = case ARGV[0]
when "PROCESS" then :in_processes
when "THREAD" then :in_threads
else raise "Learn to use this!"
end
options = {}
options[:count] = 2
if ARGV.length > 1
options[:interrupt_signal] = ARGV[1].to_s
trap('SIGI... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/fatal_queue.rb | spec/cases/fatal_queue.rb | # frozen_string_literal: true
require './spec/cases/helper'
queue = Queue.new
queue.push 1
queue.push 2
queue.push 3
Parallel.map(queue, in_threads: 2) { |(i, _id)| "ITEM-#{i}" }
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/map_with_ractor.rb | spec/cases/map_with_ractor.rb | # frozen_string_literal: true
require './spec/cases/helper'
class Callback
def self.call(arg)
"#{arg}x"
end
end
result = Parallel.map(ENV['INPUT'].chars, in_ractors: Integer(ENV["COUNT"] || 2), ractor: [Callback, :call])
print result * ''
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/with_exception_before_finish.rb | spec/cases/with_exception_before_finish.rb | # frozen_string_literal: true
require './spec/cases/helper'
method = ENV.fetch('METHOD')
in_worker_type = :"in_#{ENV.fetch('WORKER_TYPE')}"
class ParallelTestError < StandardError
end
class Callback
def self.call(x)
$stdout.sync = true
if x != 3
sleep 0.2
raise ParallelTestError
end
pri... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/profile_memory.rb | spec/cases/profile_memory.rb | # frozen_string_literal: true
def count_objects
old = Hash.new(0)
cur = Hash.new(0)
GC.start
ObjectSpace.each_object { |o| old[o.class] += 1 }
yield
GC.start
GC.start
ObjectSpace.each_object { |o| cur[o.class] += 1 }
cur.to_h { |k, v| [k, v - old[k]] }.reject { |_k, v| v == 0 }
end
class Callback
d... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/map_isolation.rb | spec/cases/map_isolation.rb | # frozen_string_literal: true
require './spec/cases/helper'
process_diff do
result = Parallel.map([1, 2, 3, 4], in_processes: 2, isolation: true) do |i|
@i ||= i
end
puts result
end
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/parallel_kill.rb | spec/cases/parallel_kill.rb | # frozen_string_literal: true
require './spec/cases/helper'
results = Parallel.map([1, 2, 3]) do |x|
case x
when 1 # -> stop all sub-processes, killing them instantly
sleep 0.1
puts "DEAD"
raise Parallel::Kill
when 3
sleep 10
else
x
end
end
puts "Works #{results.inspect}"
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/parallel_map_complex_objects.rb | spec/cases/parallel_map_complex_objects.rb | # frozen_string_literal: true
require './spec/cases/helper'
object = ["\nasd#{File.read('Gemfile')}--#{File.read('Rakefile')}" * 100, 12_345, { b: :a }]
result = Parallel.map([1, 2]) do |_x|
object
end
print 'YES' if result.inspect == [object, object].inspect
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/map_with_killed_worker_before_read.rb | spec/cases/map_with_killed_worker_before_read.rb | # frozen_string_literal: true
require './spec/cases/helper'
begin
Parallel.map([1, 2, 3]) do |_x, _i|
Process.kill("SIGKILL", Process.pid)
end
rescue Parallel::DeadWorker
puts "DEAD"
end
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/with_break_before_finish.rb | spec/cases/with_break_before_finish.rb | # frozen_string_literal: true
require './spec/cases/helper'
method = ENV.fetch('METHOD')
in_worker_type = :"in_#{ENV.fetch('WORKER_TYPE')}"
$stdout.sync = true
class Callback
def self.call(x)
$stdout.sync = true
sleep 0.1 # let workers start
raise Parallel::Break if x == 1
sleep 0.2
print x
... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/no_dump_with_each.rb | spec/cases/no_dump_with_each.rb | # frozen_string_literal: true
require './spec/cases/helper'
class NotDumpable
def marshal_dump
raise "NOOOO"
end
def to_s
'not dumpable'
end
end
Parallel.each([1]) do
print 'no dump for result'
NotDumpable.new
end
Parallel.each([NotDumpable.new]) do
print 'no dump for each'
1
end
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/any_true.rb | spec/cases/any_true.rb | # frozen_string_literal: true
require './spec/cases/helper'
$stdout.sync = true # otherwise results can go weird...
results = []
[{ in_processes: 2 }, { in_threads: 2 }, { in_threads: 0 }].each do |options|
x = [nil, nil, nil, nil, 42, nil, nil, nil]
results << Parallel.any?(x, options) do |y|
y
end
x = ... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/count_open_pipes.rb | spec/cases/count_open_pipes.rb | # frozen_string_literal: true
require './spec/cases/helper'
count = ->(*) { `lsof -l | grep pipe | wc -l`.to_i }
start = count.call
results = Parallel.map(Array.new(20), in_processes: 20, &count)
puts results.max - start
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/any_false.rb | spec/cases/any_false.rb | # frozen_string_literal: true
require './spec/cases/helper'
$stdout.sync = true # otherwise results can go weird...
results = []
[{ in_processes: 2 }, { in_threads: 2 }, { in_threads: 0 }].each do |options|
x = [nil, nil, nil, nil, nil, nil, nil, nil]
results << Parallel.any?(x, options) do |y|
y
end
x =... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/with_queue.rb | spec/cases/with_queue.rb | # frozen_string_literal: true
require './spec/cases/helper'
type = :"in_#{ARGV.fetch(0)}"
class Callback
def self.call(x)
"ITEM-#{x}"
end
end
queue = Queue.new
Thread.new do
sleep 0.2
queue.push 1
queue.push 2
queue.push 3
queue.push Parallel::Stop
end
if type == :in_ractors
puts(Parallel.map(qu... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/eof_in_process.rb | spec/cases/eof_in_process.rb | # frozen_string_literal: true
require './spec/cases/helper'
begin
Parallel.map([1]) { raise EOFError } # rubocop:disable Lint/UnreachableLoop
rescue EOFError
puts 'Yep, EOF'
else
puts 'WHOOOPS'
end
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/exit_in_process.rb | spec/cases/exit_in_process.rb | # frozen_string_literal: true
require './spec/cases/helper'
begin
Parallel.map([1]) { exit } # rubocop:disable Lint/UnreachableLoop
rescue Parallel::DeadWorker
puts "Yep, DEAD"
else
puts "WHOOOPS"
end
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/double_interrupt.rb | spec/cases/double_interrupt.rb | # frozen_string_literal: true
require './spec/cases/helper'
Signal.trap :SIGINT do
sleep 0.5
puts "YES"
exit 0
end
Parallel.map(Array.new(20), in_processes: 2) do
sleep 10
puts "I should be killed earlier"
end
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/closes_processes_at_runtime.rb | spec/cases/closes_processes_at_runtime.rb | # frozen_string_literal: true
require './spec/cases/helper'
process_diff do
Parallel.each((0..10).to_a, in_processes: 5) { |a| raise unless a * 2 }
end
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/map_with_index_empty.rb | spec/cases/map_with_index_empty.rb | # frozen_string_literal: true
require './spec/cases/helper'
result = Parallel.map_with_index([]) do |x, i|
"#{x}#{i}"
end
print result * ''
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/parallel_raise_undumpable.rb | spec/cases/parallel_raise_undumpable.rb | # frozen_string_literal: true
require './spec/cases/helper'
require 'stringio'
class MyException < StandardError
def initialize(object)
super()
@object = object
end
end
begin
Parallel.in_processes(2) do
raise MyException, StringIO.new
end
puts "NOTHING WAS RAISED"
rescue StandardError
puts $!.... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/map_worker_number_isolation.rb | spec/cases/map_worker_number_isolation.rb | # frozen_string_literal: true
require './spec/cases/helper'
process_diff do
result = Parallel.map([1, 2, 3, 4], in_processes: 2, isolation: true) do |_i|
Parallel.worker_number
end
puts result.uniq.sort.join(',')
end
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/each_with_ar_sqlite.rb | spec/cases/each_with_ar_sqlite.rb | # frozen_string_literal: true
require './spec/cases/helper'
require "logger"
require "active_record"
require "sqlite3"
require "tempfile"
$stdout.sync = true
in_worker_type = :"in_#{ENV.fetch('WORKER_TYPE')}"
Tempfile.create("db") do |temp|
ActiveRecord::Schema.verbose = false
ActiveRecord::Base.establish_connecti... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/with_exception_in_start.rb | spec/cases/with_exception_in_start.rb | # frozen_string_literal: true
require './spec/cases/helper'
method = ENV.fetch('METHOD')
in_worker_type = :"in_#{ENV.fetch('WORKER_TYPE')}"
class ParallelTestError < StandardError
end
class Callback
def self.call(x)
$stdout.sync = true
print x
sleep 0.2 # so now no work gets queued before exception is ... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/parallel_break_better_errors.rb | spec/cases/parallel_break_better_errors.rb | # frozen_string_literal: true
require './spec/cases/helper'
require 'stringio'
class MyException < StandardError
def initialize(object)
super()
@object = object
end
end
begin
Parallel.in_processes(2) do
ex = Parallel::Break.new
# better_errors sets an instance variable that contains an array of ... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/parallel_raise.rb | spec/cases/parallel_raise.rb | # frozen_string_literal: true
require './spec/cases/helper'
begin
Parallel.in_processes(2) do
raise "TEST"
end
puts "FAIL"
rescue RuntimeError
puts $!.message
end
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/parallel_with_set_processes.rb | spec/cases/parallel_with_set_processes.rb | # frozen_string_literal: true
require './spec/cases/helper'
x = Parallel.in_processes(5) do
"HELLO"
end
puts x
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/with_exception_in_finish.rb | spec/cases/with_exception_in_finish.rb | # frozen_string_literal: true
require './spec/cases/helper'
$stdout.sync = true
method = ENV.fetch('METHOD')
in_worker_type = :"in_#{ENV.fetch('WORKER_TYPE')}"
class ParallelTestError < StandardError
end
class Callback
def self.call(x)
$stdout.sync = true
print x
sleep 0.2 # let everyone start and prin... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/parallel_map.rb | spec/cases/parallel_map.rb | # frozen_string_literal: true
require './spec/cases/helper'
result = Parallel.map(['a', 'b', 'c', 'd']) do |x|
"-#{x}-"
end
print result * ' '
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/with_lambda.rb | spec/cases/with_lambda.rb | # frozen_string_literal: true
require './spec/cases/helper'
$stdout.sync = true
type = :"in_#{ARGV.fetch(0)}"
all = [3, 2, 1]
produce = -> { all.pop || Parallel::Stop }
class Callback
def self.call(x)
$stdout.sync = true
"ITEM-#{x}"
end
end
if type == :in_ractors
puts(Parallel.map(produce, type => 2, r... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/all_false.rb | spec/cases/all_false.rb | # frozen_string_literal: true
require './spec/cases/helper'
$stdout.sync = true # otherwise results can go weird...
results = []
[{ in_processes: 2 }, { in_threads: 2 }, { in_threads: 0 }].each do |options|
x = [nil, nil, nil, nil, nil, nil, nil, nil]
results << Parallel.all?(x, options) do |y|
y
end
x =... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/exception_raised_in_process.rb | spec/cases/exception_raised_in_process.rb | # frozen_string_literal: true
require './spec/cases/helper'
begin
Parallel.each([1]) { raise StandardError } # rubocop:disable Lint/UnreachableLoop
rescue Parallel::DeadWorker
puts "No, DEAD worker found"
rescue Exception # rubocop:disable Lint/RescueException
puts "Yep, rescued the exception"
else
puts "WHOOO... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/synchronizes_start_and_finish.rb | spec/cases/synchronizes_start_and_finish.rb | # frozen_string_literal: true
require './spec/cases/helper'
start = lambda { |item, _index|
print item * 5
sleep rand * 0.2
puts item * 5
}
finish = lambda { |_item, _index, result|
print result * 5
sleep rand * 0.2
puts result * 5
}
Parallel.map(['a', 'b', 'c'], start: start, finish: finish) do |i|
slee... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/parallel_high_fork_rate.rb | spec/cases/parallel_high_fork_rate.rb | # frozen_string_literal: true
require './spec/cases/helper'
Parallel.each((0..200).to_a, in_processes: 200) do |_x|
sleep 1
end
print 'OK'
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/parallel_influence_outside_data.rb | spec/cases/parallel_influence_outside_data.rb | # frozen_string_literal: true
require './spec/cases/helper'
x = 'yes'
Parallel.in_processes(2) do
x = 'no'
end
print x
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/each_with_index.rb | spec/cases/each_with_index.rb | # frozen_string_literal: true
require './spec/cases/helper'
Parallel.each_with_index(['a', 'b'], in_threads: 2) do |x, i|
print "#{x}#{i}"
end
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/progress_with_options.rb | spec/cases/progress_with_options.rb | # frozen_string_literal: true
require './spec/cases/helper'
# ruby-progressbar ignores the format string you give it
# unless the output is a TTY. When running in the test,
# the output is not a TTY, so we cannot test that the format
# string you pass overrides parallel's default. So, we pretend
# that stdout is a T... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/map_with_ar.rb | spec/cases/map_with_ar.rb | # frozen_string_literal: true
require './spec/cases/helper'
require "active_record"
database = "parallel_with_ar_test"
`mysql #{database} -e '' || mysql -e 'create database #{database}'`
ActiveRecord::Schema.verbose = false
ActiveRecord::Base.establish_connection(
adapter: "mysql2",
database: database
)
class Us... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/with_worker_number.rb | spec/cases/with_worker_number.rb | # frozen_string_literal: true
require './spec/cases/helper'
method = ENV.fetch('METHOD')
in_worker_type = :"in_#{ENV.fetch('WORKER_TYPE')}"
Parallel.public_send(method, 1..100, in_worker_type => 4) do
sleep 0.1 # so all workers get started
print Parallel.worker_number
end
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/parallel_map_range.rb | spec/cases/parallel_map_range.rb | # frozen_string_literal: true
require './spec/cases/helper'
result = Parallel.map(1..5) do |x|
x
end
print result.inspect
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/parallel_fast_exit.rb | spec/cases/parallel_fast_exit.rb | # frozen_string_literal: true
require './spec/cases/helper'
Parallel.map([1, 2, 3], in_processes: 2) do
puts "I finished..."
end
sleep 10
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/parallel_map_sleeping.rb | spec/cases/parallel_map_sleeping.rb | # frozen_string_literal: true
require './spec/cases/helper'
Parallel.map(['a', 'b', 'c', 'd']) do |_x|
sleep 1
end
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/parallel_with_nil_uses_detected_cpus.rb | spec/cases/parallel_with_nil_uses_detected_cpus.rb | # frozen_string_literal: true
require './spec/cases/helper'
x = Parallel.in_processes(nil) do
"HELLO"
end
puts x
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/each_in_place.rb | spec/cases/each_in_place.rb | # frozen_string_literal: true
require './spec/cases/helper'
$stdout.sync = true # otherwise results can go weird...
x = [+'a']
Parallel.each(x, in_threads: 1) { |y| y << 'b' }
print x.first
| ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
grosser/parallel | https://github.com/grosser/parallel/blob/8d638d0d8e4c17dd74776557991e3aa73dfc8b07/spec/cases/with_exception_in_start_before_finish.rb | spec/cases/with_exception_in_start_before_finish.rb | # frozen_string_literal: true
require './spec/cases/helper'
method = ENV.fetch('METHOD')
in_worker_type = :"in_#{ENV.fetch('WORKER_TYPE')}"
$stdout.sync = true
class ParallelTestError < StandardError
end
class Callback
def self.call(x)
$stdout.sync = true
puts "call #{x}"
x
end
end
begin
start = l... | ruby | MIT | 8d638d0d8e4c17dd74776557991e3aa73dfc8b07 | 2026-01-04T15:46:55.131598Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.