formatted-gem-updates 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 212a9014652b7d59bc12618803e9fa81f67a6277
4
- data.tar.gz: 6f9092eb32f04b6820db7ad7611bd764b1978847
3
+ metadata.gz: b453894dea22f4bea8480faea54bc21f886a27c7
4
+ data.tar.gz: 881a8aa5ca4a8ddeaefa4df68d3d4b444d7f13ea
5
5
  SHA512:
6
- metadata.gz: f31d480596d0afeaffcacc0028234f8a9b2cdb906d811d802509083c947b7796139d45d6c11f1008a75d7508204aac03ab2f3ca4e6b420b370226b0a27109e43
7
- data.tar.gz: e8e4709eb0a0f2b3d9e93c97c562f271b72b69b60c1795e4f9127e7d4975856031a220fc635b472cbe7dc4d5a05bc1957757778c617676ebe5ad3a21dd07ecd8
6
+ metadata.gz: 042ca49b87dce23eb6cce99e057269fc4a806918a54a620185ba8e15c0b826c7d0474bd9e26ec8d7a0a95b16b1c9e281617790349ce3de1b442c4f06aa04f6b3
7
+ data.tar.gz: 190fa53b2ea2546c0a2da69d82fbacb6c97636fb3f9bf2f60f7bae923ea21d3e6ea537c181464559e2a6da503e5365b33fdb67904627a0231632f1855c62be57
@@ -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
- puts "UPDATED:"
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
- puts format_for_length($longest_name_length, gem, formatted_version)
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
- puts "\nADDED:"
79
+ output_lines << "\nADDED:"
67
80
  new_gems.each do |gem, version|
68
- puts format_for_length($longest_name_length, gem, version)
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
- puts "\nREMOVED:"
86
+ output_lines << "\nREMOVED:"
74
87
  removed.each do |gem, version|
75
- puts format_for_length($longest_name_length, gem, version)
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
@@ -1,3 +1,3 @@
1
1
  module FormattedGemUpdates
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  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.2
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-01 00:00:00.000000000 Z
11
+ date: 2016-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler