gemdiff 0.7.9 → 0.8.0

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: ebf0fb9efdc58d2a1db048b41d78b5464c5c5ea3
4
- data.tar.gz: 06d6e9a541fd5f2a91f6987ef5e84243fc7f9a07
3
+ metadata.gz: 0b829cca25c34840eec008d349361677909fcd1a
4
+ data.tar.gz: 5857dc5982ffaad702e035d7c65478c36b985653
5
5
  SHA512:
6
- metadata.gz: 92e8322b0ad3fdc1f4d36aa1f4884a59d8ea7d87bc5e23753f6f029fc5da704c38218b37b522cc310e46e128303e85c1c7f2c6d956083f1fff71813a8c4579e0
7
- data.tar.gz: 555503640e0ab2e654332460136ecb96fd177210ce5cbf2a8cf953770df592188d33957ba2dd1471d59a8e7fab27159e91f812bc805f1cdb2e2557328f475952
6
+ metadata.gz: a98484533de31aeed45741b549435efaabc32845d4825c7c5f2debaf29a484a9d2af1d1c6bfe521d8b791ee9893c5277d56398f4db0bc9ef3dc01a8165bfd37e
7
+ data.tar.gz: 462d998de963aeef4b22873ef9e2a252da7d3f630097a01a2e6386cc576734c93657308f6e3f4342d4b61ab356f0dfb41afc0343bf4874f7c5d314e14c335eea
@@ -26,16 +26,20 @@ module Gemdiff
26
26
  end
27
27
 
28
28
  def new_outdated_gem(line)
29
- return nil unless line.start_with?(' * ')
30
- items = line.split(' ')
29
+ return unless line.start_with?(" * ")
31
30
 
32
- # ["*", "haml", "(4.0.5", ">", "4.0.4)"]
33
- # ["*", "a_forked_gem", "(0.7.0", "99ddbc9", ">", "0.7.0", "1da2295)"]
31
+ # clean & convert new & old output to same format
32
+ items = line.gsub("*", "")
33
+ .gsub("(newest", "")
34
+ .gsub(", installed", " >")
35
+ .gsub(/([(),])/, "")
36
+ .split(" ")
34
37
 
35
- return nil if items[4] == '>' # skip non-gems for now
36
- old_version = items[4].sub(')', '')
37
- new_version = items[2].sub('(', '')
38
- OutdatedGem.new(items[1], old_version, new_version)
38
+ # ["haml", "4.0.5", ">", "4.0.4"]
39
+ # ["a_forked_gem", "0.7.0", "99ddbc9", ">", "0.7.0", "1da2295"]
40
+
41
+ return if items[3] == ">" # skip non-gems for now
42
+ OutdatedGem.new(items[0], items[3], items[1])
39
43
  end
40
44
  end
41
45
  end
data/lib/gemdiff/cli.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'thor'
1
+ require "thor"
2
2
 
3
3
  module Gemdiff
4
4
  class CLI < Thor
@@ -11,7 +11,7 @@ module Gemdiff
11
11
  NOTHING_TO_UPDATE = "Nothing to update."
12
12
  WORKING_DIRECTORY_IS_NOT_CLEAN = "Your working directory is not clean. Please commit or stash before updating."
13
13
 
14
- desc 'find <gem>', 'Find the github repository URL for a gem'
14
+ desc "find <gem>", "Find the github repository URL for a gem"
15
15
  def find(gem_name)
16
16
  outdated_gem = OutdatedGem.new(gem_name)
17
17
  if outdated_gem.repo?
@@ -22,22 +22,22 @@ module Gemdiff
22
22
  outdated_gem
23
23
  end
24
24
 
25
- desc 'open <gem>', 'Open the github repository for a gem'
25
+ desc "open <gem>", "Open the github repository for a gem"
26
26
  def open(gem_name)
27
27
  find(gem_name).open
28
28
  end
29
29
 
30
- desc 'releases <gem>', 'Open the github releases page for a gem'
30
+ desc "releases <gem>", "Open the github releases page for a gem"
31
31
  def releases(gem_name)
32
32
  find(gem_name).releases
33
33
  end
34
34
 
35
- desc 'master <gem>', 'Open the github master branch commits page for a gem'
35
+ desc "master <gem>", "Open the github master branch commits page for a gem"
36
36
  def master(gem_name)
37
37
  find(gem_name).master
38
38
  end
39
39
 
40
- desc 'compare <gem> [<old> <new>]', <<DESC
40
+ desc "compare <gem> [<old> <new>]", <<DESC
41
41
  Compare gem versions. Opens the compare view between the specified new and old versions.
42
42
  If versions are not specified, your bundle is inspected and the latest version of the
43
43
  gem is compared with the current version in your bundle.
@@ -57,20 +57,22 @@ DESC
57
57
  outdated_gem.compare
58
58
  end
59
59
 
60
- desc 'outdated', 'Compare each outdated gem in the bundle. You will be prompted to open each compare view.'
60
+ desc "outdated", "Compare each outdated gem in the bundle. You will be prompted to open each compare view."
61
61
  def outdated
62
62
  puts CHECKING_FOR_OUTDATED
63
63
  inspector = BundleInspector.new
64
64
  puts inspector.outdated
65
+ open_all = false
65
66
  inspector.list.each do |outdated_gem|
66
67
  puts outdated_gem.compare_message
67
- response = ask("Open? (y to open, x to exit, else skip)")
68
- outdated_gem.compare if response == 'y'
69
- return if response == 'x'
68
+ response = open_all || ask("Open? (y to open, x to exit, A to open all, else skip)")
69
+ open_all = "A" if response == "A"
70
+ outdated_gem.compare if %w(y A).include?(response)
71
+ return if response == "x"
70
72
  end
71
73
  end
72
74
 
73
- desc 'update <gem>', 'Update a gem, show a git diff of the update, and commit or reset'
75
+ desc "update <gem>", "Update a gem, show a git diff of the update, and commit or reset"
74
76
  def update(name)
75
77
  gem_updater = GemUpdater.new(name)
76
78
  puts WORKING_DIRECTORY_IS_NOT_CLEAN unless gem_updater.clean?
@@ -83,10 +85,10 @@ DESC
83
85
  return
84
86
  end
85
87
  response = ask("\nCommit? (c to commit, r to reset, else do nothing)")
86
- if response == 'c'
88
+ if response == "c"
87
89
  gem_updater.commit
88
- puts "\n" + colorize_git_output(gem_updater.show)
89
- elsif response == 'r'
90
+ puts "\n" << colorize_git_output(gem_updater.show)
91
+ elsif response == "r"
90
92
  puts gem_updater.reset
91
93
  end
92
94
  end
@@ -1,3 +1,3 @@
1
1
  module Gemdiff
2
- VERSION = '0.7.9'
2
+ VERSION = "0.8.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemdiff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.9
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tee Parham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-19 00:00:00.000000000 Z
11
+ date: 2015-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -148,10 +148,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  requirements: []
150
150
  rubyforge_project:
151
- rubygems_version: 2.4.6
151
+ rubygems_version: 2.4.7
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: Find source repositories for ruby gems. Open, compare, and update outdated
155
155
  gem versions
156
156
  test_files: []
157
- has_rdoc: