rbs_rails 0.5.0 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.dependabot/config.yml +8 -0
  3. data/.github/workflows/ci.yml +29 -0
  4. data/.gitignore +4 -2
  5. data/.gitmodules +0 -3
  6. data/CHANGELOG.md +22 -0
  7. data/Gemfile +2 -2
  8. data/Gemfile.lock +61 -0
  9. data/README.md +16 -44
  10. data/Steepfile +3 -0
  11. data/bin/add-type-params.rb +2 -1
  12. data/bin/gem_rbs +94 -0
  13. data/bin/postprocess.rb +1 -1
  14. data/bin/rbs +1 -1
  15. data/bin/rbs-prototype-rb.rb +5 -1
  16. data/bin/setup +1 -0
  17. data/lib/rbs_rails.rb +4 -0
  18. data/lib/rbs_rails/active_record.rb +91 -46
  19. data/lib/rbs_rails/dependency_builder.rb +43 -0
  20. data/lib/rbs_rails/rake_task.rb +72 -0
  21. data/lib/rbs_rails/util.rb +25 -0
  22. data/lib/rbs_rails/version.rb +1 -1
  23. data/rbs_rails.gemspec +2 -2
  24. data/sig/activerecord.rbs +4 -0
  25. data/sig/fileutils.rbs +1 -0
  26. data/sig/rake.rbs +6 -0
  27. data/sig/rbs_rails/active_record.rbs +11 -2
  28. data/sig/rbs_rails/dependency_builder.rbs +9 -0
  29. data/sig/rbs_rails/rake_task.rbs +26 -0
  30. data/sig/rbs_rails/util.rbs +11 -0
  31. metadata +19 -30
  32. data/.travis.yml +0 -11
  33. data/assets/sig/action_mailer.rbs +0 -8
  34. data/assets/sig/builtin.rbs +0 -7
  35. data/assets/sig/capybara.rbs +0 -14
  36. data/assets/sig/concurrent.rbs +0 -4
  37. data/assets/sig/erb.rbs +0 -4
  38. data/assets/sig/erubi.rbs +0 -4
  39. data/assets/sig/i18n.rbs +0 -4
  40. data/assets/sig/libxml.rbs +0 -10
  41. data/assets/sig/minitest.rbs +0 -13
  42. data/assets/sig/nokogiri.rbs +0 -8
  43. data/assets/sig/pg.rbs +0 -5
  44. data/assets/sig/que.rbs +0 -4
  45. data/assets/sig/queue_classic.rbs +0 -4
  46. data/assets/sig/racc.rbs +0 -4
  47. data/assets/sig/rack-test.rbs +0 -6
  48. data/assets/sig/rack.rbs +0 -47
  49. data/assets/sig/rails.rbs +0 -14
  50. data/assets/sig/rdoc.rbs +0 -9
  51. data/assets/sig/sidekiq.rbs +0 -4
  52. data/assets/sig/sneakers.rbs +0 -4
  53. data/assets/sig/stdlib.rbs +0 -24
  54. data/assets/sig/sucker_punch.rbs +0 -4
  55. data/assets/sig/thor.rbs +0 -12
  56. data/assets/sig/tzinfo.rbs +0 -4
data/sig/fileutils.rbs CHANGED
@@ -1,3 +1,4 @@
1
1
  module FileUtils
2
2
  def self.cp_r: (Pathname, Pathname) -> untyped
3
+ def self.mkdir_p: (String | Array[String], ?untyped) -> Array[String]
3
4
  end
data/sig/rake.rbs ADDED
@@ -0,0 +1,6 @@
1
+ module Rake
2
+ class TaskLib
3
+ def desc: (String) -> void
4
+ def task: (Hash[Symbol, Symbol | Array[Symbol]]) ?{ () -> void } -> void
5
+ end
6
+ end
@@ -1,22 +1,27 @@
1
1
  module RbsRails::ActiveRecord
2
- def self.class_to_rbs: (untyped klass) -> untyped
2
+ def self.class_to_rbs: (untyped klass, ?dependencies: Array[String]) -> untyped
3
+ def self.generatable?: (untyped klass) -> boolish
3
4
  end
4
5
 
5
6
  class RbsRails::ActiveRecord::Generator
6
7
  @parse_model_file: nil | Parser::AST::Node
7
8
 
8
- def initialize: (singleton(ActiveRecord::Base) klass) -> untyped
9
+ def initialize: (singleton(ActiveRecord::Base) klass, dependencies: Array[String]) -> untyped
9
10
 
10
11
  def generate: () -> String
11
12
 
12
13
  def klass_decl: () -> String
13
14
 
15
+ def pk_type: () -> String
16
+
14
17
  def relation_decl: () -> String
15
18
 
16
19
  def collection_proxy_decl: () -> String
17
20
 
18
21
  def header: () -> String
19
22
 
23
+ def footer: () -> String
24
+
20
25
  def associations: () -> String
21
26
 
22
27
  def has_many: () -> String
@@ -55,5 +60,9 @@ class RbsRails::ActiveRecord::Generator
55
60
 
56
61
  def optional: (String) -> String
57
62
 
63
+ private
64
+
58
65
  attr_reader klass: singleton(ActiveRecord::Base)
66
+
67
+ attr_reader klass_name: String
59
68
  end
@@ -0,0 +1,9 @@
1
+ module RbsRails
2
+ class DependencyBuilder
3
+ attr_reader deps: Array[String]
4
+
5
+ def initialize: () -> void
6
+
7
+ def build: () -> (String | nil)
8
+ end
9
+ end
@@ -0,0 +1,26 @@
1
+ module RbsRails
2
+ class RakeTask < Rake::TaskLib
3
+ interface _Filter
4
+ def call: (Class) -> boolish
5
+ end
6
+ attr_accessor ignore_model_if: _Filter | nil
7
+
8
+ attr_accessor name: Symbol
9
+
10
+ attr_accessor signature_root_dir: Pathname
11
+
12
+ def initialize: (?::Symbol name) { (self) -> void } -> void
13
+
14
+ def def_all: () -> void
15
+
16
+ def def_copy_signature_files: () -> void
17
+
18
+ def def_generate_rbs_for_models: () -> void
19
+
20
+ def def_generate_rbs_for_path_helpers: () -> void
21
+
22
+ private
23
+
24
+ def setup_signature_root_dir!: () -> void
25
+ end
26
+ end
@@ -0,0 +1,11 @@
1
+ module RbsRails
2
+ module Util
3
+ MODULE_NAME: UnboundMethod
4
+
5
+ extend Util
6
+
7
+ def module_name: (Module) -> String
8
+
9
+ def format_rbs: (String) -> String
10
+ end
11
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masataka Pocke Kuwabara
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-17 00:00:00.000000000 Z
11
+ date: 2021-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0.17'
33
+ version: '1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0.17'
40
+ version: '1'
41
41
  description: A RBS files generator for Rails application
42
42
  email:
43
43
  - kuwabara@pocke.me
@@ -45,40 +45,20 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - ".dependabot/config.yml"
49
+ - ".github/workflows/ci.yml"
48
50
  - ".gitignore"
49
51
  - ".gitmodules"
50
- - ".travis.yml"
52
+ - CHANGELOG.md
51
53
  - Gemfile
54
+ - Gemfile.lock
52
55
  - LICENSE
53
56
  - README.md
54
57
  - Rakefile
55
58
  - Steepfile
56
- - assets/sig/action_mailer.rbs
57
- - assets/sig/builtin.rbs
58
- - assets/sig/capybara.rbs
59
- - assets/sig/concurrent.rbs
60
- - assets/sig/erb.rbs
61
- - assets/sig/erubi.rbs
62
- - assets/sig/i18n.rbs
63
- - assets/sig/libxml.rbs
64
- - assets/sig/minitest.rbs
65
- - assets/sig/nokogiri.rbs
66
- - assets/sig/pg.rbs
67
- - assets/sig/que.rbs
68
- - assets/sig/queue_classic.rbs
69
- - assets/sig/racc.rbs
70
- - assets/sig/rack-test.rbs
71
- - assets/sig/rack.rbs
72
- - assets/sig/rails.rbs
73
- - assets/sig/rdoc.rbs
74
- - assets/sig/sidekiq.rbs
75
- - assets/sig/sneakers.rbs
76
- - assets/sig/stdlib.rbs
77
- - assets/sig/sucker_punch.rbs
78
- - assets/sig/thor.rbs
79
- - assets/sig/tzinfo.rbs
80
59
  - bin/add-type-params.rb
81
60
  - bin/console
61
+ - bin/gem_rbs
82
62
  - bin/postprocess.rb
83
63
  - bin/rbs
84
64
  - bin/rbs-prototype-rb.rb
@@ -86,14 +66,22 @@ files:
86
66
  - bin/to-ascii.rb
87
67
  - lib/rbs_rails.rb
88
68
  - lib/rbs_rails/active_record.rb
69
+ - lib/rbs_rails/dependency_builder.rb
89
70
  - lib/rbs_rails/path_helpers.rb
71
+ - lib/rbs_rails/rake_task.rb
72
+ - lib/rbs_rails/util.rb
90
73
  - lib/rbs_rails/version.rb
91
74
  - rbs_rails.gemspec
75
+ - sig/activerecord.rbs
92
76
  - sig/fileutils.rbs
93
77
  - sig/parser.rbs
78
+ - sig/rake.rbs
94
79
  - sig/rbs_rails.rbs
95
80
  - sig/rbs_rails/active_record.rbs
81
+ - sig/rbs_rails/dependency_builder.rbs
96
82
  - sig/rbs_rails/path_helpers.rbs
83
+ - sig/rbs_rails/rake_task.rbs
84
+ - sig/rbs_rails/util.rbs
97
85
  - sig/rbs_rails/version.rbs
98
86
  homepage: https://github.com/pocke/rbs_rails
99
87
  licenses:
@@ -101,6 +89,7 @@ licenses:
101
89
  metadata:
102
90
  homepage_uri: https://github.com/pocke/rbs_rails
