aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Strapp <matt@mattstrapp.net>2024-10-30 15:01:13 -0500
committerGitHub <noreply@github.com>2024-10-30 15:01:13 -0500
commit7fb5261783bc975fdde6894a8c7f4ef778a19189 (patch)
tree34fcb0ba4055382a5bf5093661e39ec8eccf5bbd
parentdocs: Fix error in .NET example (diff)
downloadlocusts-7fb5261783bc975fdde6894a8c7f4ef778a19189.tar
locusts-7fb5261783bc975fdde6894a8c7f4ef778a19189.tar.gz
locusts-7fb5261783bc975fdde6894a8c7f4ef778a19189.tar.bz2
locusts-7fb5261783bc975fdde6894a8c7f4ef778a19189.tar.lz
locusts-7fb5261783bc975fdde6894a8c7f4ef778a19189.tar.xz
locusts-7fb5261783bc975fdde6894a8c7f4ef778a19189.tar.zst
locusts-7fb5261783bc975fdde6894a8c7f4ef778a19189.zip
feat: Ruby (#33)
* bundle gem locusts Signed-off-by: Matt Strapp <matt@mattstrapp.net> * Add changeset and flesh out gemspec Signed-off-by: Matt Strapp <matt@mattstrapp.net> * Oops Signed-off-by: Matt Strapp <matt@mattstrapp.net> * nothing Signed-off-by: Matt Strapp <matt@mattstrapp.net> * actually draw the owl Signed-off-by: Matt Strapp <matt@mattstrapp.net> * oops Signed-off-by: Matt Strapp <matt@mattstrapp.net> * oops 2 Signed-off-by: Matt Strapp <matt@mattstrapp.net> --------- Signed-off-by: Matt Strapp <matt@mattstrapp.net>
Diffstat (limited to '')
-rw-r--r--.changeset/cold-tomatoes-prove.md5
-rw-r--r--.github/dependabot.yml9
-rw-r--r--.github/workflows/ruby.yml81
-rw-r--r--.gitignore60
-rw-r--r--.standard.yml3
-rw-r--r--Gemfile12
-rw-r--r--Gemfile.lock63
-rw-r--r--README.md2
-rw-r--r--Rakefile15
-rw-r--r--docs/JVM.md2
-rw-r--r--docs/JavaScript.md23
-rw-r--r--docs/Ruby.md25
-rw-r--r--locusts.gemspec43
-rw-r--r--src/locusts.rb14
-rw-r--r--tests/test_helper.rb7
-rw-r--r--tests/test_locusts.rb10
16 files changed, 371 insertions, 3 deletions
diff --git a/.changeset/cold-tomatoes-prove.md b/.changeset/cold-tomatoes-prove.md
new file mode 100644
index 0000000..7e787c9
--- /dev/null
+++ b/.changeset/cold-tomatoes-prove.md
@@ -0,0 +1,5 @@
+---
+"locusts": major
+---
+
+feat: Add Ruby
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 556ccc5..998ee1a 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -68,3 +68,12 @@ updates:
applies-to: version-updates
patterns:
- "*"
+ - package-ecosystem: "bundler"
+ directory: "/"
+ schedule:
+ interval: "daily"
+ groups:
+ ruby-dependencies:
+ applies-to: version-updates
+ patterns:
+ - "*" \ No newline at end of file
diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml
new file mode 100644
index 0000000..cbe07e1
--- /dev/null
+++ b/.github/workflows/ruby.yml
@@ -0,0 +1,81 @@
+name: Ruby
+
+on:
+ push:
+ paths:
+ - "**.rb"
+ - "**.gemspec"
+ - "Gemfile"
+ - "Gemfile.lock"
+ - "Rakefile"
+ - ".github/workflows/ruby.yml"
+ pull_request:
+ paths:
+ - "**.rb"
+ - "**.gemspec"
+ - "Gemfile"
+ - "Gemfile.lock"
+ - "Rakefile"
+ - ".github/workflows/ruby.yml"
+
+jobs:
+ build-and-test:
+ runs-on: ubuntu-latest
+ name: Ruby
+ steps:
+ - uses: actions/checkout@v4
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: 3.3
+ bundler-cache: true
+ - name: Build and test with Rake
+ run: bundle exec rake
+
+ publish-preview:
+ runs-on: ubuntu-latest
+ needs: build-and-test
+ if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
+ name: Publish Preview to GitHub Package Registry
+ permissions:
+ packages: write
+ contents: read
+ steps:
+ - uses: actions/checkout@v4
+ - name: Set version to pre-release
+ run: sed "s/$(jq -r .version package.json)/$(jq -r .version package.json).pre/" locusts.gemspec -i
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: 3.3
+ bundler-cache: true
+ - name: Build gem
+ run: bundle exec rake build
+ - name: Set up GitHub Package Registry for RubyGems
+ run: |
+ mkdir -p ~/.gem
+ touch ~/.gem/credentials
+ chmod 0600 ~/.gem/credentials
+ echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" >> ~/.gem/credentials
+ - name: Publish gem
+ run: gem push --key github --host https://rubygems.pkg.github.com/locusts-r-us pkg/*.gem
+
+ publish-release:
+ name: Push gem to RubyGems.org
+ needs: build-and-test
+ if: ${{ github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/') }}
+ runs-on: ubuntu-latest
+ permissions:
+ id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
+ steps:
+ # Set up
+ - uses: actions/checkout@v4
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ bundler-cache: true
+ ruby-version: 3.3
+ - name: Build gem
+ run: bundle exec rake build
+ - name: Publish gem
+ run: gem push pkg/*.gem \ No newline at end of file
diff --git a/.gitignore b/.gitignore
index fe91aba..211c610 100644
--- a/.gitignore
+++ b/.gitignore
@@ -999,4 +999,62 @@ gradle-app.setting
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
-.classpath \ No newline at end of file
+.classpath
+
+# Ruby
+*.gem
+*.rbc
+/.config
+/coverage/
+/InstalledFiles
+/pkg/
+/spec/reports/
+/spec/examples.txt
+/test/tmp/
+/test/version_tmp/
+/tmp/
+
+# Used by dotenv library to load environment variables.
+# .env
+
+# Ignore Byebug command history file.
+.byebug_history
+
+## Specific to RubyMotion:
+.dat*
+.repl_history
+build/
+*.bridgesupport
+build-iPhoneOS/
+build-iPhoneSimulator/
+
+## Specific to RubyMotion (use of CocoaPods):
+#
+# We recommend against adding the Pods directory to your .gitignore. However
+# you should judge for yourself, the pros and cons are mentioned at:
+# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
+#
+# vendor/Pods/
+
+## Documentation cache and generated files:
+/.yardoc/
+/_yardoc/
+/doc/
+/rdoc/
+
+## Environment normalization:
+/.bundle/
+/vendor/bundle
+/lib/bundler/man/
+
+# for a library or gem, you might want to ignore these files since the code is
+# intended to run in multiple environments; otherwise, check them in:
+# Gemfile.lock
+# .ruby-version
+# .ruby-gemset
+
+# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
+.rvmrc
+
+# Used by RuboCop. Remote config files pulled in from inherit_from directive.
+# .rubocop-https?--* \ No newline at end of file
diff --git a/.standard.yml b/.standard.yml
new file mode 100644
index 0000000..6d67c99
--- /dev/null
+++ b/.standard.yml
@@ -0,0 +1,3 @@
+# For available configuration options, see:
+# https://github.com/standardrb/standard
+ruby_version: 3.0
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..762ef72
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+source "https://rubygems.org"
+
+# Specify your gem's dependencies in locusts.gemspec
+gemspec
+
+gem "rake", "~> 13.0"
+
+gem "minitest", "~> 5.16"
+
+gem "standard", "~> 1.3"
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 0000000..0862d4f
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,63 @@
+PATH
+ remote: .
+ specs:
+ locusts (0.0.0)
+
+GEM
+ remote: https://rubygems.org/
+ specs:
+ ast (2.4.2)
+ json (2.7.5)
+ language_server-protocol (3.17.0.3)
+ lint_roller (1.1.0)
+ minitest (5.25.1)
+ parallel (1.26.3)
+ parser (3.3.5.0)
+ ast (~> 2.4.1)
+ racc
+ racc (1.8.1)
+ rainbow (3.1.1)
+ rake (13.2.1)
+ regexp_parser (2.9.2)
+ rubocop (1.66.1)
+ json (~> 2.3)
+ language_server-protocol (>= 3.17.0)
+ parallel (~> 1.10)
+ parser (>= 3.3.0.2)
+ rainbow (>= 2.2.2, < 4.0)
+ regexp_parser (>= 2.4, < 3.0)
+ rubocop-ast (>= 1.32.2, < 2.0)
+ ruby-progressbar (~> 1.7)
+ unicode-display_width (>= 2.4.0, < 3.0)
+ rubocop-ast (1.33.0)
+ parser (>= 3.3.1.0)
+ rubocop-performance (1.22.1)
+ rubocop (>= 1.48.1, < 2.0)
+ rubocop-ast (>= 1.31.1, < 2.0)
+ ruby-progressbar (1.13.0)
+ standard (1.41.1)
+ language_server-protocol (~> 3.17.0.2)
+ lint_roller (~> 1.0)
+ rubocop (~> 1.66.0)
+ standard-custom (~> 1.0.0)
+ standard-performance (~> 1.5)
+ standard-custom (1.0.2)
+ lint_roller (~> 1.0)
+ rubocop (~> 1.50)
+ standard-performance (1.5.0)
+ lint_roller (~> 1.1)
+ rubocop-performance (~> 1.22.0)
+ unicode-display_width (2.6.0)
+
+PLATFORMS
+ ruby
+ x86_64-linux
+
+DEPENDENCIES
+ locusts!
+ minitest (~> 5.16)
+ rake (~> 13.0)
+ standard (~> 1.3)
+
+BUNDLED WITH
+ 2.5.22
diff --git a/README.md b/README.md
index ddd63da..374881e 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,7 @@ We here at Locusts-R-Us have developed a series of libraries for all sorts of pr
## Packages
[![Crates.io Version](https://img.shields.io/crates/v/locusts?style=for-the-badge&logo=rust&color=%23f74b00)](https://crates.io/crates/locusts)
+[![Gem Version](https://img.shields.io/gem/v/locusts?style=for-the-badge&logo=rubygems&logoColor=%23E9573F)](https://rubygems.org/gems/locusts)
[![Docker Image Version](https://img.shields.io/docker/v/rosstheross/locusts?sort=semver&style=for-the-badge&logo=docker&logoColor=%232496ED)](https://hub.docker.com/r/rosstheross/locusts)
[![go.mod Version](https://img.shields.io/github/go-mod/go-version/locusts-r-us/locusts?style=for-the-badge&logo=go&color=%2300ADD8)](https://pkg.go.dev/github.com/locusts-r-us/locusts)
[![Hex.pm Version](https://img.shields.io/hexpm/v/locusts?style=for-the-badge&logo=elixir&color=%234B275F)](https://hex.pm/packages/locusts)
@@ -60,6 +61,7 @@ See the [CONTRIBUTING.md](./CONTRIBUTING.md) file for more information.
- [JavaScript/TypeScript](./docs/JavaScript.md)
- [BEAM](./docs/BEAM.md)
- [JVM](./docs/JVM.md)
+- [Ruby](./docs/Ruby.md)
### Not a language but still supported
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000..d2ceb45
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+require "bundler/gem_tasks"
+require "minitest/test_task"
+
+Minitest::TestTask.create(:test) do |t|
+ t.libs << "tests"
+ t.libs << "src"
+ t.warning = false
+ t.test_globs = ["tests/**/test_*.rb"]
+end
+
+require "standard/rake"
+
+task default: %i[test standard]
diff --git a/docs/JVM.md b/docs/JVM.md
index 18b3afc..a0d4cda 100644
--- a/docs/JVM.md
+++ b/docs/JVM.md
@@ -2,4 +2,4 @@
[![CI](https://github.com/locusts-r-us/locusts/actions/workflows/jvm.yml/badge.svg)](https://github.com/locusts-r-us/locusts/actions/workflows/jvm.yml)
-TODO: Fill out this README.md with information about the JVM library. \ No newline at end of file
+TODO: Fill out this README.md with information about the JVM library.
diff --git a/docs/JavaScript.md b/docs/JavaScript.md
index 4b6a90b..5e7bdc0 100644
--- a/docs/JavaScript.md
+++ b/docs/JavaScript.md
@@ -1,4 +1,4 @@
-# TODO
+# Locusts
[![CI](https://github.com/locusts-r-us/locusts/actions/workflows/node.yml/badge.svg)](https://github.com/locusts-r-us/locusts/actions/workflows/node.yml)
[![NPM Version](https://img.shields.io/npm/v/locusts?logo=npm&label=NPM%20Package)](https://www.npmjs.com/package/locusts)
@@ -6,3 +6,24 @@
[![Deno](https://github.com/locusts-r-us/locusts/actions/workflows/deno.yml/badge.svg)](https://github.com/locusts-r-us/locusts/actions/workflows/deno.yml)
[![JSR](https://jsr.io/badges/@locusts-r-us/locusts)](https://jsr.io/@locusts-r-us/locusts)
+## Description
+
+Locusts is a series of libraries that allows you to introduce locusts into your codebase.
+Why would you want to do that? I don't know.
+
+## Installation
+
+```sh
+npm add locusts
+```
+
+## Example
+
+```javascript
+import introduceLocusts from 'locusts';
+
+function main() {
+ introduceLocusts();
+ // Locusts are now in your codebase!
+}
+```
diff --git a/docs/Ruby.md b/docs/Ruby.md
new file mode 100644
index 0000000..c79057a
--- /dev/null
+++ b/docs/Ruby.md
@@ -0,0 +1,25 @@
+# locusts
+
+[![CI](https://github.com/locusts-r-us/locusts/actions/workflows/main.yml/badge.svg)](https://github.com/locusts-r-us/locusts/actions/workflows/main.yml)
+![Gem Version](https://img.shields.io/gem/v/locusts?logo=ruby)
+
+## Description
+
+locusts is a library that provides a way to introduce locusts into your code.
+
+## Installation
+
+```sh
+bundle add locusts
+```
+
+## Example
+
+```ruby
+require 'locusts'
+
+def main
+ locusts.introduceLocusts
+ # Locusts are now in your codebase!
+end
+```
diff --git a/locusts.gemspec b/locusts.gemspec
new file mode 100644
index 0000000..75b0e6b
--- /dev/null
+++ b/locusts.gemspec
@@ -0,0 +1,43 @@
+# frozen_string_literal: true
+
+Gem::Specification.new do |spec|
+ spec.name = "locusts"
+ spec.version = "0.0.0"
+ spec.authors = ["Matt Strapp"]
+ spec.email = ["matt@mattstrapp.net"]
+
+ spec.summary = "A Ruby library that introduces locusts to your codebase."
+ # spec.description = "TODO: Write a longer description or delete this line."
+ spec.homepage = "https://github.com/locusts-r-us/locusts"
+ spec.required_ruby_version = ">= 1.6.7"
+ spec.license = "0BSD"
+
+ # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
+
+ spec.metadata = {
+ "bug_tracker_uri" => "#{spec.homepage}/issues",
+ # "changelog_uri" => "#{spec.homepage}/blob/m/CHANGELOG.md",
+ "documentation_uri" => spec.homepage.to_s,
+ "homepage_uri" => spec.homepage.to_s,
+ "source_code_uri" => spec.homepage.to_s
+ }
+
+ # Specify which files should be added to the gem when it is released.
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
+ gemspec = File.basename(__FILE__)
+ spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls|
+ ls.readlines("\x0", chomp: true).reject do |f|
+ (f == gemspec) ||
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile])
+ end
+ end
+ spec.bindir = "dist"
+ # spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
+ spec.require_paths = ["src"]
+
+ # Uncomment to register a new dependency of your gem
+ # spec.add_dependency "example-gem", "~> 1.0"
+
+ # For more information and examples about making a new gem, check out our
+ # guide at: https://bundler.io/guides/creating_gem.html
+end
diff --git a/src/locusts.rb b/src/locusts.rb
new file mode 100644
index 0000000..f4bcbd9
--- /dev/null
+++ b/src/locusts.rb
@@ -0,0 +1,14 @@
+# typed: true
+# frozen_string_literal: true
+
+module Locusts
+ class Locusts
+ # Add locusts into your codebase.
+ # Note that locusts are not included with this package, you must provide your own.
+ #
+ # @return [nil]
+ def self.introduceLocusts
+ nil
+ end
+ end
+end
diff --git a/tests/test_helper.rb b/tests/test_helper.rb
new file mode 100644
index 0000000..f390cdd
--- /dev/null
+++ b/tests/test_helper.rb
@@ -0,0 +1,7 @@
+# typed: strict
+# frozen_string_literal: true
+
+$LOAD_PATH.unshift File.expand_path("../src", __dir__)
+require "locusts"
+
+require "minitest/autorun"
diff --git a/tests/test_locusts.rb b/tests/test_locusts.rb
new file mode 100644
index 0000000..d2e8811
--- /dev/null
+++ b/tests/test_locusts.rb
@@ -0,0 +1,10 @@
+# typed: true
+# frozen_string_literal: true
+
+require "test_helper"
+
+class TestLocusts < Minitest::Test
+ def test_it_does_something_useful
+ assert_nil ::Locusts::Locusts.introduceLocusts
+ end
+end