formatted-gem-updates 0.0.2 → 0.0.3
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/exe/formatted-gem-updates +27 -6
 - data/lib/formatted_gem_updates/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b453894dea22f4bea8480faea54bc21f886a27c7
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 881a8aa5ca4a8ddeaefa4df68d3d4b444d7f13ea
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 042ca49b87dce23eb6cce99e057269fc4a806918a54a620185ba8e15c0b826c7d0474bd9e26ec8d7a0a95b16b1c9e281617790349ce3de1b442c4f06aa04f6b3
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 190fa53b2ea2546c0a2da69d82fbacb6c97636fb3f9bf2f60f7bae923ea21d3e6ea537c181464559e2a6da503e5365b33fdb67904627a0231632f1855c62be57
         
     | 
    
        data/exe/formatted-gem-updates
    CHANGED
    
    | 
         @@ -1,5 +1,16 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #!/usr/bin/env ruby
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
      
 3 
     | 
    
         
            +
            require 'optparse'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            command_line_options = {}
         
     | 
| 
      
 6 
     | 
    
         
            +
            OptionParser.new do |opts|
         
     | 
| 
      
 7 
     | 
    
         
            +
              opts.banner = "Usage: formatted-gem-updates [options]"
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
              opts.on("--amend", "Amend output to the last commit message") do |a|
         
     | 
| 
      
 10 
     | 
    
         
            +
                command_line_options[:amend] = a
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
            end.parse!
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
       3 
14 
     | 
    
         
             
            GIT_ROOT = `git rev-parse --show-toplevel`.strip
         
     | 
| 
       4 
15 
     | 
    
         
             
            exit 1 unless $?.success?
         
     | 
| 
       5 
16 
     | 
    
         | 
| 
         @@ -54,24 +65,34 @@ def format_for_length(length, lhs, rhs) 
     | 
|
| 
       54 
65 
     | 
    
         
             
              "%-#{length}s  %s" % [lhs, rhs]
         
     | 
| 
       55 
66 
     | 
    
         
             
            end
         
     | 
| 
       56 
67 
     | 
    
         | 
| 
      
 68 
     | 
    
         
            +
            output_lines = []
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
       57 
70 
     | 
    
         
             
            if updated.length > 0
         
     | 
| 
       58 
     | 
    
         
            -
               
     | 
| 
      
 71 
     | 
    
         
            +
              output_lines << "UPDATED:"
         
     | 
| 
       59 
72 
     | 
    
         
             
              updated.each do |gem, info|
         
     | 
| 
       60 
73 
     | 
    
         
             
                formatted_version = format_for_length($longest_version_length, info[:old], info[:new])
         
     | 
| 
       61 
     | 
    
         
            -
                 
     | 
| 
      
 74 
     | 
    
         
            +
                output_lines << format_for_length($longest_name_length, gem, formatted_version)
         
     | 
| 
       62 
75 
     | 
    
         
             
              end
         
     | 
| 
       63 
76 
     | 
    
         
             
            end
         
     | 
| 
       64 
77 
     | 
    
         | 
| 
       65 
78 
     | 
    
         
             
            if new_gems.length > 0
         
     | 
| 
       66 
     | 
    
         
            -
               
     | 
| 
      
 79 
     | 
    
         
            +
              output_lines << "\nADDED:"
         
     | 
| 
       67 
80 
     | 
    
         
             
              new_gems.each do |gem, version|
         
     | 
| 
       68 
     | 
    
         
            -
                 
     | 
| 
      
 81 
     | 
    
         
            +
                output_lines << format_for_length($longest_name_length, gem, version)
         
     | 
| 
       69 
82 
     | 
    
         
             
              end
         
     | 
| 
       70 
83 
     | 
    
         
             
            end
         
     | 
| 
       71 
84 
     | 
    
         | 
| 
       72 
85 
     | 
    
         
             
            if removed.length > 0
         
     | 
| 
       73 
     | 
    
         
            -
               
     | 
| 
      
 86 
     | 
    
         
            +
              output_lines << "\nREMOVED:"
         
     | 
| 
       74 
87 
     | 
    
         
             
              removed.each do |gem, version|
         
     | 
| 
       75 
     | 
    
         
            -
                 
     | 
| 
      
 88 
     | 
    
         
            +
                output_lines << format_for_length($longest_name_length, gem, version)
         
     | 
| 
       76 
89 
     | 
    
         
             
              end
         
     | 
| 
       77 
90 
     | 
    
         
             
            end
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
            if command_line_options[:amend]
         
     | 
| 
      
 93 
     | 
    
         
            +
              existing_message = `git log -1 --pretty=%B`.strip
         
     | 
| 
      
 94 
     | 
    
         
            +
              output_lines.unshift("#{existing_message}\n")
         
     | 
| 
      
 95 
     | 
    
         
            +
              system("git", "commit", "--amend", "-m", output_lines.join("\n"))
         
     | 
| 
      
 96 
     | 
    
         
            +
            else
         
     | 
| 
      
 97 
     | 
    
         
            +
              puts output_lines
         
     | 
| 
      
 98 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: formatted-gem-updates
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Travis Grathwell
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016-08- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-08-25 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     |