pkgforge 0.13.0 → 0.13.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4782dd26cfa45ffb7b41bc538771b5ae18fe576
|
4
|
+
data.tar.gz: 417fb732daf2e61d5f9cd9672d739316adea4828
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e3720027ed7a34e9abdda4f4e62b5cabc51c8bbb45bd31768fb0dea89698343ff935ac4429b19e16197134f34060ea4be13b3d44f20970eac8731a422aea608
|
7
|
+
data.tar.gz: 0f74d2a6f6694a9d9ef157f2ec9b4e34f78b922329bb35cf34473335c93b5f82cdc5389c9f31f6319d0a4d6df231c7f61503f621ee728a53508a6f5d6fcf61fc
|
@@ -6,9 +6,9 @@ module PkgForge
|
|
6
6
|
class Forge
|
7
7
|
Contract None => nil
|
8
8
|
def cleanup!
|
9
|
-
|
10
|
-
|
11
|
-
paths =
|
9
|
+
state[:tmpdirs] ||= {}
|
10
|
+
state[:tmpfiles] ||= {}
|
11
|
+
paths = state.values_at(:tmpdirs, :tmpfiles).flatten
|
12
12
|
puts "Cleaning up tmp paths: #{paths}"
|
13
13
|
FileUtils.rm_rf paths
|
14
14
|
nil
|
@@ -17,14 +17,14 @@ module PkgForge
|
|
17
17
|
|
18
18
|
Contract Symbol => String
|
19
19
|
def tmpdir(id)
|
20
|
-
|
21
|
-
|
20
|
+
state[:tmpdirs] ||= {}
|
21
|
+
state[:tmpdirs][id] ||= Dir.mktmpdir(id.to_s)
|
22
22
|
end
|
23
23
|
|
24
24
|
Contract Symbol => String
|
25
25
|
def tmpfile(id)
|
26
|
-
|
27
|
-
|
26
|
+
state[:tmpfiles] ||= {}
|
27
|
+
state[:tmpfiles][id] ||= Tempfile.create(id.to_s).path
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -32,16 +32,19 @@ module PkgForge
|
|
32
32
|
|
33
33
|
Contract None => nil
|
34
34
|
def file_prepare_package
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
path = package[:path]
|
36
|
+
raise('File package type requires "path" setting') unless path
|
37
|
+
state.merge!(
|
38
|
+
upload_path: File.join(tmpdir(:release), path),
|
39
|
+
upload_name: package[:name] || name
|
40
|
+
)
|
41
|
+
expose_artifact(*state.values_at(:upload_name, :upload_path))
|
39
42
|
end
|
40
43
|
|
41
44
|
Contract None => nil
|
42
45
|
def tarball_prepare_package
|
43
|
-
|
44
|
-
|
46
|
+
state[:upload_path] = tmpfile(:tarball)
|
47
|
+
state[:upload_name] = "#{name}.tar.gz"
|
45
48
|
make_tarball!
|
46
49
|
expose_artifact "#{name}-#{git_hash}.tar.gz", tmpfile(:tarball)
|
47
50
|
end
|
@@ -4,20 +4,20 @@ module PkgForge
|
|
4
4
|
##
|
5
5
|
# Add state methods to Forge
|
6
6
|
class Forge
|
7
|
+
Contract nil => Hash
|
8
|
+
def state
|
9
|
+
@state ||= {}
|
10
|
+
end
|
11
|
+
|
7
12
|
Contract String => nil
|
8
13
|
def load_state!(statefile)
|
9
|
-
state = JSON.parse(File.read(statefile))
|
10
|
-
@tmpfiles = state[:tmpfiles]
|
11
|
-
@tmpdirs = state[:tmpdirs]
|
14
|
+
@state = JSON.parse(File.read(statefile))
|
12
15
|
end
|
13
16
|
|
14
17
|
Contract String => nil
|
15
18
|
def write_state!(statefile)
|
16
19
|
File.open(statefile, 'w') do |fh|
|
17
|
-
fh <<
|
18
|
-
tmpfiles: @tmpfiles,
|
19
|
-
tmpdirs: @tmpdirs
|
20
|
-
}.to_json
|
20
|
+
fh << state.to_json
|
21
21
|
end
|
22
22
|
nil
|
23
23
|
end
|
data/lib/pkgforge/version.rb
CHANGED