redcar-filter-through-command 1.3.2-java → 1.3.4-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/changes.md +5 -0
 - data/lib/filter_command/command_parser.rb +4 -3
 - data/lib/filter_command/evaluator.rb +21 -22
 - data/plugin.rb +1 -1
 - metadata +2 -2
 
    
        data/changes.md
    CHANGED
    
    | 
         @@ -1,6 +1,11 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Changelog
         
     | 
| 
       2 
2 
     | 
    
         
             
            =========
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
      
 4 
     | 
    
         
            +
            ##1.3.4
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            * Fix for variable substitution not working when input type set to 'None' with an edit tab focussed
         
     | 
| 
      
 7 
     | 
    
         
            +
            * Fix for selection variable persisting when unselecting text
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       4 
9 
     | 
    
         
             
            ##1.3.2
         
     | 
| 
       5 
10 
     | 
    
         | 
| 
       6 
11 
     | 
    
         
             
            * Fix for missing refactor for execute line function to pull most recent command from history
         
     | 
| 
         @@ -11,15 +11,16 @@ module Redcar 
     | 
|
| 
       11 
11 
     | 
    
         
             
                  end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                  # Sets and inserts supported variables into the shell command enviroment
         
     | 
| 
       14 
     | 
    
         
            -
                  # and replaces shortened substitution characters
         
     | 
| 
      
 14 
     | 
    
         
            +
                  # and replaces shortened substitution characters. Supported variables
         
     | 
| 
      
 15 
     | 
    
         
            +
                  # require that an editable tab is focussed for substitution to occur.
         
     | 
| 
       15 
16 
     | 
    
         
             
                  # @param [Redcar::Document] doc a document for use in the current command
         
     | 
| 
       16 
17 
     | 
    
         
             
                  # @param [String] command the command to be executed
         
     | 
| 
       17 
18 
     | 
    
         
             
                  def self.substitute_variables doc, command
         
     | 
| 
       18 
19 
     | 
    
         
             
                    output = {}
         
     | 
| 
       19 
     | 
    
         
            -
                    ENV['REDCAR_SELECTION'] = doc.selected_text  
     | 
| 
      
 20 
     | 
    
         
            +
                    ENV['REDCAR_SELECTION'] = doc.selection? ? doc.selected_text : doc.get_line_without_end_of_line(doc.cursor_line)
         
     | 
| 
       20 
21 
     | 
    
         
             
                    ENV['REDCAR_DOCUMENT'] = doc.get_all_text
         
     | 
| 
       21 
22 
     | 
    
         
             
                    ENV['REDCAR_WORD'] = doc.current_word
         
     | 
| 
       22 
     | 
    
         
            -
                    ENV['REDCAR_LINE'] = doc. 
     | 
| 
      
 23 
     | 
    
         
            +
                    ENV['REDCAR_LINE'] = doc.get_line_without_end_of_line(doc.cursor_line)
         
     | 
| 
       23 
24 
     | 
    
         
             
                    ENV['REDCAR_SCOPE'] = doc.cursor_scope
         
     | 
| 
       24 
25 
     | 
    
         
             
                    supported_variables.each do |var|
         
     | 
| 
       25 
26 
     | 
    
         
             
                      unless ENV['REDCAR_'+var].nil?
         
     | 
| 
         @@ -18,32 +18,31 @@ module Redcar 
     | 
|
| 
       18 
18 
     | 
    
         
             
                    win = Redcar.app.focussed_window
         
     | 
| 
       19 
19 
     | 
    
         
             
                    tab = win.focussed_notebook_tab
         
     | 
| 
       20 
20 
     | 
    
         
             
                    original_command = command.clone
         
     | 
| 
       21 
     | 
    
         
            -
                     
     | 
| 
       22 
     | 
    
         
            -
                       
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                          else
         
     | 
| 
       28 
     | 
    
         
            -
                            selection = doc.get_line_without_end_of_line(doc.cursor_line)
         
     | 
| 
       29 
     | 
    
         
            -
                          end
         
     | 
| 
       30 
     | 
    
         
            -
                          command = pipe_text(selection, command)
         
     | 
| 
       31 
     | 
    
         
            -
                        when "Document"
         
     | 
| 
       32 
     | 
    
         
            -
                          command  = pipe_text(doc.get_all_text, command)
         
     | 
| 
       33 
     | 
    
         
            -
                        when "Cursor Line"
         
     | 
| 
       34 
     | 
    
         
            -
                          command  = pipe_text(doc.get_line_without_end_of_line(doc.cursor_line), command)
         
     | 
| 
       35 
     | 
    
         
            -
                        when "Cursor Word"
         
     | 
| 
       36 
     | 
    
         
            -
                          command  = pipe_text(doc.current_word, command)
         
     | 
| 
      
 21 
     | 
    
         
            +
                    if tab and tab.is_a?(Redcar::EditTab) and doc = tab.edit_view.document
         
     | 
| 
      
 22 
     | 
    
         
            +
                      case input
         
     | 
| 
      
 23 
     | 
    
         
            +
                      when "None" # do nothing
         
     | 
| 
      
 24 
     | 
    
         
            +
                      when "Selection"
         
     | 
| 
      
 25 
     | 
    
         
            +
                        if doc.selection?
         
     | 
| 
      
 26 
     | 
    
         
            +
                          selection = doc.selected_text
         
     | 
| 
       37 
27 
     | 
    
         
             
                        else
         
     | 
| 
       38 
     | 
    
         
            -
                           
     | 
| 
      
 28 
     | 
    
         
            +
                          selection = doc.get_line_without_end_of_line(doc.cursor_line)
         
     | 
| 
       39 
29 
     | 
    
         
             
                        end
         
     | 
| 
       40 
     | 
    
         
            -
                         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                         
     | 
| 
      
 30 
     | 
    
         
            +
                        command = pipe_text(selection, command)
         
     | 
| 
      
 31 
     | 
    
         
            +
                      when "Document"
         
     | 
| 
      
 32 
     | 
    
         
            +
                        command  = pipe_text(doc.get_all_text, command)
         
     | 
| 
      
 33 
     | 
    
         
            +
                      when "Cursor Line"
         
     | 
| 
      
 34 
     | 
    
         
            +
                        command  = pipe_text(doc.get_line_without_end_of_line(doc.cursor_line), command)
         
     | 
| 
      
 35 
     | 
    
         
            +
                      when "Cursor Word"
         
     | 
| 
      
 36 
     | 
    
         
            +
                        command  = pipe_text(doc.current_word, command)
         
     | 
| 
       43 
37 
     | 
    
         
             
                      else
         
     | 
| 
       44 
     | 
    
         
            -
                         
     | 
| 
       45 
     | 
    
         
            -
                        return
         
     | 
| 
      
 38 
     | 
    
         
            +
                        raise "Unknown input type found: #{input}"
         
     | 
| 
       46 
39 
     | 
    
         
             
                      end
         
     | 
| 
      
 40 
     | 
    
         
            +
                      result  = FilterCommand::CommandParser.substitute_variables(doc,command)
         
     | 
| 
      
 41 
     | 
    
         
            +
                      command = result['command']
         
     | 
| 
      
 42 
     | 
    
         
            +
                      temp    = result['temp']
         
     | 
| 
      
 43 
     | 
    
         
            +
                    elsif input != "None"
         
     | 
| 
      
 44 
     | 
    
         
            +
                      tab_type_error input
         
     | 
| 
      
 45 
     | 
    
         
            +
                      return
         
     | 
| 
       47 
46 
     | 
    
         
             
                    end
         
     | 
| 
       48 
47 
     | 
    
         
             
                    execute_command win, command, input, output
         
     | 
| 
       49 
48 
     | 
    
         
             
                    if temp and File.exist?(temp)
         
     | 
    
        data/plugin.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -2,7 +2,7 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            name: redcar-filter-through-command
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
4 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       5 
     | 
    
         
            -
              version: 1.3. 
     | 
| 
      
 5 
     | 
    
         
            +
              version: 1.3.4
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: java
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors: 
         
     | 
| 
       8 
8 
     | 
    
         
             
              - Delisa Mason
         
     | 
| 
         @@ -10,7 +10,7 @@ autorequire: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
            date: 2011-09- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2011-09-10 00:00:00 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       15 
15 
     | 
    
         
             
              - !ruby/object:Gem::Dependency 
         
     | 
| 
       16 
16 
     | 
    
         
             
                name: redcar-dev
         
     |