mj 0.5.4 → 0.6.0

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: 1c41690187e0bdc1673d0e3719ab6a01b7059459ec25a957228ac64435b72f6a
4
- data.tar.gz: 59b806a25685ef0661da12675bc098863c28e6b2b0d5c3ba6ae3bdf524de24b3
3
+ metadata.gz: efbd2ad2b7959ec1add88daadd57eaf56787c7f1e3a0297b676500f644ce2bf5
4
+ data.tar.gz: 9d3b3cfc72c599c70f76019093526870bafefc2063a08535cc58702b2e199828
5
5
  SHA512:
6
- metadata.gz: 81c3559bc183377f40f99af130be362d1d39d3d68451ecbabff3cb084496bfe51d4cff9111771a9fe3449d2a890ea060ed4ba3847d1cad9d9cb52f3189a4fa79
7
- data.tar.gz: 9a15946c97689290f26b32a89e06b0405384df0282d97b50766581ace012430c05ddddcf082892997658e100851bddbdb767dd0de58003e8176387aefac655ed
6
+ metadata.gz: afb390219762a7f89a6e67936b0b6dfdb447bc970bae132e02989c25491075ce2c0beb6bb6196c03c9fe3b2ac625d7c4c5d7ba744eb0556a851eba4117c7e50f
7
+ data.tar.gz: af2332590c6cf8f828244e720e16f550c7ced67c7394087f3f9c85fe77fd06ec93c09a5163bcf978c8044d42e6996fbcad325b62f60cc68122c9b6e11a838098
data/.rubocop.yml CHANGED
@@ -27,7 +27,7 @@ Layout/FirstArrayElementIndentation:
27
27
 
28
28
  Layout/LineLength:
29
29
  Max: 120
30
-
30
+
31
31
  Layout/MultilineMethodCallIndentation:
32
32
  EnforcedStyle: indented
33
33
 
@@ -87,10 +87,12 @@ RSpec/ExpectChange:
87
87
  RSpec/MultipleExpectations:
88
88
  Enabled: false
89
89
 
90
+ RSpec/MultipleMemoizedHelpers:
91
+ Enabled: false
92
+
90
93
  RSpec/NestedGroups:
91
94
  Max: 4
92
95
 
93
96
  # while that is a good rule, AR objects can't be properly instance_double'd
94
97
  RSpec/VerifiedDoubles:
95
98
  Enabled: false
96
-
data/Gemfile CHANGED
@@ -7,6 +7,7 @@ gemspec
7
7
 
8
8
  gem "awesome_print"
9
9
  gem "koine-test_runner"
10
+ gem "pry", require: true
10
11
  gem "rake", "~> 13.0"
11
12
  gem "rspec", "~> 3.0"
12
13
  gem "rubocop", "~> 1.21"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mj (0.5.4)
4
+ mj (0.6.0)
5
5
  thor (~> 1.2.1)
6
6
 
7
7
  GEM
@@ -9,12 +9,17 @@ GEM
9
9
  specs:
10
10
  ast (2.4.2)
11
11
  awesome_print (1.9.2)
12
+ coderay (1.1.3)
12
13
  diff-lcs (1.5.0)
13
14
  docile (1.4.0)
14
15
  koine-test_runner (0.4.0)
16
+ method_source (1.0.0)
15
17
  parallel (1.21.0)
16
18
  parser (3.1.1.0)
17
19
  ast (~> 2.4.1)
20
+ pry (0.14.2)
21
+ coderay (~> 1.1)
22
+ method_source (~> 1.0)
18
23
  rainbow (3.1.1)
19
24
  rake (13.0.6)
20
25
  regexp_parser (2.2.1)
@@ -58,7 +63,7 @@ GEM
58
63
  simplecov-html (0.12.3)
59
64
  simplecov-lcov (0.8.0)
60
65
  simplecov_json_formatter (0.1.4)
61
- thor (1.2.1)
66
+ thor (1.2.2)
62
67
  unicode-display_width (2.1.0)
63
68
 
64
69
  PLATFORMS
@@ -68,6 +73,7 @@ DEPENDENCIES
68
73
  awesome_print
69
74
  koine-test_runner
70
75
  mj!
76
+ pry
71
77
  rake (~> 13.0)
72
78
  rspec (~> 3.0)
73
79
  rubocop (~> 1.21)
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Mj
4
+ module AlternativeFile
5
+ module Resolvers
6
+ module Ruby
7
+ class VendoredGemsResolver < Resolvers::Base
8
+ def initialize
9
+ @rails = RailsResolver.new
10
+ end
11
+
12
+ private
13
+
14
+ def apply_to?(file)
15
+ file.extension == "rb" && find_root(file)
16
+ end
17
+
18
+ def add_candidates(file, candidates) # rubocop:disable Metrics/MethodLength
19
+ root = find_root(file)
20
+
21
+ @rails.resolve(file).each do |resolved|
22
+ found = resolved.to_s.sub("#{root}/app/", "")
23
+ found = found.sub("#{root}/", "")
24
+
25
+ unless found.match?("_spec.rb")
26
+ found = found.sub("spec/", "")
27
+ end
28
+
29
+ unless found.match?("_test.rb")
30
+ found = found.sub("test/", "")
31
+ end
32
+
33
+ file = [root, found].flatten.join("/")
34
+ add_candidate(file, resolved.type, to: candidates)
35
+ end
36
+ end
37
+
38
+ def find_root(file)
39
+ root = nil
40
+
41
+ parts = file.to_s.split("/")
42
+ parts.each do |part|
43
+ root = [root, part].compact.join("/")
44
+
45
+ if Dir["#{root}/*.gemspec"].any?
46
+ return root
47
+ end
48
+ end
49
+
50
+ nil
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -10,6 +10,7 @@ require_relative "resolvers/ruby/rails_resolver"
10
10
  require_relative "resolvers/ruby/rails_controller_resolver"
11
11
  require_relative "resolvers/ruby/view_component_resolver"
12
12
  require_relative "resolvers/ruby/packwerk_resolver"
13
+ require_relative "resolvers/ruby/vendored_gems_resolver"
13
14
  require_relative "resolvers/ruby/ruby_file"
14
15
  require_relative "commands/list_command_handler"
15
16
  require_relative "commands/list_command"
data/lib/mj/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mj
4
- VERSION = "0.5.4"
4
+ VERSION = "0.6.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mj
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Jacobus
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-06 00:00:00.000000000 Z
11
+ date: 2024-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -32,7 +32,6 @@ executables:
32
32
  extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
- - ".project.vim"
36
35
  - ".rspec"
37
36
  - ".rubocop.yml"
38
37
  - ".test_runner.yml"
@@ -56,6 +55,7 @@ files:
56
55
  - lib/mj/alternative_file/resolvers/ruby/rails_controller_resolver.rb
57
56
  - lib/mj/alternative_file/resolvers/ruby/rails_resolver.rb
58
57
  - lib/mj/alternative_file/resolvers/ruby/ruby_file.rb
58
+ - lib/mj/alternative_file/resolvers/ruby/vendored_gems_resolver.rb
59
59
  - lib/mj/alternative_file/resolvers/ruby/view_component_resolver.rb
60
60
  - lib/mj/alternative_file/thor_command.rb
61
61
  - lib/mj/cli.rb
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
88
  requirements: []
89
- rubygems_version: 3.2.33
89
+ rubygems_version: 3.4.10
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: My personal CLI
data/.project.vim DELETED
@@ -1,33 +0,0 @@
1
- autocmd FileType ruby nnoremap <buffer> <leader>T <esc>:call RunTestFile()<cr>
2
- autocmd FileType ruby nnoremap <buffer> <leader>t <esc>:call RunTestFileFilteredByLine()<cr>
3
- autocmd FileType ruby nnoremap <buffer> <leader>at <esc>:call RunAllTests()<cr>
4
- function! RubocopFixCs(target)
5
- let options=''
6
- let cmd = 'bundle exec rubocop'
7
-
8
- if filereadable('./bin/bundle')
9
- let cmd = './bin/bundle exec rubocop'
10
- endif
11
-
12
- if filereadable('.rubocop.yml')
13
- let options = ' --config=.rubocop.yml '
14
- endif
15
-
16
- let full_command = cmd . " -A " . options . a:target
17
- call ClearEchoAndExecute(full_command)
18
- endfunction
19
-
20
- function! RunTestFileFilteredByLine()
21
- let command = "bundle exec run_test " . expand('%') . " --line=" . line(".")
22
- call ClearEchoAndExecute(command)
23
- endfunction
24
-
25
- function! RunTestFile()
26
- let command = "bundle exec run_test " . expand('%')
27
- call ClearEchoAndExecute(command)
28
- endfunction
29
-
30
- function! RunAllTests()
31
- let command = "bundle exec run_test " . expand('%') . " --all"
32
- call ClearEchoAndExecute(command)
33
- endfunction