gemfile_locker 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +17 -15
- data/lib/gemfile_locker/cli.rb +16 -17
- data/lib/gemfile_locker/gemfile_processor.rb +1 -1
- data/lib/gemfile_locker/version.rb +1 -1
- 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: 2f411635748ebab869141b3e36ca6a8ef8cb7e5a
|
4
|
+
data.tar.gz: 8269cc977e333fe795775831873f7692184edb00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1845a4763600725c8f58d1f5e6c88579eb710a978e8553af9c9bcfcf27df0dbdd06a4b371cad3399c16a9a62aa284f4d05b7cebc63a213b1e119c4d8b526c639
|
7
|
+
data.tar.gz: 75009ff12e89fc6051e68af04d9fed9ade15a008170a636c58409c23f42214e1be13eae4d1feeed7878aaa0c2ab38d4424a7e9b1efd6a7c1dbe0a3687c723da6
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -4,12 +4,10 @@
|
|
4
4
|
[![Code Climate](https://codeclimate.com/github/printercu/gemfile_locker/badges/gpa.svg)](https://codeclimate.com/github/printercu/gemfile_locker)
|
5
5
|
[![Build Status](https://travis-ci.org/printercu/gemfile_locker.svg)](https://travis-ci.org/printercu/gemfile_locker)
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
GemfileLocker can lock all dependencies strictly or semi-strictly (with `~>`),
|
7
|
+
It can lock all (or selected) dependencies strictly or semi-strictly (with `~>`),
|
10
8
|
so it gets safe to run `bundle update` anytime.
|
11
9
|
|
12
|
-
It can also unlock
|
10
|
+
It can also unlock dependencies so you can easily update to the latest versions.
|
13
11
|
|
14
12
|
## Installation
|
15
13
|
|
@@ -30,21 +28,25 @@ Or install it yourself as:
|
|
30
28
|
## Usage
|
31
29
|
|
32
30
|
```
|
33
|
-
gemfile_locker help
|
31
|
+
gemfile_locker help [COMMAND]
|
34
32
|
|
35
|
-
gemfile_locker lock # Lock all missing versions
|
33
|
+
gemfile_locker lock [gem ...] [options] # Lock all missing versions or specified gems.
|
36
34
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
--
|
41
|
-
--
|
35
|
+
Options:
|
36
|
+
-l, [--loose=LOOSE] # Lock with `~>`. Optionaly provide level (default to patch)
|
37
|
+
# Possible values: major, minor, patch, full
|
38
|
+
-e, [--except=one two three] # List of gems to skip
|
39
|
+
-f, [--force] # Overwrite version definitions
|
40
|
+
# (By default it adds only missing version definitions)
|
41
|
+
-g, [--gemfile=GEMFILE] # Path to gemfile
|
42
|
+
# Default: Gemfile
|
42
43
|
|
43
|
-
gemfile_locker unlock #
|
44
|
+
gemfile_locker unlock [gem ...] [options] # Unock all or specified gems.
|
44
45
|
|
45
|
-
|
46
|
-
--
|
47
|
-
--
|
46
|
+
Options:
|
47
|
+
-e, [--except=one two three] # List of gems to skip
|
48
|
+
-g, [--gemfile=GEMFILE] # Path to gemfile
|
49
|
+
# Default: Gemfile
|
48
50
|
```
|
49
51
|
|
50
52
|
## Development
|
data/lib/gemfile_locker/cli.rb
CHANGED
@@ -2,16 +2,17 @@ require 'thor'
|
|
2
2
|
|
3
3
|
module GemfileLocker
|
4
4
|
class CLI < Thor
|
5
|
-
|
5
|
+
class_option :gemfile,
|
6
|
+
aliases: '-g',
|
7
|
+
default: 'Gemfile',
|
8
|
+
desc: 'Path to gemfile'
|
9
|
+
|
10
|
+
desc 'lock [gem ...] [options]', 'Lock all missing versions or specified gems.'
|
6
11
|
method_option :loose,
|
7
12
|
aliases: '-l',
|
8
13
|
lazy_default: 'patch',
|
9
14
|
enum: %w(major minor patch full),
|
10
15
|
desc: 'Lock with `~>`. Optionaly provide level (default to patch)'
|
11
|
-
method_option :only,
|
12
|
-
aliases: '-o',
|
13
|
-
type: :array,
|
14
|
-
desc: 'List of gems to process'
|
15
16
|
method_option :except,
|
16
17
|
aliases: '-e',
|
17
18
|
type: :array,
|
@@ -19,24 +20,22 @@ module GemfileLocker
|
|
19
20
|
method_option :force,
|
20
21
|
aliases: '-f',
|
21
22
|
type: :boolean,
|
22
|
-
desc: 'Overwrite version definitions
|
23
|
-
|
24
|
-
|
25
|
-
lockfile = File.read("#{
|
26
|
-
|
23
|
+
desc: 'Overwrite version definitions'
|
24
|
+
def lock(*only)
|
25
|
+
gemfile = options[:gemfile]
|
26
|
+
lockfile = File.read("#{gemfile}.lock")
|
27
|
+
processor_opts = only.any? ? options.merge(only: only) : options
|
28
|
+
run_editor gemfile, Locker.new(lockfile, processor_opts)
|
27
29
|
end
|
28
30
|
|
29
|
-
desc 'unlock [
|
30
|
-
method_option :only,
|
31
|
-
aliases: '-o',
|
32
|
-
type: :array,
|
33
|
-
desc: 'List of gems to process'
|
31
|
+
desc 'unlock [gem ...] [options]', 'Unock all or specified gems.'
|
34
32
|
method_option :except,
|
35
33
|
aliases: '-e',
|
36
34
|
type: :array,
|
37
35
|
desc: 'List of gems to skip'
|
38
|
-
def unlock(
|
39
|
-
|
36
|
+
def unlock(*only)
|
37
|
+
processor_opts = only.any? ? options.merge(only: only) : options
|
38
|
+
run_editor options[:gemfile], Unlocker.new(processor_opts)
|
40
39
|
end
|
41
40
|
|
42
41
|
private
|
@@ -46,7 +46,7 @@ module GemfileLocker
|
|
46
46
|
def process_gems(string)
|
47
47
|
string.gsub(GEM_LINE_REGEX) do
|
48
48
|
match = Regexp.last_match
|
49
|
-
data = GEM_MATCH_FIELDS.map { |x| [x, match[x]] }
|
49
|
+
data = Hash[GEM_MATCH_FIELDS.map { |x| [x, match[x]] }]
|
50
50
|
result = yield data
|
51
51
|
result ||= data
|
52
52
|
GEM_MATCH_FIELDS.map { |x| result[x] }.join
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemfile_locker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Melentiev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|