gemdiff 0.9.4 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9909488ec770e2a8427089179f3cbf92533218a8
4
- data.tar.gz: 6a91e4df9b5a7cb6b589e0206bcf12c5c1257f08
3
+ metadata.gz: c363b38509d01526333a18f886e606eea6aa90d5
4
+ data.tar.gz: 3bd784defe3b4b3fe89e14f057258e07c278f43d
5
5
  SHA512:
6
- metadata.gz: b9dee0eaf940cad7694a028c439e5db1fd8c88e55a82510e335b5ac6c881e3dfee160c5d7721911b9b575ba8df30123081d7198f80b9ad87e10adbadd2bf7db9
7
- data.tar.gz: 47fc60afd8dbb429c52de6647fd15384851e19f6e1b62de4813861ba7cc04f85e34e192c24e7f10eb9c0d7a07dfdd3d32e366e967a03c47c0a05a0e49d452138
6
+ metadata.gz: abbdfbe899cfc0dec0114f70e8e9b43bceff666d57e67770c311a141565277c4e8531a6a8f860477ed8b74c760df72236c73c7c2c53ef3bd4889b994665ed937
7
+ data.tar.gz: 73affd9ee6973ec6ac18bdfdba65e1dd083db5298353b763d2bf13315b02fc2021d138bfd75a39151a3b5ef91a671b2eeda3840dc4fd4b4670e8fb485ab3b902
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  `gemdiff` is a command-line tool to find source code for ruby gems.
7
7
  You can compare source code differences between the current version of a gem in your bundle and
8
8
  the latest version of the gem.
9
- `gemdiff` helps connect gem version management (rubygems + bundler) with source code (GitHub).
9
+ `gemdiff` connects gem version management (rubygems + bundler) with source code (GitHub).
10
10
 
11
11
  ### Why?
12
12
 
@@ -115,6 +115,8 @@ Author: Tee Parham
115
115
  Date: Mon Mar 3 16:38:32 2014 -0700
116
116
 
117
117
  Update haml to 4.0.5
118
+
119
+ https://github.com/haml/haml/compare/4.0.4...4.0.5
118
120
 
119
121
  diff --git a/Gemfile.lock
120
122
  ```
@@ -157,11 +159,11 @@ $ gemdiff help
157
159
 
158
160
  ### Shortcuts
159
161
 
160
- You can use abbreviations for any of the above commands. For example, this is equivalent to `gemdiff find haml`:
162
+ You can use abbreviations for any of the above commands. For example, this is equivalent to `gemdiff find pundit`:
161
163
 
162
164
  ```sh
163
- $ gemdiff f haml
164
- http://github.com/haml/haml
165
+ $ gemdiff f pundit
166
+ https://github.com/elabs/pundit
165
167
  ```
166
168
 
167
169
  ### What if it didn't work?
data/lib/gemdiff/cli.rb CHANGED
@@ -87,7 +87,7 @@ DESC
87
87
  response = ask("\nCommit? (c to commit, r to reset, else do nothing)")
88
88
  if response == "c"
89
89
  gem_updater.commit
90
- puts "\n" << colorize_git_output(gem_updater.show)
90
+ puts "\n" + colorize_git_output(gem_updater.show)
91
91
  elsif response == "r"
92
92
  puts gem_updater.reset
93
93
  end
@@ -41,13 +41,15 @@ module Gemdiff
41
41
  end
42
42
 
43
43
  def git_commit
44
- added = git_changed_line
45
- return false if added.empty?
46
- version = added.split("\n").first.split(" ").last.gsub(/[()]/, "")
47
- git_add_and_commit_lockfile version
44
+ return false if git_added_line.empty?
45
+ git_add_and_commit_lockfile
48
46
  true
49
47
  end
50
48
 
49
+ def version(changed_line)
50
+ changed_line.split("\n").first.split(" ").last.gsub(/[()]/, "")
51
+ end
52
+
51
53
  # example returns:
52
54
  # + rails (4.2.3)
53
55
  # or
@@ -57,12 +59,24 @@ module Gemdiff
57
59
  # + activejob (= 4.2.3)
58
60
  # + activejob (4.2.3)
59
61
  # + activejob (= 4.2.3)
60
- def git_changed_line
61
- `git diff | grep ' #{name} (' | grep '+ '`
62
+ def git_added_line
63
+ @added_line ||= `git diff | grep ' #{name} (' | grep '+ '`
64
+ end
65
+
66
+ # example returns:
67
+ # - json (1.8.1)
68
+ def git_removed_line
69
+ `git diff | grep ' #{name} (' | grep '\\- '`
70
+ end
71
+
72
+ def commit_message
73
+ new_version = version(git_added_line)
74
+ outdated = OutdatedGem.new(name, new_version, version(git_removed_line))
75
+ "Update #{name} to #{new_version}\n\n#{outdated.compare_url}"
62
76
  end
63
77
 
64
- def git_add_and_commit_lockfile(version)
65
- `git add Gemfile.lock && git commit -m 'Update #{name} to #{version}'`
78
+ def git_add_and_commit_lockfile
79
+ `git add Gemfile.lock && git commit -m '#{commit_message}'`
66
80
  end
67
81
 
68
82
  def git_reset
@@ -1,3 +1,3 @@
1
1
  module Gemdiff
2
- VERSION = "0.9.4"
2
+ VERSION = "1.0.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.9.4
4
+ version: 1.0.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: 2016-02-20 00:00:00.000000000 Z
11
+ date: 2016-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit