lockfile_preserver 1.0.0 → 1.0.1
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/.gitignore +1 -1
- data/.rspec +0 -1
- data/.travis.yml +2 -0
- data/CHANGELOG.md +17 -0
- data/Gemfile +1 -0
- data/README.md +37 -1
- data/circle.yml +3 -0
- data/lib/lockfile_preserver/bundled_with.rb +5 -5
- data/lib/lockfile_preserver/pipeline.rb +21 -0
- data/lib/lockfile_preserver/ruby_version.rb +46 -0
- data/lib/lockfile_preserver/version.rb +1 -1
- data/lib/lockfile_preserver.rb +15 -2
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bbb130278a37b895922f1f2684152b36defecf7
|
4
|
+
data.tar.gz: a33a854a9028cbf70baf46c68b64eacac5613f7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b917123ac6a7e962d89fa5dc564d69e87c75dd5da7445a2bb95b5527b1d694cfc071d9d6e3af35a958a7d6510b55b0083f699651869d4e7ae976016e211ea403
|
7
|
+
data.tar.gz: 51cfefd14596e786e9dc4765302fcea8f72df7fe23e2522a23356a1b1452e490e5f9cf3dcf4fbaac58fe9a57ffb5ade0970ac18a9e191a4c87b96ef9c00ee220
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
## Unreleased
|
4
|
+
|
5
|
+
## 1.0.1 - 2016.06.02
|
6
|
+
|
7
|
+
- Introduce `LockfilePreserver::RubyVersion` [#2][pr2]
|
8
|
+
- Introduce `LockfilePreserver::Pipeline` [#2][pr2]
|
9
|
+
- Refactor spec fixture originations [#2][pr2]
|
10
|
+
- `.keep` now accepts `:ruby_version` to preserve Ruby Version section from the lockfile [#2][pr2]
|
11
|
+
- new `.keep_all` method to preserve BUNDLED WITH and RUBY VERSION section from the lockfile [#2][pr2]
|
12
|
+
|
13
|
+
[pr2]: https://github.com/jollygoodcode/lockfile_preserver/pull/2
|
14
|
+
|
15
|
+
## 1.0.0 - 2016.03.08
|
16
|
+
|
17
|
+
Init LockfilePreserver.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# LockfilePreserver
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/lockfile_preserver)
|
4
|
+
[](https://travis-ci.org/jollygoodcode/lockfile_preserver)
|
5
|
+
[](https://codeclimate.com/github/jollygoodcode/lockfile_preserver)
|
6
|
+
|
3
7
|
Preserve `BUNDLED_WITH` section of your lockfile!
|
4
8
|
|
5
9
|
## Installation
|
@@ -20,16 +24,42 @@ Or install it yourself as:
|
|
20
24
|
|
21
25
|
## Usage
|
22
26
|
|
27
|
+
Given a folder where `Gemfile` has some outdated gems:
|
28
|
+
|
29
|
+
```
|
30
|
+
.
|
31
|
+
├── Gemfile
|
32
|
+
└── Gemfile.lock
|
33
|
+
```
|
34
|
+
|
23
35
|
```ruby
|
24
|
-
|
36
|
+
lockfile = IO.read "Gemfile.lock"
|
25
37
|
```
|
26
38
|
|
39
|
+
Then we do a `bundle update`. The lockfile has been updated:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
updated_lockfile = IO.read "Gemfile.lock"
|
43
|
+
```
|
44
|
+
|
45
|
+
Preserve `BUNDLED_WITH` changes to your lockfile:
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
LockfilePreserver.keep(lockfile, updated_lockfile)
|
49
|
+
```
|
50
|
+
|
51
|
+
That's it!
|
52
|
+
|
27
53
|
## Development
|
28
54
|
|
29
55
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
56
|
|
31
57
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
58
|
|
59
|
+
## Credits
|
60
|
+
|
61
|
+
A huge THANK YOU to all our [contributors](https://github.com/jollygoodcode/dasherize/graphs/contributors)! :heart:
|
62
|
+
|
33
63
|
## Contributing
|
34
64
|
|
35
65
|
Bug reports and pull requests are welcome on GitHub at https://github.com/jollygoodcode/lockfile_preserver.
|
@@ -37,3 +67,9 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/jollyg
|
|
37
67
|
## The UNLICENSE
|
38
68
|
|
39
69
|
See [UNLICENSE](/UNLICENSE).
|
70
|
+
|
71
|
+
## Maintained by Jolly Good Code
|
72
|
+
|
73
|
+
[](http://www.jollygoodcode.com)
|
74
|
+
|
75
|
+
We specialise in rapid development of high quality MVPs. [Hire us](http://www.jollygoodcode.com/#get-in-touch) to turn your product idea into reality.
|
data/circle.yml
ADDED
@@ -1,8 +1,8 @@
|
|
1
1
|
module LockfilePreserver
|
2
2
|
class BundledWith
|
3
|
-
def initialize(original,
|
3
|
+
def initialize(original, updated)
|
4
4
|
@original = original
|
5
|
-
@
|
5
|
+
@updated = updated
|
6
6
|
end
|
7
7
|
|
8
8
|
def keep
|
@@ -15,7 +15,7 @@ module LockfilePreserver
|
|
15
15
|
|
16
16
|
private
|
17
17
|
|
18
|
-
attr_reader :original, :
|
18
|
+
attr_reader :original, :updated
|
19
19
|
|
20
20
|
BUNDLED_WITH = "BUNDLED WITH".freeze
|
21
21
|
REGEXP = %r{\n\nBUNDLED WITH\n\s+(?<version>#{Gem::Version::VERSION_PATTERN})\n*}
|
@@ -26,11 +26,11 @@ module LockfilePreserver
|
|
26
26
|
private_constant :NEW_LINE
|
27
27
|
|
28
28
|
def keep_bundled_with
|
29
|
-
|
29
|
+
updated.sub(REGEXP, bundled_with)
|
30
30
|
end
|
31
31
|
|
32
32
|
def remove_bundled_with
|
33
|
-
|
33
|
+
updated.sub(REGEXP, NEW_LINE)
|
34
34
|
end
|
35
35
|
|
36
36
|
def bundled_with
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module LockfilePreserver
|
2
|
+
class Pipeline
|
3
|
+
def initialize(preservers)
|
4
|
+
@preservers = preservers
|
5
|
+
end
|
6
|
+
|
7
|
+
def call(original, updated)
|
8
|
+
result = updated
|
9
|
+
|
10
|
+
preservers.each do |preserver|
|
11
|
+
result = preserver.new(original, result).keep
|
12
|
+
end
|
13
|
+
|
14
|
+
result
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
attr_reader :preservers
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module LockfilePreserver
|
2
|
+
class RubyVersion
|
3
|
+
def initialize(original, updated)
|
4
|
+
@original = original
|
5
|
+
@updated = updated
|
6
|
+
end
|
7
|
+
|
8
|
+
def keep
|
9
|
+
if original.include? RUBY_VERSION
|
10
|
+
keep_ruby_version
|
11
|
+
else
|
12
|
+
remove_ruby_version
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
attr_reader :original, :updated
|
19
|
+
|
20
|
+
RUBY_VERSION = "RUBY VERSION".freeze
|
21
|
+
VERSION_PATTERN = %r{.+}
|
22
|
+
REGEXP = %r{\n\nRUBY VERSION\n\s+(?<version>#{VERSION_PATTERN})\n*}
|
23
|
+
NEW_LINE = "\n".freeze
|
24
|
+
|
25
|
+
private_constant :RUBY_VERSION
|
26
|
+
private_constant :REGEXP
|
27
|
+
private_constant :NEW_LINE
|
28
|
+
|
29
|
+
def keep_ruby_version
|
30
|
+
updated.sub(REGEXP, ruby_version_section)
|
31
|
+
end
|
32
|
+
|
33
|
+
def remove_ruby_version
|
34
|
+
updated.sub(REGEXP, NEW_LINE)
|
35
|
+
end
|
36
|
+
|
37
|
+
def ruby_version_section
|
38
|
+
"\n\nRUBY VERSION\n" \
|
39
|
+
" #{ruby_version}\n"
|
40
|
+
end
|
41
|
+
|
42
|
+
def ruby_version
|
43
|
+
@_ruby_version ||= original.match(REGEXP)[:version]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/lockfile_preserver.rb
CHANGED
@@ -1,12 +1,25 @@
|
|
1
1
|
require "lockfile_preserver/version"
|
2
|
+
require "lockfile_preserver/pipeline"
|
2
3
|
require "lockfile_preserver/bundled_with"
|
4
|
+
require "lockfile_preserver/ruby_version"
|
3
5
|
|
4
6
|
module LockfilePreserver
|
5
7
|
def self.keep(original, updated, section = :bundled_with)
|
6
8
|
if section == :bundled_with
|
7
9
|
LockfilePreserver::BundledWith.new(original, updated).keep
|
8
|
-
|
9
|
-
|
10
|
+
elsif section == :ruby_version
|
11
|
+
LockfilePreserver::RubyVersion.new(original, updated).keep
|
12
|
+
elsif
|
13
|
+
abort %(We currently only support preserve "BUNDLED WITH" & "RUBY VERSION" section of lockfile.)
|
10
14
|
end
|
11
15
|
end
|
16
|
+
|
17
|
+
def self.keep_all(original, updated)
|
18
|
+
pipeline = Pipeline.new [
|
19
|
+
LockfilePreserver::BundledWith,
|
20
|
+
LockfilePreserver::RubyVersion
|
21
|
+
]
|
22
|
+
|
23
|
+
pipeline.call(original, updated)
|
24
|
+
end
|
12
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lockfile_preserver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JuanitoFatas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: LockfilePreserver preserves section you don't want to update.
|
14
14
|
email:
|
@@ -20,14 +20,18 @@ files:
|
|
20
20
|
- ".gitignore"
|
21
21
|
- ".rspec"
|
22
22
|
- ".travis.yml"
|
23
|
+
- CHANGELOG.md
|
23
24
|
- Gemfile
|
24
25
|
- README.md
|
25
26
|
- Rakefile
|
26
27
|
- UNLICENSE
|
27
28
|
- bin/console
|
28
29
|
- bin/setup
|
30
|
+
- circle.yml
|
29
31
|
- lib/lockfile_preserver.rb
|
30
32
|
- lib/lockfile_preserver/bundled_with.rb
|
33
|
+
- lib/lockfile_preserver/pipeline.rb
|
34
|
+
- lib/lockfile_preserver/ruby_version.rb
|
31
35
|
- lib/lockfile_preserver/version.rb
|
32
36
|
- lockfile_preserver.gemspec
|
33
37
|
homepage: https://github.com/jollygoodcode/lockfile_preserver
|
@@ -50,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
50
54
|
version: '0'
|
51
55
|
requirements: []
|
52
56
|
rubyforge_project:
|
53
|
-
rubygems_version: 2.6.
|
57
|
+
rubygems_version: 2.6.4
|
54
58
|
signing_key:
|
55
59
|
specification_version: 4
|
56
60
|
summary: LockfilePreserver preserves section you don't want to update.
|