Skip to content
Merged
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
53 changes: 53 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Ruby

on:
push:
branches:
- main

pull_request:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
name: Test - Ruby ${{ matrix.ruby }}
strategy:
fail-fast: false
matrix:
ruby:
- '3.0'
- '3.1'
- '3.2'
- '3.3'
- '3.4'

steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run the test suite
run: bundle exec rspec

lint:
runs-on: ubuntu-latest
name: Lint (RuboCop)

steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
bundler-cache: true
- name: Run RuboCop
run: bundle exec rubocop
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/

# rspec failure tracking
.rspec_status

# Personal, private notes kept locally and excluded from the repo
# (e.g. the development diary "how-i-created-my-first-ruby-gem-with-kiro.md").
/private-notes/

# Built gem artifacts
/*.gem

# Gems should not commit their lockfile (Bundler resolves it per environment).
# Committing it here pinned Bundler 4.x, which breaks CI on Ruby < 3.2.
/Gemfile.lock
3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--format documentation
--color
--require spec_helper
20 changes: 20 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
AllCops:
TargetRubyVersion: 3.0
NewCops: enable
SuggestExtensions: false

Style/StringLiterals:
EnforcedStyle: double_quotes

Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes

# Spec files legitimately contain long describe/context blocks.
Metrics/BlockLength:
Exclude:
- "spec/**/*"

# The PasswordForge module is documented in lib/password_forge.rb; other files
# reopen it to add classes and do not need to repeat the documentation.
Style/Documentation:
Enabled: false
13 changes: 13 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

source "https://rubygems.org"

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

gem "irb"
gem "rake", "~> 13.0"

gem "rspec", "~> 3.0"

gem "rubocop", "~> 1.21"
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2026 Andrea Carratta

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.
12 changes: 12 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

require "rubocop/rake_task"

RuboCop::RakeTask.new

task default: %i[spec rubocop]
11 changes: 11 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "password_forge"

# 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__)
8 changes: 8 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions lib/password_forge.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

require_relative "password_forge/version"

# PasswordForge generates random passwords from selectable character sets.
module PasswordForge
# Base error class for all PasswordForge-specific errors.
class Error < StandardError; end
# Implementation is added in the next version.
end
5 changes: 5 additions & 0 deletions lib/password_forge/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

module PasswordForge
VERSION = "0.0.0"
end
43 changes: 43 additions & 0 deletions password_forge.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# frozen_string_literal: true

require_relative "lib/password_forge/version"

Gem::Specification.new do |spec|
spec.name = "password_forge"
spec.version = PasswordForge::VERSION
spec.authors = ["Andrea Carratta"]

spec.summary = "A configurable password generator with selectable character sets."
spec.description = "PasswordForge generates random passwords from selectable character sets " \
"(uppercase, lowercase, numeric, special). Built as a learning-friendly, " \
"well-tested Ruby gem with a clean, idiomatic API."
spec.homepage = "https://github.com/devandreacarratta/password-forge-ruby-gem"
spec.license = "MIT"
spec.required_ruby_version = ">= 3.0.0"
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/devandreacarratta/password-forge-ruby-gem/tree/main"
spec.metadata["changelog_uri"] = "https://github.com/devandreacarratta/password-forge-ruby-gem/blob/main/CHANGELOG.md"

# Require MFA for gem pushes to protect against supply chain attacks.
# 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[bin/ Gemfile .gitignore .rspec spec/ .github/ .rubocop.yml])
end
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

# 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://guides.rubygems.org/make-your-own-gem/
end
4 changes: 4 additions & 0 deletions sig/password_forge.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module PasswordForge
VERSION: String
# See the writing guide of rbs: https://github.com/ruby/rbs#guides
end
7 changes: 7 additions & 0 deletions spec/password_forge_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

RSpec.describe PasswordForge do
it "has a version number" do
expect(PasswordForge::VERSION).not_to be_nil
end
end
15 changes: 15 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

require "password_forge"

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