bundle_outdated_formatter 0.2.0 → 0.3.0
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.
- checksums.yaml +4 -4
 - data/.rubocop.yml +6 -0
 - data/.rubocop_todo.yml +1 -60
 - data/CHANGELOG.md +8 -0
 - data/README.md +108 -0
 - data/Rakefile +1 -1
 - data/bundle_outdated_formatter.gemspec +3 -2
 - data/lib/bundle_outdated_formatter/cli.rb +27 -6
 - data/lib/bundle_outdated_formatter/error.rb +4 -0
 - data/lib/bundle_outdated_formatter/formatter.rb +34 -98
 - data/lib/bundle_outdated_formatter/formatter/csv_formatter.rb +17 -0
 - data/lib/bundle_outdated_formatter/formatter/html_formatter.rb +45 -0
 - data/lib/bundle_outdated_formatter/formatter/json_formatter.rb +12 -0
 - data/lib/bundle_outdated_formatter/formatter/markdown_formatter.rb +19 -0
 - data/lib/bundle_outdated_formatter/formatter/tsv_formatter.rb +17 -0
 - data/lib/bundle_outdated_formatter/formatter/xml_formatter.rb +36 -0
 - data/lib/bundle_outdated_formatter/formatter/yaml_formatter.rb +11 -0
 - data/lib/bundle_outdated_formatter/version.rb +1 -1
 - metadata +10 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 01ca034f54fe1038725483780bd66d5ffaa54dd4
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 4d73ac36a9fbc80284074eef08d8e277b69a031d
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: bd843a7fe2d0ea2d97d4a1517576db6dc6b9cc4272ca5573e1330d9de37dd1d13203b17572bf978e3aa018f82f6dcfbe5bb31ece0129198307cdc6a5b096a035
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 5c8ffeeb1c97cb179bee7ffe33d2de0355b3c3c827eef1bd1715fb10b8df779f9ee10cb448bc8b1314511e6054c72b57d0e9c1bd9243ec85c2d19b08833e9288
         
     | 
    
        data/.rubocop.yml
    CHANGED
    
    
    
        data/.rubocop_todo.yml
    CHANGED
    
    | 
         @@ -1,66 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # This configuration was generated by
         
     | 
| 
       2 
2 
     | 
    
         
             
            # `rubocop --auto-gen-config`
         
     | 
| 
       3 
     | 
    
         
            -
            # on 2017- 
     | 
| 
      
 3 
     | 
    
         
            +
            # on 2017-07-08 13:45:56 +0900 using RuboCop version 0.49.1.
         
     | 
| 
       4 
4 
     | 
    
         
             
            # The point is for the user to remove these configuration records
         
     | 
| 
       5 
5 
     | 
    
         
             
            # one by one as the offenses are removed from the code base.
         
     | 
| 
       6 
6 
     | 
    
         
             
            # Note that changes in the inspected code, or installation of new
         
     | 
| 
       7 
7 
     | 
    
         
             
            # versions of RuboCop, may require this file to be generated again.
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
            # Offense count: 1
         
     | 
| 
       10 
     | 
    
         
            -
            # Cop supports --auto-correct.
         
     | 
| 
       11 
     | 
    
         
            -
            Layout/EmptyLineAfterMagicComment:
         
     | 
| 
       12 
     | 
    
         
            -
              Exclude:
         
     | 
| 
       13 
     | 
    
         
            -
                - 'bundle_outdated_formatter.gemspec'
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
            # Offense count: 2
         
     | 
| 
       16 
     | 
    
         
            -
            Metrics/AbcSize:
         
     | 
| 
       17 
     | 
    
         
            -
              Max: 23
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
            # Offense count: 1
         
     | 
| 
       20 
     | 
    
         
            -
            # Configuration parameters: CountComments.
         
     | 
| 
       21 
     | 
    
         
            -
            Metrics/ClassLength:
         
     | 
| 
       22 
     | 
    
         
            -
              Max: 102
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
            # Offense count: 1
         
     | 
| 
       25 
     | 
    
         
            -
            Metrics/CyclomaticComplexity:
         
     | 
| 
       26 
     | 
    
         
            -
              Max: 7
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
            # Offense count: 8
         
     | 
| 
       29 
     | 
    
         
            -
            # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
         
     | 
| 
       30 
     | 
    
         
            -
            # URISchemes: http, https
         
     | 
| 
       31 
     | 
    
         
            -
            Metrics/LineLength:
         
     | 
| 
       32 
     | 
    
         
            -
              Max: 126
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
            # Offense count: 4
         
     | 
| 
       35 
     | 
    
         
            -
            # Configuration parameters: CountComments.
         
     | 
| 
       36 
     | 
    
         
            -
            Metrics/MethodLength:
         
     | 
| 
       37 
     | 
    
         
            -
              Max: 20
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
            # Offense count: 2
         
     | 
| 
       40 
     | 
    
         
            -
            Style/Documentation:
         
     | 
| 
       41 
     | 
    
         
            -
              Exclude:
         
     | 
| 
       42 
     | 
    
         
            -
                - 'spec/**/*'
         
     | 
| 
       43 
     | 
    
         
            -
                - 'test/**/*'
         
     | 
| 
       44 
     | 
    
         
            -
                - 'lib/bundle_outdated_formatter/cli.rb'
         
     | 
| 
       45 
     | 
    
         
            -
                - 'lib/bundle_outdated_formatter/formatter.rb'
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
            # Offense count: 1
         
     | 
| 
       48 
     | 
    
         
            -
            # Cop supports --auto-correct.
         
     | 
| 
       49 
     | 
    
         
            -
            # Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
         
     | 
| 
       50 
     | 
    
         
            -
            # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
         
     | 
| 
       51 
     | 
    
         
            -
            Style/HashSyntax:
         
     | 
| 
       52 
     | 
    
         
            -
              Exclude:
         
     | 
| 
       53 
     | 
    
         
            -
                - 'Rakefile'
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
            # Offense count: 2
         
     | 
| 
       56 
     | 
    
         
            -
            # Cop supports --auto-correct.
         
     | 
| 
       57 
     | 
    
         
            -
            # Configuration parameters: PreferredDelimiters.
         
     | 
| 
       58 
     | 
    
         
            -
            Style/PercentLiteralDelimiters:
         
     | 
| 
       59 
     | 
    
         
            -
              Exclude:
         
     | 
| 
       60 
     | 
    
         
            -
                - 'bundle_outdated_formatter.gemspec'
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
            # Offense count: 2
         
     | 
| 
       63 
     | 
    
         
            -
            # Cop supports --auto-correct.
         
     | 
| 
       64 
     | 
    
         
            -
            Style/UnneededPercentQ:
         
     | 
| 
       65 
     | 
    
         
            -
              Exclude:
         
     | 
| 
       66 
     | 
    
         
            -
                - 'bundle_outdated_formatter.gemspec'
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -41,6 +41,7 @@ $ bundle outdated | bof 
     | 
|
| 
       41 
41 
     | 
    
         
             
            | Option | Alias | Description | Default |
         
     | 
| 
       42 
42 
     | 
    
         
             
            | :----- | :---- | :---------- | :------ |
         
     | 
| 
       43 
43 
     | 
    
         
             
            | `--format` | `-f` | Format. `markdown`, `json`, `yaml`, `csv`, `xml`, or `html`. | `markdown` |
         
     | 
| 
      
 44 
     | 
    
         
            +
            | `--pretty` | `-p` | `true` if pretty output.<br>This option is available in `json`, `xml`, or `html` formats. | `false` |
         
     | 
| 
       44 
45 
     | 
    
         | 
| 
       45 
46 
     | 
    
         
             
            ## Examples
         
     | 
| 
       46 
47 
     | 
    
         | 
| 
         @@ -70,10 +71,40 @@ Outdated gems included in the bundle: 
     | 
|
| 
       70 
71 
     | 
    
         | 
| 
       71 
72 
     | 
    
         
             
            ### Convert to JSON
         
     | 
| 
       72 
73 
     | 
    
         | 
| 
      
 74 
     | 
    
         
            +
            Normal output:
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
       73 
76 
     | 
    
         
             
            ```
         
     | 
| 
       74 
77 
     | 
    
         
             
            [{"gem":"faker","newest":"1.6.6","installed":"1.6.5","requested":"~> 1.4","groups":"development, test"},{"gem":"hashie","newest":"3.4.6","installed":"1.2.0","requested":"= 1.2.0","groups":"default"},{"gem":"headless","newest":"2.3.1","installed":"2.2.3","requested":"","groups":""}]
         
     | 
| 
       75 
78 
     | 
    
         
             
            ```
         
     | 
| 
       76 
79 
     | 
    
         | 
| 
      
 80 
     | 
    
         
            +
            Pretty output:
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
            ```
         
     | 
| 
      
 83 
     | 
    
         
            +
            [
         
     | 
| 
      
 84 
     | 
    
         
            +
              {
         
     | 
| 
      
 85 
     | 
    
         
            +
                "gem": "faker",
         
     | 
| 
      
 86 
     | 
    
         
            +
                "newest": "1.6.6",
         
     | 
| 
      
 87 
     | 
    
         
            +
                "installed": "1.6.5",
         
     | 
| 
      
 88 
     | 
    
         
            +
                "requested": "~> 1.4",
         
     | 
| 
      
 89 
     | 
    
         
            +
                "groups": "development, test"
         
     | 
| 
      
 90 
     | 
    
         
            +
              },
         
     | 
| 
      
 91 
     | 
    
         
            +
              {
         
     | 
| 
      
 92 
     | 
    
         
            +
                "gem": "hashie",
         
     | 
| 
      
 93 
     | 
    
         
            +
                "newest": "3.4.6",
         
     | 
| 
      
 94 
     | 
    
         
            +
                "installed": "1.2.0",
         
     | 
| 
      
 95 
     | 
    
         
            +
                "requested": "= 1.2.0",
         
     | 
| 
      
 96 
     | 
    
         
            +
                "groups": "default"
         
     | 
| 
      
 97 
     | 
    
         
            +
              },
         
     | 
| 
      
 98 
     | 
    
         
            +
              {
         
     | 
| 
      
 99 
     | 
    
         
            +
                "gem": "headless",
         
     | 
| 
      
 100 
     | 
    
         
            +
                "newest": "2.3.1",
         
     | 
| 
      
 101 
     | 
    
         
            +
                "installed": "2.2.3",
         
     | 
| 
      
 102 
     | 
    
         
            +
                "requested": "",
         
     | 
| 
      
 103 
     | 
    
         
            +
                "groups": ""
         
     | 
| 
      
 104 
     | 
    
         
            +
              }
         
     | 
| 
      
 105 
     | 
    
         
            +
            ]
         
     | 
| 
      
 106 
     | 
    
         
            +
            ```
         
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
       77 
108 
     | 
    
         
             
            ### Convert to YAML
         
     | 
| 
       78 
109 
     | 
    
         | 
| 
       79 
110 
     | 
    
         
             
            ```
         
     | 
| 
         @@ -104,18 +135,95 @@ Outdated gems included in the bundle: 
     | 
|
| 
       104 
135 
     | 
    
         
             
            "headless","2.3.1","2.2.3","",""
         
     | 
| 
       105 
136 
     | 
    
         
             
            ```
         
     | 
| 
       106 
137 
     | 
    
         | 
| 
      
 138 
     | 
    
         
            +
            ### Convert to TSV
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
            ```
         
     | 
| 
      
 141 
     | 
    
         
            +
            "gem"	"newest"	"installed"	"requested"	"groups"
         
     | 
| 
      
 142 
     | 
    
         
            +
            "faker"	"1.6.6"	"1.6.5"	"~> 1.4"	"development, test"
         
     | 
| 
      
 143 
     | 
    
         
            +
            "hashie"	"3.4.6"	"1.2.0"	"= 1.2.0"	"default"
         
     | 
| 
      
 144 
     | 
    
         
            +
            "headless"	"2.3.1"	"2.2.3"	""	""
         
     | 
| 
      
 145 
     | 
    
         
            +
            ```
         
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
       107 
147 
     | 
    
         
             
            ### Convert to XML
         
     | 
| 
       108 
148 
     | 
    
         | 
| 
      
 149 
     | 
    
         
            +
            Normal output:
         
     | 
| 
      
 150 
     | 
    
         
            +
             
     | 
| 
       109 
151 
     | 
    
         
             
            ```
         
     | 
| 
       110 
152 
     | 
    
         
             
            <?xml version='1.0' encoding='UTF-8'?><gems><outdated><gem>faker</gem><newest>1.6.6</newest><installed>1.6.5</installed><requested>~> 1.4</requested><groups>development, test</groups></outdated><outdated><gem>hashie</gem><newest>3.4.6</newest><installed>1.2.0</installed><requested>= 1.2.0</requested><groups>default</groups></outdated><outdated><gem>headless</gem><newest>2.3.1</newest><installed>2.2.3</installed><requested></requested><groups></groups></outdated></gems>
         
     | 
| 
       111 
153 
     | 
    
         
             
            ```
         
     | 
| 
       112 
154 
     | 
    
         | 
| 
      
 155 
     | 
    
         
            +
            Pretty output:
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
            ```
         
     | 
| 
      
 158 
     | 
    
         
            +
            <?xml version='1.0' encoding='UTF-8'?>
         
     | 
| 
      
 159 
     | 
    
         
            +
            <gems>
         
     | 
| 
      
 160 
     | 
    
         
            +
              <outdated>
         
     | 
| 
      
 161 
     | 
    
         
            +
                <gem>faker</gem>
         
     | 
| 
      
 162 
     | 
    
         
            +
                <newest>1.6.6</newest>
         
     | 
| 
      
 163 
     | 
    
         
            +
                <installed>1.6.5</installed>
         
     | 
| 
      
 164 
     | 
    
         
            +
                <requested>~> 1.4</requested>
         
     | 
| 
      
 165 
     | 
    
         
            +
                <groups>development, test</groups>
         
     | 
| 
      
 166 
     | 
    
         
            +
              </outdated>
         
     | 
| 
      
 167 
     | 
    
         
            +
              <outdated>
         
     | 
| 
      
 168 
     | 
    
         
            +
                <gem>hashie</gem>
         
     | 
| 
      
 169 
     | 
    
         
            +
                <newest>3.4.6</newest>
         
     | 
| 
      
 170 
     | 
    
         
            +
                <installed>1.2.0</installed>
         
     | 
| 
      
 171 
     | 
    
         
            +
                <requested>= 1.2.0</requested>
         
     | 
| 
      
 172 
     | 
    
         
            +
                <groups>default</groups>
         
     | 
| 
      
 173 
     | 
    
         
            +
              </outdated>
         
     | 
| 
      
 174 
     | 
    
         
            +
              <outdated>
         
     | 
| 
      
 175 
     | 
    
         
            +
                <gem>headless</gem>
         
     | 
| 
      
 176 
     | 
    
         
            +
                <newest>2.3.1</newest>
         
     | 
| 
      
 177 
     | 
    
         
            +
                <installed>2.2.3</installed>
         
     | 
| 
      
 178 
     | 
    
         
            +
                <requested></requested>
         
     | 
| 
      
 179 
     | 
    
         
            +
                <groups></groups>
         
     | 
| 
      
 180 
     | 
    
         
            +
              </outdated>
         
     | 
| 
      
 181 
     | 
    
         
            +
            </gems>
         
     | 
| 
      
 182 
     | 
    
         
            +
            ```
         
     | 
| 
      
 183 
     | 
    
         
            +
             
     | 
| 
       113 
184 
     | 
    
         
             
            ### Convert to HTML
         
     | 
| 
       114 
185 
     | 
    
         | 
| 
      
 186 
     | 
    
         
            +
            Normal output:
         
     | 
| 
      
 187 
     | 
    
         
            +
             
     | 
| 
       115 
188 
     | 
    
         
             
            ```
         
     | 
| 
       116 
189 
     | 
    
         
             
            <table><tr><th>gem</th><th>newest</th><th>installed</th><th>requested</th><th>groups</th></tr><tr><td>faker</td><td>1.6.6</td><td>1.6.5</td><td>~> 1.4</td><td>development, test</td></tr><tr><td>hashie</td><td>3.4.6</td><td>1.2.0</td><td>= 1.2.0</td><td>default</td></tr><tr><td>headless</td><td>2.3.1</td><td>2.2.3</td><td></td><td></td></tr></table>
         
     | 
| 
       117 
190 
     | 
    
         
             
            ```
         
     | 
| 
       118 
191 
     | 
    
         | 
| 
      
 192 
     | 
    
         
            +
            Pretty output:
         
     | 
| 
      
 193 
     | 
    
         
            +
             
     | 
| 
      
 194 
     | 
    
         
            +
            ```
         
     | 
| 
      
 195 
     | 
    
         
            +
            <table>
         
     | 
| 
      
 196 
     | 
    
         
            +
              <tr>
         
     | 
| 
      
 197 
     | 
    
         
            +
                <th>gem</th>
         
     | 
| 
      
 198 
     | 
    
         
            +
                <th>newest</th>
         
     | 
| 
      
 199 
     | 
    
         
            +
                <th>installed</th>
         
     | 
| 
      
 200 
     | 
    
         
            +
                <th>requested</th>
         
     | 
| 
      
 201 
     | 
    
         
            +
                <th>groups</th>
         
     | 
| 
      
 202 
     | 
    
         
            +
              </tr>
         
     | 
| 
      
 203 
     | 
    
         
            +
              <tr>
         
     | 
| 
      
 204 
     | 
    
         
            +
                <td>faker</td>
         
     | 
| 
      
 205 
     | 
    
         
            +
                <td>1.6.6</td>
         
     | 
| 
      
 206 
     | 
    
         
            +
                <td>1.6.5</td>
         
     | 
| 
      
 207 
     | 
    
         
            +
                <td>~> 1.4</td>
         
     | 
| 
      
 208 
     | 
    
         
            +
                <td>development, test</td>
         
     | 
| 
      
 209 
     | 
    
         
            +
              </tr>
         
     | 
| 
      
 210 
     | 
    
         
            +
              <tr>
         
     | 
| 
      
 211 
     | 
    
         
            +
                <td>hashie</td>
         
     | 
| 
      
 212 
     | 
    
         
            +
                <td>3.4.6</td>
         
     | 
| 
      
 213 
     | 
    
         
            +
                <td>1.2.0</td>
         
     | 
| 
      
 214 
     | 
    
         
            +
                <td>= 1.2.0</td>
         
     | 
| 
      
 215 
     | 
    
         
            +
                <td>default</td>
         
     | 
| 
      
 216 
     | 
    
         
            +
              </tr>
         
     | 
| 
      
 217 
     | 
    
         
            +
              <tr>
         
     | 
| 
      
 218 
     | 
    
         
            +
                <td>headless</td>
         
     | 
| 
      
 219 
     | 
    
         
            +
                <td>2.3.1</td>
         
     | 
| 
      
 220 
     | 
    
         
            +
                <td>2.2.3</td>
         
     | 
| 
      
 221 
     | 
    
         
            +
                <td></td>
         
     | 
| 
      
 222 
     | 
    
         
            +
                <td></td>
         
     | 
| 
      
 223 
     | 
    
         
            +
              </tr>
         
     | 
| 
      
 224 
     | 
    
         
            +
            </table>
         
     | 
| 
      
 225 
     | 
    
         
            +
            ```
         
     | 
| 
      
 226 
     | 
    
         
            +
             
     | 
| 
       119 
227 
     | 
    
         
             
            ## Supported Ruby Versions
         
     | 
| 
       120 
228 
     | 
    
         | 
| 
       121 
229 
     | 
    
         
             
            * Ruby 2.0.0
         
     | 
    
        data/Rakefile
    CHANGED
    
    
| 
         @@ -1,4 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       2 
3 
     | 
    
         
             
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
       3 
4 
     | 
    
         
             
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
       4 
5 
     | 
    
         
             
            require 'bundle_outdated_formatter/version'
         
     | 
| 
         @@ -9,8 +10,8 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       9 
10 
     | 
    
         
             
              spec.authors       = ['emsk']
         
     | 
| 
       10 
11 
     | 
    
         
             
              spec.email         = ['emsk1987@gmail.com']
         
     | 
| 
       11 
12 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
              spec.summary       =  
     | 
| 
       13 
     | 
    
         
            -
              spec.description   =  
     | 
| 
      
 13 
     | 
    
         
            +
              spec.summary       = 'Formatter for `bundle outdated`'
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.description   = 'BundleOutdatedFormatter is a command-line tool to format output of `bundle outdated`'
         
     | 
| 
       14 
15 
     | 
    
         
             
              spec.homepage      = 'https://github.com/emsk/bundle_outdated_formatter'
         
     | 
| 
       15 
16 
     | 
    
         
             
              spec.license       = 'MIT'
         
     | 
| 
       16 
17 
     | 
    
         | 
| 
         @@ -1,20 +1,37 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'thor'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'bundle_outdated_formatter/ 
     | 
| 
      
 2 
     | 
    
         
            +
            require 'bundle_outdated_formatter/error'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'bundle_outdated_formatter/formatter/markdown_formatter'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'bundle_outdated_formatter/formatter/json_formatter'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'bundle_outdated_formatter/formatter/yaml_formatter'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'bundle_outdated_formatter/formatter/csv_formatter'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'bundle_outdated_formatter/formatter/tsv_formatter'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'bundle_outdated_formatter/formatter/xml_formatter'
         
     | 
| 
      
 9 
     | 
    
         
            +
            require 'bundle_outdated_formatter/formatter/html_formatter'
         
     | 
| 
       3 
10 
     | 
    
         | 
| 
       4 
11 
     | 
    
         
             
            module BundleOutdatedFormatter
         
     | 
| 
      
 12 
     | 
    
         
            +
              # Command-line interface of {BundleOutdatedFormatter}
         
     | 
| 
       5 
13 
     | 
    
         
             
              class CLI < Thor
         
     | 
| 
       6 
     | 
    
         
            -
                 
     | 
| 
      
 14 
     | 
    
         
            +
                FORMATTERS = {
         
     | 
| 
      
 15 
     | 
    
         
            +
                  'markdown' => MarkdownFormatter,
         
     | 
| 
      
 16 
     | 
    
         
            +
                  'json'     => JSONFormatter,
         
     | 
| 
      
 17 
     | 
    
         
            +
                  'yaml'     => YAMLFormatter,
         
     | 
| 
      
 18 
     | 
    
         
            +
                  'csv'      => CSVFormatter,
         
     | 
| 
      
 19 
     | 
    
         
            +
                  'tsv'      => TSVFormatter,
         
     | 
| 
      
 20 
     | 
    
         
            +
                  'xml'      => XMLFormatter,
         
     | 
| 
      
 21 
     | 
    
         
            +
                  'html'     => HTMLFormatter
         
     | 
| 
      
 22 
     | 
    
         
            +
                }.freeze
         
     | 
| 
       7 
23 
     | 
    
         | 
| 
       8 
24 
     | 
    
         
             
                default_command :output
         
     | 
| 
       9 
25 
     | 
    
         | 