103
91
  source_code_uri: https://github.com/pocke/rbs_rails
92
+ changelog_uri: https://github.com/pocke/rbs_rails/blob/master/CHANGELOG.md
104
93
  post_install_message:
105
94
  rdoc_options: []
106
95
  require_paths:
@@ -116,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
105
  - !ruby/object:Gem::Version
117
106
  version: '0'
118
107
  requirements: []
119
- rubygems_version: 3.2.1
108
+ rubygems_version: 3.2.3
120
109
  signing_key:
121
110
  specification_version: 4
122
111
  summary: A RBS files generator for Rails application
data/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - 2.6.5
5
- - 2.7.0
6
- - ruby-head
7
-
8
- before_install:
9
- - gem install bundler -v 2.1.4
10
-
11
- cache: bundler
@@ -1,8 +0,0 @@
1
- module ActionMailer
2
- class Base
3
- # TODO
4
- # extend ActionView::Layouts::ClassMethods
5
-
6
- def self.default: (?Hash[Symbol, untyped] value) -> Hash[Symbol, untyped]
7
- end
8
- end
@@ -1,7 +0,0 @@
1
- class Monitor
2
- end
3
- class MonitorMixin
4
- end
5
-
6
- module Singleton
7
- end
@@ -1,14 +0,0 @@
1
- module Capybara
2
- module DSL
3
- end
4
-
5
- module Minitest
6
- module Assertions
7
- end
8
- end
9
-
10
- module Poltergeist
11
- class Driver
12
- end
13
- end
14
- end
@@ -1,4 +0,0 @@
1
- module Concurrent
2
- class Map
3
- end
4
- end
data/assets/sig/erb.rbs DELETED
@@ -1,4 +0,0 @@
1
- class ERB
2
- class Compiler
3
- end
4
- end
data/assets/sig/erubi.rbs DELETED
@@ -1,4 +0,0 @@
1
- module Erubi
2
- class Engine
3
- end
4
- end
data/assets/sig/i18n.rbs DELETED
@@ -1,4 +0,0 @@
1
- module I18n
2
- class Config
3
- end
4
- end
@@ -1,10 +0,0 @@
1
- # is it correct?
2
-
3
- module LibXML
4
- end
5
- module LibXML::XML
6
- end
7
- module LibXML::XML::SaxParser
8
- end
9
- module LibXML::XML::SaxParser::Callbacks
10
- end
@@ -1,13 +0,0 @@
1
- module Minitest
2
- class Test
3
- end
4
-
5
- class SummaryReporter
6
- end
7
-
8
- class StatisticsReporter
9
- end
10
-
11
- module Assertions
12
- end
13
- end
@@ -1,8 +0,0 @@
1
- module Nokogiri
2
- end
3
- module Nokogiri::XML
4
- end
5
- module Nokogiri::XML::SAX
6
- end
7
- class Nokogiri::XML::SAX::Document
8
- end
data/assets/sig/pg.rbs DELETED
@@ -1,5 +0,0 @@
1
- module PG
2
- class Connection
3
- def async_exec: (*untyped) -> untyped
4
- end
5
- end
data/assets/sig/que.rbs DELETED
@@ -1,4 +0,0 @@
1
- module Que
2
- class Job
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- class QC
2
- class Queue
3
- end
4
- end
data/assets/sig/racc.rbs DELETED
@@ -1,4 +0,0 @@
1
- module Racc
2
- class Parser
3
- end
4
- end
@@ -1,6 +0,0 @@
1
- module Rack
2
- module Test
3
- class UploadedFile
4
- end
5
- end
6
- end
data/assets/sig/rack.rbs DELETED
@@ -1,47 +0,0 @@
1
- module Rack
2
- class Server
3
- end
4
-
5
- class Response
6
- module Helpers
7
- def location: () -> untyped
8
- end
9
- end
10
-
11
- class Request
12
- module Helpers
13
- end
14
-
15
- module Env
16
- end
17
- end
18
-
19
- module Session
20
- module Abstract
21
- class SessionHash
22
- end
23
-
24
- class PersistedSecure
25
- class SecureSessionHash
26
- end
27
- end
28
-
29
- class Persisted
30
- end
31
- end
32
-
33
- class SessionId
34
- end
35
-
36
- class Dalli
37
- end
38
- end
39
-
40
- module Cache
41
- class MetaStore
42
- end
43
-
44
- class EntityStore
45
- end
46
- end
47
- end
data/assets/sig/rails.rbs DELETED
@@ -1,14 +0,0 @@
1
- module Rails
2
- overload def self.env: () -> ActiveSupport::StringInquirer
3
-
4
- module Dom
5
- module Testing
6
- module Assertions
7
- end
8
- end
9
- end
10
- end
11
-
12
- class Rails::Application
13
- def routes: () -> untyped
14
- end
data/assets/sig/rdoc.rbs DELETED
@@ -1,9 +0,0 @@
1
- module RDoc
2
- module Generator
3
- class SDoc
4
- end
5
- end
6
-
7
- class Task
8
- end
9
- end