Compare commits

..

No commits in common. "main" and "v0.1.2" have entirely different histories.
main ... v0.1.2

17 changed files with 180 additions and 119 deletions

82
.circleci/config.yml Normal file
View file

@ -0,0 +1,82 @@
version: 2.1
executors:
ruby:
parameters:
version:
description: "Ruby version number"
default: "3.2.0"
type: string
docker:
- image: cimg/ruby:<< parameters.version >>
commands:
bundle_install:
description: Install Ruby dependencies with Bundler
parameters:
version:
description: "Ruby version number"
default: "3.2.0"
type: string
steps:
- restore_cache:
keys:
- bundle-v1-{{ arch }}-<< parameters.version >>
- run:
name: Install Ruby Dependencies
command: |
gem install bundler -v 2.4.3 --conservative --no-document
bundle config --local path vendor/bundle
bundle check || (bundle install --jobs=4 --retry=3 && bundle clean)
- save_cache:
paths:
- ./vendor/bundle
key: bundle-v1-{{ arch }}-<< parameters.version >>-{{ checksum "Gemfile.lock" }}
jobs:
rubocop:
executor: ruby
steps:
- checkout
- bundle_install
- run: bundle exec rubocop
test:
parameters:
version:
description: "Ruby version number"
default: "3.2.0"
type: string
executor:
name: ruby
version: << parameters.version >>
steps:
- checkout
- bundle_install:
version: << parameters.version >>
- run: bundle exec rake test TESTOPTS="--ci-dir=./reports"
- store_test_results:
path: ./reports
workflows:
version: 2
commit-workflow:
jobs:
- rubocop
- test:
matrix:
parameters:
version: ["2.7.5", "3.0.3", "3.1.3", "3.2.0"]
cron-workflow:
jobs:
- rubocop
- test:
matrix:
parameters:
version: ["2.7.5", "3.0.3", "3.1.3", "3.2.0"]
triggers:
- schedule:
cron: "0 13 * * 6"
filters:
branches:
only:
- main

View file

