Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 42 additions & 37 deletions .github/workflows/test_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,62 @@ name: Test and Release

on:
push:
branches:
branches:
- main

jobs:
tests:
strategy:
matrix:
ruby: [2.6, 2.7, 3.0]
ruby: [3.2, 3.3, 3.4, 4.0]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run linter
run: bundle exec rubocop
- name: Run tests
run: bundle exec rspec
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run linter
run: bundle exec rubocop
- name: Run tests
run: bundle exec rspec
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install yarn dep
run: yarn install
- name: Check prettier
run: yarn prettier -c '**/*.rb'
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4
bundler-cache: true
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Install yarn dep
run: yarn install
- name: Check prettier
run: yarn prettier -c '**/*.rb' '!vendor/**'
release:
needs: [tests, prettier]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
bundler-cache: true
- name: Prepare credentials
env:
RUBYGEM_KEY: ${{ secrets.RUBYGEM_KEY }}
run: "mkdir -p ~/.gem && echo -e \"---\\r\\n:rubygems_api_key: $RUBYGEM_KEY\" > ~/.gem/credentials && chmod 0600 ~/.gem/credentials"
- name: Setup username/email
run: "git config --global user.email zaratan@hey.com && git config --global user.name \"Denis <Zaratan> Pasin\""
- name: Fetch tags from remote
run: "git fetch -t"
- name: Publish if version change
run: 'git diff `git tag | tail -1` -- lib/dev_oops/version.rb | grep -E "^\+.*VERSION" && rake release || echo "No release for now"'
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4
bundler-cache: true
- name: Prepare credentials
env:
RUBYGEM_KEY: ${{ secrets.RUBYGEM_KEY }}
run: "mkdir -p ~/.gem && echo -e \"---\\r\\n:rubygems_api_key: $RUBYGEM_KEY\" > ~/.gem/credentials && chmod 0600 ~/.gem/credentials"
- name: Setup username/email
run: 'git config --global user.email zaratan@hey.com && git config --global user.name "Denis <Zaratan> Pasin"'
- name: Fetch tags from remote
run: "git fetch -t"
- name: Publish if version change
run: 'git diff `git tag | tail -1` -- lib/dev_oops/version.rb | grep -E "^\+.*VERSION" && rake release || echo "No release for now"'
47 changes: 26 additions & 21 deletions .github/workflows/test_only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,41 @@ name: Tests

on:
push:
branches-ignore:
branches-ignore:
- main

jobs:
tests:
strategy:
matrix:
ruby: [2.6, 2.7, 3.0]
ruby: [3.2, 3.3, 3.4, 4.0]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run linter
run: bundle exec rubocop
- name: Run tests
run: bundle exec rspec
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run linter
run: bundle exec rubocop
- name: Run tests
run: bundle exec rspec
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install yarn dep
run: yarn install
- name: Check prettier
run: yarn prettier -c '**/*.rb'
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4
bundler-cache: true
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Install yarn dep
run: yarn install
- name: Check prettier
run: yarn prettier -c '**/*.rb' '!vendor/**'
2 changes: 1 addition & 1 deletion .github/workflows/verify_version_change.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Fetch main branch
run: git fetch origin main:main
- name: Verify if there's a change in version
Expand Down
6 changes: 3 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
inherit_from:
- http://relaxed.ruby.style/rubocop.yml
- ./.rubocop-http---relaxed-ruby-style-rubocop-yml

inherit_gem:
prettier: rubocop.yml

require:
plugins:
- rubocop-performance

AllCops:
Expand All @@ -14,7 +14,7 @@ AllCops:
SuggestExtensions: false
Exclude:
- "bin/*"
- 'vendor/**/*'
- "vendor/**/*"
- "node_modules/**/*"

Gemspec/RequiredRubyVersion:
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0
3.4.7
15 changes: 12 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.3.1] - 2025-12-17

Accepting boolean args

### Added

- boolean args are supported

## [0.2.0] - 2021-04-03

Refactoring architecture + Basic Documentation
Expand All @@ -27,6 +35,7 @@ First working version

- All the things

[unreleased]: https://github.com/zaratan/dev_oops/compare/v0.2.0...HEAD
[0.2.0]: https://github.com/zaratan/rspec_in_context/releases/tag/v0.2.0
[0.1.1]: https://github.com/zaratan/rspec_in_context/releases/tag/v0.1.1
[unreleased]: https://github.com/zaratan/dev_oops/compare/v0.3.1...HEAD
[0.3.1]: https://github.com/zaratan/dev_oops/compare/v0.2.0...v0.3.1
[0.2.0]: https://github.com/zaratan/dev_oops/releases/tag/v0.2.0
[0.1.1]: https://github.com/zaratan/dev_oops/releases/tag/v0.1.1
13 changes: 10 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# frozen_string_literal: true

