gemdiff 0.5.0 → 0.5.1

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: 05a404d4d18549814615ecb9a1a02bab2c467bc9
4
- data.tar.gz: 324693252dd101a19f2c7cad72487731f6c83353
3
+ metadata.gz: d99d8f54e658c4b0e91ba163f040ea78949b8f87
4
+ data.tar.gz: a463b1e9ff73296086f5634df1d7d64655a01fd2
5
5
  SHA512:
6
- metadata.gz: 7a15acfc4346304062941911e3b0e46ef969180ef2c7e8265a4f523149e1550199bcf456b649f436e90e12a379a396d9aef74d9555ff8fe4376c8138e4b87613
7
- data.tar.gz: 38b2b7a4c67d98c6ed986375a59718402d3a6190c35e62fc0bac538296eaca63b9490bf5af224564b46d04d4c5e7478eddb56ca5c9ef04eb4e9eb6d5f200dd52
6
+ metadata.gz: 70491a4633618f6d4e6ea23a931980d2ab37a58c580389dc9115989195c3662adb3e56cd8b00681fc52d39dd74154a4b7db40519e789670e3a9f90def9d0c496
7
+ data.tar.gz: 76d6ebb39cb15f2f137bb9e05de68e98af6e629ed63b6dc199ffb8f9de035847c26f5084524fcfcc01621cf3bf3f577259b5eae2e9b88a9f45bd306ce3e22e5e
@@ -21,7 +21,6 @@ Gem::Specification.new do |spec|
21
21
  spec.required_ruby_version = ">= 1.9.3"
22
22
 
23
23
  spec.add_dependency "bundler", "~> 1.5"
24
- spec.add_dependency "highline", "~> 1.6"
25
24
  spec.add_dependency "octokit", "~> 2.7"
26
25
  spec.add_dependency "thor", "~> 0.18"
27
26
 
@@ -2,11 +2,14 @@ require 'thor'
2
2
 
3
3
  module Gemdiff
4
4
  class CLI < Thor
5
+ include Thor::Actions
5
6
  include Colorize
6
7
 
7
8
  default_task :outdated
8
9
 
9
10
  CHECKING_FOR_OUTDATED = "Checking for outdated gems in your bundle..."
11
+ NOTHING_TO_UPDATE = "Nothing to update."
12
+ WORKING_DIRECTORY_IS_NOT_CLEAN = "Your working directory is not clean. Please commit or stash before updating."
10
13
 
11
14
  desc 'find <gem>', 'Find the github repository URL for a gem'
12
15
  def find(gem_name)
@@ -71,10 +74,18 @@ DESC
71
74
 
72
75
  desc 'update <gem>', 'Update a gem, show a git diff of the update, and commit or reset'
73
76
  def update(name)
74
- puts "Updating #{name}..."
75
77
  gem = GemUpdater.new(name)
78
+ unless gem.clean?
79
+ puts WORKING_DIRECTORY_IS_NOT_CLEAN
80
+ end
81
+ puts "Updating #{name}..."
76
82
  gem.update
77
- puts colorize_git_output(gem.diff)
83
+ diff_output = colorize_git_output(gem.diff)
84
+ puts diff_output
85
+ if diff_output.empty?
86
+ puts NOTHING_TO_UPDATE
87
+ return
88
+ end
78
89
  response = ask("\nCommit? (c to commit, r to reset, else do nothing)")
79
90
  if response == 'c'
80
91
  gem.commit
@@ -26,6 +26,10 @@ module Gemdiff
26
26
  git_reset
27
27
  end
28
28
 
29
+ def clean?
30
+ git_diff.empty?
31
+ end
32
+
29
33
  private
30
34
 
31
35
  def git_show
@@ -14,6 +14,7 @@ module Gemdiff
14
14
  activemodel: 'rails/rails',
15
15
  activerecord: 'rails/rails',
16
16
  activesupport: 'rails/rails',
17
+ delayed_job: 'collectiveidea/delayed_job',
17
18
  railties: 'rails/rails',
18
19
  resque: 'resque/resque',
19
20
  }
@@ -1,3 +1,3 @@
1
1
  module Gemdiff
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
@@ -125,6 +125,7 @@ module Gemdiff
125
125
  describe "#update" do
126
126
  before do
127
127
  @mock_gem = mock do
128
+ stubs clean?: true
128
129
  stubs diff: "le diff"
129
130
  stubs show: "le show"
130
131
  end
@@ -42,5 +42,20 @@ module Gemdiff
42
42
  updater.show
43
43
  end
44
44
  end
45
+
46
+ describe "#clean?" do
47
+ it "returns true for empty diff" do
48
+ updater = GemUpdater.new("x")
49
+ updater.stubs git_diff: ""
50
+ assert updater.clean?
51
+ end
52
+
53
+ it "returns false for non-empty diff" do
54
+ updater = GemUpdater.new("x")
55
+ updater.stubs git_diff: "something"
56
+ refute updater.clean?
57
+ end
58
+ end
59
+
45
60
  end
46
61
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemdiff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tee Parham
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.5'
27
- - !ruby/object:Gem::Dependency
28
- name: highline
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.6'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.6'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: octokit
43
29
  requirement: !ruby/object:Gem::Requirement