| 
       10 
26 
     | 
    
         
             
                desc 'output', 'Format output of `bundle outdated`'
         
     | 
| 
       11 
     | 
    
         
            -
                option :format, type: :string, aliases: '-f', default: 'markdown', desc: 'Format. (markdown, json, yaml, csv, xml, html)'
         
     | 
| 
      
 27 
     | 
    
         
            +
                option :format, type: :string, aliases: '-f', default: 'markdown', desc: 'Format. (markdown, json, yaml, csv, tsv, xml, html)'
         
     | 
| 
      
 28 
     | 
    
         
            +
                option :pretty, type: :boolean, aliases: '-p', desc: '`true` if pretty output.'
         
     | 
| 
       12 
29 
     | 
    
         | 
| 
       13 
30 
     | 
    
         
             
                def output
         
     | 
| 
      
 31 
     | 
    
         
            +
                  raise BundleOutdatedFormatter::UnknownFormatError, options[:format] unless allow_format?
         
     | 
| 
       14 
32 
     | 
    
         
             
                  return if STDIN.tty?
         
     | 
| 
       15 
     | 
    
         
            -
                  return unless allow_format?
         
     | 
| 
       16 
33 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
                  formatter =  
     | 
| 
      
 34 
     | 
    
         
            +
                  formatter = create_formatter
         
     | 
| 
       18 
35 
     | 
    
         
             
                  formatter.read_stdin
         
     | 
| 
       19 
36 
     | 
    
         
             
                  puts formatter.convert
         
     | 
| 
       20 
37 
     | 
    
         
             
                end
         
     | 
| 
         @@ -29,7 +46,11 @@ module BundleOutdatedFormatter 
     | 
|
| 
       29 
46 
     | 
    
         
             
                private
         
     | 
| 
       30 
47 
     | 
    
         | 
| 
       31 
48 
     | 
    
         
             
                def allow_format?
         
     | 
| 
       32 
     | 
    
         
            -
                   
     | 
| 
      
 49 
     | 
    
         
            +
                  FORMATTERS.keys.include?(options[:format])
         
     | 
| 
      
 50 
     | 
    
         
            +
                end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                def create_formatter
         
     | 
| 
      
 53 
     | 
    
         
            +
                  FORMATTERS[options[:format]].new(options)
         
     | 
| 
       33 
54 
     | 
    
         
             
                end
         
     | 
| 
       34 
55 
     | 
    
         
             
              end
         
     | 
| 
       35 
56 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,24 +1,18 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'json'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'psych'
         
     | 
| 
       3 
     | 
    
         
            -
            require 'csv'
         
     | 
| 
       4 
1 
     | 
    
         
             
            require 'rexml/document'
         
     | 
| 
       5 
2 
     | 
    
         | 
| 
       6 
3 
     | 
    
         
             
            module BundleOutdatedFormatter
         
     | 
| 
      
 4 
     | 
    
         
            +
              # Formatter for all formats
         
     | 
| 
       7 
5 
     | 
    
         
             
              class Formatter
         
     | 
| 
       8 
     | 
    
         
            -
                 
     | 
| 
      
 6 
     | 
    
         
            +
                GEM_REGEXP       = /\A(\* )*(?<gem>.+) \(/
         
     | 
| 
       9 
7 
     | 
    
         
             
                NEWEST_REGEXP    = /newest (?<newest>[\d\.]+)/
         
     | 
| 
       10 
8 
     | 
    
         
             
                INSTALLED_REGEXP = /installed (?<installed>[\d\.]+)/
         
     | 
| 
       11 
9 
     | 
    
         
             
                REQUESTED_REGEXP = /requested (?<requested>.+)\)/
         
     | 
| 
       12 
10 
     | 
    
         
             
                GROUPS_REGEXP    = /in groups "(?<groups>.+)"/
         
     | 
| 
       13 
11 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
                MARKDOWN_HEADER = <<-EOS.freeze
         
     | 
| 
       15 
     | 
    
         
            -
            | gem | newest | installed | requested | groups |
         
     | 
| 
       16 
     | 
    
         
            -
            | --- | --- | --- | --- | --- |
         
     | 
| 
       17 
     | 
    
         
            -
                EOS
         
     | 
| 
       18 
12 
     | 
    
         
             
                COLUMNS = %w[gem newest installed requested groups].freeze
         
     | 
| 
       19 
