Add bin and edit workflow
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 9s

This commit is contained in:
2026-09-16 13:11:16 -06:00
parent c8ac4fcae5
commit 4cee170d66
17576 changed files with 895740 additions and 2 deletions
@@ -0,0 +1,5 @@
## [Unreleased]
## [0.1.0] - <%= Time.now.strftime('%F') %>
- Initial release
@@ -0,0 +1,10 @@
# Code of Conduct
<%= config[:name].inspect %> follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
* Participants will be tolerant of opposing views.
* Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
* When interpreting the words and actions of others, participants should always assume good intentions.
* Behaviour which can be reasonably considered harassment will not be tolerated.
If you have any concerns about behaviour within this project, please contact us at [<%= config[:email].inspect %>](mailto:<%= config[:email].inspect %>).
@@ -0,0 +1,13 @@
# This Cargo.toml is here to let externals tools (IDEs, etc.) know that this is
# a Rust project. Your extensions dependencies should be added to the Cargo.toml
# in the ext/ directory.
[workspace]
members = ["./ext/<%= config[:name] %>"]
resolver = "2"
[profile.release]
# By default, debug symbols are stripped from the final binary which makes it
# harder to debug if something goes wrong. It's recommended to keep debug
# symbols in the release build so that you can debug the final binary if needed.
debug = true
@@ -0,0 +1,24 @@
# frozen_string_literal: true
source "https://rubygems.org"
# Specify your gem's dependencies in <%= config[:name] %>.gemspec
gemspec
gem "irb"
gem "rake", "~> 13.0"
<%- if config[:ext] -%>
gem "rake-compiler"
<%- end -%>
<%- if config[:test] -%>
gem "<%= config[:test] %>", "~> <%= config[:test_framework_version] %>"
<%- end -%>
<%- if config[:linter] == "rubocop" -%>
gem "rubocop", "~> <%= config[:linter_version] %>"
<%- elsif config[:linter] == "standard" -%>
gem "standard", "~> <%= config[:linter_version] %>"
<%- end -%>
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) <%= Time.now.year %> <%= config[:author] %>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@@ -0,0 +1,49 @@
# <%= config[:constant_name] %>
TODO: Delete this and the text below, and describe your gem
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/<%= config[:namespaced_path] %>`. To experiment with that code, run `bin/console` for an interactive prompt.
## Installation
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
Install the gem and add to the application's Gemfile by executing:
```bash
bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
```
If bundler is not being used to manage dependencies, install the gem by executing:
```bash
gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
```
## Usage
TODO: Write usage instructions here
## Development
After checking out the repo, run `bin/setup` to install dependencies.<% if config[:test] %> Then, run `rake <%= config[:test_task] %>` to run the tests.<% end %> You can also run `bin/console` for an interactive prompt that will allow you to experiment.<% if config[:bin] %> Run `bundle exec <%= config[:name] %>` to use the gem in this directory, ignoring other installed copies of this gem.<% end %>
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
<% if config[:git] -%>
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/<%= config[:github_username] %>/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/<%= config[:git_default_branch] %>/CODE_OF_CONDUCT.md).<% end %>
<% end -%>
<% if config[:mit] -%>
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
<% end -%>
<% if config[:git] && config[:coc] -%>
## Code of Conduct
Everyone interacting in the <%= config[:constant_name] %> project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/<%= config[:git_default_branch] %>/CODE_OF_CONDUCT.md).
<% end -%>
@@ -0,0 +1,72 @@
# frozen_string_literal: true
require "bundler/gem_tasks"
<% default_task_names = [config[:test_task]].compact -%>
<% case config[:test] -%>
<% when "minitest" -%>
require "minitest/test_task"
Minitest::TestTask.create
<% when "test-unit" -%>
require "rake/testtask"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
end
<% when "rspec" -%>
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
<% end -%>
<% if config[:linter] == "rubocop" -%>
<% default_task_names << :rubocop -%>
require "rubocop/rake_task"
RuboCop::RakeTask.new
<% elsif config[:linter] == "standard" -%>
<% default_task_names << :standard -%>
require "standard/rake"
<% end -%>
<% if config[:ext] -%>
<% default_task_names.unshift(:compile) -%>
<% default_task_names.unshift(:clobber) unless config[:ext] == 'rust' -%>
<% if config[:ext] == 'rust' -%>
require "rb_sys/extensiontask"
task build: :compile
GEMSPEC = Gem::Specification.load("<%= config[:underscored_name] %>.gemspec")
RbSys::ExtensionTask.new(<%= config[:name].inspect %>, GEMSPEC) do |ext|
ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
end
<% else -%>
require "rake/extensiontask"
task build: :compile
GEMSPEC = Gem::Specification.load("<%= config[:underscored_name] %>.gemspec")
Rake::ExtensionTask.new("<%= config[:underscored_name] %>", GEMSPEC) do |ext|
ext.lib_dir = "lib/<%= config[:namespaced_path] %>"
end
<% end -%>
<% if config[:ext] == "go" -%>
require "go_gem/rake_task"
GoGem::RakeTask.new("<%= config[:underscored_name] %>")
<% end -%>
<% end -%>
<% if default_task_names.size == 1 -%>
task default: <%= default_task_names.first.inspect %>
<% else -%>
task default: %i[<%= default_task_names.join(" ") %>]
<% end -%>
@@ -0,0 +1,11 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
require "bundler/setup"
require "<%= config[:namespaced_path] %>"
# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
require "irb"
IRB.start(__FILE__)
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx
bundle install
# Do any other automated setup that you need to do here
@@ -0,0 +1,37 @@
version: 2.1
jobs:
build:
docker:
- image: ruby:<%= RUBY_VERSION %>
<%- if config[:ext] == 'rust' -%>
environment:
RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN: 'true'
<%- end -%>
<%- if config[:ext] == 'go' -%>
environment:
GO_VERSION: '1.23.0'
<%- end -%>
steps:
- checkout
<%- if config[:ext] == 'rust' -%>
- run:
name: Install Rust/Cargo dependencies
command: apt-get update && apt-get install -y clang
- run:
name: Install a RubyGems version that can compile rust extensions
command: gem update --system '<%= ::Gem.rubygems_version %>'
<%- end -%>
<%- if config[:ext] == 'go' -%>
- run:
name: Install Go
command: |
wget https://go.dev/dl/go$GO_VERSION.linux-amd64.tar.gz -O /tmp/go.tar.gz
tar -C /usr/local -xzf /tmp/go.tar.gz
echo 'export PATH=/usr/local/go/bin:"$PATH"' >> "$BASH_ENV"
<%- end -%>
- run:
name: Run the default task
command: |
gem install bundler -v <%= Bundler::VERSION %>
bundle install
bundle exec rake
@@ -0,0 +1,3 @@
#!/usr/bin/env ruby
require "<%= config[:namespaced_path] %>"
@@ -0,0 +1,22 @@
[package]
name = <%= config[:name].inspect %>
version = "0.1.0"
edition = "2021"
authors = ["<%= config[:author] %> <<%= config[:email] %>>"]
<%- if config[:mit] -%>
license = "MIT"
<%- end -%>
publish = false
[lib]
crate-type = ["cdylib"]
[dependencies]
magnus = { version = "0.8.2" }
rb-sys = { version = "0.9", features = ["stable-api-compiled-fallback"] }
[build-dependencies]
rb-sys-env = "0.2.2"
[dev-dependencies]
rb-sys-test-helpers = { version = "0.2.2" }
@@ -0,0 +1,5 @@
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
let _ = rb_sys_env::activate()?;
Ok(())
}
@@ -0,0 +1,10 @@
# frozen_string_literal: true
require "mkmf"
# Makes all symbols private by default to avoid unintended conflict
# with other gems. To explicitly export symbols you can use RUBY_FUNC_EXPORTED
# selectively, or entirely remove this flag.
append_cflags("-fvisibility=hidden")
create_makefile(<%= config[:makefile_path].inspect %>)
@@ -0,0 +1,11 @@
# frozen_string_literal: true
require "mkmf"
require "go_gem/mkmf"
# Makes all symbols private by default to avoid unintended conflict
# with other gems. To explicitly export symbols you can use RUBY_FUNC_EXPORTED
# selectively, or entirely remove this flag.
append_cflags("-fvisibility=hidden")
create_go_makefile(<%= config[:makefile_path].inspect %>)
@@ -0,0 +1,6 @@
# frozen_string_literal: true
require "mkmf"
require "rb_sys/mkmf"
create_rust_makefile(<%= config[:makefile_path].inspect %>)
@@ -0,0 +1,5 @@
module github.com/<%= config[:go_module_username] %>/<%= config[:underscored_name] %>
go 1.23
require github.com/ruby-go-gem/go-gem-wrapper latest
@@ -0,0 +1,2 @@
#include "<%= config[:underscored_name] %>.h"
#include "_cgo_export.h"
@@ -0,0 +1,9 @@
#include "<%= config[:underscored_name] %>.h"
VALUE rb_m<%= config[:constant_array].join %>;
RUBY_FUNC_EXPORTED void
Init_<%= config[:underscored_name] %>(void)
{
rb_m<%= config[:constant_array].join %> = rb_define_module(<%= config[:constant_name].inspect %>);
}
@@ -0,0 +1,31 @@
package main
/*
#include "<%= config[:underscored_name] %>.h"
VALUE rb_<%= config[:underscored_name] %>_sum(VALUE self, VALUE a, VALUE b);
*/
import "C"
import (
"github.com/ruby-go-gem/go-gem-wrapper/ruby"
)
//export rb_<%= config[:underscored_name] %>_sum
func rb_<%= config[:underscored_name] %>_sum(_ C.VALUE, a C.VALUE, b C.VALUE) C.VALUE {
longA := ruby.NUM2LONG(ruby.VALUE(a))
longB := ruby.NUM2LONG(ruby.VALUE(b))
sum := longA + longB
return C.VALUE(ruby.LONG2NUM(sum))
}
//export Init_<%= config[:underscored_name] %>
func Init_<%= config[:underscored_name] %>() {
rb_m<%= config[:constant_array].join %> := ruby.RbDefineModule(<%= config[:constant_name].inspect %>)
ruby.RbDefineSingletonMethod(rb_m<%= config[:constant_array].join %>, "sum", C.rb_<%= config[:underscored_name] %>_sum, 2)
}
func main() {
}
@@ -0,0 +1,6 @@
#ifndef <%= config[:underscored_name].upcase %>_H
#define <%= config[:underscored_name].upcase %>_H 1
#include "ruby.h"
#endif /* <%= config[:underscored_name].upcase %>_H */
@@ -0,0 +1,23 @@
use magnus::{function, prelude::*, Error, Ruby};
pub fn hello(subject: String) -> String {
format!("Hello {subject}, from Rust!")
}
#[magnus::init]
fn init(ruby: &Ruby) -> Result<(), Error> {
let module = ruby.<%= config[:constant_array].map {|c| "define_module(#{c.dump})?"}.join(".") %>;
module.define_singleton_method("hello", function!(hello, 1))?;
Ok(())
}
#[cfg(test)]
mod tests {
use rb_sys_test_helpers::ruby_test;
use super::hello;
#[ruby_test]
fn test_hello() {
assert_eq!("Hello world, from Rust!", hello("world".to_string()));
}
}
@@ -0,0 +1,69 @@
---
name: Build gems
on:
push:
tags:
- "v*"
- "cross-gem/*"
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
ci-data:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.fetch.outputs.result }}
steps:
- uses: oxidize-rb/actions/fetch-ci-data@v1
id: fetch
with:
supported-ruby-platforms: |
exclude: ["arm-linux", "x64-mingw32"]
stable-ruby-versions: |
exclude: ["head"]
source-gem:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Build gem
run: bundle exec rake build
- uses: actions/upload-artifact@v7
with:
name: source-gem
path: pkg/*.gem
cross-gem:
name: Compile native gem for ${{ matrix.platform }}
runs-on: ubuntu-latest
needs: ci-data
strategy:
matrix:
platform: ${{ fromJSON(needs.ci-data.outputs.result).supported-ruby-platforms }}
steps:
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: oxidize-rb/actions/cross-gem@v1
id: cross-gem
with:
platform: ${{ matrix.platform }}
ruby-versions: ${{ join(fromJSON(needs.ci-data.outputs.result).stable-ruby-versions, ',') }}
- uses: actions/upload-artifact@v7
with:
name: cross-gem
path: ${{ steps.cross-gem.outputs.gem-path }}
@@ -0,0 +1,48 @@
name: Ruby
on:
push:
branches:
- <%= config[:git_default_branch] %>
pull_request:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
name: Ruby ${{ matrix.ruby }}
strategy:
matrix:
ruby:
- '<%= RUBY_VERSION %>'
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
<%- if config[:ext] == 'rust' -%>
- name: Set up Ruby & Rust
uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
cargo-cache: true
rubygems: '<%= ::Gem.rubygems_version %>'
<%- else -%>
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
<%- end -%>
<%- if config[:ext] == 'go' -%>
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: ext/<%= config[:underscored_name] %>/go.mod
<%- end -%>
- name: Run the default task
run: bundle exec rake
@@ -0,0 +1,23 @@
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
<%- if config[:ext] -%>
*.bundle
*.so
*.o
*.a
mkmf.log
<%- if config[:ext] == 'rust' -%>
target/
<%- end -%>
<%- end -%>
<%- if config[:test] == "rspec" -%>
# rspec failure tracking
.rspec_status
<%- end -%>
@@ -0,0 +1,27 @@
default:
image: ruby:<%= RUBY_VERSION %>
before_script:
<%- if config[:ext] == 'rust' -%>
- apt-get update && apt-get install -y clang
- gem update --system '<%= ::Gem.rubygems_version %>'
<%- end -%>
<%- if config[:ext] == 'go' -%>
- wget https://go.dev/dl/go$GO_VERSION.linux-amd64.tar.gz -O /tmp/go.tar.gz
- tar -C /usr/local -xzf /tmp/go.tar.gz
- export PATH=/usr/local/go/bin:$PATH
<%- end -%>
- gem install bundler -v <%= Bundler::VERSION %>
- bundle install
example_job:
<%- if config[:ext] == 'rust' -%>
variables:
RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN: 'true'
<%- end -%>
<%- if config[:ext] == 'go' -%>
variables:
GO_VERSION: '1.23.0'
<%- end -%>
script:
- bundle exec rake
@@ -0,0 +1,15 @@
# frozen_string_literal: true
require_relative "<%= File.basename(config[:namespaced_path]) %>/version"
<%- if config[:ext] -%>
require "<%= File.basename(config[:namespaced_path]) %>/<%= config[:underscored_name] %>"
<%- end -%>
<%- config[:constant_array].each_with_index do |c, i| -%>
<%= " " * i %>module <%= c %>
<%- end -%>
<%= " " * config[:constant_array].size %>class Error < StandardError; end
<%= " " * config[:constant_array].size %># Your code goes here...
<%- (config[:constant_array].size-1).downto(0) do |i| -%>
<%= " " * i %>end
<%- end -%>
@@ -0,0 +1,9 @@
# frozen_string_literal: true
<%- config[:constant_array].each_with_index do |c, i| -%>
<%= " " * i %>module <%= c %>
<%- end -%>
<%= " " * config[:constant_array].size %>VERSION = "0.1.0"
<%- (config[:constant_array].size-1).downto(0) do |i| -%>
<%= " " * i %>end
<%- end -%>
@@ -0,0 +1,58 @@
# frozen_string_literal: true
require_relative "lib/<%=config[:namespaced_path]%>/version"
Gem::Specification.new do |spec|
spec.name = <%= config[:name].inspect %>
spec.version = <%= config[:constant_name] %>::VERSION
spec.authors = [<%= config[:author].inspect %>]
spec.email = [<%= config[:email].inspect %>]
spec.summary = "TODO: Write a short summary, because RubyGems requires one."
spec.description = "TODO: Write a longer description or delete this line."
spec.homepage = "<%= config[:homepage_uri] %>"
<%- if config[:mit] -%>
spec.license = "MIT"
<%- end -%>
spec.required_ruby_version = ">= <%= config[:required_ruby_version] %>"
spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "<%= config[:source_code_uri] %>"
<%- if config[:changelog] -%>
spec.metadata["changelog_uri"] = "<%= config[:changelog_uri] %>"
<%- end -%>
# Uncomment the line below to require MFA for gem pushes.
# This helps protect your gem from supply chain attacks by ensuring
# no one can publish a new version without multi-factor authentication.
# See: https://guides.rubygems.org/mfa-requirement-opt-in/
# spec.metadata["rubygems_mfa_required"] = "true"
# 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[<%= config[:ignore_paths].join(" ") %>])
end
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
<%- if %w(c rust go).include?(config[:ext]) -%>
spec.extensions = ["ext/<%= config[:underscored_name] %>/extconf.rb"]
<%- end -%>
# Uncomment to register a new dependency of your gem
# spec.add_dependency "example-gem", "~> 1.0"
<%- if config[:ext] == 'rust' -%>
spec.add_dependency "rb_sys", "~> 0.9.128"
<%- end -%>
<%- if config[:ext] == 'go' -%>
spec.add_dependency "go_gem", "~> 0.2"
<%- end -%>
# For more information and examples about making a new gem, check out our
# guide at: https://guides.rubygems.org/make-your-own-gem/
end
@@ -0,0 +1,3 @@
--format documentation
--color
--require spec_helper
@@ -0,0 +1,8 @@
AllCops:
TargetRubyVersion: <%= ::Gem::Version.new(config[:required_ruby_version]).segments[0..1].join(".") %>
Style/StringLiterals:
EnforcedStyle: double_quotes
Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
@@ -0,0 +1,8 @@
<%- config[:constant_array].each_with_index do |c, i| -%>
<%= " " * i %>module <%= c %>
<%- end -%>
<%= " " * config[:constant_array].size %>VERSION: String
<%= " " * config[:constant_array].size %># See the writing guide of rbs: https://github.com/ruby/rbs#guides
<%- (config[:constant_array].size-1).downto(0) do |i| -%>
<%= " " * i %>end
<%- end -%>
@@ -0,0 +1,19 @@
# frozen_string_literal: true
RSpec.describe <%= config[:constant_name] %> do
it "has a version number" do
expect(<%= config[:constant_name] %>::VERSION).not_to be nil
end
<%- if config[:ext] == 'rust' -%>
it "can call into Rust" do
result = <%= config[:constant_name] %>.hello("world")
expect(result).to be("Hello earth, from Rust!")
end
<%- else -%>
it "does something useful" do
expect(false).to eq(true)
end
<%- end -%>
end
@@ -0,0 +1,15 @@
# frozen_string_literal: true
require "<%= config[:namespaced_path] %>"
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
config.expect_with :rspec do |c|
c.syntax = :expect
end
end
@@ -0,0 +1,3 @@
# For available configuration options, see:
# https://github.com/standardrb/standard
ruby_version: <%= ::Gem::Version.new(config[:required_ruby_version]).segments[0..1].join(".") %>
@@ -0,0 +1,6 @@
# frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "<%= config[:namespaced_path] %>"
require "minitest/autorun"
@@ -0,0 +1,19 @@
# frozen_string_literal: true
require "test_helper"
class <%= config[:minitest_constant_name] %> < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::<%= config[:constant_name] %>::VERSION
end
<%- if config[:ext] == 'rust' -%>
def test_hello_world
assert_equal "Hello earth, from Rust!", <%= config[:constant_name] %>.hello("world")
end
<%- else -%>
def test_it_does_something_useful
assert false
end
<%- end -%>
end
@@ -0,0 +1,15 @@
# frozen_string_literal: true
require "test_helper"
class <%= config[:constant_name] %>Test < Test::Unit::TestCase
test "VERSION" do
assert do
::<%= config[:constant_name] %>.const_defined?(:VERSION)
end
end
test "something useful" do
assert_equal("expected", "actual")
end
end
@@ -0,0 +1,6 @@
# frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "<%= config[:namespaced_path] %>"
require "test-unit"