pkgforge 0.15.1 → 0.16.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b32223a258b463fd3224483698ae93666cb4c62f
4
- data.tar.gz: a51cba2c1d23ae850272180e979a1bb9579e9de6
3
+ metadata.gz: 3474d4ccac1d2bfecd1de96fedf6cae21b5fb43f
4
+ data.tar.gz: 65a3c719b1f44a9bade4d7e44bffb79f48404904
5
5
  SHA512:
6
- metadata.gz: 33af822ddf80adce9ca11271c6a011fbd1e05703501380e093842edfc04baab3083569b78bd6ee852005ac0a96a3c25076444a89c67f21a622fd23f7361a67dd
7
- data.tar.gz: 9d338f307ac0d6b2202977c3af3d959ffe40b0b44259bbcafe1581c41be9475b5b5422544959f663c77618c73784f5f21b70b06fdb16fcac8df0369c3e32a06b
6
+ metadata.gz: 6eff41349e20da6169bcd29177391ec29c1ffb536a0fcf98b5c4625edc0f8da0187a9311c0fec4dedce0ba8c80e342f23c2595f3a64b3131a5654367e93fb6e9
7
+ data.tar.gz: 2be4289e4d53a8abe039a6ea3961611699076e1aba042492177f76a65d4e112f1e6bd5d1f0d254cd27d1da5e460f5fc64373cd7ac5d2fe34d78f08ff25b47d47
data/.circle-ruby CHANGED
@@ -1,4 +1,4 @@
1
- 2.4.0
1
+ 2.4.1
2
2
  2.3.3
3
3
  2.2.6
4
4
  2.1.10
@@ -15,38 +15,33 @@ module PkgForge
15
15
  def package!
16
16
  add_license!
17
17
  type_method = "#{package[:type]}_prepare_package"
18
- return send(type_method) if respond_to?(type_method, true)
19
- raise("Unknown package type: #{package[:type]}")
18
+ method_found = respond_to?(type_method, true)
19
+ raise("Unknown package type: #{package[:type]}") unless method_found
20
+ send(type_method)
21
+ expose_artifacts!
20
22
  end
21
23
 
22
24
  private
23
25
 
24
- Contract String, String => nil
25
- def expose_artifact(artifact_name, artifact_source)
26
- FileUtils.mkdir_p 'pkg'
27
- dest = File.join('pkg', artifact_name)
28
- FileUtils.cp artifact_source, dest
29
- FileUtils.chmod 0o0644, dest
30
- nil
31
- end
32
-
33
26
  Contract None => nil
34
27
  def file_prepare_package
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))
28
+ artifacts = package[:artifacts] || [package[:artifact]].compact
29
+ raise('File package type requires artifacts list') if artifacts.empty?
30
+ artifacts.each do |x|
31
+ x[:source] = File.join(tmpdir(:release), x[:source])
32
+ add_artifact(x)
33
+ end
34
+ nil
42
35
  end
43
36
 
44
37
  Contract None => nil
45
38
  def tarball_prepare_package
46
- state[:upload_path] = tmpfile(:tarball)
47
- state[:upload_name] = "#{name}.tar.gz"
39
+ add_artifact(
40
+ source: tmpfile(:tarball),
41
+ name: "#{name}.tar.gz",
42
+ long_name: "#{name}-#{git_hash}.tar.gz"
43
+ )
48
44
  make_tarball!
49
- expose_artifact "#{name}-#{git_hash}.tar.gz", tmpfile(:tarball)
50
45
  end
51
46
 
52
47
  Contract None => nil
@@ -4,25 +4,43 @@ module PkgForge
4
4
  class Forge
5
5
  Contract None => nil
6
6
  def push!
7
- upload_artifact!
7
+ upload_artifacts!
8
8
  end
9
9
 
10
10
  private
11
11
 
12
+ Contract HashOf[Symbol => String] => nil
13
+ def add_artifact(params)
14
+ state[:artifacts] ||= []
15
+ state[:artifacts] << params
16
+ nil
17
+ end
18
+
19
+ Contract None => nil
20
+ def expose_artifacts!
21
+ FileUtils.mkdir_p 'pkg'
22
+ return unless state[:artifacts]
23
+ state[:artifacts].each do |artifact|
24
+ dest = File.join('pkg', artifact[:long_name] || artifact[:name])
25
+ FileUtils.cp artifact[:source], dest
26
+ FileUtils.chmod 0o0644, dest
27
+ end
28
+ nil
29
+ end
30
+
12
31
  Contract None => String
13
32
  def version
14
33
  @version ||= `git describe --abbrev=0 --tags`.rstrip
15
34
  end
16
35
 
17
36
  Contract None => nil
18
- def upload_artifact!
19
- run_local [
20
- 'targit',
21
- '--authfile', '.github',
22
- '--create',
23
- '--name', state[:upload_name],
24
- "#{org}/#{name}", version, state[:upload_path]
25
- ]
37
+ def upload_artifacts!
38
+ return unless state[:artifacts]
39
+ state[:artifacts].each do |artifact|
40
+ run_local ['targit', '--authfile', '.github', '--create',
41
+ '--name', artifact[:name],
42
+ "#{org}/#{name}", version, artifact[:source]]
43
+ end
26
44
  nil
27
45
  end
28
46
  end
@@ -1,5 +1,5 @@
1
1
  ##
2
2
  # Declare version number
3
3
  module PkgForge
4
- VERSION = '0.15.1'.freeze
4
+ VERSION = '0.16.0'.freeze
5
5
  end
data/pkgforge.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency 'contracts', '~> 0.14.0'
22
22
  s.add_dependency 'cymbal', '~> 1.0.0'
23
23
 
24
- s.add_development_dependency 'rubocop', '~> 0.47.0'
24
+ s.add_development_dependency 'rubocop', '~> 0.48.0'
25
25
  s.add_development_dependency 'rake', '~> 12.0.0'
26
26
  s.add_development_dependency 'codecov', '~> 0.1.1'
27
27
  s.add_development_dependency 'rspec', '~> 3.5.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pkgforge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-23 00:00:00.000000000 Z
11
+ date: 2017-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mercenary
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.47.0
61
+ version: 0.48.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.47.0
68
+ version: 0.48.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement