gem_updater 0.2.0 → 0.3.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 +4 -4
- data/bin/gem_update +21 -3
- data/lib/gem_updater.rb +7 -2
- data/lib/gem_updater/source_page_parser.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d74c7bdd8dc7f1c7e094ebd39799b81cc02cb2f6
|
4
|
+
data.tar.gz: 4e70bca51c3e4cacd682fe8a161e13b740d11b27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba0e9ff0961d9ab3b5ca31d8f0da628a2a57cc6c50c2f87396f99eae6bf303e8b319e79e398a2763d2e88f1fc1652df0fc1c7540aa0d2073d0c04bacc9d1ce29
|
7
|
+
data.tar.gz: dee0f2a9d35a6ae04465883d370326a8f232b499396fcba8632a4cc9f26c66a5afb898259adc66ef38a7fa01f5872d769f270a3f7f86bea55e43a1ecc3ef6107
|
data/bin/gem_update
CHANGED
@@ -3,11 +3,29 @@
|
|
3
3
|
# Exit cleanly from an early interrupt
|
4
4
|
Signal.trap("INT") { exit 1 }
|
5
5
|
|
6
|
+
$:.unshift File.expand_path( '../../lib', __FILE__ )
|
6
7
|
require 'gem_updater'
|
7
8
|
|
8
9
|
gems = GemUpdater::Updater.new
|
9
10
|
gems.update!
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
if gems.gemfile.changes.any?
|
13
|
+
if ARGV.include? '--commit'
|
14
|
+
require 'tempfile'
|
15
|
+
file = Tempfile.new( 'gem_updater' )
|
16
|
+
file.write "UPDATE gems\n\n"
|
17
|
+
file.write gems.format_diff.join
|
18
|
+
file.close
|
19
|
+
|
20
|
+
gemfile = Bundler.default_gemfile.to_s
|
21
|
+
|
22
|
+
system %(git add #{gemfile} #{gemfile}.lock && git commit -t #{file.path} --allow-empty-message)
|
23
|
+
file.unlink
|
24
|
+
else
|
25
|
+
puts "\nHere are your changes:"
|
26
|
+
puts '------------------------'
|
27
|
+
gems.output_diff
|
28
|
+
end
|
29
|
+
else
|
30
|
+
puts "\nCongratulations, your Gemfile was already up-to-date!"
|
31
|
+
end
|
data/lib/gem_updater.rb
CHANGED
@@ -31,11 +31,16 @@ module GemUpdater
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
# Print formatted diff
|
35
|
+
def output_diff
|
36
|
+
puts format_diff.join( "\n" )
|
37
|
+
end
|
38
|
+
|
34
39
|
# Format the diff to get human readable information
|
35
40
|
# on the gems that were updated.
|
36
41
|
def format_diff
|
37
|
-
gemfile.changes.
|
38
|
-
|
42
|
+
gemfile.changes.map do |gem, details|
|
43
|
+
ERB.new( template, nil, '<>' ).result( binding )
|
39
44
|
end
|
40
45
|
end
|
41
46
|
|
@@ -38,8 +38,8 @@ module GemUpdater
|
|
38
38
|
# @return [URI] valid URI
|
39
39
|
def correct_uri( url )
|
40
40
|
uri = URI( url )
|
41
|
-
if uri.host
|
42
|
-
uri = URI
|
41
|
+
if uri.host.match( 'github.com' ) && uri.scheme == 'http'
|
42
|
+
uri = URI "https://github.com#{uri.path}"
|
43
43
|
end
|
44
44
|
|
45
45
|
uri
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem_updater
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maxime Demolin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|