solargraph-rails 0.2.1.1 → 0.2.2.pre.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: 4de8c2ed7ec21658fc8613358b5c6ed4052b06457b100a4fb4612bd014414c46
4
- data.tar.gz: 9e8e8a3b202e074168c34fd49c59dbba0c27744e163e8b6c2ea668fbd0817bde
3
+ metadata.gz: 42b094ca4d96b63dd47297f752e821904875c11eda1f2a367ab84da2862b5ff6
4
+ data.tar.gz: 60200f07c8ff06a580cd4f44aba81fe2313c12364bf23b9637c8a874b2769c2e
5
5
  SHA512:
6
- metadata.gz: c11ae8b938ba3cf42fd79a63cb6b5729783709c0f6bc42e1e70d091ff5d69ee182ea64894d039a6b484cbc52b388f0d69c852e16eacbdcc306a3806b797e4f89
7
- data.tar.gz: 66d7b753bf6c833b9d9c3bee0e2a210f637d281cd97cea7c636ba7c529ec930389e4d13c8e0bc4114da436633278c21ab1ec9ba66c5b42f5ac0038271493ac3b
6
+ metadata.gz: 55fb5b511f8ff2dc298d47063e4a602154cee613852a750ecc7fe77acdf1a9aa0686fbed86435180cf4c88dcb1038b7510b6ef9b1b58f4ff636d7f17cf34a475
7
+ data.tar.gz: b33e682d6b94cb029d741495c0e14719ffbc643273d8fbe96b88725cbcc085425710e6d95683646f107bc5d874dc2ed00b96e89149fe881d2b6113bba95c3eda
data/Gemfile.lock CHANGED
@@ -1,28 +1,39 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- solargraph-rails (0.2.1.1)
5
- solargraph (>= 0.41.1)
4
+ solargraph-rails (0.2.1)
5
+ activesupport
6
+ solargraph (~> 0.41.1)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
9
10
  specs:
11
+ activesupport (6.1.3.2)
12
+ concurrent-ruby (~> 1.0, >= 1.0.2)
13
+ i18n (>= 1.6, < 2)
14
+ minitest (>= 5.1)
15
+ tzinfo (~> 2.0)
16
+ zeitwerk (~> 2.3)
10
17
  ast (2.4.2)
11
- backport (1.2.0)
18
+ backport (1.1.2)
12
19
  benchmark (0.1.1)
13
20
  bundler-audit (0.8.0)
14
21
  bundler (>= 1.2.0, < 3)
15
22
  thor (~> 1.0)
16
23
  byebug (11.1.3)
24
+ concurrent-ruby (1.1.9)
17
25
  diff-lcs (1.4.4)
18
26
  e2mmap (0.1.0)
27
+ i18n (1.8.10)
28
+ concurrent-ruby (~> 1.0)
19
29
  jaro_winkler (1.5.4)
20
30
  kramdown (2.3.1)
21
31
  rexml
22
32
  kramdown-parser-gfm (1.1.0)
23
33
  kramdown (~> 2.0)
24
34
  mini_portile2 (2.5.3)
25
- nokogiri (1.11.7)
35
+ minitest (5.14.4)
36
+ nokogiri (1.11.6)
26
37
  mini_portile2 (~> 2.5.0)
27
38
  racc (~> 1.4)
28
39
  parallel (1.20.1)
@@ -48,7 +59,7 @@ GEM
48
59
  diff-lcs (>= 1.2.0, < 2.0)
49
60
  rspec-support (~> 3.10.0)
50
61
  rspec-support (3.10.0)
51
- rubocop (1.18.3)
62
+ rubocop (1.16.0)
52
63
  parallel (~> 1.10)
53
64
  parser (>= 3.0.0.0)
54
65
  rainbow (>= 2.2.2, < 4.0)
@@ -60,11 +71,10 @@ GEM
60
71
  rubocop-ast (1.7.0)
61
72
  parser (>= 3.0.1.1)
62
73
  ruby-progressbar (1.11.0)
63
- solargraph (0.42.3)
64
- backport (~> 1.2)
74
+ solargraph (0.41.1)
75
+ backport (~> 1.1)
65
76
  benchmark
66
77
  bundler (>= 1.17.2)
67
- diff-lcs (~> 1.4)
68
78
  e2mmap
69
79
  jaro_winkler (~> 1.5)
70
80
  kramdown (~> 2.3)
@@ -77,8 +87,11 @@ GEM
77
87
  yard (~> 0.9, >= 0.9.24)
78
88
  thor (1.1.0)
79
89
  tilt (2.0.10)
90
+ tzinfo (2.0.4)
91
+ concurrent-ruby (~> 1.0)
80
92
  unicode-display_width (2.0.0)
