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: 0f425f94459cf26692a4b0777fd948c0b5df4374
4
- data.tar.gz: 7c13454851dbba27203e436b16f70191d0d764f7
3
+ metadata.gz: a4782dd26cfa45ffb7b41bc538771b5ae18fe576
4
+ data.tar.gz: 417fb732daf2e61d5f9cd9672d739316adea4828
5
5
  SHA512:
6
- metadata.gz: 2d36da18b2d7683e39e02346d45a1eddc947c56f67717e99af3ae278afe0ab554909631d25ccbed2ea586617f3794b65418ae932ba55af312e02efea22c04b94
7
- data.tar.gz: b72637cbbab74905f0e2cee9a37bf94d15988de832a90e3271a3dd89ee16b5f3bdaee9928194f9d231e01bdfe44af106a776be4893500fa410e1e5196b7ae02d
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
- @tmpdirs ||= {}
10
- @tmpfiles ||= {}
11
- paths = [@tmpfiles.values, @tmpdirs.values].flatten
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
- @tmpdirs ||= {}
21
- @tmpdirs[id] ||= Dir.mktmpdir(id.to_s)
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
- @tmpfiles ||= {}
27
- @tmpfiles[id] ||= Tempfile.create(id.to_s).path
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
- raise('File package type requires "path" setting') unless package[:path]
36
- @upload_path = File.join(tmpdir(:release), package[:path])
37
- @upload_name = package[:name] || name
38
- expose_artifact @upload_name, @upload_path
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
- @upload_path = tmpfile(:tarball)
44
- @upload_name = "#{name}.tar.gz"
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
@@ -20,8 +20,8 @@ module PkgForge
20
20
  'targit',
21
21
  '--authfile', '.github',
22
22
  '--create',
23
- '--name', @upload_name,
24
- "#{org}/#{name}", version, @upload_path
23
+ '--name', state[:upload_name],
24
+ "#{org}/#{name}", version, state[:upload_path]
25
25
  ]
26
26
  nil
27
27
  end
@@ -1,5 +1,5 @@
1
1
  ##
2
2
  # Declare version number
3
3
  module PkgForge
4
- VERSION = '0.13.0'.freeze
4
+ VERSION = '0.13.1'.freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pkgforge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker