solargraph-rails 0.2.0 → 0.2.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: df10b3b2f00a486c79433fbb7038ffbee966d3420022b3789a5fd00965769524
4
- data.tar.gz: b1fb1d828e84a1f74d0f4ab644050fef127e3a019be3f5ef3592d0cb9893b0ac
3
+ metadata.gz: 60dc687282db670b1cfa0b017c2e0d994f86e6adafca80d99eb4d455aaf2b68f
4
+ data.tar.gz: 54f79f529ed0fee77b93d88d7a56868b040ded60aa836f001d27e26ddbef843d
5
5
  SHA512:
6
- metadata.gz: 31be19170418090a2f09e207b9c7a3c421ce74c17138730ce1670bddefbeffdbe0775158598aefd1630346a43beba6d5f4128705a236cf89765845b7b9170976
7
- data.tar.gz: 2bfd1f0f082d1f52686ec6342ffc30fe84f374a5fe52dc5e8cad3a5995b28e7f0a9f99bf854a06b92e8926cbd5a4d3f3f5adbe498e95f726f49ee28fe74ac63d
6
+ metadata.gz: b358c11d03830142a393eb55281fa149b8b784474c681c907b509784467cd4b8d6712de6afd1db135dd2794b7888aca02962f483a74b5897c1676440fa6b398e
7
+ data.tar.gz: 3ebbd33b3f491a2e4a9e2a4b86ecfd08c6eab3a8f3475157fb36fb8683d361ebe000bfcad019b8740761407187e5b7ed3bd00483c388e1fcea5bc50c0523745d
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- solargraph-rails (0.2.0.pre)
5
- solargraph (~> 0.40.0)
4
+ solargraph-rails (0.2.0)
5
+ solargraph (~> 0.41.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -21,7 +21,7 @@ GEM
21
21
  rexml
22
22
  kramdown-parser-gfm (1.1.0)
23
23
  kramdown (~> 2.0)
24
- mini_portile2 (2.5.1)
24
+ mini_portile2 (2.5.3)
25
25
  nokogiri (1.11.6)
26
26
  mini_portile2 (~> 2.5.0)
27
27
  racc (~> 1.4)
@@ -48,19 +48,19 @@ GEM
48
48
  diff-lcs (>= 1.2.0, < 2.0)
49
49
  rspec-support (~> 3.10.0)
50
50
  rspec-support (3.10.0)
51
- rubocop (1.15.0)
51
+ rubocop (1.16.0)
52
52
  parallel (~> 1.10)
53
53
  parser (>= 3.0.0.0)
54
54
  rainbow (>= 2.2.2, < 4.0)
55
55
  regexp_parser (>= 1.8, < 3.0)
56
56
  rexml
57
- rubocop-ast (>= 1.5.0, < 2.0)
57
+ rubocop-ast (>= 1.7.0, < 2.0)
58
58
  ruby-progressbar (~> 1.7)
59
59
  unicode-display_width (>= 1.4.0, < 3.0)
60
60
  rubocop-ast (1.7.0)
61
61
  parser (>= 3.0.1.1)
62
62
  ruby-progressbar (1.11.0)
63
- solargraph (0.40.4)
63
+ solargraph (0.41.1)
64
64
  backport (~> 1.1)
65
65
  benchmark
66
66
  bundler (>= 1.17.2)
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Solargraph::Rails - Help solargraph with Rails
2
2
 
3
3
  ## Work in progress - here be dragons
4
- There are significant rough edges to this gem still. You won't be able to use it if you're not willing to install a gem using `--pre`. See `Installation` below for more info.
4
+ There are significant rough edges to this gem still.
5
5
 
6
6
  ## Models
7
7
  Given a typical Rails model like this:
@@ -63,13 +63,15 @@ This project is being used to write production code by the maintainer, but it is
63
63
 
64
64
  Typically gems like these are not installed via the Gemfile, because most projects have more than one contributor and other contributors might have different setups for their editors in mind. Instead you need to use `gem install`.
65
65
 
66
- `gem install solargraph-rails --pre`
66
+ `gem install solargraph-rails`
67
67
 
68
68
  #### Alternative: using bundler
69
- If you do want to use bundler, add `gem 'solargraph-rails', '0.2.0.pre'`
69
+ If you do want to use bundler, add `gem 'solargraph-rails', '~> 0.2.0'`
70
70
 
71
71
  ### Add `solargraph-rails` to your `.solargraph.yml`
72
72
 
73
+ (if you don't have a `.solargraph.yml` in your project root, you can run `solargraph config` to add one)
74
+
73
75
  ```
74
76
  plugins:
75
77
  - solargraph-rails
@@ -53,6 +53,7 @@ module Solargraph
53
53
  parser.parse
54
54
 
55
55
  Solargraph::Logging.logger.info "Adding #{model_attrs.count} attributes as pins"
56
+ # TODO have to return other types of pins too
56
57
  model_attrs.map do |attr|
57
58
  Solargraph::Pin::Method.new(
58
59
  name: attr[:name],
@@ -6,6 +6,7 @@ module Solargraph
6
6
  def initialize(file_contents: '')
7
7
  @lines = file_contents.lines
8
8
  @comment_handlers = []
9
+ @non_comment_handlers = []
9
10
  @class_handlers = []
10
11
  @module_handlers = []
11
12
  end
@@ -22,6 +23,10 @@ module Solargraph
22
23
  @module_handlers << blk
23
24
  end
24
25
 
26
+ def on_ruby_line(&blk)
27
+ @non_comment_handlers << blk
28
+ end
29
+
25
30
  def parse
26
31
  @lines
27
32
  .map(&:rstrip)
@@ -32,6 +37,8 @@ module Solargraph
32
37
  if is_comment?(line)
33
38
  comment_content = line.gsub(/#\s*/, '')
34
39
  @comment_handlers.each { |handler| handler.call(comment_content) }
40
+ else
41
+ @non_comment_handlers.each { |handler| handler.call(line) }
35
42
  end
36
43
 
37
44
  if is_class?(line)
@@ -1,5 +1,5 @@
1
1
  module Solargraph
2
2
  module Rails
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "rake", "~> 12.3.3"
26
26
  spec.add_development_dependency "rspec", "~> 3.0"
27
27
 
28
- spec.add_runtime_dependency "solargraph", "~> 0.40.0"
28
+ spec.add_runtime_dependency "solargraph", "~> 0.41.1"
29
29
  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: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fritz Meissner
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-28 00:00:00.000000000 Z
11
+ date: 2021-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.40.0
61
+ version: 0.41.1
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.40.0
68
+ version: 0.41.1
69
69
  description: Add reflection on ActiveModel dynamic attributes that will be created
70
70
  at runtime
71
71
  email: