rails-annotate-solargraph 0.5.3 → 0.5.4

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: f47a9a65cb37174ca12847169325afbecef1182e7d34bf555accf5551fbb7f1c
4
- data.tar.gz: 97d1aae264b49adc45222847f6d2f25278abacec90134226cc7c023e205df6d5
3
+ metadata.gz: ec69805fa2a76baa2426ff33c59c38e0718a6a4eec157f22316f763dd54f3bfa
4
+ data.tar.gz: c4117b15f2c46581519cb45fac4c29ddc8f23eed4e681884d2f4937d9517b891
5
5
  SHA512:
6
- metadata.gz: fa14e6c6068da07e1a4df3c2e41c021882ee65178fe124f2a729001964624900aa0578173870fac7bfac26bb474e530261a561a9082e267dfc8d4a48c3a3adc8
7
- data.tar.gz: 84a6120026334a68f175c8fba73ddee4720d9d6913b52ef36cfc797409543a444419000d3a687843ee57cd1ad264523f761b2988984a74137079b67f413bb396
6
+ metadata.gz: a3a8ab7da803667329851ed7ea9f05671c5ada593a6250f6dd880e3a58361690cbd9aee652ad9664f017b83708e801d0d186c02d21f174309aaddeba878cfd4f
7
+ data.tar.gz: df176e7c898dfd3d1df49107fdcf7cff30e9307a9d2f36e215fc927fe6d7d56ece4c3807e617452e0d6f5c448f4afbf7d9bba01f1fe0c4aa51836db6a9170b73
@@ -6,8 +6,11 @@
6
6
  "gsub",
7
7
  "inet",
8
8
  "klass",
9
+ "lstrip",
9
10
  "rakefile",
11
+ "rstrip",
10
12
  "solargraph",
13
+ "stringio",
11
14
  "yieldparam"
12
15
  ]
13
16
  }
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.5.4] - 2022-08-12
4
+
5
+ - Improve scope documenting
6
+ - Split tests into unit tests and integration tests
7
+ - Remove solargraph from dependencies
8
+ - Improve file update messages
9
+
3
10
  ## [0.5.3] - 2022-04-20
4
11
 
5
12
  - fix a minor bug which in some rails apps prevented scopes from being documented
data/Gemfile CHANGED
@@ -6,7 +6,6 @@ source "https://rubygems.org"
6
6
  gemspec
7
7
 
8
8
  gem 'byebug'
9
- gem 'debug'
10
9
  gem 'git'
11
10
  gem "minitest", "~> 5.0"
12
11
  gem "rake", "~> 13.0"
data/Gemfile.lock CHANGED
@@ -1,75 +1,75 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rails-annotate-solargraph (0.5.3)
4
+ rails-annotate-solargraph (0.5.4)
5
+ parser (~> 3)
5
6
  rails (>= 5.0, < 8.0)
6
- solargraph
7
7
  yard
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (7.0.2.3)
13
- actionpack (= 7.0.2.3)
14
- activesupport (= 7.0.2.3)
12
+ actioncable (7.0.3.1)
13
+ actionpack (= 7.0.3.1)
14
+ activesupport (= 7.0.3.1)
15
15
  nio4r (~> 2.0)
16
16
  websocket-driver (>= 0.6.1)
17
- actionmailbox (7.0.2.3)
18
- actionpack (= 7.0.2.3)
19
- activejob (= 7.0.2.3)
20
- activerecord (= 7.0.2.3)
21
- activestorage (= 7.0.2.3)
22
- activesupport (= 7.0.2.3)
17
+ actionmailbox (7.0.3.1)
18
+ actionpack (= 7.0.3.1)
19
+ activejob (= 7.0.3.1)
20
+ activerecord (= 7.0.3.1)
21
+ activestorage (= 7.0.3.1)
22
+ activesupport (= 7.0.3.1)
23
23
  mail (>= 2.7.1)
24
24
  net-imap
25
25
  net-pop
