solargraph-rails 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8535143a29b76e1a9800e728bbc2c6d8d996dde200a162c4ad7b2747c859f3cb
4
- data.tar.gz: 8fb9ee00b1486f63489b788bbc49db1301027ae47928f0aec1c686bdd0f0b6d0
3
+ metadata.gz: d858d4629536831435d33c60964333216d2e46e42599dcd601775aa318b01365
4
+ data.tar.gz: 9bd2374250f08adbe776f83b8e65ccb44687fe711e1d8c504a75179c7c8c2a6f
5
5
  SHA512:
6
- metadata.gz: 013c47d9b9b382bb11da4f8463aeb5bdf94afe71bdcac2c8bce2609d1d81cc3a7f9857bc2003665615d2538a2ca6be43550b3ba14a21144315011c2d607a8475
7
- data.tar.gz: 280e6f1520de2562a725da745d4d2295150660403c2eb02177cdbfbe3784e0c048d34363cbd431d59891226716c836517d0f197435cd01d5248252db56a9246c
6
+ metadata.gz: 3ceef9227e4ac62fe4d47546a5f0760c0844094239c81d6b5ba398ffad29194f5fb6e29f55a287d093ba356a7393db0793da764600a727d674409e854cf86701
7
+ data.tar.gz: 1a12a01d7b6807e68afe580125f0abd11273362a54e24b3207921c870805c89636346dfe925ffbb94729b71313965dbbe0e8a777170eaed1fceac3e4c3350125
@@ -1,9 +1,7 @@
1
- # This workflow uses actions that are not certified by GitHub.
2
- # They are provided by a third-party and are governed by
3
- # separate terms of service, privacy policy, and support
4
- # documentation.
5
- # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
- # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
1
+ # To debug locally:
2
+ # npm install -g act
3
+ # act act pull_request
4
+ #
7
5
 
8
6
  name: Ruby
9
7
 
@@ -14,32 +12,65 @@ on:
14
12
 
15
13
  jobs:
16
14
  test:
17
- # older versions of Ruby want openssl1 which is not on ubuntu-latest
18
- runs-on: ubuntu-20.04
15
+ runs-on: ubuntu-latest
19
16
  strategy:
20
17
  matrix:
21
18
  ruby-version:
22
- - "2.7"
23
19
  - "3.0"
20
+ # - "3.1"
21
+ # - "3.2"
22
+ # - "3.3"
23
+ # - "3.4"
24
24
  solargraph-version:
25
- - "0.44.3"
26
- - "0.45.0"
27
- - "0.46.0"
28
- - "0.47.2"
25
+ - "0.48.0"
26
+ - "0.49.0"
27
+ - "0.50.0"
28
+ - "0.51.2"
29
+ - "0.52.0"
30
+ - "0.54.6.alpha"
31
+ rails-version:
32
+ - "7"
29
33
  fail-fast: false
30
34
 
31
35
  steps:
32
36
  - uses: actions/checkout@v2
33
- - name: Cache RVM
37
+ - uses: ruby/setup-ruby@v1
38
+ with:
39
+ ruby-version: ${{ matrix.ruby-version }}
40
+ bundler: latest
41
+ bundler-cache: true
42
+
43
+
44
+ - name: Install child bundle
45
+ run: |
46
+ set -x
47
+ export MATRIX_SOLARGRAPH_VERSION="${{ matrix.solargraph-version }}"
48
+ export BUNDLE_PATH=$(pwd)/vendor/bundle
49
+ cd "spec/rails${{ matrix.rails-version }}"
50
+ bundle install
51
+
52
+ - name: cache gem annotations
34
53
  uses: actions/cache@v3
35
- id: rvm
54
+ id: dot-cache
36
55
  with:
37
- key: ${{ runner.os }}-rvm-${{ matrix.ruby-version }}
56
+ key: ${{ runner.os }}-dot-cache-${{ matrix.ruby-version }}
38
57
  path: |
39
- /home/runner/.rvm
40
- /home/runner/.yardoc
41
- #/usr/local/rvm/
58
+ /home/runner/.cache
59
+
60
+ - name: bundle list
61
+ run: bundle list && cat Gemfile.lock && find vendor -name Gemfile
62
+
42
63
  #- name: Setup upterm session
43
64
  # uses: lhotari/action-upterm@v1
