beaver-build 2.1.0 → 2.2.0
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/lib/beaver.rb +21 -5
- data/lib/command.rb +15 -1
- data/lib/file_dep.rb +1 -1
- data/lib/sh.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c14453e56d234a62a48d99e3151389a8987ad31413fb822e3c239309b3a933b
|
4
|
+
data.tar.gz: ad7487c17109c457e5d7d9fbda58a7479599f947f8c74be00623d10c6170627d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa4a243e27a05613f9e042bd2e2a17419d461b17cef85865bef00ce57f6141e9fe383891ac229c5f9481a256e5785d4f88edd60796e3769255cb6ae8b9ab21c2
|
7
|
+
data.tar.gz: 50a9fbb0f1103e13b00025dd84707c8c175b70f906e7a8e49b5806c91185822af4751096b5ac5c278dd7f01f7704d7ef5d3b31eaecd322b7bc02c89b885fde97
|
data/lib/beaver.rb
CHANGED
@@ -60,7 +60,7 @@ class Beaver
|
|
60
60
|
def call(cmd)
|
61
61
|
_cmd = @commands[cmd.to_sym]
|
62
62
|
if _cmd.nil?
|
63
|
-
puts "No command called #{cmd} found"
|
63
|
+
STDERR.puts "No command called #{cmd} found"
|
64
64
|
exit 1
|
65
65
|
end
|
66
66
|
|
@@ -69,11 +69,18 @@ class Beaver
|
|
69
69
|
|
70
70
|
# Run this command when it is called, no matter if its dependencies did not change
|
71
71
|
def must_run cmd
|
72
|
-
|
73
|
-
if
|
74
|
-
puts "\001b[31mNON-FATAL ERROR\001b[0m: Command #{cmd} does not exist, so `must_run` has not effect"
|
72
|
+
_cmd = @commands[cmd.to_sym]
|
73
|
+
if _cmd.nil?
|
74
|
+
STDERR.puts "\001b[31mNON-FATAL ERROR\001b[0m: Command #{cmd} does not exist, so `must_run` has not effect"
|
75
|
+
exit 1
|
75
76
|
end
|
76
|
-
|
77
|
+
_cmd.overwrite_should_run = true
|
78
|
+
|
79
|
+
_cmd.call
|
80
|
+
end
|
81
|
+
|
82
|
+
def set_main(cmd)
|
83
|
+
@mainCommand = cmd.to_sym
|
77
84
|
end
|
78
85
|
|
79
86
|
# Put this at the end of a file
|
@@ -89,6 +96,11 @@ class Beaver
|
|
89
96
|
$cache.save # save cache file
|
90
97
|
end
|
91
98
|
|
99
|
+
# Returns all available commands as an array
|
100
|
+
def list_commands
|
101
|
+
return @commands.map { |k, v| k }
|
102
|
+
end
|
103
|
+
|
92
104
|
# Clean cache
|
93
105
|
def clean
|
94
106
|
FileUtils.rm_r @cache_loc
|
@@ -108,3 +120,7 @@ require 'sh'
|
|
108
120
|
def call(cmd)
|
109
121
|
$beaver.call cmd
|
110
122
|
end
|
123
|
+
|
124
|
+
def must_run(cmd)
|
125
|
+
$beaver.musts_run cmd
|
126
|
+
end
|
data/lib/command.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'file.rb'
|
2
2
|
|
3
|
+
$__BEAVER_SHOULD_RUN_SCOPE = false
|
4
|
+
|
3
5
|
class Command
|
4
6
|
attr_accessor :name
|
5
7
|
attr_accessor :fn
|
@@ -16,9 +18,21 @@ class Command
|
|
16
18
|
|
17
19
|
# Execute the command if needed (dependency files changed)
|
18
20
|
def call
|
21
|
+
global_alread_defined = $__BEAVER_SHOULD_RUN_SCOPE
|
22
|
+
if self.overwrite_should_run
|
23
|
+
$__BEAVER_SHOULD_RUN_SCOPE = true
|
24
|
+
end
|
25
|
+
if $__BEAVER_SHOULD_RUN_SCOPE
|
26
|
+
self.overwrite_should_run = true
|
27
|
+
end
|
28
|
+
|
19
29
|
if self.should_run?
|
20
30
|
self.call_now()
|
21
31
|
end
|
32
|
+
|
33
|
+
if !global_alread_defined && $__BEAVER_SHOULD_RUN_SCOPE
|
34
|
+
$__BEAVER_SHOULD_RUN_SCOPE = false
|
35
|
+
end
|
22
36
|
end
|
23
37
|
|
24
38
|
# Force call the command, even if none of the files changed
|
@@ -81,6 +95,6 @@ class Command
|
|
81
95
|
end
|
82
96
|
|
83
97
|
def cmd(name, deps = nil, &fn)
|
84
|
-
cmd = Command.new name, deps, fn
|
98
|
+
cmd = Command.new name.to_sym, deps, fn
|
85
99
|
$beaver.__appendCommand cmd
|
86
100
|
end
|
data/lib/file_dep.rb
CHANGED
data/lib/sh.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaver-build
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Everaert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|