26
26
  net-smtp
27
- actionmailer (7.0.2.3)
28
- actionpack (= 7.0.2.3)
29
- actionview (= 7.0.2.3)
30
- activejob (= 7.0.2.3)
31
- activesupport (= 7.0.2.3)
27
+ actionmailer (7.0.3.1)
28
+ actionpack (= 7.0.3.1)
29
+ actionview (= 7.0.3.1)
30
+ activejob (= 7.0.3.1)
31
+ activesupport (= 7.0.3.1)
32
32
  mail (~> 2.5, >= 2.5.4)
33
33
  net-imap
34
34
  net-pop
35
35
  net-smtp
36
36
  rails-dom-testing (~> 2.0)
37
- actionpack (7.0.2.3)
38
- actionview (= 7.0.2.3)
39
- activesupport (= 7.0.2.3)
37
+ actionpack (7.0.3.1)
38
+ actionview (= 7.0.3.1)
39
+ activesupport (= 7.0.3.1)
40
40
  rack (~> 2.0, >= 2.2.0)
41
41
  rack-test (>= 0.6.3)
42
42
  rails-dom-testing (~> 2.0)
43
43
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
44
- actiontext (7.0.2.3)
45
- actionpack (= 7.0.2.3)
46
- activerecord (= 7.0.2.3)
47
- activestorage (= 7.0.2.3)
48
- activesupport (= 7.0.2.3)
44
+ actiontext (7.0.3.1)
45
+ actionpack (= 7.0.3.1)
46
+ activerecord (= 7.0.3.1)
47
+ activestorage (= 7.0.3.1)
48
+ activesupport (= 7.0.3.1)
49
49
  globalid (>= 0.6.0)
50
50
  nokogiri (>= 1.8.5)
51
- actionview (7.0.2.3)
52
- activesupport (= 7.0.2.3)
51
+ actionview (7.0.3.1)
52
+ activesupport (= 7.0.3.1)
53
53
  builder (~> 3.1)
54
54
  erubi (~> 1.4)
55
55
  rails-dom-testing (~> 2.0)
56
56
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
57
- activejob (7.0.2.3)
58
- activesupport (= 7.0.2.3)
57
+ activejob (7.0.3.1)
58
+ activesupport (= 7.0.3.1)
59
59
  globalid (>= 0.3.6)
60
- activemodel (7.0.2.3)
61
- activesupport (= 7.0.2.3)
62
- activerecord (7.0.2.3)
63
- activemodel (= 7.0.2.3)
64
- activesupport (= 7.0.2.3)
65
- activestorage (7.0.2.3)
66
- actionpack (= 7.0.2.3)
67
- activejob (= 7.0.2.3)
68
- activerecord (= 7.0.2.3)
69
- activesupport (= 7.0.2.3)
60
+ activemodel (7.0.3.1)
61
+ activesupport (= 7.0.3.1)
62
+ activerecord (7.0.3.1)
63
+ activemodel (= 7.0.3.1)
64
+ activesupport (= 7.0.3.1)
65
+ activestorage (7.0.3.1)
66
+ actionpack (= 7.0.3.1)
67
+ activejob (= 7.0.3.1)
68
+ activerecord (= 7.0.3.1)
69
+ activesupport (= 7.0.3.1)
70
70
  marcel (~> 1.0)
71
71
  mini_mime (>= 1.1.0)
72
- activesupport (7.0.2.3)
72
+ activesupport (7.0.3.1)
73
73
  concurrent-ruby (~> 1.0, >= 1.0.2)
74
74
  i18n (>= 1.6, < 2)
75
75
  minitest (>= 5.1)
@@ -81,28 +81,22 @@ GEM
81
81
  byebug (11.1.3)
82
82
  concurrent-ruby (1.1.10)
83
83
  crass (1.0.6)
84
- debug (1.5.0)
85
- irb (>= 1.3.6)
86
- reline (>= 0.2.7)
87
84
  diff-lcs (1.5.0)
88
85
  digest (3.1.0)
89
86
  e2mmap (0.1.0)
90
- erubi (1.10.0)
87
+ erubi (1.11.0)
91
88
  git (1.10.2)
92
89
  rchardet (~> 1.8)
93
90
  globalid (1.0.0)
94
91
  activesupport (>= 5.0)
95
- i18n (1.10.0)
92
+ i18n (1.12.0)
96
93
  concurrent-ruby (~> 1.0)
97
- io-console (0.5.11)
98
- irb (1.4.1)
99
- reline (>= 0.3.0)
100
94
  jaro_winkler (1.5.4)
101
95
  kramdown (2.3.2)
102
96
  rexml
103
97
  kramdown-parser-gfm (1.1.0)
104
98
  kramdown (~> 2.0)
105
- loofah (2.16.0)
99
+ loofah (2.18.0)
106
100
  crass (~> 1.0.2)
107
101
  nokogiri (>= 1.5.9)
108
102
  mail (2.7.1)
@@ -136,31 +130,31 @@ GEM
136
130
  parser (3.1.1.0)
137
131
  ast (~> 2.4.1)
138
132
  racc (1.6.0)
139
- rack (2.2.3)
140
- rack-test (1.1.0)
141
- rack (>= 1.0, < 3)
142
- rails (7.0.2.3)
143
- actioncable (= 7.0.2.3)
144
- actionmailbox (= 7.0.2.3)
145
- actionmailer (= 7.0.2.3)
146
- actionpack (= 7.0.2.3)
147
- actiontext (= 7.0.2.3)
148
- actionview (= 7.0.2.3)
149
- activejob (= 7.0.2.3)
150
- activemodel (= 7.0.2.3)
151
- activerecord (= 7.0.2.3)
152
- activestorage (= 7.0.2.3)
153
- activesupport (= 7.0.2.3)
133
+ rack (2.2.4)
134
+ rack-test (2.0.2)
135
+ rack (>= 1.3)
136
+ rails (7.0.3.1)
137
+ actioncable (= 7.0.3.1)
138
+ actionmailbox (= 7.0.3.1)
139
+ actionmailer (= 7.0.3.1)
140
+ actionpack (= 7.0.3.1)
141
+ actiontext (= 7.0.3.1)
142
+ actionview (= 7.0.3.1)
143
+ activejob (= 7.0.3.1)
144
+ activemodel (= 7.0.3.1)
145
+ activerecord (= 7.0.3.1)
146
+ activestorage (= 7.0.3.1)
147
+ activesupport (= 7.0.3.1)
154
148
  bundler (>= 1.15.0)
155
- railties (= 7.0.2.3)
149
+ railties (= 7.0.3.1)
156
150
  rails-dom-testing (2.0.3)
157
151
  activesupport (>= 4.2.0)
158
152
  nokogiri (>= 1.6)
159
- rails-html-sanitizer (1.4.2)
153
+ rails-html-sanitizer (1.4.3)
160
154
  loofah (~> 2.3)
161
- railties (7.0.2.3)
162
- actionpack (= 7.0.2.3)
163
- activesupport (= 7.0.2.3)
155
+ railties (7.0.3.1)
156
+ actionpack (= 7.0.3.1)
157
+ activesupport (= 7.0.3.1)
164
158
  method_source
165
159
  rake (>= 12.2)
166
160
  thor (~> 1.0)
@@ -169,8 +163,6 @@ GEM
169
163
  rake (13.0.6)
170
164
  rchardet (1.8.0)
171
165
  regexp_parser (2.2.1)
172
- reline (0.3.1)
173
- io-console (~> 0.5)
174
166
  reverse_markdown (2.1.1)
175
167
  nokogiri
176
168
  rexml (3.2.5)
@@ -202,11 +194,11 @@ GEM
202
194
  tilt (~> 2.0)
203
195
  yard (~> 0.9, >= 0.9.24)
204
196
  sqlite3 (1.4.2)
