gemdiff 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +63 -12
- data/lib/gemdiff/cli.rb +7 -2
- data/lib/gemdiff/outdated_gem.rb +9 -1
- data/lib/gemdiff/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3898dd723d8d26e925dafa3acb27991770441ec
|
4
|
+
data.tar.gz: b76cc169d3721612d70b8834ecfdc05ae4506b7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0898a9357e02d3e41fa533b44eca9e0580234fadd332deac029a1b1bd2de84918648554b7f591a40910ef8a2d2a6943731570259dd7e344423043452e9b5309
|
7
|
+
data.tar.gz: 551677b3fa3cae12d917ce310c69ef8530af8063f3224230aa7c47ba5b9be959eec40b64e240a0fae6f8539147393d904c2875629af690d18dd05bf1655b4869
|
data/README.md
CHANGED
@@ -4,6 +4,12 @@
|
|
4
4
|
associated with ruby gems. It makes it easy to compare source code differences
|
5
5
|
between the current version of a gem in your bundle and the latest version of the gem.
|
6
6
|
|
7
|
+
## Why?
|
8
|
+
|
9
|
+
1. Looking up the github repository for a gem often requires The Google.
|
10
|
+
2. Many gems do not have the source repository URL in the gemspec.
|
11
|
+
3. You should Always Be Updating. This makes it easier.
|
12
|
+
|
7
13
|
## Install
|
8
14
|
|
9
15
|
```sh
|
@@ -11,30 +17,75 @@ gem install gemdiff
|
|
11
17
|
```
|
12
18
|
|
13
19
|
## Commands
|
14
|
-
|
20
|
+
|
21
|
+
### `outdated`
|
22
|
+
|
23
|
+
Runs `bundle outdated --strict` on the project in the current directory.
|
24
|
+
For each outdated gem, it prompts you if you would like to open the compare view
|
25
|
+
for that gem. Enter 'y' to review or enter to skip.
|
26
|
+
|
27
|
+
This is the default task so you can just run `gemdiff`.
|
28
|
+
|
29
|
+
```sh
|
30
|
+
$ cd /your/ruby/project/using/bundler
|
31
|
+
$ gemdiff
|
32
|
+
Checking for outdated gems in your bundle...
|
33
|
+
aws-sdk: 1.35.0 > 1.34.1
|
34
|
+
Open? (y to open, else skip)
|
35
|
+
webmock: 1.17.4 > 1.17.3
|
36
|
+
Open? (y to open, else skip) y
|
37
|
+
sprockets: 2.11.0 > 2.10.1
|
38
|
+
Open? (y to open, else skip)
|
39
|
+
```
|
40
|
+
|
41
|
+
### `compare`
|
42
|
+
|
43
|
+
You don't need to use bundler or be in a project. You can query a specific gem by
|
44
|
+
entering explicit version numbers.
|
45
|
+
|
46
|
+
For example, open the GitHub compare view in browser for difference between versions 4.0.2 and 5.0.0:
|
47
|
+
|
48
|
+
```sh
|
49
|
+
$ gemdiff compare arel --new=5.0.0 --old=4.0.2
|
50
|
+
```
|
51
|
+
|
52
|
+
### `find`
|
53
|
+
|
54
|
+
Lookup the repository URL using the gemspec. If a GitHub URL is not found, hit the GitHub search API.
|
15
55
|
|
16
56
|
```sh
|
17
57
|
$ gemdiff find arel
|
18
58
|
http://github.com/rails/arel
|
19
59
|
```
|
20
60
|
|
21
|
-
### open
|
61
|
+
### `open`
|
62
|
+
|
63
|
+
Open the repository URL:
|
64
|
+
|
22
65
|
```sh
|
23
66
|
$ gemdiff open arel
|
24
|
-
# opens arel project url in browser
|
25
67
|
```
|
26
68
|
|
27
|
-
###
|
69
|
+
### `releases`
|
70
|
+
|
71
|
+
Open the repository's release history page:
|
72
|
+
|
28
73
|
```sh
|
29
|
-
$ gemdiff
|
30
|
-
# opens GitHub compare view in browser for difference between versions 4.0.2 and 5.0.0
|
74
|
+
$ gemdiff releases arel
|
31
75
|
```
|
32
76
|
|
33
|
-
|
77
|
+
## It didn't work
|
34
78
|
|
35
|
-
|
79
|
+
`gemdiff` operates on a few assumptions:
|
36
80
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
81
|
+
1. The gem must have a repository on GitHub. If not, `gemdiff` will find nothing or a similar repository, which
|
82
|
+
is not helpful.
|
83
|
+
|
84
|
+
2. The GitHub repository must have tagged releases to show compare views.
|
85
|
+
|
86
|
+
3. The versions must be tagged using the standard name format of v1.2.3. If you find exceptions that follow
|
87
|
+
a non-standard pattern, please submit a pull request. See `lib/gemdiff/outdated_gem.rb`.
|
88
|
+
|
89
|
+
4. Encourage gem maintainers to either enter the GitHub repository URL in the `homepage` field of their gemspec,
|
90
|
+
or anywhere in the description. `gemdiff` is much faster if so, and if not, it guesses the best match using
|
91
|
+
the GitHub search API.
|
data/lib/gemdiff/cli.rb
CHANGED
@@ -18,10 +18,15 @@ module Gemdiff
|
|
18
18
|
desc 'open gem_name', 'Open the github repository for a gem'
|
19
19
|
def open(gem_name)
|
20
20
|
gem = find(gem_name)
|
21
|
-
return unless gem.repo?
|
22
21
|
gem.open
|
23
22
|
end
|
24
23
|
|
24
|
+
desc 'releases gem_name', 'Open the github releases page for a gem'
|
25
|
+
def releases(gem_name)
|
26
|
+
gem = find(gem_name)
|
27
|
+
gem.releases
|
28
|
+
end
|
29
|
+
|
25
30
|
desc 'compare gem_name', <<DESC
|
26
31
|
Compare gem versions. Opens the compare view between the specified new and old versions.
|
27
32
|
If versions are not specified, your bundle is inspected and the latest version of the
|
@@ -35,7 +40,7 @@ DESC
|
|
35
40
|
gem.set_versions options
|
36
41
|
if gem.missing_versions?
|
37
42
|
puts "Checking for outdated gems in your bundle..."
|
38
|
-
unless gem.
|
43
|
+
unless gem.load_bundle_versions
|
39
44
|
puts "#{gem_name} is not outdated in your bundle. Specify versions."
|
40
45
|
return
|
41
46
|
end
|
data/lib/gemdiff/outdated_gem.rb
CHANGED
@@ -3,7 +3,7 @@ module Gemdiff
|
|
3
3
|
|
4
4
|
# gems that tag releases with tag names like 1.2.3
|
5
5
|
# keep it alphabetical
|
6
|
-
LIST_NO_V = %w[atomic haml thread_safe]
|
6
|
+
LIST_NO_V = %w[atomic babosa cancan compass haml thread_safe]
|
7
7
|
|
8
8
|
attr_accessor :name, :old_version, :new_version
|
9
9
|
|
@@ -39,6 +39,10 @@ module Gemdiff
|
|
39
39
|
!!repo
|
40
40
|
end
|
41
41
|
|
42
|
+
def releases_url
|
43
|
+
"#{repo}/releases"
|
44
|
+
end
|
45
|
+
|
42
46
|
def compare_message
|
43
47
|
"#{name}: #{new_version} > #{old_version}"
|
44
48
|
end
|
@@ -47,6 +51,10 @@ module Gemdiff
|
|
47
51
|
"#{repo}/compare/#{compare_part}"
|
48
52
|
end
|
49
53
|
|
54
|
+
def releases
|
55
|
+
`open #{releases_url}` if repo?
|
56
|
+
end
|
57
|
+
|
50
58
|
def compare
|
51
59
|
`open #{compare_url}` if repo?
|
52
60
|
end
|
data/lib/gemdiff/version.rb
CHANGED