Skip to content

Commit

Permalink
Merge pull request #3 from Uaitt/feat/gem-release
Browse files Browse the repository at this point in the history
Feat/gem release
  • Loading branch information
Uaitt authored Jul 24, 2023
2 parents 23968c0 + 571b83b commit b60627d
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 9 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ AllCops:
Exclude:
- bin/*
- vendor/**/*
- exe/*
NewCops: enable
TargetRubyVersion: 3.0
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source 'https://rubygems.org'

gem 'aasm'
gemspec

group :development, :test do
gem 'activerecord'
Expand Down
8 changes: 7 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
PATH
remote: .
specs:
aasm_rbs (0.1.0)
aasm (~> 5)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -106,7 +112,7 @@ PLATFORMS
x86_64-linux

DEPENDENCIES
aasm
aasm_rbs!
activerecord
rspec
rubocop
Expand Down
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2023 Lorenzo Zabot

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.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
# AASM RBS Generator
Easily generate `RBS` signatures of all the `AASM`-automatically generated methods and constants of your ruby classes.

## Description
If you have found this gem, you probably are adding a type system with `RBS` on top of your `Ruby` project or `Rails` application, and you are managing the state of some of your classes with the `AASM` gem.

If you have no idea about what `AASM` is, you should take a look at their [README]() first.

You should now know that when you `include AASM` on a Ruby class and you define states, events and transitions, your classes will automatically get a few things, including:
- a constant for every state
- instance methods for every state
- scopes for every state if the class is an `ActiveRecord` model
- instance methods for every event

The problem is that when writing `RBS` you should write the signatures for the previous things one-by-one and it can get really frustrating/boring when dealing with large classes.

With this small gem, you can now generate all those signatures automatically with a single command, and save time for doing something more meaningful.

## Installation
Add the following line to your application's `Gemfile`:

```rb
gem 'aasm_rbs'
```

Then, execute `bundle install` in order to load the gem's code.

## Usage
Generating the `RBS` signatures is as easy as launching the following command from the command-line:
```
bundle exec aasm_rbs ClassName
```

The generated signatures should appear in `stdout`.


31 changes: 31 additions & 0 deletions aasm-rbs.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# frozen_string_literal: true

require_relative 'lib/aasm_rbs/version'

Gem::Specification.new do |spec|
spec.name = 'aasm_rbs'
spec.version = AasmRbs::VERSION
spec.summary = 'AASM RBS'
spec.description = 'Easily generate RBS signatures for all the Ruby classes that implement a state-machine with AASM'
spec.license = 'MIT'

spec.required_ruby_version = '>= 3.0.0'

spec.author = 'Lorenzo Zabot'
spec.email = ['lorenzozabot@gmail.com']
spec.homepage = '/~https://github.com/Uaitt/aasm_rbs'

spec.metadata = {
'allowed_push_host' => 'https://rubygems.org',
'homepage_uri' => spec.homepage,
'source_code_uri' => spec.homepage,
'rubygems_mfa_required' => 'true'
}

spec.files = Dir['lib/**/*', 'LICENSE', 'README.md']
spec.require_paths = ['lib']
spec.executables = 'exe/aasm_rbs'
spec.bindir = 'exe'

spec.add_runtime_dependency 'aasm', '~> 5'
end
7 changes: 0 additions & 7 deletions bin/aasm_rbs_generate

This file was deleted.

File renamed without changes.

0 comments on commit b60627d

Please sign in to comment.