205
- strscan (3.0.1)
197
+ strscan (3.0.4)
206
198
  thor (1.2.1)
207
199
  tilt (2.0.10)
208
- timeout (0.2.0)
209
- tzinfo (2.0.4)
200
+ timeout (0.3.0)
201
+ tzinfo (2.0.5)
210
202
  concurrent-ruby (~> 1.0)
211
203
  unicode-display_width (2.1.0)
212
204
  webrick (1.7.0)
@@ -215,7 +207,7 @@ GEM
215
207
  websocket-extensions (0.1.5)
216
208
  yard (0.9.27)
217
209
  webrick (~> 1.7.0)
218
- zeitwerk (2.5.4)
210
+ zeitwerk (2.6.0)
219
211
 
220
212
  PLATFORMS
221
213
  arm64-darwin-20
@@ -223,7 +215,6 @@ PLATFORMS
223
215
 
224
216
  DEPENDENCIES
225
217
  byebug
226
- debug
227
218
  git
228
219
  minitest (~> 5.0)
229
220
  rails-annotate-solargraph!
data/README.md CHANGED
@@ -74,7 +74,7 @@ end
74
74
 
75
75
  There are a few values for this option:
76
76
 
77
- - `:schema_file` -- default value, annotations get saved to a special file `app/models/annotate_solargraph_schema.rb`
77
+ - `:schema_file` -- default value, annotations get saved to a special file `.annotate_solargraph_schema`
78
78
  - `:bottom` -- annotations are appended to the model files
79
79
  - `:top` -- annotations are prepended to the model files
80
80
 
@@ -90,9 +90,59 @@ $ rake annotate:solargraph:generate
90
90
 
91
91
  ## Development
92
92
 
93
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
93
+ ### Setup
94
94
 
95
- 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
95
+ To setup this gem for development you should use the setup script.
96
+
97
+ ```sh
98
+ $ bin/setup
99
+ ```
100
+
101
+ ### Console
102
+
103
+ You can access an IRB with this entire gem preloaded like this
104
+
105
+ ```sh
106
+ $ bin/console
107
+ ```
108
+
109
+ ### Tests
110
+
111
+ You can run all tests with:
112
+
113
+ ```sh
114
+ $ rake test
115
+ ```
116
+
117
+ All unit tests:
118
+
119
+ ```sh
120
+ $ rake test:unit
121
+ ```
122
+
123
+ All integration tests:
124
+
125
+ ```sh
126
+ $ rake test:integration
127
+ ```
128
+
129
+ ### Release
130
+
131
+ To release a new version, update the version number in `version.rb`, and then run
132
+
133
+ ```sh
134
+ $ bundle exec rake release
135
+ ```
136
+
137
+ This will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
138
+
139
+ ### Local installation
140
+
141
+ To install this gem onto your local machine, run
142
+
143
+ ```sh
144
+ $ bundle exec rake install
145
+ ```
96
146
 
97
147
  ## Contributing
98
148
 
data/Rakefile CHANGED
@@ -3,10 +3,28 @@
3
3
  require "bundler/gem_tasks"
4
4
  require "rake/testtask"
5
5
 
6
- Rake::TestTask.new(:test) do |t|
7
- t.libs << "test"
8
- t.libs << "lib"
9
- t.test_files = FileList["test/rails/**/*_test.rb"]
6
+ ::Rake::TestTask.new(:test) do |t|
7
+ t.libs << 'lib'
8
+ t.libs << 'test'
9
+ t.libs << 'test/fixtures'
10
+ # ignore tests of rails apps
11
+ t.test_files = ::FileList['test/**/*_test.rb'] - ::FileList['test/dummy/**/*_test.rb']
12
+ end
13
+
14
+ ::Rake::TestTask.new('test:unit') do |t|
15
+ t.libs << 'lib'
16
+ t.libs << 'test'
17
+ t.libs << 'test/fixtures'
18
+ # ignore tests of rails apps
19
+ t.test_files = ::FileList['test/unit/**/*_test.rb']
20
+ end
21
+
22
+ ::Rake::TestTask.new('test:integration') do |t|
23
+ t.libs << 'lib'
24
+ t.libs << 'test'
25
+ t.libs << 'test/fixtures'
26
+ # ignore tests of rails apps
27
+ t.test_files = ::FileList['test/integration/**/*_test.rb']
10
28
  end
