rbs_rails 0.8.0 → 0.8.1

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: 34709bd1892db293d9371b2574c97f5144d97f8b2de661072d7f65fb0616f971
4
- data.tar.gz: 68f8207b59c550a6f5e6485ee322c38141154b47026c4d50c6bfe3cee9270494
3
+ metadata.gz: 30c59f478f8fa0cd0c41751feb468a04208e057ff318edf80717b63d2f4664b8
4
+ data.tar.gz: f382afdc82aaa47b6fe14cba2cdcbb62f127dc04d95020b71ed1b6c1aa8dfd9d
5
5
  SHA512:
6
- metadata.gz: 01d91fa0f2aaeed8dd4614ec59f5604b125684ed63325f6edbb30c29db62e2ae60cffd450a28b0ef5ec44f32570bb1a25fdbb70230060def0a4ee73fb714ab0f
7
- data.tar.gz: 535c957a38bc5644be6e83ccf1bf439a1830110a3355b4dfd4b84453f42d5975a506d85166ac53230d62af207765e1c4cab2f3de0b7564c97c084188e7726304
6
+ metadata.gz: 54ca5ed84a59c4e67892f8c4e72cdc190420d457345523eb11b3dd4efe7dde5d8662afc7ace9dbee3be1aa5577b257b028ccdba20297b45332919999ac648914
7
+ data.tar.gz: 61ba620c335f27ddb58ce96d4bf3d03ea61071c528b587b7fa419d93c462ba6d96e6ad4e508243a1e6aff903966bfa49e18a02ecf9eb69f053c2cdd215da20a7
@@ -1,13 +1,21 @@
1
1
  name: CI
2
2
 
3
- on: [push, pull_request]
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ types:
9
+ - opened
10
+ - synchronize
11
+ - reopened
4
12
 
5
13
  jobs:
6
14
  test:
7
15
  strategy:
8
16
  fail-fast: false
9
17
  matrix:
10
- ruby: [2.6, 2.7, '3.0']
18
+ ruby: [2.6, 2.7, '3.0', head]
11
19
  runs-on: ubuntu-latest
12
20
  steps:
13
21
  - uses: actions/checkout@v2
@@ -15,4 +23,7 @@ jobs:
15
23
  with:
16
24
  ruby-version: ${{ matrix.ruby }}
17
25
  bundler-cache: true # runs 'bundle install' and caches installed gems automatically
26
+ - env:
27
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28
+ run: bin/gem_rbs
18
29
  - run: bundle exec rake
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
  /test/app/sig/rbs_rails
11
11
  /test/app/sig/app
12
12
  /test/app/sig/path_helpers.rbs
13
+ /gem_rbs
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 0.8.1 (2021-01-09)
6
+
7
+ * Skip generation RBS fro class that doesn't have table in DB. [#95](https://github.com/pocke/rbs_rails/pull/95)
8
+
5
9
  ## 0.8.0 (2020-12-31)
6
10
 
7
11
  * **[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)
data/README.md CHANGED
@@ -73,7 +73,10 @@ You need to put RBS repo to `path/to/rbs_repo`. See https://github.com/ruby/gem_
73
73
 
74
74
  ## Development
75
75
 
76
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
76
+ After checking out the repo, run `GITHUB_TOKEN=xxx bin/setup` to install dependencies.
77
+ `GITHUB_TOKEN` environment variable is required to fetch RBS from [ruby/gem_rbs](https://github.com/ruby/gem_rbs) repository.
78
+
79
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
77
80
 
78
81
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
79
82
 
@@ -1,11 +1,11 @@
1
- #!ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  require 'net/http'
4
4
  require 'json'
5
5
  require 'securerandom'
6
6
  require 'pathname'
7
7
 
8
- TOKEN = ENV.fetch('GITHUB_ACCESS_TOKEN')
8
+ TOKEN = ENV.fetch('GITHUB_TOKEN')
9
9
  VERSION = "6.0.3.2"
10
10
 
11
11
  def req(query)
data/bin/setup CHANGED
@@ -4,5 +4,6 @@ IFS=$'\n\t'
4
4
  set -vx
5
5
 
6
6
  bundle install
7
+ bin/gem_rbs
7
8
 
8
9
  # Do any other automated setup that you need to do here
@@ -1,6 +1,12 @@
1
1
  module RbsRails
2
2
  module ActiveRecord
3
3
 
4
+ def self.generatable?(klass)
5
+ return false if klass.abstract_class?
6
+
7
+ klass.connection.table_exists?(klass.table_name)
8
+ end
9
+
4
10
  def self.class_to_rbs(klass, dependencies: [])
5
11
  Generator.new(klass, dependencies: dependencies).generate
6
12
  end
@@ -35,9 +35,8 @@ module RbsRails
35
35
 
36
36
  dep_builder = DependencyBuilder.new
37
37
 
38
- # HACK: for steep
39
- (_ = ::ActiveRecord::Base).descendants.each do |klass|
40
- next if klass.abstract_class?
38
+ ::ActiveRecord::Base.descendants.each do |klass|
39
+ next unless RbsRails::ActiveRecord.generatable?(klass)
41
40
  next if ignore_model_if&.call(klass)
42
41
 
43
42
  path = signature_root_dir / "app/models/#{klass.name.underscore}.rbs"
@@ -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.8.0"
5
+ VERSION = "0.8.1"
6
6
  end
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
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.
21
21
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|gem_rbs)/}) }
22
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
23
  end
24
24
  spec.bindir = "exe"
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -1,5 +1,6 @@
1
1
  module RbsRails::ActiveRecord
2
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
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.8.0
4
+ version: 0.8.1
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-31 00:00:00.000000000 Z
11
+ date: 2021-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -45,7 +45,6 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - ".gitattributes"
49
48
  - ".github/workflows/ci.yml"
50
49
  - ".gitignore"
51
50
  - ".gitmodules"
@@ -103,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
102
  - !ruby/object:Gem::Version
104
103
  version: '0'
105
104
  requirements: []
106
- rubygems_version: 3.1.4
105
+ rubygems_version: 3.3.0.dev
107
106
  signing_key:
108
107
  specification_version: 4
109
108
  summary: A RBS files generator for Rails application
@@ -1 +0,0 @@
1
- gem_rbs/gems/* linguist-generated=true