@ -1,53 +0,0 @@
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
ruby-version: 4.0.0
- name: Cache Ruby gems
uses: actions/cache@v5
with:
path: vendor/bundle
key: ${{ runner.os }}-bundle-4.0.0-${{ hashFiles('Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-bundle-4.0.0-
- name: Install dependencies
run: |
bundle config set --local path vendor/bundle
bundle install --jobs 8 --retry 3
- name: Run RuboCop
run: bundle exec rubocop
test:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ["3.2.9", "3.3.10", "3.4.8", "4.0.0"]
steps:
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- name: Cache Ruby gems
uses: actions/cache@v5
with:
path: vendor/bundle
key: ${{ runner.os }}-bundle-${{ matrix.ruby-version }}-${{ hashFiles('Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-bundle-${{ matrix.ruby-version }}-
- name: Install dependencies
run: |
bundle config set --local path vendor/bundle
bundle install --jobs 8 --retry 3
- name: Run tests
run: bundle exec rake test

View file

@ -38,11 +38,11 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@ -53,7 +53,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v4
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
@ -67,4 +67,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
uses: github/codeql-action/analyze@v2

View file

@ -9,6 +9,6 @@ jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v6
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

1
.gitignore vendored
View file

@ -11,4 +11,3 @@ ext/**/Makefile
ext/**/*.o
**/wordexp*.bundle
*.gem
Gemfile.lock

View file

@ -1,10 +1,6 @@
plugins:
- rubocop-minitest
- rubocop-rake
AllCops:
NewCops: enable
TargetRubyVersion: 3.0
TargetRubyVersion: 2.7
Layout/EmptyLineAfterGuardClause:
Enabled: false

View file

@ -1 +0,0 @@
4.0.1

View file

@ -4,21 +4,6 @@
[gh]: https://github.com/samsonjs/wordexp/releases
# 0.2.2
# 2026-01-02
- Build the native extension under `wordexp/` so `require "wordexp/wordexp_ext"` resolves correctly
# 0.2.1
# 2026-01-02
- Ship source-only gem artifacts to ensure the native extension is built locally
# 0.2.0
# 2023-10-05
- Drop support for Ruby 2.7 because it's no longer supported
# 0.1.2
# 2023-01-08

16
Gemfile
View file

@ -1,13 +1,13 @@
source 'https://rubygems.org'
gemspec
gem 'minitest', '~> 6.0'
gem 'minitest', '~> 5.16'
gem 'minitest-ci', '~> 3.4'
gem 'minitest-reporters', '~> 1.6'
gem 'rake', '~> 13.3'
gem 'minitest-reporters', '~> 1.3'
gem 'rake', '~> 13.0'
gem 'rake-compiler', '~> 1.2'
gem 'rubocop', '~> 1.81'
gem 'rubocop-minitest', '~> 0.38'
gem 'rubocop-packaging', '~> 0.5'
gem 'rubocop-performance', '~> 1.26'
gem 'rubocop-rake', '~> 0.6'
gem 'rubocop', '1.42.0'
gem 'rubocop-minitest', '0.25.1'
gem 'rubocop-packaging', '0.5.2'
gem 'rubocop-performance', '1.15.2'
gem 'rubocop-rake', '0.6.0'

72
Gemfile.lock Normal file
View file

@ -0,0 +1,72 @@
PATH
remote: .
specs:
wordexp (0.1.1)
GEM
remote: https://rubygems.org/
specs:
ansi (1.5.0)
ast (2.4.2)
builder (3.2.4)
json (2.6.3)
minitest (5.17.0)
minitest-ci (3.4.0)
minitest (>= 5.0.6)
minitest-reporters (1.5.0)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
parallel (1.22.1)
parser (3.2.0.0)
ast (~> 2.4.1)
rainbow (3.1.1)
rake (13.0.6)
rake-compiler (1.2.1)
rake
regexp_parser (2.6.1)
rexml (3.2.5)
rubocop (1.42.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.2.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.24.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.24.1)
parser (>= 3.1.1.0)
rubocop-minitest (0.25.1)
rubocop (>= 0.90, < 2.0)
rubocop-packaging (0.5.2)
rubocop (>= 1.33, < 2.0)
rubocop-performance (1.15.2)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
ruby-progressbar (1.11.0)
unicode-display_width (2.4.2)
PLATFORMS
arm64-darwin-21
x86_64-linux
DEPENDENCIES
minitest (~> 5.16)
minitest-ci (~> 3.4)
minitest-reporters (~> 1.3)
rake (~> 13.0)
rake-compiler (~> 1.2)
rubocop (= 1.42.0)
rubocop-minitest (= 0.25.1)
rubocop-packaging (= 0.5.2)
rubocop-performance (= 1.15.2)
rubocop-rake (= 0.6.0)
wordexp!
BUNDLED WITH
2.4.3

View file

@ -1,8 +1,8 @@
# wordexp
[![Gem Version](https://badge.fury.io/rb/wordexp.svg)](https://rubygems.org/gems/wordexp)
[![CI](https://github.com/samsonjs/wordexp/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/samsonjs/wordexp/actions/workflows/ci.yml?query=branch%3Amain)
[![0 dependencies!](https://0dependencies.dev/0dependencies.svg)](https://0dependencies.dev)
[![Circle](https://circleci.com/gh/samsonjs/wordexp/tree/main.svg?style=shield)](https://app.circleci.com/pipelines/github/samsonjs/wordexp?branch=main)
[![Code Climate Maintainability](https://api.codeclimate.com/v1/badges/21cc24badf15d19b5cec/maintainability)](https://codeclimate.com/github/samsonjs/wordexp/maintainability)
A Ruby gem for performing shell word expansion using [wordexp][]. It's like [Shellwords][] turned up to 11. Not only does it split taking quotes into account, but it also expands environment variables and tildes, and runs subcommands in `` `backticks` `` or `$(dollar parentheses)`.

View file

@ -1,11 +1,10 @@
require 'bundler/gem_tasks'
require 'English'
require 'minitest/test_task'
require 'open3'
require 'rake/extensiontask'
require 'rake/testtask'
require 'rubocop/rake_task'
desc 'Clean build files'
task :clean do
`cd ext/wordexp_ext && make clean && rm -f Makefile`
end
@ -14,11 +13,10 @@ Rake::ExtensionTask.new 'wordexp_ext' do |ext|
ext.lib_dir = 'lib/wordexp'
end
Minitest::TestTask.create(test: :compile) do |t|
Rake::TestTask.new(test: :compile) do |t|
t.libs << 'test'
t.libs << 'lib'
t.warning = false
t.test_globs = ['test/**/*_test.rb']
t.test_files = FileList['test/**/*_test.rb']
end
RuboCop::RakeTask.new
@ -32,14 +30,12 @@ Rake::Task['release'].enhance do
system 'open https://github.com/samsonjs/wordexp/releases'
end
desc 'Set environment variable OVERCOMMIT_DISABLE to 1'
task :disable_overcommit do
ENV['OVERCOMMIT_DISABLE'] = '1'
end
Rake::Task[:build].enhance [:disable_overcommit]
desc 'Ensure that files in the gemspec are tracked with git'
task :verify_gemspec_files do
git_files = `git ls-files -z`.split("\x0")
ext_files = Dir['**/*.bundle']
@ -66,14 +62,12 @@ Rake::Task[:build].enhance [:verify_gemspec_files]
task bump: %w[bump:bundler bump:ruby bump:year]
namespace :bump do
desc 'Update to the latest bundler version in .circleci/config.yml and Gemfile.lock'
task :bundler do
version = Gem.latest_version_for('bundler').to_s
replace_in_file '.circleci/config.yml', /bundler -v (\S+)/ => version
replace_in_file 'Gemfile.lock', /^BUNDLED WITH\n\s+(\d\S+)$/ => version
end
desc 'Update ruby versions in wordexp.gemspec, .rubocop.yml, and .circleci/config.yml'
task :ruby do
lowest = RubyVersions.lowest_supported
lowest_minor = RubyVersions.lowest_supported_minor
@ -86,7 +80,6 @@ namespace :bump do
replace_in_file '.circleci/config.yml', /version: (\[.+\])/ => latest_patches.inspect
end
desc 'Update to the latest year in LICENSE.txt'
task :year do
replace_in_file 'LICENSE.txt', /\(c\) (\d+)/ => Date.today.year.to_s
end

View file

@ -1,3 +1,3 @@
require 'mkmf'
create_makefile 'wordexp/wordexp_ext'
create_makefile 'wordexp_ext/wordexp_ext'

View file

@ -1,3 +1,3 @@
module Wordexp
VERSION = '0.2.2'.freeze
VERSION = '0.1.2'.freeze
end

View file

@ -1,6 +1,2 @@
# Generate XML test reports that can be parsed by CircleCI
if ENV['CIRCLECI']
require 'minitest/ci'
Minitest::Ci.report_dir = './reports'
end
require 'minitest/ci' if ENV['CIRCLECI']

View file

@ -3,4 +3,4 @@ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'wordexp'
require 'minitest/autorun'
Dir[File.expand_path('support/**/*.rb', __dir__)].each { |rb| require(rb) }
Dir[File.expand_path('support/**/*.rb', __dir__)].sort.each { |rb| require(rb) }

View file

@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
spec.summary = 'A Ruby gem for performing shell word expansion using wordexp'
spec.homepage = 'https://github.com/samsonjs/wordexp'
spec.license = 'MIT'
spec.required_ruby_version = '>= 3.0.0'
spec.required_ruby_version = '>= 2.7.0'
spec.metadata = {
'bug_tracker_uri' => 'https://github.com/samsonjs/wordexp/issues',
@ -20,16 +20,8 @@ Gem::Specification.new do |spec|
}
# Specify which files should be added to the gem when it is released.
files = `git ls-files -z`.split("\x0")
if files.empty?
glob = %w[LICENSE.txt README.md exe/**/* lib/**/* ext/**/*]
files = Dir.glob(glob).reject do |f|
File.directory?(f) ||
f.end_with?('.bundle', '.o', '.so') ||
f.end_with?('Makefile')
end
end
spec.files = files
glob = %w[LICENSE.txt README.md exe/**/* lib/**/* ext/extconf.rb ext/wordexp_ext.c]
spec.files = Dir.glob(glob).reject { |f| File.directory?(f) }
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.extensions = %w[ext/wordexp_ext/extconf.rb]