source 'https://rubygems.org'
source "https://rubygems.org"

# Specify your gem's dependencies in dev_oops.gemspec
gemspec

gem 'rake', '~> 12.0'
gem 'rspec', '~> 3.0'
gem "bundler"
gem "bundler-audit", "> 0.6.0"
gem "prettier"
gem "pry-byebug"
gem "rake"
gem "rspec"
gem "rubocop"
gem "rubocop-performance"
gem "solargraph"
44 changes: 17 additions & 27 deletions dev_oops.gemspec
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
# frozen_string_literal: true

require_relative 'lib/dev_oops/version'
require_relative "lib/dev_oops/version"

Gem::Specification.new do |spec|
spec.name = 'dev_oops'
spec.name = "dev_oops"
spec.version = DevOops::VERSION
spec.authors = ['Denis <Zaratan> Pasin']
spec.email = ['zaratan@hey.com']
spec.authors = ["Denis <Zaratan> Pasin"]
spec.email = ["zaratan@hey.com"]

spec.summary = 'Shell snipets manager'
spec.summary = "Shell snipets manager"
spec.description =
'Shell snipets manager for those scripts you end up copy pasting over and over'
spec.homepage = 'https://zaratan.fr'
spec.license = 'MIT'
spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
"Shell snipets manager for those scripts you end up copy pasting over and over"
spec.homepage = "https://zaratan.fr"
spec.license = "MIT"
spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")

spec.metadata['homepage_uri'] = spec.homepage
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["rubygems_mfa_required"] = "true"

# spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
Expand All @@ -24,24 +25,13 @@ Gem::Specification.new do |spec|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files =
Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
`git ls-files -z`.split("\x0")
.reject { |f| f.match(%r{^(test|spec|features)/}) }
end
spec.bindir = 'exe'
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
spec.require_paths = ["lib"]

spec.add_runtime_dependency 'thor'
spec.add_runtime_dependency 'zeitwerk'

spec.add_development_dependency 'bundler'
spec.add_development_dependency 'bundler-audit', '> 0.6.0'
spec.add_development_dependency 'prettier'
spec.add_development_dependency 'pry-byebug'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'rubocop-performance'
spec.add_development_dependency 'solargraph'
spec.add_dependency "thor"
spec.add_dependency "zeitwerk"
end
19 changes: 19 additions & 0 deletions dev_oops/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"desc": "Example command to demonstrate the gem usage",
"usage": "example [boolean_flag] [--test_me|-t]",
"args": [
{
"name": "boolean_flag",
"desc": "A boolean flag to demonstrate functionality",
"aliases": ["b"],
"required": false,
"boolean": true
},
{
"name": "test_me",
"desc": "An optional flag to test the command",
"aliases": ["t"],
"required": false
}
]
}
13 changes: 13 additions & 0 deletions dev_oops/example.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if [[ $test_me == "yes" ]]; then
echo "Test me is set to yes"
else
echo "Test me is not set to yes"
fi

if [[ -z $boolean_flag ]]; then
echo "Boolean flag is not set"
else
echo "Boolean flag is set to $boolean_flag"
fi

echo "This is an example script."
10 changes: 5 additions & 5 deletions lib/dev_oops.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# frozen_string_literal: true

require 'dev_oops/version'
require "dev_oops/version"

require 'fileutils'
require 'json'
require 'thor'
require "fileutils"
require "json"
require "thor"

require 'zeitwerk'
require "zeitwerk"
loader = Zeitwerk::Loader.for_gem
loader.setup # ready!

Expand Down
8 changes: 4 additions & 4 deletions lib/dev_oops/commands/edit_script.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def self.source_root

argument :script_name
class_option :global,
desc: 'force the script to be global',
aliases: ['g'],
desc: "force the script to be global",
aliases: ["g"],
type: :boolean

def self.banner
Expand All @@ -26,8 +26,8 @@ def edit
ScriptsLoader.script_dir(script_name)
end
path = "#{script_dir}/#{script_name}.json"
template 'templates/empty_script.tt', path unless File.exist?(path)
system("#{ENV['EDITOR'] || 'vim'} #{path}")
template "templates/empty_script.tt", path unless File.exist?(path)
system("#{ENV["EDITOR"] || "vim"} #{path}")
end
end
end
Expand Down
Loading