81
93
  yard (0.9.26)
94
+ zeitwerk (2.4.2)
82
95
 
83
96
  PLATFORMS
84
97
  ruby
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/core_ext/string'
4
+
3
5
  module Solargraph
4
6
  module Rails
5
7
  class PinCreator
@@ -50,13 +52,47 @@ module Solargraph
50
52
  end
51
53
  end
52
54
 
55
+ parser.on_ruby_line do |line|
56
+ if line =~ /belongs_to\s+:([a-z_]*)/
57
+ belongs_to_reader = Regexp.last_match(1)
58
+
59
+ loc = Solargraph::Location.new(
60
+ path,
61
+ Solargraph::Range.from_to(
62
+ parser.current_line_number,
63
+ 0,
64
+ parser.current_line_number,
65
+ parser.current_line_length - 1
66
+ )
67
+ )
68
+ model_attrs << { name: belongs_to_reader, type: belongs_to_reader.camelize, location: loc }
69
+ elsif line =~ /has_many\s+:([a-z_]*)/
70
+ has_many_reader = Regexp.last_match(1)
71
+
72
+ loc = Solargraph::Location.new(
73
+ path,
74
+ Solargraph::Range.from_to(
75
+ parser.current_line_number,
76
+ 0,
77
+ parser.current_line_number,
78
+ parser.current_line_length - 1
79
+ )
80
+ )
81
+ model_attrs << {
82
+ name: has_many_reader,
83
+ type: "Array<#{has_many_reader.singularize.camelize}>",
84
+ location: loc
85
+ }
86
+ end
87
+ end
88
+
53
89
  parser.parse
54
90
 
55
91
  Solargraph::Logging.logger.info "Adding #{model_attrs.count} attributes as pins"
56
92
  model_attrs.map do |attr|
57
93
  Solargraph::Pin::Method.new(
58
94
  name: attr[:name],
59
- comments: "@return [#{type_translation[attr[:type]]}]",
95
+ comments: "@return [#{type_translation.fetch(attr[:type], attr[:type])}]",
60
96
  location: attr[:location],
61
97
  closure: Solargraph::Pin::Namespace.new(name: module_names.join('::') + "::#{model_name}"),
62
98
  scope: :instance,
@@ -1,5 +1,5 @@
1
1
  module Solargraph
2
2
  module Rails
3
- VERSION = '0.2.1.1'
3
+ VERSION = '0.2.2.pre.1'
4
4
  end
5
5
  end
@@ -25,5 +25,6 @@ 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.41.1"
28
+ spec.add_runtime_dependency "solargraph", "~> 0.41.1"
29
+ spec.add_runtime_dependency "activesupport", "~> 6.1.3"
29
30
  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.1.1
4
+ version: 0.2.2.pre.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-07-08 00:00:00.000000000 Z
11
+ date: 2021-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -56,16 +56,30 @@ dependencies:
56
56
  name: solargraph
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
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
68
  version: 0.41.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: activesupport
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 6.1.3
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 6.1.3
69
83
  description: Add reflection on ActiveModel dynamic attributes that will be created
70
84
  at runtime
71
85
  email:
@@ -77,7 +91,6 @@ files:
77
91
  - ".gitignore"
78
92
  - ".rspec"
79
93
  - ".travis.yml"
80
- - CHANGELOG.md
81
94
  - Gemfile
82
95
  - Gemfile.lock
83
96
  - LICENSE.txt
@@ -109,9 +122,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
122
  version: '0'
110
123
  required_rubygems_version: !ruby/object:Gem::Requirement
111
124
  requirements:
112
- - - ">="
125
+ - - ">"
113
126
  - !ruby/object:Gem::Version
114
- version: '0'
127
+ version: 1.3.1
115
128
  requirements: []
116
129
  rubygems_version: 3.2.3
117
130
  signing_key:
data/CHANGELOG.md DELETED
@@ -1,28 +0,0 @@
1
- # solargraph-rails changelog
2
-
3
- ## Changes
4
-
5
- ### v0.2.1.1
6
-
7
- * Loosen dependency requirement on solargraph
8
-
9
- ### v0.2.2.pre.4
10
- * Loosen the dependency requirements
11
-
12
- ### v0.2.2.pre.3
13
- * Update to solargraph 0.42.3
14
- * Determine return type of association using class_name argument
15
-
16
- ### v0.2.2.pre.2
17
-
18
- * Simplistic support for associations
19
- * Added dependency on ActiveSupport 6.1 for helpful String methods like `.camelize` and `.singularize`
20
-
21
- ### v0.2.1
22
-
23
- * Update Solargraph to 0.41
24
-
25
- ### v0.2.0
26
- First released version with no need to use --pre!
27
-
28
- * Updated dependencies with security warnings