13 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
                def initialize( 
     | 
| 
       21 
     | 
    
         
            -
                  @ 
     | 
| 
      
 14 
     | 
    
         
            +
                def initialize(options)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @pretty = options[:pretty]
         
     | 
| 
       22 
16 
     | 
    
         
             
                  @outdated_gems = []
         
     | 
| 
       23 
17 
     | 
    
         
             
                end
         
     | 
| 
       24 
18 
     | 
    
         | 
| 
         @@ -26,111 +20,53 @@ module BundleOutdatedFormatter 
     | 
|
| 
       26 
20 
     | 
    
         
             
                  @outdated_gems = STDIN.each.to_a.map(&:strip).reject(&:empty?)
         
     | 
| 
       27 
21 
     | 
    
         | 
| 
       28 
22 
     | 
    
         
             
                  @outdated_gems.map! do |line|
         
     | 
| 
       29 
     | 
    
         
            -
                     
     | 
| 
       30 
     | 
    
         
            -
                    matched_newest    = NEWEST_REGEXP.match(line)
         
     | 
| 
       31 
     | 
    
         
            -
                    matched_installed = INSTALLED_REGEXP.match(line)
         
     | 
| 
       32 
     | 
    
         
            -
                    matched_requested = REQUESTED_REGEXP.match(line)
         
     | 
| 
       33 
     | 
    
         
            -
                    matched_groups    = GROUPS_REGEXP.match(line)
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
                    if matched_name.nil? && matched_newest.nil? && matched_installed.nil? && matched_requested.nil? && matched_groups.nil?
         
     | 
| 
       36 
     | 
    
         
            -
                      nil
         
     | 
| 
       37 
     | 
    
         
            -
                    else
         
     | 
| 
       38 
     | 
    
         
            -
                      {
         
     | 
| 
       39 
     | 
    
         
            -
                        'gem'       => gem_text(matched_name, :name),
         
     | 
| 
       40 
     | 
    
         
            -
                        'newest'    => gem_text(matched_newest, :newest),
         
     | 
| 
       41 
     | 
    
         
            -
                        'installed' => gem_text(matched_installed, :installed),
         
     | 
| 
       42 
     | 
    
         
            -
                        'requested' => gem_text(matched_requested, :requested),
         
     | 
| 
       43 
     | 
    
         
            -
                        'groups'    => gem_text(matched_groups, :groups)
         
     | 
| 
       44 
     | 
    
         
            -
                      }
         
     | 
| 
       45 
     | 
    
         
            -
                    end
         
     | 
| 
      
 23 
     | 
    
         
            +
                    find_gem(line)
         
     | 
| 
       46 
24 
     | 
    
         
             
                  end
         
     | 
| 
       47 
25 
     | 
    
         | 
| 
       48 
26 
     | 
    
         
             
                  @outdated_gems.compact!
         
     | 
| 
       49 
27 
     | 
    
         
             
                end
         
     | 
| 
       50 
28 
     | 
    
         | 
| 
       51 
     | 
    
         
            -
                def convert
         
     | 
| 
       52 
     | 
    
         
            -
                  text =
         
     | 
| 
       53 
     | 
    
         
            -
                    case @format
         
     | 
| 
       54 
     | 
    
         
            -
                    when 'markdown' then format_markdown
         
     | 
| 
       55 
     | 
    
         
            -
                    when 'json'     then format_json
         
     | 
| 
       56 
     | 
    
         
            -
                    when 'yaml'     then format_yaml
         
     | 
| 
       57 
     | 
    
         
            -
                    when 'csv'      then format_csv
         
     | 
| 
       58 
     | 
    
         
            -
                    when 'xml'      then format_xml
         
     | 
| 
       59 
     | 
    
         
            -
                    when 'html'     then format_html
         
     | 
| 
       60 
     | 
    
         
            -
                    else                 ''
         
     | 
| 
       61 
     | 
    
         
            -
                    end
         
     | 
| 
       62 
     | 
    
         
            -
                  text.chomp
         
     | 
| 
       63 
     | 
    
         
            -
                end
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
29 
     | 
    
         
             
                private
         
     | 
| 
       66 
30 
     | 
    
         | 
| 
       67 
     | 
    
         
            -
                def  
     | 
| 
       68 
     | 
    
         
            -
                   
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
                 
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
      
 31 
     | 
    
         
            +
                def find_gem(line)
         
     | 
| 
      
 32 
     | 
    
         
            +
                  matched = match_gem(line)
         
     | 
| 
      
 33 
     | 
    
         
            +
                  return unless match_gem?(matched)
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                  {
         
     | 
| 
      
 36 
     | 
    
         
            +
                    'gem'       => gem_text(matched[:gem], :gem),
         
     | 
| 
      
 37 
     | 
    
         
            +
                    'newest'    => gem_text(matched[:newest], :newest),
         
     | 
| 
      
 38 
     | 
    
         
            +
                    'installed' => gem_text(matched[:installed], :installed),
         
     | 
| 
      
 39 
     | 
    
         
            +
                    'requested' => gem_text(matched[:requested], :requested),
         
     | 
| 
      
 40 
     | 
    
         
            +
                    'groups'    => gem_text(matched[:groups], :groups)
         
     | 
| 
      
 41 
     | 
    
         
            +
                  }
         
     | 
| 
       77 
42 
     | 
    
         
             
                end
         
     | 
| 
       78 
43 
     | 
    
         | 
| 
       79 
     | 
    
         
            -
                def  
     | 
| 
       80 
     | 
    
         
            -
                   
     | 
| 
      
 44 
     | 
    
         
            +
                def match_gem(line)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  {
         
     | 
| 
      
 46 
     | 
    
         
            +
                    gem:       GEM_REGEXP.match(line),
         
     | 
| 
      
 47 
     | 
    
         
            +
                    newest:    NEWEST_REGEXP.match(line),
         
     | 
| 
      
 48 
     | 
    
         
            +
                    installed: INSTALLED_REGEXP.match(line),
         
     | 
| 
      
 49 
     | 
    
         
            +
                    requested: REQUESTED_REGEXP.match(line),
         
     | 
| 
      
 50 
     | 
    
         
            +
                    groups:    GROUPS_REGEXP.match(line)
         
     | 
| 
      
 51 
     | 
    
         
            +
                  }
         
     | 
| 
       81 
52 
     | 
    
         
             
                end
         
     | 
| 
       82 
53 
     | 
    
         | 
| 
       83 
     | 
    
         
            -
                def  
     | 
| 
       84 
     | 
    
         
            -
                   
     | 
| 
       85 
     | 
    
         
            -
                     
     | 
| 
       86 
     | 
    
         
            -
                    @outdated_gems.each do |gem|
         
     | 
| 
       87 
     | 
    
         
            -
                      csv << gem.values
         
     | 
| 
       88 
     | 
    
         
            -
                    end
         
     | 
| 
      
 54 
     | 
    
         
            +
                def match_gem?(matched)
         
     | 
| 
      
 55 
     | 
    
         
            +
                  COLUMNS.any? do |column|
         
     | 
| 
      
 56 
     | 
    
         
            +
                    !matched[column.to_sym].nil?
         
     | 
| 
       89 
57 
     | 
    
         
             
                  end
         
     | 
| 
       90 
58 
     | 
    
         
             
                end
         
     | 
| 
       91 
59 
     | 
    
         | 
| 
       92 
     | 
    
         
            -
                def  
     | 
| 
       93 
     | 
    
         
            -
                   
     | 
| 
       94 
     | 
    
         
            -
                  xml << REXML::XMLDecl.new('1.0', 'UTF-8')
         
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
                  root = REXML::Element.new('gems')
         
     | 
| 
       97 
     | 
    
         
            -
                  xml.add_element(root)
         
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
                  @outdated_gems.each do |gem|
         
     | 
| 
       100 
     | 
    
         
            -
                    elements = root.add_element(REXML::Element.new('outdated'))
         
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
                    COLUMNS.each do |column|
         
     | 
| 
       103 
     | 
    
         
            -
                      elements.add_element(column).add_text(gem[column])
         
     | 
| 
       104 
     | 
    
         
            -
                    end
         
     | 
| 
       105 
     | 
    
         
            -
                  end
         
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
                  xml.to_s
         
     | 
| 
      
 60 
     | 
    
         
            +
                def gem_text(text, name)
         
     | 
| 
      
 61 
     | 
    
         
            +
                  text ? text[name] : ''
         
     | 
| 
       108 
62 
     | 
    
         
             
                end
         
     | 
| 
       109 
63 
     | 
    
         | 
| 
       110 
     | 
    
         
            -
                def  
     | 
| 
       111 
     | 
    
         
            -
                   
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
     | 
    
         
            -
                  root = REXML::Element.new('table')
         
     | 
| 
       114 
     | 
    
         
            -
                  html.add_element(root)
         
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
                  elements = root.add_element(REXML::Element.new('tr'))
         
     | 
| 
       117 
     | 
    
         
            -
                  COLUMNS.each do |column|
         
     | 
| 
       118 
     | 
    
         
            -
                    elements.add_element('th').add_text(column)
         
     | 
| 
       119 
     | 
    
         
            -
                  end
         
     | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
       121 
     | 
    
         
            -
                  @outdated_gems.each do |gem|
         
     | 
| 
       122 
     | 
    
         
            -
                    elements = root.add_element(REXML::Element.new('tr'))
         
     | 
| 
      
 64 
     | 
    
         
            +
                def xml_formatter
         
     | 
| 
      
 65 
     | 
    
         
            +
                  return REXML::Formatters::Default.new unless @pretty
         
     | 
| 
       123 
66 
     | 
    
         | 
| 
       124 
     | 
    
         
            -
             
     | 
| 
       125 
     | 
    
         
            -
             
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
       127 
     | 
    
         
            -
                  end
         
     | 
| 
       128 
     | 
    
         
            -
             
     | 
| 
       129 
     | 
    
         
            -
                  html.to_s
         
     | 
| 
       130 
     | 
    
         
            -
                end
         
     | 
| 
       131 
     | 
    
         
            -
             
     | 
| 
       132 
     | 
    
         
            -
                def gem_text(text, name)
         
     | 
| 
       133 
     | 
    
         
            -
                  text ? text[name] : ''
         
     | 
| 
      
 67 
     | 
    
         
            +
                  formatter = REXML::Formatters::Pretty.new
         
     | 
| 
      
 68 
     | 
    
         
            +
                  formatter.compact = true
         
     | 
| 
      
 69 
     | 
    
         
            +
                  formatter
         
     | 
| 
       134 
70 
     | 
    
         
             
                end
         
     | 
| 
       135 
71 
     | 
    
         
             
              end
         
     | 
| 
       136 
72 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'csv'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'bundle_outdated_formatter/formatter'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module BundleOutdatedFormatter
         
     | 
| 
      
 5 
     | 
    
         
            +
              # Formatter for CSV
         
     | 
| 
      
 6 
     | 
    
         
            +
              class CSVFormatter < Formatter
         
     | 
| 
      
 7 
     | 
    
         
            +
                def convert
         
     | 
| 
      
 8 
     | 
    
         
            +
                  text = CSV.generate(force_quotes: true) do |csv|
         
     | 
| 
      
 9 
     | 
    
         
            +
                    csv << COLUMNS
         
     | 
| 
      
 10 
     | 
    
         
            +
                    @outdated_gems.each do |gem|
         
     | 
| 
      
 11 
     | 
    
         
            +
                      csv << gem.values
         
     | 
| 
      
 12 
     | 
    
         
            +
                    end
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                  text.chomp
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,45 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rexml/document'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'bundle_outdated_formatter/formatter'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module BundleOutdatedFormatter
         
     | 
| 
      
 5 
     | 
    
         
            +
              # Formatter for HTML
         
     | 
| 
      
 6 
     | 
    
         
            +
              class HTMLFormatter < Formatter
         
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(options)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  super(options)
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  @html = REXML::Document.new(nil, raw: :all)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @root = REXML::Element.new('table')
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @html.add_element(@root)
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                def convert
         
     | 
| 
      
 16 
     | 
    
         
            +
                  add_header_row
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                  @outdated_gems.each do |gem|
         
     | 
| 
      
 19 
     | 
    
         
            +
                    add_data_row(gem)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  io = StringIO.new
         
     | 
| 
      
 23 
     | 
    
         
            +
                  xml_formatter.write(@html, io)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  io.string.chomp
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                private
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                def add_header_row
         
     | 
| 
      
 30 
     | 
    
         
            +
                  elements = @root.add_element(REXML::Element.new('tr'))
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                  COLUMNS.each do |column|
         
     | 
| 
      
 33 
     | 
    
         
            +
                    elements.add_element('th').add_text(column)
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                def add_data_row(gem)
         
     | 
| 
      
 38 
     | 
    
         
            +
                  elements = @root.add_element(REXML::Element.new('tr'))
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                  COLUMNS.each do |column|
         
     | 
| 
      
 41 
     | 
    
         
            +
                    elements.add_element('td').add_text(gem[column])
         
     | 
| 
      
 42 
     | 
    
         
            +
                  end
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'json'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'bundle_outdated_formatter/formatter'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module BundleOutdatedFormatter
         
     | 
| 
      
 5 
     | 
    
         
            +
              # Formatter for JSON
         
     | 
| 
      
 6 
     | 
    
         
            +
              class JSONFormatter < Formatter
         
     | 
| 
      
 7 
     | 
    
         
            +
                def convert
         
     | 
| 
      
 8 
     | 
    
         
            +
                  text = @pretty ? JSON.pretty_generate(@outdated_gems) : @outdated_gems.to_json
         
     | 
| 
      
 9 
     | 
    
         
            +
                  text.chomp
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'bundle_outdated_formatter/formatter'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module BundleOutdatedFormatter
         
     | 
| 
      
 4 
     | 
    
         
            +
              # Formatter for Markdown
         
     | 
| 
      
 5 
     | 
    
         
            +
              class MarkdownFormatter < Formatter
         
     | 
| 
      
 6 
     | 
    
         
            +
                HEADER = <<-EOS.freeze
         
     | 
| 
      
 7 
     | 
    
         
            +
            | gem | newest | installed | requested | groups |
         
     | 
| 
      
 8 
     | 
    
         
            +
            | --- | --- | --- | --- | --- |
         
     | 
| 
      
 9 
     | 
    
         
            +
                EOS
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                def convert
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @outdated_gems.map! do |gem|
         
     | 
| 
      
 13 
     | 
    
         
            +
                    "| #{gem.values.join(' | ')} |".gsub(/  /, ' ')
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  (HEADER + @outdated_gems.join("\n")).chomp
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'csv'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'bundle_outdated_formatter/formatter'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module BundleOutdatedFormatter
         
     | 
| 
      
 5 
     | 
    
         
            +
              # Formatter for TSV
         
     | 
| 
      
 6 
     | 
    
         
            +
              class TSVFormatter < Formatter
         
     | 
| 
      
 7 
     | 
    
         
            +
                def convert
         
     | 
| 
      
 8 
     | 
    
         
            +
                  text = CSV.generate(force_quotes: true, col_sep: "\t") do |tsv|
         
     | 
| 
      
 9 
     | 
    
         
            +
                    tsv << COLUMNS
         
     | 
| 
      
 10 
     | 
    
         
            +
                    @outdated_gems.each do |gem|
         
     | 
| 
      
 11 
     | 
    
         
            +
                      tsv << gem.values
         
     | 
| 
      
 12 
     | 
    
         
            +
                    end
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                  text.chomp
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,36 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rexml/document'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'bundle_outdated_formatter/formatter'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module BundleOutdatedFormatter
         
     | 
| 
      
 5 
     | 
    
         
            +
              # Formatter for XML
         
     | 
| 
      
 6 
     | 
    
         
            +
              class XMLFormatter < Formatter
         
     | 
| 
      
 7 
     | 
    
         
            +
                def initialize(options)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  super(options)
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  @xml = REXML::Document.new(nil, raw: :all)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  @xml << REXML::XMLDecl.new('1.0', 'UTF-8')
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @root = REXML::Element.new('gems')
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @xml.add_element(@root)
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                def convert
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @outdated_gems.each do |gem|
         
     | 
| 
      
 18 
     | 
    
         
            +
                    add_outdated(gem)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  io = StringIO.new
         
     | 
| 
      
 22 
     | 
    
         
            +
                  xml_formatter.write(@xml, io)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  io.string.chomp
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                private
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                def add_outdated(gem)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  elements = @root.add_element(REXML::Element.new('outdated'))
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                  COLUMNS.each do |column|
         
     | 
| 
      
 32 
     | 
    
         
            +
                    elements.add_element(column).add_text(gem[column])
         
     | 
| 
      
 33 
     | 
    
         
            +
                  end
         
     | 
| 
      
 34 
     | 
    
         
            +
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
              end
         
     | 
| 
      
 36 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: bundle_outdated_formatter
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - emsk
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2017- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-07-08 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: psych
         
     | 
| 
         @@ -147,7 +147,15 @@ files: 
     | 
|
| 
       147 
147 
     | 
    
         
             
            - exe/bof
         
     | 
| 
       148 
148 
     | 
    
         
             
            - lib/bundle_outdated_formatter.rb
         
     | 
| 
       149 
149 
     | 
    
         
             
            - lib/bundle_outdated_formatter/cli.rb
         
     | 
| 
      
 150 
     | 
    
         
            +
            - lib/bundle_outdated_formatter/error.rb
         
     | 
| 
       150 
151 
     | 
    
         
             
            - lib/bundle_outdated_formatter/formatter.rb
         
     | 
| 
      
 152 
     | 
    
         
            +
            - lib/bundle_outdated_formatter/formatter/csv_formatter.rb
         
     | 
| 
      
 153 
     | 
    
         
            +
            - lib/bundle_outdated_formatter/formatter/html_formatter.rb
         
     | 
| 
      
 154 
     | 
    
         
            +
            - lib/bundle_outdated_formatter/formatter/json_formatter.rb
         
     | 
| 
      
 155 
     | 
    
         
            +
            - lib/bundle_outdated_formatter/formatter/markdown_formatter.rb
         
     | 
| 
      
 156 
     | 
    
         
            +
            - lib/bundle_outdated_formatter/formatter/tsv_formatter.rb
         
     | 
| 
      
 157 
     | 
    
         
            +
            - lib/bundle_outdated_formatter/formatter/xml_formatter.rb
         
     | 
| 
      
 158 
     | 
    
         
            +
            - lib/bundle_outdated_formatter/formatter/yaml_formatter.rb
         
     | 
| 
       151 
159 
     | 
    
         
             
            - lib/bundle_outdated_formatter/version.rb
         
     | 
| 
       152 
160 
     | 
    
         
             
            homepage: https://github.com/emsk/bundle_outdated_formatter
         
     | 
| 
       153 
161 
     | 
    
         
             
            licenses:
         
     |