mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	Added syntax_suggest cli and resolve failing exapmle with it
This commit is contained in:
		
							parent
							
								
									bd1b1eeb0e
								
							
						
					
					
						commit
						8dfc077f70
					
				
				
				Notes:
				
					git
				
				2022-08-26 12:16:16 +09:00 
				
			
			
			
		
		
					 3 changed files with 16 additions and 1 deletions
				
			
		
							
								
								
									
										7
									
								
								libexec/syntax_suggest
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										7
									
								
								libexec/syntax_suggest
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
#!/usr/bin/env ruby
 | 
			
		||||
 | 
			
		||||
require_relative "../lib/syntax_suggest/api"
 | 
			
		||||
 | 
			
		||||
SyntaxSuggest::Cli.new(
 | 
			
		||||
  argv: ARGV
 | 
			
		||||
).call
 | 
			
		||||
| 
						 | 
				
			
			@ -5,7 +5,11 @@ require_relative "../spec_helper"
 | 
			
		|||
module SyntaxSuggest
 | 
			
		||||
  RSpec.describe "exe" do
 | 
			
		||||
    def exe_path
 | 
			
		||||
      root_dir.join("exe").join("syntax_suggest")
 | 
			
		||||
      if ruby_core?
 | 
			
		||||
        root_dir.join("../libexec").join("syntax_suggest")
 | 
			
		||||
      else
 | 
			
		||||
        root_dir.join("exe").join("syntax_suggest")
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def exe(cmd)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,6 +43,10 @@ def fixtures_dir
 | 
			
		|||
  spec_dir.join("fixtures")
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
def ruby_core?
 | 
			
		||||
  !root_dir.join("syntax_suggest.gemspec").exist?
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
def code_line_array(source)
 | 
			
		||||
  SyntaxSuggest::CleanDocument.new(source: source).call.lines
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue