File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,9 @@ module Shards
48
48
when " list"
49
49
Commands ::List .run(path, tree: args.includes?(" --tree" ))
50
50
when " lock"
51
- Commands ::Lock .run(path,
51
+ Commands ::Lock .run(
52
+ path,
53
+ args.reject(& .starts_with?(" --" )),
52
54
print: args.includes?(" --print" ),
53
55
update: args.includes?(" --update" )
54
56
)
Original file line number Diff line number Diff line change @@ -4,11 +4,24 @@ require "../solver"
4
4
module Shards
5
5
module Commands
6
6
class Lock < Command
7
- def run (print = false , update = false )
7
+ def run (shards, print = false , update = false )
8
8
Shards .logger.info { " Resolving dependencies" }
9
9
10
10
solver = Solver .new(spec)
11
- solver.locks = locks if ! update && lockfile?
11
+
12
+ if lockfile?
13
+ if update
14
+ # update selected dependencies to latest possible versions, but
15
+ # avoid to update unspecified dependencies, if possible:
16
+ unless shards.empty?
17
+ solver.locks = locks.reject { |d | shards.includes?(d.name) }
18
+ end
19
+ else
20
+ # install must be as conservative as possible:
21
+ solver.locks = locks
22
+ end
23
+ end
24
+
12
25
solver.prepare(development: ! Shards .production?)
13
26
14
27
if solution = solver.solve
You can’t perform that action at this time.
0 commit comments