11
29
 
12
30
  require "rubocop/rake_task"
@@ -16,7 +16,10 @@ module Annotate
16
16
  template ::Rails::Annotate::Solargraph::SCHEMA_FILE_NAME, ::Rails::Annotate::Solargraph::SCHEMA_RAILS_PATH
17
17
 
18
18
  solargraph_config_file = ::File.join(::Rails.root, ::Rails::Annotate::Solargraph::SOLARGRAPH_FILE_NAME)
19
- system 'solargraph config' unless ::File.exist? solargraph_config_file
19
+ unless ::File.exist? solargraph_config_file
20
+ template(::Rails::Annotate::Solargraph::SOLARGRAPH_FILE_NAME, ::Rails::Annotate::Solargraph::SOLARGRAPH_FILE_PATH)
21
+ end
22
+
20
23
  solargraph_config = ::YAML.load_file solargraph_config_file
21
24
  solargraph_config['include'] = solargraph_config['include'] || []
22
25
  solargraph_config['include'].unshift ::Rails::Annotate::Solargraph::SCHEMA_RAILS_PATH
@@ -0,0 +1,23 @@
1
+ ---
2
+ include:
3
+ - ".annotate_solargraph_schema"
4
+ - "**/*.rb"
5
+ exclude:
6
+ - spec/**/*
7
+ - test/**/*
8
+ - vendor/**/*
9
+ - ".bundle/**/*"
10
+ require: []
11
+ domains: []
12
+ reporters:
13
+ - rubocop
14
+ - require_not_found
15
+ formatter:
16
+ rubocop:
17
+ cops: safe
18
+ except: []
19
+ only: []
20
+ extra_args: []
21
+ require_paths: []
22
+ plugins: []
23
+ max_files: 5000
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'parser/current'
4
+
3
5
  class ActiveRecord::Base
4
6
  class << self
5
7
  alias orig_scope scope
@@ -10,22 +12,28 @@ class ActiveRecord::Base
10
12
  scope_name = args.first
11
13
  scope_proc = args[1]
12
14
  proc_parameters = scope_proc.respond_to?(:parameters) ? scope_proc.parameters.map(&:last) : []
13
- scope_line = nil
15
+ scope_definition = ::String.new
14
16
  scope_model_class = self
17
+ scope_lines = 0
18
+ scope_indentation = nil
15
19
 
16
20
  ::File.open(file_path) do |file|
17
21
  file.each_line.with_index(1) do |line, current_line_number|
18
- next unless current_line_number == scope_line_number
22
+ next if current_line_number < scope_line_number
23
+ break if scope_lines > 50
24
+
25
+ scope_indentation ||= line.length - line.lstrip.length
26
+ scope_definition << "#{line.rstrip[scope_indentation..]}\n"
27
+ scope_lines += 1
19
28
 
20
- scope_line = line.strip
21
- break
29
+ break if ::Parser::CurrentRuby.new.parse ::Parser::Source::Buffer.new('(string)', source: scope_definition)
22
30
  end
23
31
  end
24
32
 
25
- ::Rails::Annotate::Solargraph::Model.add_scope(scope_name.to_sym, scope_model_class, proc_parameters, scope_line)
33
+ ::Rails::Annotate::Solargraph::Model.add_scope(scope_name.to_sym, scope_model_class, proc_parameters, scope_definition)
26
34
 
27
35
  orig_scope(*args, **kwargs, &block)
28
- rescue
36
+ rescue ::StandardError
29
37
  orig_scope(*args, **kwargs, &block)
30
38
  end
31
39
  end
