Skip to content

Commit

Permalink
chore: split into anyt-core and anyt
Browse files Browse the repository at this point in the history
anyt-core has no dependency on Redis or AnyCable and can be used in other contexts

One particular use-case is using AnyT WebSocket client as an Action Cable-compatible synchrounous client in Ruby applications
  • Loading branch information
palkan committed Feb 22, 2024
1 parent b6c031d commit 4631bec
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: 3.2
bundler-cache: true
- name: Lint Ruby code with RuboCop
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
CI: true
services:
redis:
image: redis:5.0-alpine
image: redis:6.0-alpine
ports: ["6379:6379"]
options: --health-cmd="redis-cli ping" --health-interval 1s --health-timeout 3s --health-retries 30
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
ruby-version: 3.2
bundler-cache: true
- name: Run tests
run: |
Expand Down
11 changes: 10 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ gem "pry-byebug", platform: :mri
eval_gemfile "gemfiles/rubocop.gemfile"

# Specify your gem's dependencies in anyt.gemspec
gemspec
gemspec name: "anyt"

if File.directory?(File.join(__dir__, "../anycable"))
$stdout.puts "\n=== Using local AnyCable gems ===\n\n"
Expand All @@ -19,3 +19,12 @@ else
gem "anycable", github: "anycable/anycable"
gem "anycable-rails", github: "anycable/anycable-rails"
end

if File.directory?(File.join(__dir__, "../../rails"))
$stdout.puts "\n=== Using local Rails ===\n\n"
path "../../rails" do
gem "rails"
end
else
gem "rails"
end
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
[![Gem Version](https://badge.fury.io/rb/anyt.svg)](https://rubygems.org/gems/anyt)
![Test](https://github.com/anycable/anyt/workflows/Test/badge.svg)

# AnyCable Conformance Testing Tool
# Action Cable / AnyCable conformance testing tool

AnyT is a command-line tool to test your Action Cable or [AnyCable](http://anycable.io)-compatible WebSocket servers.

AnyT is a command-line tool to test your [AnyCable](http://anycable.io)-compatible WebSocket servers.
It contains a set of tests to determine which features are supported by the implementation under consideration.

## Installation
Expand Down
27 changes: 27 additions & 0 deletions anyt-core.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

require_relative "lib/anyt/version"

Gem::Specification.new do |spec|
spec.name = "anyt-core"
spec.version = Anyt::VERSION
spec.authors = ["palkan"]
spec.email = ["[email protected]"]

spec.summary = "Action Cable / AnyCable conformance testing tool"
spec.description = "Action Cable / AnyCable conformance testing tool"
spec.homepage = "http://github.com/anycable/anyt"
spec.license = "MIT"

spec.files = Dir.glob("lib/**/*") + Dir.glob("bin/*") + %w[README.md MIT-LICENSE]
spec.require_paths = ["lib"]

spec.required_ruby_version = ">= 2.6.0"

spec.add_dependency "rack", ">= 2.0"
spec.add_dependency "rails", ">= 6.0"
spec.add_dependency "anyway_config", ">= 2.2.0"
spec.add_dependency "websocket", "~> 1.2.4"
spec.add_dependency "websocket-client-simple", "~> 0.3.0"
spec.add_dependency "concurrent-ruby", "~> 1.0"
end
14 changes: 4 additions & 10 deletions anyt.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,22 @@ Gem::Specification.new do |spec|
spec.authors = ["palkan"]
spec.email = ["[email protected]"]

spec.summary = "Anycable conformance testing tool"
spec.description = "Anycable conformance testing tool"
spec.summary = "Action Cable / AnyCable conformance testing tool"
spec.description = "Action Cable / AnyCable conformance testing tool"
spec.homepage = "http://github.com/anycable/anyt"
spec.license = "MIT"

spec.files = Dir.glob("lib/**/*") + Dir.glob("bin/*") + %w[README.md MIT-LICENSE]
spec.files = %w[README.md MIT-LICENSE]
spec.require_paths = ["lib"]

spec.executables << "anyt"

spec.required_ruby_version = ">= 2.6.0"
spec.add_dependency "anyt-core", Anyt::VERSION

spec.add_dependency "rack", "~> 2.0"
spec.add_dependency "minitest", "~> 5.10"
spec.add_dependency "minitest-reporters", "~> 1.1.0"
spec.add_dependency "rails", ">= 6.0"
spec.add_dependency "anyway_config", "~> 2.2.0"
spec.add_dependency "anycable-rails", "> 1.0.99", "< 2.0"
spec.add_dependency "redis", "~> 4.0"
spec.add_dependency "websocket", "~> 1.2.4"
spec.add_dependency "websocket-client-simple", "~> 0.3.0"
spec.add_dependency "concurrent-ruby", "~> 1.0"
spec.add_dependency "childprocess", "~> 3.0"

spec.add_development_dependency "bundler", "~> 2"
Expand Down
2 changes: 2 additions & 0 deletions lib/anyt/client.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require "anyt"

module Anyt
# Synchronous websocket client
# Based on https://github.com/rails/rails/blob/v5.0.1/actioncable/test/client_test.rb
Expand Down
2 changes: 1 addition & 1 deletion lib/anyt/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Anyt
VERSION = "1.2.4"
VERSION = "1.3.0"
end

0 comments on commit 4631bec

Please sign in to comment.