44
- - name: Test
45
- run: "/bin/bash ./ci.sh ${{ matrix.ruby-version }} ${{ matrix.solargraph-version}}"
65
+
66
+ - name: RSpec
67
+ run: |
68
+ set -x
69
+ echo $MATRIX_SOLARGRAPH_VERSION
70
+ export MATRIX_SOLARGRAPH_VERSION="${{ matrix.solargraph-version }}"
71
+ export BUNDLE_PATH=$(pwd)/vendor/bundle
72
+ ruby --version
73
+ bundle install
74
+ bundle exec solargraph gems || true
75
+ bundle exec solargraph version
76
+ bundle exec rspec spec/solargraph-rails
data/.gitignore CHANGED
@@ -7,10 +7,6 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  .DS_Store
10
- spec/rails5/log/
11
- spec/rails5/tmp/
12
- spec/rails6/log/
13
- spec/rails6/tmp/
14
10
  spec/rails7/log/
15
11
  spec/rails7/tmp/
16
12
  .projections.json
@@ -19,3 +15,5 @@ spec/rails7/tmp/
19
15
  # rspec failure tracking
20
16
  .rspec_status
21
17
  Gemfile.lock
18
+ /.Gemfile
19
+ vendor
data/CHANGELOG.md CHANGED
@@ -2,6 +2,33 @@
2
2
 
3
3
  ## Changes
4
4
 
5
+ ### v1.1.1
6
+
7
+ New maintainer: @apiology
8
+
9
+ Features / fixes:
10
+
11
+ - support tsvector type columns in migrations (#55)
12
+ - support recent Solargraph releases
13
+ - fix incorrect return type in Walker.normalize_ast
14
+ - limit Solargraph versions to those that support global conventions for now pending new Solargraph release (<0.53 for now)
15
+ - limit Solargraph versions to tested versions (>0.48)
16
+ - additional built-in annotations for better completions and types
17
+ - work around ActiveSupport 7.0.x core\_ext Logger bug
18
+
19
+ Internal improvements:
20
+
21
+ - revive and improve CI workflow for higher quality releases (Huge thanks to @grncdr!)
22
+ - cache YARD gem annotations for faster GitHub workflows via RubyGems plugin
23
+ - track definition skips by Solargraph version
24
+ - remove testing of Rails 5/6; retain and revive Rails 7 testing
25
+ - sync type definitions with current functionality
26
+ - switch to more recent Solargraph releases in CI matrix
27
+ - support recent Solargraph versions in specs
28
+ - use `Solargraph::ApiMap.load_with_cache` when available in specs for eager type loading
29
+ - use .Gemfile pattern to allow local untracked Gemfile changes
30
+ - better support for updating definitions
31
+
5
32
  ### v1.1.0
6
33
 
7
34
  - remove pinned solargraph version
data/DEVELOPMENT.md CHANGED
@@ -4,36 +4,27 @@
4
4
 
5
5
  1. create fork and clone the repo
6
6
  2. install gem deps `bundle install`
7
- 3. install dummy rails5 app deps and build its yard cache
7
+ 3. install dummy Rails app deps and build its yard cache
8
8
 
9
9
  ```
10
- $ cd spec/rails5
11
- $ bundle install && yard gems
12
- $ cd ../../
13
- ```
14
-
15
- 3. install dummy rails6 app deps and build its yard cache
16
-
17
- ```
18
- $ cd spec/rails6
10
+ $ cd spec/rails7
19
11
  $ bundle install && yard gems
20
12
  $ cd ../../
21
13
  ```
14
+ 4. now tests should pass locally and you can try different changes
15
+ 5. submit PR
22
16
 
23
- 4. install dummy rails7 app deps and build its yard cache
17
+ ## Debugging workflow / test matrix issues locally
24
18
 
25
- ```
26
- $ cd spec/rails7
27
- $ bundle install && yard gems
28
- $ cd ../../
29
- ```
30
- 5. now tests should pass locally and you can try different changes
31
- 6. sumbit PR
19
+ ```sh
20
+ npm install -g act
21
+ act pull_request
22
+ ```
32
23
 
33
24
  ## Completion coverage tracking
34
25
 
35
26
  Solargraph-Rails uses a [set of yaml files](https://github.com/iftheshoefritz/solargraph-rails/tree/master/spec/definitions) to track coverage of found completions.
36
- Those yaml files are generated at runtime from a dummy [rails5](https://github.com/iftheshoefritz/solargraph-rails/tree/master/spec/rails5) or [rails6](https://github.com/iftheshoefritz/solargraph-rails/tree/master/spec/rails6) app.
27
+ Those yaml files are generated at runtime from a dummy [Rails 7 app](https://github.com/iftheshoefritz/solargraph-rails/tree/master/spec/rails7).
37
28
 
38
29
  The main goal is to catch any regressions in case of any change. In case a method completion is marked completed and it is not found in solargraph completions, the tests will fail.
39
30
 
@@ -85,7 +76,18 @@ In case a new set of assertion files has to be created (for a new Rails version
85
76
  All you have to do is execute the script and pass it a path to rails app:
86
77
 
87
78
  ```
88
- ruby script/generate_definitions.rb spec/rails6
79
+ ruby script/generate_definitions.rb spec/rails7
89
80
  ```
90
81
 
91
82
  Make sure to review the script and uncomment relevant parts
83
+
84
+ ## Preparing a release (maintainers)
85
+
86
+ 1. Look up [most recent release](https://rubygems.org/gems/solargraph-rails)
87
+ [done to here]
88
+ 2. Open up [commit list](https://github.com/iftheshoefritz/solargraph-rails/compare/v1.1.0...main)a
89
+ 3. Update [CHANGELOG.md](./CHANGELOG.md)
90
+ 4. Flip to 'files changed view' and refine updates
91
+ 5. Bump [version](./lib/solargraph/rails/version.rb) appropriately
92
+ 6. Create branch, commit and merge changes - "Prepare for vX.Y.Z release", branch: prepare_vX.Y.Z_release
93
+ 7. `git checkout master && git pull && bundle exec rake release`
data/Gemfile CHANGED
@@ -1,10 +1,39 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+
4
+ # Kind of ugly, but works. The setup-ruby action forces gems to be installed to vendor/bundle
5
+ # If we use it naively we end up with vendor/bundle and spec/rails7/vendor/bundle, which
6
+ # breaks all the tests because docs are generated in two different directories.
7
+ #
8
+ # So if we just install the rails deps at the same time, we have a single cache and a single
9
+ # directory for gems.
10
+ plugin 'auto_yard', path: './ci/auto_yard'
11
+ rails_version = ENV['MATRIX_RAILS_VERSION'] || '7'
12
+ instance_eval File.read(File.expand_path("spec/rails#{rails_version}/Gemfile", __dir__))
4
13
 
5
14
  group :development, :test do
6
- gem 'byebug'
7
15
  gem 'bundler-audit'
16
+ gem 'debug'
17
+ gem 'byebug'
18
+ end
19
+
20
+ if rails_version == '7'
21
+ # https://stackoverflow.com/questions/79360526/uninitialized-constant-activesupportloggerthreadsafelevellogger-nameerror
22
+ gem "concurrent-ruby", '<=1.3.5'
8
23
  end
24
+
9
25
  # Specify your gem's dependencies in solargraph_rails.gemspec
10
26
  gemspec
27
+
28
+ solargraph_force_ci_version = (ENV['CI'] && ENV['MATRIX_SOLARGRAPH_VERSION'])
29
+
30
+ if solargraph_force_ci_version == '0.54.6.alpha'
31
+ gem 'solargraph',
32
+ github: 'apiology/solargraph',
33
+ branch: 'v54-alpha'
34
+ # path: '../solargraph'
35
+ end
36
+
37
+ # Local gemfile for development tools, etc.
38
+ local_gemfile = File.expand_path(".Gemfile", __dir__)
39
+ instance_eval File.read local_gemfile if File.exist? local_gemfile
data/README.md CHANGED
@@ -74,16 +74,14 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/ifthes
74
74
  3. install dummy rails app deps and build the yard cache:
75
75
 
76
76
  ```
77
- $ cd spec/rails5
77
+ $ cd spec/rails7
78
78
  $ bundle install && yard gems
79
79
  $ cd ../../
80
80
  ```
81
81
 
82
- (and the same for rails 6 and rails 7)
83
-
84
82
  4. now tests should pass locally and you can try different changes
85
83
 
86
- 5. sumbit PR
84
+ 5. submit PR
87
85
 
88
86
  ## License
89
87
 
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'auto_yard'
5
+ spec.version = '0.0.1'
6
+ spec.authors = ['Stephen Sugden']
7
+ spec.email = ['grncdr@users.noreply.github.com']
8
+
9
+ spec.summary = 'Run yard gems automatically after bundle install'
10
+ spec.description = spec.summary
11
+ spec.license = 'MIT'
12
+ spec.required_ruby_version = '>= 2.6.0'
13
+
14
+ spec.homepage = 'https://github.com'
15
+ spec.metadata['homepage_uri'] = spec.homepage
16
+
17
+ spec.files = ['plugins.rb']
18
+ end
File without changes
@@ -0,0 +1,3 @@
1
+ Bundler::Plugin.add_hook('after-install-all') do
2
+ system('bundle exec yard gems')
3
+ end
@@ -14,6 +14,7 @@
14
14
  # include AbstractController::Rendering
15
15
  # extend ActiveSupport::Callbacks::ClassMethods
16
16
  # extend ActiveSupport::Rescuable::ClassMethods
17
+ # extend ActionController::AllowBrowser::ClassMethods
17
18
  # extend AbstractController::Callbacks::ClassMethods
18
19
  # extend ActionController::RequestForgeryProtection::ClassMethods
19
20
  # end
@@ -26,6 +27,14 @@
26
27
  # include ActionDispatch::Routing::Mapper::Resources
27
28
  # include ActionDispatch::Routing::Mapper::CustomUrls
28
29
  # end
30
+ # class ActionMailer::Base
31
+ # extend ActionView::Layouts::ClassMethods
32
+ # end
33
+ # class Rails::Railtie
34
+ # # @yieldself [Rails::Application]
35
+ # # @return [void]
36
+ # def configure(&block); end
37
+ # end
29
38
  # class Rails
30
39
  # # @return [Rails::Application]
31
40
  # def self.application; end
@@ -33,14 +42,19 @@
33
42
  # class Rails::Application
34
43
  # # @return [ActionDispatch::Routing::RouteSet]
35
44
  # def routes; end
45
+ # extend Rails::Application
36
46
  # end
37
47
  # class ActionDispatch::Routing::RouteSet
38
48
  # # @yieldself [ActionDispatch::Routing::Mapper]
49
+ # # @return [void]
39
50
  # def draw; end
40
51
  # end
41
52
  # class ActiveRecord::Base
53
+ # extend Enumerable
42
54
  # extend ActiveRecord::QueryMethods
43
55
  # extend ActiveRecord::FinderMethods
56
+ # extend ActiveRecord::Calculations
57
+ # extend ActiveRecord::Batches
44
58
  # extend ActiveRecord::Associations::ClassMethods
45
59
  # extend ActiveRecord::Inheritance::ClassMethods
46
60
  # extend ActiveRecord::ModelSchema::ClassMethods
@@ -48,3 +62,9 @@
48
62
  # extend ActiveRecord::Scoping::Named::ClassMethods
49
63
  # include ActiveRecord::Persistence
50
64
  # end
65
+ # @!override Time#to_time
66
+ # @return [Time]
67
+ # @!override Time.at
68
+ # @return [Time]
69
+ # @!override Time#+
70
+ # @return [Time]
@@ -19,6 +19,7 @@ module Solargraph
19
19
  inet: 'IPAddr',
20
20
  citext: 'String',
21
21
  binary: 'String',
22
+ tsvector: 'String',
22
23
  timestamp: 'ActiveSupport::TimeWithZone'
23
24
  }
24
25
 
@@ -86,7 +87,7 @@ module Solargraph
86
87
 
87
88
  def infer_table_names(ns)
88
89
  table_name = ns.name.tableize
89
- if ns.namespace.present?
90
+ if ns.namespace && !ns.namespace.empty?
90
91
  [ns.path.tableize.tr('/', '_'), table_name]
91
92
  else
92
93
  [table_name]
@@ -1,5 +1,5 @@
1
1
  module Solargraph
2
2
  module Rails
3
- VERSION = '1.1.0'
3
+ VERSION = '1.1.1'
4
4
  end
5
5
  end
@@ -49,15 +49,8 @@ module Solargraph
49
49
  end
50
50
  end
51
51
 
52
- # https://github.com/castwide/solargraph/issues/522
53
52
  def self.normalize_ast(source)
54
- ast = source.node
55
-
56
- if ast.is_a?(::Parser::AST::Node)
57
- ast
58
- else
59
- NodeParser.parse_with_comments(source.code, source.filename)
60
- end
53
+ NodeParser.parse_with_comments(source.code, source.filename)
61
54
  end
62
55
 
63
56
  def self.from_source(source)
@@ -1,4 +1,6 @@
1
1
  require 'solargraph'
2
+ require 'logger'
3
+ require 'active_support'
2
4
  require 'active_support/core_ext/string/inflections'
3
5
 
4
6
  require_relative 'solargraph/rails/util.rb'
@@ -2,6 +2,10 @@ lib = File.expand_path('../lib', __FILE__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require 'solargraph/rails/version'
4
4
 
5
+
6
+ solargraph_force_ci_version = (ENV['CI'] && ENV['MATRIX_SOLARGRAPH_VERSION'])
7
+ solargraph_version = solargraph_force_ci_version ? [solargraph_force_ci_version] : [">= 0.48.0", '<0.53.0']
8
+
5
9
  Gem::Specification.new do |spec|
6
10
  spec.name = 'solargraph-rails'
7
11
  spec.version = Solargraph::Rails::VERSION
@@ -27,6 +31,11 @@ Gem::Specification.new do |spec|
27
31
  spec.add_development_dependency 'rake', '~> 12.3.3'
28
32
  spec.add_development_dependency 'rspec', '~> 3.0'
29
33
 
30
- spec.add_runtime_dependency 'solargraph'
34
+ # Solargraph temporarily dropped support for Convention.global in
35
+ # 0.53 - this should be lifted after it returns:
36
+ #
37
+ # https://github.com/castwide/solargraph/pull/877
38
+ spec.add_runtime_dependency 'solargraph', *solargraph_version
39
+
31
40
  spec.add_runtime_dependency 'activesupport'
32
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solargraph-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fritz Meissner
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-02 00:00:00.000000000 Z
11
+ date: 2025-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: solargraph
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 0.54.6.alpha
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 0.54.6.alpha
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: activesupport
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -102,7 +102,10 @@ files:
102
102
  - Rakefile
103
103
  - bin/console
104
104
  - bin/setup
105
- - ci.sh
105
+ - ci/auto_yard/.gitignore
106
+ - ci/auto_yard/auto_yard.gemspec
107
+ - ci/auto_yard/lib/.keep
108
+ - ci/auto_yard/plugins.rb
106
109
  - lib/solargraph-rails.rb
107
110
  - lib/solargraph/rails/annotate.rb
108
111
  - lib/solargraph/rails/annotations.rb
@@ -124,7 +127,7 @@ homepage: https://github.com/iftheshoefritz/solargraph-rails
124
127
  licenses:
125
128
  - MIT
126
129
  metadata: {}
127
- post_install_message:
130
+ post_install_message:
128
131
  rdoc_options: []
129
132
  require_paths:
130
133
  - lib
@@ -139,8 +142,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
142
  - !ruby/object:Gem::Version
140
143
  version: '0'
141
144
  requirements: []
142
- rubygems_version: 3.1.6
143
- signing_key:
145
+ rubygems_version: 3.3.27
146
+ signing_key:
144
147
  specification_version: 4
145
148
  summary: Solargraph plugin that adds Rails-specific code through a Convention
146
149
  test_files: []
data/ci.sh DELETED
@@ -1,34 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
- # when running in github actions:
4
- RVM_PATH=/home/runner/.rvm
5
- # when running locally using act:
6
- #RVM_PATH=/usr/local/rvm
7
- MATRIX_RUBY_VERSION=$1
8
- MATRIX_SOLARGRAPH_VERSION=$2
9
-
10
- if [[ ! -d $RVM_PATH ]]; then
11
- # this fetches the develop version; using -s stable should fetch the latest stable, but has a gpg error:
12
- curl -sSL https://get.rvm.io | bash -s
13
- fi
14
-
15
- # when running in github actions:
16
- source /home/runner/.rvm/scripts/rvm
17
- # when running locally in Act container:
18
- #source /usr/local/rvm/scripts/rvm
19
-
20
-
21
- #rvm package install openssl # hack because ubuntu won't give us openSSL
22
- rvm install ruby $MATRIX_RUBY_VERSION
23
- rvm use $MATRIX_RUBY_VERSION
24
- gem install bundler
25
-
26
- echo "s/gem 'solargraph'/gem 'solargraph', '${MATRIX_SOLARGRAPH_VERSION}'/" > command.sed
27
-
28
- (cd spec/rails5; sed -i -f ../../command.sed Gemfile; cat Gemfile; bundle install; yard gems)
29
- (cd spec/rails6; sed -i -f ../../command.sed Gemfile; cat Gemfile; bundle install; yard gems)
30
- (cd spec/rails7; sed -i -f ../../command.sed Gemfile; cat Gemfile; bundle install; yard gems)
31
-
32
- bundle install
33
-
34
- bundle exec rspec