@@ -8,8 +8,6 @@ module Rails
8
8
  class Model
9
9
  using TerminalColors::Refinement
10
10
 
11
- Scope = ::Struct.new(:name, :model_class, :proc_parameters, :definition, keyword_init: true)
12
-
13
11
  # @return [Regexp]
14
12
  MAGIC_COMMENT_REGEXP = /(^#\s*encoding:.*(?:\n|r\n))|(^# coding:.*(?:\n|\r\n))|(^# -\*- coding:.*(?:\n|\r\n))|(^# -\*- encoding\s?:.*(?:\n|\r\n))|(^#\s*frozen_string_literal:.+(?:\n|\r\n))|(^# -\*- frozen_string_literal\s*:.+-\*-(?:\n|\r\n))/.freeze
15
13
 
@@ -45,11 +43,17 @@ module Rails
45
43
  # @param proc_parameters [Array<Symbol>]
46
44
  # @param definition [String]
47
45
  def add_scope(name, model_class, proc_parameters, definition)
48
- scope = Scope.new(name: name, model_class: model_class, proc_parameters: proc_parameters, definition: definition)
46
+ scope = Scope.new(
47
+ name: name,
48
+ model_class: model_class,
49
+ proc_parameters: proc_parameters,
50
+ definition: definition
51
+ )
52
+
49
53
  @scopes ||= {}
50
54
  @scopes[model_class] ||= []
51
55
  @scopes[model_class] << scope
52
- @scopes[model_class].sort_by! { |scope| scope.name }
56
+ @scopes[model_class].sort_by!(&:name)
53
57
  end
54
58
 
55
59
  # @param klass [Class]
@@ -162,18 +166,16 @@ module Rails
162
166
 
163
167
  private
164
168
 
169
+ # @return [Array<Scope>]
170
+ def scopes
171
+ self.class.scopes[@klass]
172
+ end
173
+
165
174
  # @param doc_string [String]
166
175
  # @return [void]
167
176
  def document_scopes(doc_string)
168
- self.class.scopes[@klass]&.each do |scope|
169
- doc_string << <<~DOC
170
- # # Scope `#{scope.name.inspect}`.
171
- # #
172
- # # #{scope.definition}
173
- # #
174
- # # @return [Array<#{@klass}>, nil]
175
- # def self.#{scope.name}(#{scope.proc_parameters.join(', ')}); end
176
- DOC
177
+ scopes&.each do |scope|
178
+ doc_string << scope.documentation
177
179
  end
178
180
  end
179
181
 
@@ -219,9 +221,9 @@ module Rails
219
221
  # @param content [String]
220
222
  # @return [void]
221
223
  def write_file(file_name, content)
222
- ::FileUtils.touch(file_name) unless ::File.exists?(file_name)
224
+ ::FileUtils.touch(file_name) unless ::File.exist?(file_name)
223
225
  ::File.write(file_name, content)
224
- puts "modify".rjust(12).with_styles(:bold, :green) + " #{relative_file_name(file_name)}"
226
+ puts "modify".rjust(12).with_styles(:bold, :green) + " #{relative_file_name(file_name)} (#{@klass})"
225
227
  end
226
228
 
227
229
  # @return [String]
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rails
4
+ module Annotate
5
+ module Solargraph
6
+ # Represents a scope on an ActiveRecord Model.
7
+ class Scope
8
+ # @param name [Symbol]
9
+ attr_reader :name
10
+ # @param model_class [Class]
11
+ attr_reader :model_class
12
+ # @param proc_parameters [Array<Symbol>]
13
+ attr_reader :proc_parameters
14
+ # @param definition [String]
15
+ attr_reader :definition
16
+
17
+ # @param name [Symbol]
18
+ # @param model_class [Class]
19
+ # @param proc_parameters [Array<Symbol>]
20
+ # @param definition [String]
21
+ def initialize(name:, model_class:, proc_parameters:, definition:)
22
+ @name = name
23
+ @model_class = model_class
24
+ @proc_parameters = proc_parameters
25
+ @definition = definition
26
+ freeze
27
+ end
28
+
29
+ # @return [String]
30
+ def documentation
31
+ <<~DOC
32
+ # # Scope `#{@name.inspect}`.
33
+ # #
34
+ #{documented_definition}
35
+ # #
36
+ # # @return [Array<#{@model_class}>, nil]
37
+ # #{signature}
38
+ DOC
39
+ end
40
+
41
+ private
42
+
43
+ # @return [String]
44
+ def signature
45
+ args = @proc_parameters.join(', ')
46
+
47
+ "def self.#{@name}(#{args}); end"
48
+ end
49
+
50
+ # @return [String]
51
+ def documented_definition
52
+ result = ::String.new
53
+ @definition.each_line do |line|
54
+ result << "# # #{line}"
55
+ end
56
+
57
+ result.chomp
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -3,7 +3,7 @@
3
3
  module Rails
4
4
  module Annotate
5
5
  module Solargraph
6
- VERSION = '0.5.3'
6
+ VERSION = '0.5.4'
7
7
  end
8
8
  end
9
9
  end
@@ -6,11 +6,12 @@ require 'fileutils'
6
6
  require_relative "solargraph/version"
7
7
  require_relative "solargraph/configuration"
8
8
  require_relative "solargraph/terminal_colors"
9
+ require_relative "solargraph/scope"
9
10
  require_relative "solargraph/model"
10
11
 
11
12
  begin
12
13
  require_relative "overrides"
13
- rescue
14
+ rescue ::StandardError
14
15
  nil
15
16
  end
16
17
 
@@ -31,6 +32,8 @@ module Rails
31
32
  # @return [String]
32
33
  SOLARGRAPH_FILE_NAME = '.solargraph.yml'
33
34
  # @return [String]
35
+ SOLARGRAPH_FILE_PATH = SOLARGRAPH_FILE_NAME
36
+ # @return [String]
34
37
  SCHEMA_FILE_NAME = '.annotate_solargraph_schema'
35
38
  # @return [String]
36
39
  SCHEMA_RAILS_PATH = SCHEMA_FILE_NAME
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
 
32
32
  # Uncomment to register a new dependency of your gem
33
33
  spec.add_dependency 'rails', ">= 5.0", '< 8.0'
34
- spec.add_dependency 'solargraph'
34
+ spec.add_dependency 'parser', '~> 3'
35
35
  spec.add_dependency 'yard'
36
36
 
37
37
  # For more information and examples about making a new gem, check out our
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-annotate-solargraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mateusz Drewniak
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-20 00:00:00.000000000 Z
11
+ date: 2022-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -31,19 +31,19 @@ dependencies:
31
31
  - !ruby/object:Gem::Version
32
32
  version: '8.0'
33
33
  - !ruby/object:Gem::Dependency
34
- name: solargraph
34
+ name: parser
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0'
39
+ version: '3'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ">="
44
+ - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0'
46
+ version: '3'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: yard
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -82,11 +82,13 @@ files:
82
82
  - bin/setup
83
83
  - lib/generators/annotate/solargraph/install_generator.rb
84
84
  - lib/generators/annotate/solargraph/templates/.annotate_solargraph_schema
85
+ - lib/generators/annotate/solargraph/templates/.solargraph.yml
85
86
  - lib/generators/annotate/solargraph/templates/rails_annotate_solargraph.rake
86
87
  - lib/rails/annotate/overrides.rb
87
88
  - lib/rails/annotate/solargraph.rb
88
89
  - lib/rails/annotate/solargraph/configuration.rb
89
90
  - lib/rails/annotate/solargraph/model.rb
91
+ - lib/rails/annotate/solargraph/scope.rb
90
92
  - lib/rails/annotate/solargraph/terminal_colors.rb
91
93
  - lib/rails/annotate/solargraph/version.rb
92
94
  - rails-annotate-solargraph.gemspec