keep_up 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +9 -1
- data/lib/keep_up/application.rb +20 -6
- data/lib/keep_up/bundle.rb +8 -4
- data/lib/keep_up/bundler_definition_builder.rb +25 -0
- data/lib/keep_up/gem_index.rb +24 -0
- data/lib/keep_up/gemspec_filter.rb +1 -1
- data/lib/keep_up/repository.rb +4 -6
- data/lib/keep_up/version.rb +1 -1
- metadata +5 -4
- data/lib/keep_up/remote_index.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 139b7cb090fcb84c95e481c0c53916a89bc0a93e
|
4
|
+
data.tar.gz: d6f41235120d1dcb492039497d151bb27ad48771
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd5cd0d7f42b6687ea47d5cf227483128f761fd6a2bc6b14062f83e3e7829f4f216a5b2ff5b02e09227cb26705953a04be7b654b417597e426b76837e6e93214
|
7
|
+
data.tar.gz: 38f762f73f2ff74b9dd541704ca40574f17856e81bd9ab954bc278f2c079f26b41063c60589c348cc5f40a783c75f8bdafb1e5f01455e4bad5e5a7fcc3713a3b
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.4.0 / 2016-12-11
|
4
|
+
|
5
|
+
* Allow local operation
|
6
|
+
* Handle explicitely frozen strings in gemspecs
|
7
|
+
|
3
8
|
## 0.3.0 / 2016-11-30
|
4
9
|
|
5
|
-
* Allow specifying gems to skip and not to attempt updates for
|
10
|
+
* Allow specifying gems to skip and not to attempt updates for
|
6
11
|
|
7
12
|
## 0.2.0 / 2016-11-24
|
8
13
|
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ install it yourself as:
|
|
11
11
|
|
12
12
|
$ gem install keep_up
|
13
13
|
|
14
|
-
## Usage
|
14
|
+
## Basic Usage
|
15
15
|
|
16
16
|
KeepUp only works with git at the moment!
|
17
17
|
|
@@ -30,6 +30,14 @@ Next, run `bundle install` and run your tests or whatever. Since KeepUp
|
|
30
30
|
generates a separate commit for each succesful update, you can use `git bisect`
|
31
31
|
to find any updates that cause problems and remove or fix them.
|
32
32
|
|
33
|
+
## Options
|
34
|
+
|
35
|
+
* You can pass `--skip <GEMNAME>` to make KeepUp not consider the named gem for
|
36
|
+
upgrades. This is helpful if you know a given upgrade is problematic. This
|
37
|
+
option can be passed multiple times.
|
38
|
+
* You can pass `--local` to make KeepUp not try to fetch remote gem version
|
39
|
+
information.
|
40
|
+
|
33
41
|
## Planned Features
|
34
42
|
|
35
43
|
* Check the starting situation (clean checkout, Gemfile.lock up to date)
|
data/lib/keep_up/application.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
require 'open3'
|
3
3
|
require_relative 'bundle'
|
4
|
+
require_relative 'bundler_definition_builder'
|
5
|
+
require_relative 'gem_index'
|
6
|
+
require_relative 'null_filter'
|
4
7
|
require_relative 'repository'
|
8
|
+
require_relative 'skip_filter'
|
5
9
|
require_relative 'updater'
|
6
10
|
require_relative 'version_control'
|
7
|
-
require_relative 'null_filter'
|
8
|
-
require_relative 'skip_filter'
|
9
11
|
|
10
12
|
module KeepUp
|
11
13
|
# Error thrown when we can't go any further.
|
@@ -14,8 +16,6 @@ module KeepUp
|
|
14
16
|
|
15
17
|
# Main application
|
16
18
|
class Application
|
17
|
-
attr_reader :skip
|
18
|
-
|
19
19
|
def initialize(local:, test_command:, skip:)
|
20
20
|
@test_command = test_command
|
21
21
|
@local = local
|
@@ -29,18 +29,28 @@ module KeepUp
|
|
29
29
|
|
30
30
|
private
|
31
31
|
|
32
|
+
attr_reader :skip, :local
|
33
|
+
|
32
34
|
def update_all_dependencies
|
33
|
-
Updater.new(bundle:
|
34
|
-
repository: Repository.new,
|
35
|
+
Updater.new(bundle: bundle,
|
36
|
+
repository: Repository.new(index: index),
|
35
37
|
version_control: VersionControl.new,
|
36
38
|
filter: filter).run
|
37
39
|
end
|
38
40
|
|
41
|
+
def bundle
|
42
|
+
Bundle.new(definition_builder: definition_builder)
|
43
|
+
end
|
44
|
+
|
39
45
|
def report_up_to_date
|
40
46
|
puts 'Bundle up to date!'
|
41
47
|
puts 'All done!'
|
42
48
|
end
|
43
49
|
|
50
|
+
def definition_builder
|
51
|
+
@definition_builder ||= BundlerDefinitionBuilder.new(local: local)
|
52
|
+
end
|
53
|
+
|
44
54
|
def filter
|
45
55
|
@filter ||= if skip.any?
|
46
56
|
SkipFilter.new(skip)
|
@@ -49,5 +59,9 @@ module KeepUp
|
|
49
59
|
end
|
50
60
|
|
51
61
|
end
|
62
|
+
|
63
|
+
def index
|
64
|
+
GemIndex.new(definition_builder: definition_builder)
|
65
|
+
end
|
52
66
|
end
|
53
67
|
end
|
data/lib/keep_up/bundle.rb
CHANGED
@@ -6,6 +6,10 @@ require_relative 'dependency'
|
|
6
6
|
module KeepUp
|
7
7
|
# A Gemfile with its current set of locked dependencies.
|
8
8
|
class Bundle
|
9
|
+
def initialize(definition_builder:)
|
10
|
+
@definition_builder = definition_builder
|
11
|
+
end
|
12
|
+
|
9
13
|
def direct_dependencies
|
10
14
|
(gemspec_dependencies + gemfile_dependencies).map do |dep|
|
11
15
|
spec = locked_spec dep
|
@@ -25,6 +29,8 @@ module KeepUp
|
|
25
29
|
|
26
30
|
private
|
27
31
|
|
32
|
+
attr_reader :definition_builder
|
33
|
+
|
28
34
|
def gemfile_dependencies
|
29
35
|
bundler_lockfile.dependencies
|
30
36
|
end
|
@@ -44,7 +50,7 @@ module KeepUp
|
|
44
50
|
end
|
45
51
|
|
46
52
|
def bundler_definition
|
47
|
-
@bundler_definition ||=
|
53
|
+
@bundler_definition ||= definition_builder.build(false)
|
48
54
|
end
|
49
55
|
|
50
56
|
def update_gemfile_contents(dependency)
|
@@ -79,9 +85,7 @@ module KeepUp
|
|
79
85
|
|
80
86
|
def update_lockfile(dependency)
|
81
87
|
Bundler.clear_gemspec_cache
|
82
|
-
|
83
|
-
tap(&:resolve_remotely!).
|
84
|
-
lock('Gemfile.lock')
|
88
|
+
definition_builder.build(gems: [dependency.name]).lock('Gemfile.lock')
|
85
89
|
true
|
86
90
|
rescue Bundler::VersionConflict
|
87
91
|
puts 'Update failed'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
|
3
|
+
module KeepUp
|
4
|
+
class BundlerDefinitionBuilder
|
5
|
+
def initialize(local: false)
|
6
|
+
@local = local
|
7
|
+
end
|
8
|
+
|
9
|
+
def build(lock)
|
10
|
+
definition = Bundler::Definition.build('Gemfile', 'Gemfile.lock', lock)
|
11
|
+
if lock
|
12
|
+
if local
|
13
|
+
definition.resolve_with_cache!
|
14
|
+
else
|
15
|
+
definition.resolve_remotely!
|
16
|
+
end
|
17
|
+
end
|
18
|
+
definition
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
attr_reader :local
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module KeepUp
|
2
|
+
# Searches possibly remote gem index to find potential dependency updates.
|
3
|
+
class GemIndex
|
4
|
+
def initialize(definition_builder:)
|
5
|
+
@definition_builder = definition_builder
|
6
|
+
end
|
7
|
+
|
8
|
+
def search(dependency)
|
9
|
+
index.search(Bundler::Dependency.new(dependency.name, nil))
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
attr_reader :definition_builder
|
15
|
+
|
16
|
+
def definition
|
17
|
+
@definition ||= definition_builder.build(true)
|
18
|
+
end
|
19
|
+
|
20
|
+
def index
|
21
|
+
@index ||= definition.index
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -3,7 +3,7 @@ module KeepUp
|
|
3
3
|
module GemspecFilter
|
4
4
|
def self.apply(contents, dependency)
|
5
5
|
contents.each_line.map do |line|
|
6
|
-
if line =~ /^(.*_dependency[ (](?:['"]|%q.)#{dependency.name}
|
6
|
+
if line =~ /^(.*_dependency[ (](?:['"]|%q.)#{dependency.name}.(?:\.freeze)?, \[?['"](?:~>|=)? *)[^'"]*(['"].*)/m
|
7
7
|
match = Regexp.last_match
|
8
8
|
"#{match[1]}#{dependency.version}#{match[2]}"
|
9
9
|
else
|
data/lib/keep_up/repository.rb
CHANGED
@@ -1,16 +1,14 @@
|
|
1
|
-
require_relative 'remote_index'
|
2
|
-
|
3
1
|
module KeepUp
|
4
2
|
# Picks updated versions for dependencies.
|
5
3
|
class Repository
|
6
|
-
attr_reader :
|
4
|
+
attr_reader :index
|
7
5
|
|
8
|
-
def initialize(
|
9
|
-
@
|
6
|
+
def initialize(index:)
|
7
|
+
@index = index
|
10
8
|
end
|
11
9
|
|
12
10
|
def updated_dependency_for(dependency)
|
13
|
-
candidates =
|
11
|
+
candidates = index.search(dependency)
|
14
12
|
latest = candidates.sort_by(&:version).last
|
15
13
|
latest unless latest.version <= dependency.locked_version
|
16
14
|
end
|
data/lib/keep_up/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: keep_up
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matijs van Zuijlen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11
|
11
|
+
date: 2016-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -118,11 +118,12 @@ files:
|
|
118
118
|
- lib/keep_up.rb
|
119
119
|
- lib/keep_up/application.rb
|
120
120
|
- lib/keep_up/bundle.rb
|
121
|
+
- lib/keep_up/bundler_definition_builder.rb
|
121
122
|
- lib/keep_up/dependency.rb
|
123
|
+
- lib/keep_up/gem_index.rb
|
122
124
|
- lib/keep_up/gemfile_filter.rb
|
123
125
|
- lib/keep_up/gemspec_filter.rb
|
124
126
|
- lib/keep_up/null_filter.rb
|
125
|
-
- lib/keep_up/remote_index.rb
|
126
127
|
- lib/keep_up/repository.rb
|
127
128
|
- lib/keep_up/skip_filter.rb
|
128
129
|
- lib/keep_up/updater.rb
|
@@ -148,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
149
|
version: '0'
|
149
150
|
requirements: []
|
150
151
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.
|
152
|
+
rubygems_version: 2.6.8
|
152
153
|
signing_key:
|
153
154
|
specification_version: 4
|
154
155
|
summary: Automatically update your dependencies
|
data/lib/keep_up/remote_index.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
module KeepUp
|
2
|
-
# Searches possibly remote gem index o find potential dependency updates.
|
3
|
-
class RemoteIndex
|
4
|
-
def search(dependency)
|
5
|
-
remote_index.search(Bundler::Dependency.new(dependency.name, nil))
|
6
|
-
end
|
7
|
-
|
8
|
-
def remote_definition
|
9
|
-
@remote_definition ||=
|
10
|
-
Bundler::Definition.build('Gemfile', 'Gemfile.lock', true).tap(&:resolve_remotely!)
|
11
|
-
end
|
12
|
-
|
13
|
-
def remote_index
|
14
|
-
@remote_index ||= remote_definition.index
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|