rbs_rails 0.7.0 → 0.8.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: 82919f7e04d613a702ad6cadbff8df905f23b54bf7dbdae04122a5af5df09608
4
- data.tar.gz: 7070d476fe7f15776eed7fa406c423f18ba54077b4293ccb6064c151c7a89754
3
+ metadata.gz: 34709bd1892db293d9371b2574c97f5144d97f8b2de661072d7f65fb0616f971
4
+ data.tar.gz: 68f8207b59c550a6f5e6485ee322c38141154b47026c4d50c6bfe3cee9270494
5
5
  SHA512:
6
- metadata.gz: 92c046d0f404ff63fe86b3fab5bd92dd24731919827c5ee04330cecf26ae158608e4b0babc1097977ef5cddcbd9474983621d188b996cf264cb96a65142adf95
7
- data.tar.gz: 947c7022e0e49010cdc0fbce0bd453993f3ba0bc3df1fb5d406bce94361c49f8d61044b95ba9fed901e6635a9476b4c699812f2334e5e36552552138baada338
6
+ metadata.gz: 01d91fa0f2aaeed8dd4614ec59f5604b125684ed63325f6edbb30c29db62e2ae60cffd450a28b0ef5ec44f32570bb1a25fdbb70230060def0a4ee73fb714ab0f
7
+ data.tar.gz: 535c957a38bc5644be6e83ccf1bf439a1830110a3355b4dfd4b84453f42d5975a506d85166ac53230d62af207765e1c4cab2f3de0b7564c97c084188e7726304
@@ -0,0 +1 @@
1
+ gem_rbs/gems/* linguist-generated=true
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 0.8.0 (2020-12-31)
6
+
7
+ * **[BREAKING]** Move RBS files that are copied by `rbs_rails:copy_signature_files` task to [ruby/gem_rbs](https://github.com/ruby/gem_rbs) repository [#90](https://github.com/pocke/rbs_rails/pull/90)
8
+ * Allow all kinds of argument for scope [#89](https://github.com/pocke/rbs_rails/pull/89)
9
+
5
10
  ## 0.7.0 (2020-12-28)
6
11
 
7
12
  * **[BREAKING]** Re-structure signature directory. [#86](https://github.com/pocke/rbs_rails/pull/86)
data/README.md CHANGED
@@ -28,9 +28,8 @@ require 'rbs_rails/rake_task'
28
28
  RbsRails::RakeTask.new
29
29
  ```
30
30
 
31
- Then, the following four tasks are available.
31
+ Then, the following three tasks are available.
32
32
 
33
- * `rbs_rails:copy_signature_files`: Copy RBS files for rbs_rails
34
33
  * `rbs_rails:generate_rbs_for_models`: Generate RBS files for Active Record models
35
34
  * `rbs_rails:generate_rbs_for_path_helpers`: Generate RBS files for path helpers
36
35
  * `rbs_rails:all`: Execute all tasks of RBS Rails
@@ -56,6 +55,9 @@ target :app do
56
55
  library 'logger'
57
56
  library 'mutex_m'
58
57
  library 'date'
58
+ library 'monitor'
59
+ library 'singleton'
60
+ library 'tsort'
59
61
 
60
62
  library 'activesupport'
61
63
  library 'actionpack'
data/Steepfile CHANGED
@@ -9,6 +9,9 @@ target :lib do
9
9
  library "logger"
10
10
  library "mutex_m"
11
11
  library "date"
12
+ library 'monitor'
13
+ library 'singleton'
14
+ library 'tsort'
12
15
 
13
16
  library 'activesupport'
14
17
  library 'actionpack'
@@ -16,6 +16,7 @@ end
16
16
  def env
17
17
  @env ||= begin
18
18
  loader = RBS::EnvironmentLoader.new()
19
+ loader.add(library: 'tsort')
19
20
  RBS::Environment.from_loader(loader).resolve_type_names
20
21
  end
21
22
  end
@@ -45,7 +45,7 @@ class QueryBuilder
45
45
  end
46
46
 
47
47
  def query
48
- # TODO: variable type
48
+ # TODO: Allow non-String type for variables
49
49
  "query(#{variables.keys.map { |v| "$#{v}: String!" }.join(',')}) { #{@queries.join("\n")} }"
50
50
  end
51
51
  end
data/bin/rbs CHANGED
@@ -18,7 +18,7 @@ end
18
18
  exec(
19
19
  'rbs',
20
20
  # Require stdlibs
21
- '-rlogger', '-rpathname', '-rmutex_m', '-rdate',
21
+ '-rlogger', '-rpathname', '-rmutex_m', '-rdate', '-rmonitor', '-rsingleton', '-rtsort',
22
22
  "--repo=#{repo}",
23
23
  # Require Rails libraries
24
24
  v('-ractivesupport'), v('-ractionpack'), v('-ractivejob'), v('-ractivemodel'), v('-ractionview'), v('-ractiverecord'), v('-rrailties'),
@@ -233,28 +233,36 @@ module RbsRails
233
233
  next unless body_node.type == :block
234
234
 
235
235
  args = args_to_type(body_node.children[1])
236
- "def #{singleton ? 'self.' : ''}#{name}: (#{args}) -> #{relation_class_name}"
236
+ "def #{singleton ? 'self.' : ''}#{name}: #{args} -> #{relation_class_name}"
237
237
  end.compact.join("\n")
238
238
  end
239
239
 
240
240
  private def args_to_type(args_node)
241
241
  # @type var res: Array[String]
242
242
  res = []
243
+ # @type var block: String?
244
+ block = nil
243
245
  args_node.children.each do |node|
244
246
  case node.type
245
247
  when :arg
246
- res << "untyped"
248
+ res << "untyped #{node.children[0]}"
247
249
  when :optarg
248
- res << "?untyped"
250
+ res << "?untyped #{node.children[0]}"
249
251
  when :kwarg
250
252
  res << "#{node.children[0]}: untyped"
251
253
  when :kwoptarg
252
254
  res << "?#{node.children[0]}: untyped"
255
+ when :restarg
256
+ res << "*untyped #{node.children[0]}"
257
+ when :kwrestarg
258
+ res << "**untyped #{node.children[0]}"
259
+ when :blockarg
260
+ block = " { (*untyped) -> untyped }"
253
261
  else
254
262
  raise "unexpected: #{node}"
255
263
  end
256
264
  end
257
- res.join(", ")
265
+ "(#{res.join(", ")})#{block}"
258
266
  end
259
267
 
260
268
  private def parse_model_file
@@ -14,7 +14,6 @@ module RbsRails
14
14
 
15
15
  setup_signature_root_dir!
16
16
 
17
- def_copy_signature_files
18
17
  def_generate_rbs_for_models
19
18
  def_generate_rbs_for_path_helpers
20
19
  def_all
@@ -23,19 +22,10 @@ module RbsRails
23
22
  def def_all
24
23
  desc 'Run all tasks of rbs_rails'
25
24
 
26
- deps = [:"#{name}:copy_signature_files", :"#{name}:generate_rbs_for_models", :"#{name}:generate_rbs_for_path_helpers"]
25
+ deps = [:"#{name}:generate_rbs_for_models", :"#{name}:generate_rbs_for_path_helpers"]
27
26
  task("#{name}:all": deps)
28
27
  end
29
28
 
30
- def def_copy_signature_files
31
- desc 'Copy RBS files for rbs_rails'
32
- task("#{name}:copy_signature_files": :environment) do
33
- require 'rbs_rails'
34
-
35
- RbsRails.copy_signatures(to: signature_root_dir)
36
- end
37
- end
38
-
39
29
  def def_generate_rbs_for_models
40
30
  desc 'Generate RBS files for Active Record models'
41
31
  task("#{name}:generate_rbs_for_models": :environment) do
@@ -2,5 +2,5 @@ module RbsRails
2
2
  # Because of copy_signatures is defined by lib/rbs_rails.rb
3
3
  # @dynamic self.copy_signatures
4
4
 
5
- VERSION = "0.7.0"
5
+ VERSION = "0.8.0"
6
6
  end
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
 
15
15
  spec.metadata["homepage_uri"] = spec.homepage
16
16
  spec.metadata["source_code_uri"] = spec.homepage
17
- # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
17
+ spec.metadata["changelog_uri"] = "https://github.com/pocke/rbs_rails/blob/master/CHANGELOG.md"
18
18
 
19
19
  # Specify which files should be added to the gem when it is released.
20
20
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
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.7.0
4
+ version: 0.8.0
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-28 00:00:00.000000000 Z
11
+ date: 2020-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -45,6 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - ".gitattributes"
48
49
  - ".github/workflows/ci.yml"
49
50
  - ".gitignore"
50
51
  - ".gitmodules"
@@ -54,30 +55,6 @@ files:
54
55
  - README.md
55
56
  - Rakefile
56
57
  - Steepfile
57
- - assets/sig/action_mailer.rbs
58
- - assets/sig/builtin.rbs
59
- - assets/sig/capybara.rbs
60
- - assets/sig/concurrent.rbs
61
- - assets/sig/erb.rbs
62
- - assets/sig/erubi.rbs
63
- - assets/sig/i18n.rbs
64
- - assets/sig/libxml.rbs
65
- - assets/sig/minitest.rbs
66
- - assets/sig/nokogiri.rbs
67
- - assets/sig/pg.rbs
68
- - assets/sig/que.rbs
69
- - assets/sig/queue_classic.rbs
70
- - assets/sig/racc.rbs
71
- - assets/sig/rack-test.rbs
72
- - assets/sig/rack.rbs
73
- - assets/sig/rails.rbs
74
- - assets/sig/rdoc.rbs
75
- - assets/sig/sidekiq.rbs
76
- - assets/sig/sneakers.rbs
77
- - assets/sig/stdlib.rbs
78
- - assets/sig/sucker_punch.rbs
79
- - assets/sig/thor.rbs
80
- - assets/sig/tzinfo.rbs
81
58
  - bin/add-type-params.rb
82
59
  - bin/console
83
60
  - bin/gem_rbs
@@ -110,6 +87,7 @@ licenses:
110
87
  metadata:
111
88
  homepage_uri: https://github.com/pocke/rbs_rails
112
89
  source_code_uri: https://github.com/pocke/rbs_rails
90
+ changelog_uri: https://github.com/pocke/rbs_rails/blob/master/CHANGELOG.md
113
91
  post_install_message:
114
92
  rdoc_options: []
115
93
  require_paths:
@@ -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
@@ -1,4 +0,0 @@
1
- class ERB
2
- class Compiler
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module Erubi
2
- class Engine
3
- end
4
- end
@@ -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
@@ -1,5 +0,0 @@
1
- module PG
2
- class Connection
3
- def async_exec: (*untyped) -> untyped
4
- end
5
- end
@@ -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
@@ -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
@@ -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
@@ -1,10 +0,0 @@
1
- module Rails
2
- def self.env: () -> ActiveSupport::StringInquirer | ...
3
-
4
- module Dom
5
- module Testing
6
- module Assertions
7
- end
8
- end
9
- end
10
- end
@@ -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
@@ -1,4 +0,0 @@
1
- module Sidekiq
2
- module Worker
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module Sneakers
2
- module Worker
3
- end
4
- end
@@ -1,24 +0,0 @@
1
- module DRb
2
- end
3
-
4
- module DRb::DRbUndumped
5
- end
6
-
7
- module TSort
8
- end
9
-
10
- class SimpleDelegator
11
- end
12
-
13
- module Gem
14
- class Version
15
- end
16
- end
17
-
18
- module OpenSSL
19
- class Cipher
20
- end
21
- end
22
-
23
- module FileUtils
24
- end
@@ -1,4 +0,0 @@
1
- module SuckerPunch
2
- module Job
3
- end
4
- end
@@ -1,12 +0,0 @@
1
- class Thor
2
- class Group
3
- end
4
-
5
- module Actions
6
- class CreateFile
7
- end
8
- end
9
-
10
- class Error
11
- end
12
- end
@@ -1,4 +0,0 @@
1
- module TZInfo
2
- class Timezone
3
- end
4
- end