File tree 3 files changed +16
-13
lines changed
3 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -540,22 +540,19 @@ describe "install" do
540
540
dependencies: {web: " *" , orm: " *" },
541
541
development_dependencies: {mock: " *" },
542
542
}
543
+ # --production requires a lock file because it implies --frozen
544
+ lock = {web: " 1.0.0" , orm: " 0.3.0" }
543
545
544
- with_shard(metadata) do
545
- File .exists?(File .join(application_path, " shard.lock" )).should be_false
546
+ with_shard(metadata, lock) do
546
547
run " shards install --production"
547
548
548
549
# it installed dependencies (recursively)
549
550
assert_installed " web"
550
551
assert_installed " orm"
551
- assert_installed " pg"
552
552
553
553
# it didn't install development dependencies
554
554
refute_installed " mock"
555
555
refute_installed " minitest"
556
-
557
- # it didn't generate lock file
558
- File .exists?(File .join(application_path, " shard.lock" )).should be_false
559
556
end
560
557
end
561
558
end
Original file line number Diff line number Diff line change @@ -23,14 +23,16 @@ describe "list" do
23
23
dependencies: {web: " *" , orm: " *" },
24
24
development_dependencies: {mock: " *" },
25
25
}
26
- with_shard(metadata) do
26
+ # --production requires a lock file because it implies --frozen
27
+ lock = {web: " 1.0.0" , orm: " 0.3.0" }
28
+
29
+ with_shard(metadata, lock) do
27
30
run " shards install --production"
28
31
stdout = run " shards list --production"
29
- stdout.should contain(" web (2.1.0)" )
30
- stdout.should contain(" orm (0.5.0)" )
31
- stdout.should contain(" pg (0.2.1)" )
32
- stdout.should_not contain(" mock (0.1.0)" )
33
- stdout.should_not contain(" shoulda (0.1.0)" )
32
+ stdout.should contain(" web (1.0.0)" )
33
+ stdout.should contain(" orm (0.3.0)" )
34
+ stdout.should_not contain(" mock" )
35
+ stdout.should_not contain(" shoulda" )
34
36
end
35
37
end
36
38
Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ module Shards
5
5
module Commands
6
6
class Install < Command
7
7
def run (* , ignore_crystal_version = false )
8
+ if Shards .frozen? && ! lockfile?
9
+ raise Error .new(" Missing shard.lock" )
10
+ end
11
+
8
12
Log .info { " Resolving dependencies" }
9
13
10
14
solver = MolinilloSolver .new(spec, override, ignore_crystal_version: ignore_crystal_version)
@@ -18,7 +22,7 @@ module Shards
18
22
19
23
packages = handle_resolver_errors { solver.solve }
20
24
21
- if lockfile? && Shards .frozen?
25
+ if Shards .frozen?
22
26
validate(packages)
23
27
end
24
28
You can’t perform that action at this time.
0 commit comments