aasm_rbs 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fbdb030fb9e8f7ad127801029354cde4f093b439a79a6ee6f6e34ecf434c743
4
- data.tar.gz: 94313e1c7b7d87c81a3cb60707828bfe29e0d1b912f99f23e57371e7afaff250
3
+ metadata.gz: 5ddfc302bf61720f7444bbd35a41071341e1bccf688c1c2132c3e87545360125
4
+ data.tar.gz: d4b4678955f896fef85efd6d9011563df8f09c79d36e84979f22d4f009a226ec
5
5
  SHA512:
6
- metadata.gz: 3cef3ef97abc72ae1d60fafe2fc0eb8161a833f1178ca0bb394a5171b54f98fa30373c4b369cec0326730bc578cc549d5b588766fd4a985d346801cf81171fe9
7
- data.tar.gz: 670b68f23ab091ab8d48789c793b8abd337621f92cf1e1e9037bdaa7dc229c40aaba5e2630923362ed65831da6143f62acc2117088d1be01a4538f0238a4b9a8
6
+ metadata.gz: fb93b9cf0fa7a90dc315ebcf13d48cab132539f01cd4235784e16224a6ea6fe8dd72834e083f561e54d341399d00647ccb11305d18ce7a4c7e3dd7a4a6588566
7
+ data.tar.gz: a0488476811cd0bcc2a1aefddd06c96a34ade62c8aeb797d8df7aea13354111b72f8a002a0a91a612015376010f2332217408513123658bcc55967f54b45b9ae
data/README.md CHANGED
@@ -1,4 +1,7 @@
1
1
  # AASM RBS Generator
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/aasm_rbs.svg)](https://badge.fury.io/rb/aasm_rbs) [![Gem Downloads](https://badgen.net/rubygems/dt/aasm_rbs)](https://rubygems.org/gems/aasm_rbs) [![Linters](https://github.com/Uaitt/aasm_rbs/actions/workflows/linters.yml/badge.svg)](https://github.com/Uaitt/aasm_rbs/actions/workflows/linters.yml) [![Specs](https://github.com/Uaitt/aasm_rbs/actions/workflows/specs.yml/badge.svg)](https://github.com/Uaitt/aasm_rbs/actions/workflows/specs.yml)
4
+
2
5
  Easily generate RBS signatures for all the AASM automatically generated methods and constants of your ruby classes.
3
6
 
4
7
  ## Description
@@ -26,11 +29,30 @@ gem 'aasm_rbs'
26
29
  Then, execute `bundle install` in order to load the gem's code.
27
30
 
28
31
  ## Usage
32
+ At the moment AASM RBS only supports pure-ruby projects or Rails applications.
33
+
34
+ This gem assumes that your project is arranged with a traditional structure:
35
+ - If dealing with a Rails app, your classes should be in any folder nested inside of `app/` or `lib/`
36
+ - If dealing with a Ruby project, your actual classes should go inside of `lib/` and arranged as:
37
+ ```
38
+ lib/
39
+ ├── foo/
40
+ │ ├── bar.rb # contains Foo::Bar
41
+ │ ├── baz.rb # contains Foo::Baz
42
+ │── foo.rb # contains Foo
43
+ ```
44
+
45
+ For more information about how to structure your projects, take a look at the following articles:
46
+ - [Autoloading and reloading constants](https://guides.rubyonrails.org/autoloading_and_reloading_constants.html) from the Rails guides
47
+ - [Exploring the structure of a Ruby gem](https://www.cloudbees.com/blog/exploring-structure-ruby-gems) fantastic article from cloudbees (a little bit old but still relevant)
48
+
29
49
  Generating the RBS signatures is as easy as launching the following command from the command-line:
30
50
  ```
31
- bundle exec aasm_rbs ClassName
51
+ bundle exec aasm_rbs Namespace::ClassName
32
52
  ```
33
53
 
54
+ If your class is namespaced inside of other modules/classes, please pass the whole name as you see in the previous command to AASM RBS or it won't be able to infer the path.
55
+
34
56
  The generated signatures will appear in `stdout`.
35
57
 
36
58
 
data/exe/aasm_rbs CHANGED
@@ -6,7 +6,7 @@ end
6
6
 
7
7
  require_relative '../lib/aasm_rbs'
8
8
 
9
- AasmRbs.load_constants(ARGV[0])
9
+ AasmRbs.load_constants(ARGV[0] || '')
10
10
 
11
11
  $stdout.puts ''
12
12
  $stdout.puts AasmRbs.run(ARGV[0] || '')
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AasmRbs
4
- VERSION = '0.1.1'
4
+ VERSION = '0.2.0'
5
5
  end
data/lib/aasm_rbs.rb CHANGED
@@ -17,7 +17,7 @@ module AasmRbs
17
17
  begin
18
18
  require file
19
19
  rescue LoadError
20
- abort puts 'There was a problem loading the class file'
20
+ abort 'There was a problem loading the class file'
21
21
  end
22
22
  end
23
23
 
data/sig/aasm_rbs.rbs CHANGED
@@ -1,4 +1,7 @@
1
1
  module AasmRbs
2
+ Rake: untyped # there is yet no Rake official RBS
3
+
4
+ def self.load_constants: (String) -> void
2
5
  def self.run: (String) -> String?
3
6
  end
4
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aasm_rbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lorenzo Zabot